function openGIS(service, ip, appname){

    GIS = window.open("openTiris.php?service="+service+"&ip="+ip+"&appname="+appname+"", "GIS__Dialog", "width=800, height=600, left=10, top=10, scrollbars=no, status=yes");
    GIS.focus();
}

function openFreeGIS(url){

    GIS = window.open("openFreeTiris.php?url="+url+"", "GIS__Dialog", "width=800, height=600, left=10, top=10, scrollbars=no, status=yes");
    GIS.focus();
}

function openPrint(site, request){
	P = window.open("print.php?page="+site+"&request="+request,"printDialog","width=450,height=450,left=10,top=10,scrollbars=yes");
	P.focus();
}

function openDebug(){
	D = window.open("debug.php","DebugDialog","width=600,height=400,left=500,top=10,scrollbars=yes");
	//D.focus();
}


function openSitemap(site, request){
    
    remote = window.open("","sitemapwin","width=250,height=450,scrollbars=yes");
    remote.location.href = "print.php?page="+site+"&request="+request;
        if (remote.opener == null) remote.opener = window; 
    remote.opener.name = "opener";
    remote.focus();
}


function openEditor(page) {

	page="admin/editor/makehtml.php?page="+page;
	editorwin=window.open(page,"editor","width=450,height=500,scrollbars=no,noresize");
	editorwin.focus();
}


function openPhoto(photoid, width, height, path){

    F = window.open("showPhoto.php?id="+photoid+"&height="+height+"&width="+width+"&path="+path+"","photowindow","width="+width+",height="+height+",left=10,top=10, dependent");
    F.focus();
}


function openAttachment(page, msgid, partnr, filename) {
    A = window.open("actions/Attachment.php?page="+page+"&msgid="+msgid+"&partnr="+partnr+"&filename="+filename+"","attachmentwindow","width=700, height=400, left=10,top=10, scrollbars=yes, menubar=yes, dependent");
    A.focus();
}


/** CALENDER **/

function goLastMonth(page, month, year) { 
    if(month == 1) { 
        --year; 
        month = 13; 
    } 
    
    if(arguments[5] != "") {
        document.location.href = '?sRid='+arguments[3]+'&sLid='+arguments[4]+'&sFid='+arguments[5]+'&page='+page+'&month='+(month-1)+'&year='+year; 
    }
    else {
        document.location.href = '?sRid='+arguments[3]+'&sLid='+arguments[4]+'&page='+page+'&month='+(month-1)+'&year='+year; 
    }
} 

function goNextMonth(page, month, year) { 
    if(month == 12) { 
        ++year; 
        month = 0; 
    } 
    if(arguments[5] != "") {
        document.location.href = '?sRid='+arguments[3]+'&sLid='+arguments[4]+'&sFid='+arguments[5]+'&page='+page+'&month='+(month+1)+'&year='+year; 
    }
    else {
        document.location.href = '?sRid='+arguments[3]+'&sLid='+arguments[4]+'&page='+page+'&month='+(month+1)+'&year='+year; 
    }
} 


/** ADD EVENTS */
function addEvent(obj, evType, fn){ 
 if (obj.addEventListener){ 
   obj.addEventListener(evType, fn, true); 
   return true; 
 } else if (obj.attachEvent){ 
   var r = obj.attachEvent("on"+evType, fn); 
   return r; 
 } else { 
   return false; 
 } 
}



/** TOOLTIPS */

var offsetxpoint=-60 //Customize x offset of tooltip
var offsetypoint=20 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

function ietruebody(){
return (document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thecolor, thewidth){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}

function positiontip(e){
if (enabletip){
var curX=(ns6)?e.pageX : event.x+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.y+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20

var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
else if (curX<leftedge)
tipobj.style.left="5px"
else
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetxpoint+"px"

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight)
tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
else
tipobj.style.top=curY+offsetypoint+"px"
tipobj.style.visibility="visible"
}
}

function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}

document.onmousemove=positiontip

//NS4 = (document.layers) ? true : false;
//function checkEnter(event) { 	
//	var code = 0;
//	if (NS4)
//		code = event.which;
//	else
//		code = event.keyCode;
//	if (code==13)
//		document.myform.submit();
//}
////window.captureEvents(Event.CLICK);
//window.onClick = checkEnter(window.event.keyCode);


