var WindowObjectReference;

function FG_max_popup(mylink, windowname)
{
if(WindowObjectReference == null || WindowObjectReference.closed)
{
	if (! window.focus)return true;
	var href;
	if (typeof(mylink) == 'string')
	   href=mylink;
	else
	   href=mylink.href;
	   //window.open(href, windowname, 'width='+screen.width+',height='+screen.height+',,left=0,top=0,fullWindow=1,fullscreen=1,status=1,toolbar=0,directories=0,menubar=0,scrollbars=1,resizable=1,left=0,top=0');
		WindowObjectReference=window.open(href, windowname, 'width='+screen.width+',height='+screen.height+',left=0,top=0,fullWindow=1,fullscreen=1,status=1,toolbar=0,directories=0,menubar=0,scrollbars=1,resizable=1,left=0,top=0');
		if (window.focus) {WindowObjectReference.focus()}
		if (!WindowObjectReference.opener) WindowObjectReference.opener = self;
		
	return false;
	}


}

function FG_max_popup_opener(mylink, closeme, closeonly)
{
if (! (window.focus && window.opener))return true;
window.opener.focus();
if (! closeonly)window.opener.location.href=mylink.href;
if (closeme)window.close();
return false;
}

function FG_max_popup_closer() {
window.opener.location.href = window.opener.location.href;

if (window.opener.progressWindow)
	{
		window.opener.progressWindow.close()
	}
	window.close();
return false;
}


function close_window(popup) {
    top.window_handle.close();
    top.window_opened = false;

    return false;
}

//################ Begin Klok ##############
function GetTime() { 
var dt = new Date();
var def = dt.getTimezoneOffset()/60;
var gmt = (dt.getHours() + def);
document.klok.lokaal.value = (IfZero(dt.getHours()) + ":" + IfZero(dt.getMinutes()) + ":" + IfZero(dt.getSeconds()));
var ending = ":" + IfZero(dt.getMinutes()) + ":" +  IfZero(dt.getSeconds());
setTimeout("GetTime()", 1000);
}
function IfZero(num) {
return ((num <= 9) ? ("0" + num) : num);
}
function check24(hour) {
return (hour >= 24) ? hour - 24 : hour;
}
//################ Eind Klok ##############

//################ Begin Tooltip ##############

function enableTooltips(id){
var links,i,h;
if(document.getElementById(id) !=null)
{
if(!document.getElementById || !document.getElementsByTagName) return;
AddCss();
h=document.createElement("span");
h.id="btip";
h.setAttribute("id","btip");
h.style.position="absolute";
document.getElementsByTagName("body")[0].appendChild(h);
if(id==null) links=document.getElementsByTagName("a");
else links=document.getElementById(id).getElementsByTagName("a");
for(i=0;i<links.length;i++){
    Prepare(links[i]);
    }
}

function Prepare(el){
var tooltip,t,b,s,l;
t=el.getAttribute("title");
if(t && t.length && t.length!=0){
//if(t==null || t.length==0) hideTooltip;
el.removeAttribute("title");
tooltip=CreateEl("span","tooltip");
s=CreateEl("span","top");
s.appendChild(document.createTextNode(t));
tooltip.appendChild(s);
b=CreateEl("b","bottom");
//l=el.getAttribute("href");
//if(l.length>28) l=l.substr(0,25)+"...";
//b.appendChild(document.createTextNode(l));
tooltip.appendChild(b);
setOpacity(tooltip);
el.tooltip=tooltip;
el.onmouseover=showTooltip;
el.onmouseout=hideTooltip;
//el.onmouseover=el.style.color='#CC0033';
//el.onmouseout=el.style.color='';

el.onmousemove=Locate;
}
}

function showTooltip(e){
document.getElementById("btip").appendChild(this.tooltip);
Locate(e);
}

function hideTooltip(e){
var d=document.getElementById("btip");
if(d.childNodes.length>0) d.removeChild(d.firstChild);
}

function setOpacity(el){
el.style.filter="alpha(opacity:95)";
el.style.KHTMLOpacity="0.95";
el.style.MozOpacity="0.95";
el.style.opacity="0.95";
}

function CreateEl(t,c){
	var x=document.createElement(t);
	x.className=c;
	x.style.display="block";
	return(x);
}

function AddCss(){
var l=CreateEl("link");
l.setAttribute("type","text/css");
l.setAttribute("rel","stylesheet");
l.setAttribute("href","/style.css");
l.setAttribute("media","screen");
document.getElementsByTagName("head")[0].appendChild(l);
}

function Locate(e){
var posx=0,posy=0;
if(e==null) e=window.event;
if(e.pageX || e.pageY){
    posx=e.pageX; posy=e.pageY;
    }
else if(e.clientX || e.clientY){
    if(document.documentElement.scrollTop){
        posx=e.clientX+document.documentElement.scrollLeft;
        posy=e.clientY+document.documentElement.scrollTop;
        }
    else{
        posx=e.clientX+document.body.scrollLeft;
        posy=e.clientY+document.body.scrollTop;
        }
    }
document.getElementById("btip").style.top=(posy+10)+"px";
document.getElementById("btip").style.left=(posx-20)+"px";
}

}
//################ Eind Tooltip ##############

//################ Begin Submit ##############
function submit(Form)
{
document.getElementById(Form).submit();
}
//################ Eind Submit ##############

//################ Begin Checkboxen ##############
function SetChecked(chkName,c)
{
	form = document.getElementById(chkName);
	for (i=0;i<form.elements.length;i++)
		if (form.elements[i].type == "checkbox")
			form.elements[i].checked = c.checked? true:false;
}

function SetUnCheck(chkName) {
var name="all_"+chkName
	document.getElementById(name).checked = false;
}

function check_change(chkName)
{
box = eval(document.getElementById(chkName));
box.checked = !box.checked;
}

//################ Eind Checkboxen ##############
function loadnew(url) {
  top.location.href= url;
}
//################ Overlay ##############
function getposOffset(overlay, offsettype){
var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
var parentEl=overlay.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function overlay(curobj, subobjstr, opt_position){
if (document.getElementById){
var subobj=document.getElementById(subobjstr)
subobj.style.display=(subobj.style.display!="block")? "block" : "none"
var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
subobj.style.left=xpos+"px"
subobj.style.top=ypos+"px"
return false
}
else
return true
}

function overlayclose(subobj){
document.getElementById(subobj).style.display="none"
}


function include_Javascript(file) {
var th = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
	script.setAttribute('type','text/javascript');
	script.setAttribute('src',file);
	script.setAttribute('defer',true);
	th.appendChild(script);
} 

/* include js files here */
include_Javascript('/chat/js/webim.js?v=102');
include_Javascript('/chat/js/webimhelper.js?v=102');
/* END - include js files here */

