window.onload = function () {
	loadDoc('ajax/remote.php?remote=online','timeonline');
	myInterval = window.setInterval(function () {
		loadDoc('ajax/remote.php?remote=online','timeonline');
	},60000);
}

function ismaxlength(obj,mlength){
if (obj.getAttribute && obj.value.length>mlength)
	obj.value=obj.value.substring(0,mlength)
	document.getElementById('__'+obj.id+'_maxlength').innerHTML = obj.value.length
}

function sendmsg(from,to,toname) {
	var message = prompt("Bericht aan "+toname,"Bericht");
	if(message)	loadDoc('ajax/remote.php?remote=sendmessage&from='+from+'&to='+to+'&message='+message,'timeonline');
}

function e(n) {
	return document.getElementById(n);
}
function newPass() {
	document.getElementById('pass').value = document.getElementById('pass2').value;
}
function confirmDialog(urllink, text){
    var retval=confirm(text);
    if(retval==true){
        window.location=urllink;
    } else {
        return;
    }
} 
function confirmSubmit(form,func,text){
    if(text) {
		 var retval=confirm(text);
	 } else {
		 var retval=true;
	 }
    if(retval==true){
		document.getElementById(form+'button').value = func;
        document.getElementById(form).submit();
    } else {
        return false;
    }
}
function selectAll(form, name, check) {
	if(check==true) check=1; else check=0;
	var objForm = document.getElementById(form);
	var x = 0;
	for(i=0;i<objForm.length;i++) {
		if(objForm[i].type == "checkbox" && objForm[i].name.indexOf(name+'[')!= "-1" && !objForm[i].disabled) {
			box = objForm[i].name;
			document.getElementById(box).checked = check;
			x++;
		}
	}
}
function showhidefolder(id, img) {
	e = document.getElementById(id)
	if(e.style.display == 'none') {
		e.style.display = 'block'
		img.src = '/global/gfx/file_folder_open.gif'
		img.onmouseover = function() { this.src="/global/gfx/file_folder_open_over.gif" }
		img.onmouseout = function() { this.src="/global/gfx/file_folder_open.gif" }
		createCookie(id,1)
	} else {
		e.style.display = 'none'
		img.src = '/global/gfx/file_folder_closed.gif'
		img.onmouseover = function() { this.src="/global/gfx/file_folder_closed_over.gif" }
		img.onmouseout = function() { this.src="/global/gfx/file_folder_closed.gif" }
		createCookie(id,0)
	}
}
function visible(id,image) {

	if(e(id).style.display == 'none') {
		e(id).style.display = 'block';
		if(e(image)) e(image).src = '/global/gfx/contract.gif';
	} else {
		e(id).style.display = 'none';
		if(e(image)) e(image).src = '/global/gfx/expand.gif';
	}
}
function show(id) {
	document.getElementById(id).style.display = 'block';
}
function hide(id) {
	document.getElementById(id).style.display = 'none';
}
function visible2(id,status) {
	if(status) {
		document.getElementById(id).style.display = 'block';
	} else {
		document.getElementById(id).style.display = 'none';
	}
}
function unlockfield(img, field) {
	imgsrc = img.src;
	imgsrc = imgsrc.substring(imgsrc.lastIndexOf('_')+1)
	imgsrc = imgsrc.substring(0,imgsrc.indexOf('.'))
	if(imgsrc=='locked') {
		img.src = '/global/gfx/lock_unlocked.gif';
		e(field).readOnly = false
		e(field).style.backgroundColor = '#fff';
		e(field).focus();
	} else {
		img.src = '/global/gfx/lock_locked.gif';
		e(field).readOnly = true	
		e(field).style.backgroundColor = '#eee';
	}
}
function formatValutaField(obj) {
	value = obj.value;
	if(value.substr(0,2)=='€ ') value = value.replace(/\./g,'');
	if(value.substr(0,2)=='€ ') value = value.substr(1);
	if(value.substr(0,1)==' ') value = value.substr(1);
	value = parseFloat(value.replace(/,/g,'.')).toFixed(2).replace(/\./g,',');
	if(value=='NaN') value = '0,00';
	if(typeof(valutaFieldBlankZero)!="undefined" && value == '0,00') {
		obj.value = "";
	} else {	
		obj.value = '€ '+PointPerThousand(value);
	}
}
function formatFloatField(obj) {
	value = obj.value;
	if(value.substr(0,2)=='€ ') value = value.replace(/\./g,'');
	value = parseFloat(value.replace(/,/g,'.')).toString();
	value = value.replace(/\./g,',');
	if(value=='NaN') value = '0';
	if(typeof(floatFieldBlankZero)!="undefined" && value == '0') value = "";
	obj.value = PointPerThousand(value);
}
function formatPercentageField(obj) {
	value = obj.value;
	value = parseFloat(value.replace(/,/g,'.')).toString();
	value = value.replace(/\./g,',');
	if(value=='NaN') value = '0';
	obj.value = value+" %";
}
function formatPermilleField(obj) {
	value = obj.value;
	value = parseFloat(value.replace(/,/g,'.')).toString();
	value = value.replace(/\./g,',');
	if(value=='NaN') value = '0';
	obj.value = value+" ‰";
}
function PointPerThousand(amount)
{
	var delimiter = "."; // replace comma if desired
	var a = amount.split(',',2)
	if(a.length>1) {
		var d = a[1];
		var i = parseInt(a[0]);
	} else {
		var d = '';
		var i = parseInt(a);
	}
	if(isNaN(i)) { return ''; }
	var minus = '';
	if(i < 0) { minus = '-'; }
	i = Math.abs(i);
	var n = new String(i);
	var a = [];
	while(n.length > 3)
	{
		var nn = n.substr(n.length-3);
		a.unshift(nn);
		n = n.substr(0,n.length-3);
	}
	if(n.length > 0) { a.unshift(n); }
	n = a.join(delimiter);
	if(d.length < 1) { amount = n; }
	else { amount = n + ',' + d; }
	amount = minus + amount;
	return amount;
}
// end of function PointPerThousand()


// Switch visible 

	var setVisabilityXmlhttp=false;
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
		try {
			setVisabilityXmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				setVisabilityXmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (E) {
				setVisabilityXmlhttp = false;
			}
		}
	@else
		setVisabilityXmlhttp = false;
	@end @*/
	if (!setVisabilityXmlhttp && typeof XMLHttpRequest!='undefined') {
		try {
			setVisabilityXmlhttp = new XMLHttpRequest();
		} catch (e) {
			setVisabilityXmlhttp = false;
		}
	}

	function setVisability(table, field, id) {
		if (setVisabilityXmlhttp) {
			setVisabilityXmlhttp.open("GET",'/cms/lib/visible.php?table='+table+'&field='+field+'&id='+id,true);
			setVisabilityXmlhttp.onreadystatechange = function() {
				if (setVisabilityXmlhttp.readyState==4 && document.getElementById(table+field+id)) {
					document.getElementById(table+field+id).src = '/global/gfx/'+setVisabilityXmlhttp.responseText+'.gif';
				}
			}
			setVisabilityXmlhttp.send(null);
		}
	}

// Switch selected 

	var setSelectedXmlhttp=false;
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
		try {
			setSelectedXmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				setSelectedXmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (E) {
				setSelectedXmlhttp = false;
			}
		}
	@else
		setSelectedXmlhttp = false;
	@end @*/
	if (!setSelectedXmlhttp && typeof XMLHttpRequest!='undefined') {
		try {
			setSelectedXmlhttp = new XMLHttpRequest();
		} catch (e) {
			setSelectedXmlhttp = false;
		}
	}

	function setSelected(table, field, id, filter, value) {
		if (setSelectedXmlhttp) {
			setSelectedXmlhttp.open("GET",'/cms/lib/selected.php?table='+table+'&field='+field+'&id='+id+'&filter='+filter+'&value='+value,true);
			setSelectedXmlhttp.onreadystatechange = function() {
				if (setSelectedXmlhttp.readyState==4 && document.getElementById(table+field+id+'selected')) {
					for(var i=0; i<document.images.length; i++) {
						var img = document.images[i]
						var imgid = img.id
						if(imgid.indexOf(table+field)==0) img.src = '/global/gfx/list_unselected.gif'
					}
					document.getElementById(table+field+id+'selected').src = '/global/gfx/'+setSelectedXmlhttp.responseText+'.gif';
				}
			}
			setSelectedXmlhttp.send(null);
		}
	}

// the functions below (c) dreamsolution; for handling complex selects

// -------------------------------------------------------------------
// Fixing upload for complexselect...
// -------------------------------------------------------------------

// the functions below (c) dreamsolution; for handling complex selects

function MakeOptionsString(obj) {
    var result="";
    var sep="";
    for (var i=0; i<obj.options.length; i++) {
        result += sep + obj.options[i].value ;
        sep=",";
    }
    return(result);
}
function MakeOptionsString2(obj) { // Only use this one when using bit values..
var result=0;
for (var i=0; i<obj.options.length; i++) {
result += parseInt(obj.options[i].value) ;
}
return(result);
}
			
function fix_onsubmit(formname,field,hiddenfield) {
	document.forms[formname].elements[hiddenfield].value=MakeOptionsString(document.forms[formname].elements[field])
	//form[formname].hiddenfield.value=MakeOptionsString(formname.field);
}

function moveSelectedOptions(from,to) {
    // Unselect matching options, if required
    if (arguments.length>3) {
        var regex = arguments[3];
        if (regex != "") {
            unSelectMatchingOptions(from,regex);
        }
    }
    // Move them over
    for (var i=0; i<from.options.length; i++) {
        var o = from.options[i];
        if (o.selected) {
            to.options[to.options.length] = new Option( o.text, o.value, false, false);
        }
    }
    // Delete them from original
    for (var i=(from.options.length-1); i>=0; i--) {
        var o = from.options[i];
        if (o.selected) {
            from.options[i] = null;
        }
    }
    if ((arguments.length<3) || (arguments[2]==true)) {
        //sortSelect(from);
        //sortSelect(to);
    }
    from.selectedIndex = -1;
    to.selectedIndex = -1;
}

function selectAllOptions(obj) {
    for (var i=0; i<obj.options.length; i++) {
        obj.options[i].selected = true;
    }
}

function moveAllOptions(from,to) {
    selectAllOptions(from);
    if (arguments.length==2) {
        moveSelectedOptions(from,to);
    }
    else if (arguments.length==3) {
        moveSelectedOptions(from,to,arguments[2]);
    }
    else if (arguments.length==4) {
        moveSelectedOptions(from,to,arguments[2],arguments[3]);
    }
}

function openSite(URLStr)
{
    var maxx = screen.width;
    var maxy = screen.height;
    windowprops = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=100,height=100,left=100,top=100";
    window.open(URLStr+"&maxx="+maxx+"&maxy="+maxy,"",windowprops);
}

function changesubmit() {
	document.forms[0].elements['opslaan'].disabled = true;
	document.forms[0].elements['opslaan'].value = 'Moment a.u.b.';
}

function expand(n) {
	document.getElementById(n).style.display = ((document.getElementById(n).style.display == 'none')?'block' :'none');
	document.getElementById('btn_'+n).src = ((document.getElementById(n).style.display == 'none')?'/global/gfx/expand.gif' :'/global/gfx/contract.gif');	
}

function getWindowHeight() {
	var windowHeight=0;
	if (typeof(window.innerHeight)=='number') {
		windowHeight=window.innerHeight;
	} else {
		if (document.documentElement&&
			document.documentElement.clientHeight) {
			windowHeight=document.documentElement.clientHeight;
		} else {
			if (document.body&&document.body.clientHeight) {
				windowHeight=document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

function getWindowWidth() {
	var windowWidth=0;
	if (typeof(window.innerWidth)=='number') {
		windowWidth=window.innerWidth;
	} else {
		if (document.documentElement&&
			document.documentElement.clientWidth) {
			windowWidth=document.documentElement.clientWidth;
		} else {
			if (document.body&&document.body.clientWidth) {
				windowWidth=document.body.clientWidth;
			}
		}
	}
	return windowWidth;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function myFileBrowser (field_name, url, type, win) {
    var fileBrowserWindow = new Array();
    fileBrowserWindow['title'] = 'File Browser';
    fileBrowserWindow['file'] = "/cms/imagebrowser.php" + "?type=" + type;
    fileBrowserWindow['width'] = '600';
    fileBrowserWindow['height'] = '400';
    fileBrowserWindow['close_previous'] = 'no';
    tinyMCE.openWindow(fileBrowserWindow, {
      window : win,
      input : field_name,
      resizable : 'yes',
		scrollbars : 'yes',
      inline : 'yes'
    });
    return false;
  }

function myFileBrowser3 (field_name, url, type, win) {

    var cmsURL = "/cms/imagebrowser.php" + "?type=" + type;    // script URL - use an absolute path!
    if (cmsURL.indexOf("?") < 0) {
        //add the type as the only query parameter
        cmsURL = cmsURL + "?type=" + type;
    }
    else {
        //add the type as an additional query parameter
        // (PHP session ID is now included if there is one at all)
        cmsURL = cmsURL + "&type=" + type;
    }

    tinyMCE.activeEditor.windowManager.open({
        file : cmsURL,
        title : 'My File Browser',
        width : 620,  // Your dimensions may differ - toy around with them!
        height : 450,
        resizable : "yes",
        inline : "yes",  // This parameter only has an effect if you use the inlinepopups plugin!
        close_previous : "no"
    }, {
        window : win,
        input : field_name
    });
    return false;
  }



function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
		}
	}
@else
	xmlhttp = false;
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp = false;
	}
}

function loadDoc(docname, id) {
	if (xmlhttp) {
		xmlhttp.open("GET",docname,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4) {
				if(document.getElementById(id)) document.getElementById(id).innerHTML=xmlhttp.responseText;
			}
		}
		xmlhttp.send(null)
	}
}

function loadDocValue(docname, id) {
	if (xmlhttp) {
		xmlhttp.open("GET",docname,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4) {
				if(document.getElementById(id)) document.getElementById(id).value=xmlhttp.responseText;
			}
		}
		xmlhttp.send(null)
	}
}

function LoadDocRedirect(docname) {
	if (xmlhttp) {
		xmlhttp.open("GET",docname,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4) {
				window.location = xmlhttp.responseText;
			}
		}
		xmlhttp.send(null)
	}
}

var xmlhttpAlert=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
	try {
		xmlhttpAlert = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			xmlhttpAlert = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttpAlert = false;
		}
	}
@else
	xmlhttpAlert = false;
@end @*/
if (!xmlhttpAlert && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttpAlert = new XMLHttpRequest();
	} catch (e) {
		xmlhttpAlert = false;
	}
}

function loadDocAlert(docname) {
	if (xmlhttpAlert) {
		xmlhttpAlert.open("GET",docname,true);
		xmlhttpAlert.onreadystatechange=function() {
			if (xmlhttpAlert.readyState==4) {
				if(xmlhttpAlert.responseText) alert(xmlhttpAlert.responseText);
			}
		}
		xmlhttpAlert.send(null)
	}
}


// Deze functie geeft een dialoog voor het afsluiten van een pagina, zolang needToConfirm true is. Standaard wordt bij het formobject deze waarde op true gezet.

var needToConfirm = false;
window.onbeforeunload = confirmExit;
function confirmExit() {
    if (needToConfirm)
      return "Weet u zeker dat u deze pagina wilt sluiten zonder op te slaan?";
}

function toggleErrorLabel(label,state) {
	if(!e(label)) alert(label+' does not exist')
	if(state == 'on') {
		e(label).style.color = "#C00";
	}else{
		e(label).style.color = "#000";
	}
}

function ValidateForm(form) {

	var error = 0;
	var errorMessage = 'Je hebt dit formulier niet volledig ingevuld:\n\n';
		
	if(typeof(form.required)=='undefined') {
		return true;
	}
		
	
	var fieldnames = form.required.value.split(',');
	
	for(key in fieldnames) {
		if(e(fieldnames[key])) {
			type = e(fieldnames[key]).type
			label = e('label_'+fieldnames[key]).innerHTML;
			label = strip_tags(label);
			//label = fieldnames[key];
			if(type=='text' || type=='textarea') {
				if(e(fieldnames[key]).value == "") { 
					errorMessage += '- '+label+' is niet ingevuld\n';
					error = 1;
					toggleErrorLabel('label_'+fieldnames[key],'on');
				}else{
					toggleErrorLabel('label_'+fieldnames[key]);
				}
			} else if(type=='select-one') {
				if(e(fieldnames[key]).options[e(fieldnames[key]).selectedIndex].value=='' || e(fieldnames[key]).options[e(fieldnames[key]).selectedIndex].value=='0') {
					errorMessage += '- '+label+' is niet gekozen\n';
					error = 1;
					toggleErrorLabel('label_'+fieldnames[key],'on');
				}
			} else if(type=='password') {
				p1 = e(fieldnames[key]).value;
				p2 = e(fieldnames[key].substring(0,fieldnames[key].length-1)+'2').value;
				if(p1!='') {
					if(p1.length<6) {
						errorMessage += '- '+label+' is korter dan 6 tekens\n';
						error = 1;						
					} else if(p1!=p2) {
						errorMessage += '- De wachtwoorden zijn niet gelijk\n';
						error = 1;						
					}
				}
			} else {
				alert(type)
			}
		}
	
	}

	if(error){
		alert(errorMessage);
		return false; 
	}else{
		return true;
	}
}

function strip_tags(str, allowed_tags) {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Luke Godfrey
    // +      input by: Pul
    // +   bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: Onno Marsman
    // +      input by: Alex
    // +   bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +      input by: Marc Palau
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +      input by: Brett Zamir (http://brett-zamir.me)
    // +   bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: Eric Nagel
    // +      input by: Bobby Drake
    // +   bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // *     example 1: strip_tags('<p>Kevin</p> <br /><b>van</b> <i>Zonneveld</i>', '<i><b>');
    // *     returns 1: 'Kevin <b>van</b> <i>Zonneveld</i>'
    // *     example 2: strip_tags('<p>Kevin <img src="someimage.png" onmouseover="someFunction()">van <i>Zonneveld</i></p>', '<p>');
    // *     returns 2: '<p>Kevin van Zonneveld</p>'
    // *     example 3: strip_tags("<a href='http://kevin.vanzonneveld.net'>Kevin van Zonneveld</a>", "<a>");
    // *     returns 3: '<a href='http://kevin.vanzonneveld.net'>Kevin van Zonneveld</a>'
    // *     example 4: strip_tags('1 < 5 5 > 1');
    // *     returns 4: '1 < 5 5 > 1'
 
    var key = '', allowed = false;
    var matches = [];
    var allowed_array = [];
    var allowed_tag = '';
    var i = 0;
    var k = '';
    var html = '';
 
    var replacer = function(search, replace, str) {
        return str.split(search).join(replace);
    };
 
    // Build allowes tags associative array
    if (allowed_tags) {
        allowed_array = allowed_tags.match(/([a-zA-Z]+)/gi);
    }
 
    str += '';
 
    // Match tags
    matches = str.match(/(<\/?[\S][^>]*>)/gi);
 
    // Go through all HTML tags
    for (key in matches) {
        if (isNaN(key)) {
            // IE7 Hack
            continue;
        }
 
        // Save HTML tag
        html = matches[key].toString();
 
        // Is tag not in allowed list? Remove from str!
        allowed = false;
 
        // Go through all allowed tags
        for (k in allowed_array) {
            // Init
            allowed_tag = allowed_array[k];
            i = -1;
 
            if (i != 0) { i = html.toLowerCase().indexOf('<'+allowed_tag+'>');}
            if (i != 0) { i = html.toLowerCase().indexOf('<'+allowed_tag+' ');}
            if (i != 0) { i = html.toLowerCase().indexOf('</'+allowed_tag)   ;}
 
            // Determine
            if (i == 0) {
                allowed = true;
                break;
            }
        }
 
        if (!allowed) {
            str = replacer(html, "", str); // Custom replace. No regexing
        }
    }
 
    return str;
}

// Extended Tooltip Javascript
// copyright 9th August 2002, 3rd July 2005, 24th August 2008
// by Stephen Chapman, Felgall Pty Ltd

// permission is granted to use this javascript provided that the below code is not altered
function pw() {return window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth}; function mouseX(evt) {return evt.clientX ? evt.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) : evt.pageX;} function mouseY(evt) {return evt.clientY ? evt.clientY + (document.documentElement.scrollTop || document.body.scrollTop) : evt.pageY} function popUp(evt,oi) {if (document.getElementById) {var wp = pw(); dm = document.getElementById(oi); ds = dm.style; st = ds.visibility; if (dm.offsetWidth) ew = dm.offsetWidth; else if (dm.clip.width) ew = dm.clip.width; if (st == "visible" || st == "show") { ds.visibility = "hidden"; } else {tv = mouseY(evt) + 20; lv = mouseX(evt) - (ew/4); if (lv < 2) lv = 2; else if (lv + ew > wp) lv -= ew/2; lv += 'px';tv += 'px';  ds.left = lv; ds.top = tv; ds.visibility = "visible";}}}
                  