// JavaScript Document

function print_screen(elemt) {
	win = window.open();
   self.focus();
   win.document.open();
   win.document.write('<'+'html'+'><'+'head'+'><'+'style'+'>');
   win.document.write('body, td { font-family: Verdana; font-size: 10pt;}');
   win.document.write('<'+'/'+'style'+'><'+'/'+'head'+'><'+'body'+'>');
   win.document.write(elemt);
   win.document.write('<'+'/'+'body'+'><'+'/'+'html'+'>');
   win.document.close();
   win.print();
   win.close();
}

function CheckEmail()
{
	var N = true;
	var VB = 'vb: uw_naam@domein.be';
	var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;

	if (document.mailForm.email.value == '')
	{
		N = false;
		alert('Geef a.u.b. uw e-mail adres in');
		document.mailForm.email.focus();
	}
	else
	{

		if (document.mailForm.email.value.indexOf('@') == -1)
		{
			N = false;
			Z = 'Een e-mail adres moet een "apenstaartje" (@) bevatten.\n';
			alert(Z + VB);
			document.mailForm.email.focus();
		}

		if (document.mailForm.email.value.indexOf('.') == -1)
		{
			N = false;
			Z = 'Een e-mail adres moet een punt bevatten.\n';
			alert(Z + VB);
			document.mailForm.email.focus();
		}

		if (document.mailForm.email.value.search(emailRegEx) == -1)
		{
			N = false;
			Z = 'Geef een geldig mail adres in.\n';
         alert(Z + VB);
         document.mailForm.email.focus();
     	}
	}

	return N;
}

function tooltip(event, elemt)
{
document.getElementById(elemt).style.backgroundColor="#ffcc33"
document.getElementById(elemt).style.borderColor="#000000"
document.getElementById(elemt).style.borderStyle="solid"
document.getElementById(elemt).style.borderWidth="1px"
//document.getElementById(elemt).style.width="300px"
/*document.getElementById(elemt).style.clear="both"*/
var browser=navigator.appName
	if (browser=="Microsoft Internet Explorer")
	  {  //block + absolute
	  	document.getElementById(elemt).style.display="block"
	  	/*document.getElementById(elemt).style.left=event.clientX.x+20
		document.getElementById(elemt).style.top=event.clientY.y*/
		
		document.getElementById(elemt).style.left=event.clientX+ document.documentElement.scrollLeft + document.body.scrollLeft + 20
		document.getElementById(elemt).style.top=event.clientY + document.documentElement.scrollTop + document.body.scrollTop + 20

		document.getElementById(elemt).style.position="absolute"
	  }
	else
	  {
		document.getElementById(elemt).style.display="inline"
		document.getElementById(elemt).style.left=event.clientX+20+"px"
		document.getElementById(elemt).style.top=event.clientY+20+"px"
		document.getElementById(elemt).style.position="fixed"
	  }
	  
document.getElementById(elemt).style.zIndex=1000
/*document.getElementById(elemt).style.position=browserStyle()*/
}

function showDiv()
{
	
}

function resetHelp()
{
	str = "help";
	box = "hlpTxt";
	showInBox(str, box);
}

function showHelp(str, box, clr)
{
	
	showInBox(str, box);
}

function changeLink(param, sqlType, event)
{
	document.getElementById('myAnchor').innerHTML="download "+param;
	str = document.getElementById('myAnchor').href;
	if (str.search(sqlType) == -1)
	{
		str+="&"+sqlType+"="+param;
	} else {
		
		if (event.keyCode == 8)
		{
			nrstr = str.length;
			if (param != '')
			{
				str=str.substring(0, nrstr-1);
			} else {
				nrsqlType = sqlType.length;
				str=str.substring(0, nrstr-(nrsqlType+3));
			}
		} else {
			nrparam = param.length;
			str+=param.substring(nrparam-1, nrparam);
		}
	}
	document.getElementById('myAnchor').href=str;
	//document.getElementById('myAnchor').target="_blank";
}

var boxx = "";
function showInBox(str, box)
{
	/*browser check*/
 	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
	  alert ("Your browser does not support AJAX!");
	  return;
	} 
	
	var browser=navigator.appName

	var url="func/ajaxTxt.php";

	boxx = box;
	url=url+"?q="+encodeURIComponent(str);

	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);

}

function invisi(cont) {
	/*browser check*/
 	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
	  alert ("Your browser does not support AJAX!");
	  return;
	} 
	/*end browser check*/
	boxx = cont;
	document.getElementById(boxx).style.display="none";
}

function visi(cont) {
	/*browser check*/
 	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
	  alert ("Your browser does not support AJAX!");
	  return;
	} 
	/*end browser check*/
	boxx = cont;
	document.getElementById(boxx).style.display="inline";
	document.getElementById(boxx).style.visibility="visible";
}

var strBlog
function invisiBlog(cont) {
	boxx = 'show'+cont;
	urll = cont;
	var where_is_x = cont.indexOf('x');
	var disp = cont.substr(0, where_is_x);
	if (where_is_x == -1) disp = cont;
	document.getElementById(boxx).style.display="none";
	document.getElementById(boxx).style.visibility="hidden";
	document.getElementById(urll).innerHTML = '<a onmousedown="visiBlog( \''+urll+'\' )">'+disp+'</a>';
}

function visiBlog(cont) {
	boxx = 'show'+cont;
	urll = cont;
	var where_is_x = cont.indexOf('x');
	var disp = cont.substr(0, where_is_x);
	if (where_is_x == -1) disp = cont;
	document.getElementById(boxx).style.display="inline";
	document.getElementById(boxx).style.visibility="visible";
	document.getElementById(urll).innerHTML = '<a onmousedown="invisiBlog( \''+urll+'\' )">'+disp+'</a>';
}

function stateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		xmlDoc=xmlHttp.responseXML;

		document.getElementById(boxx).innerHTML = '<span style="font-size: 12; font-weight: bold; ">' + xmlDoc.getElementsByTagName("txtinfo")[0].childNodes[0].nodeValue + '</span>';
	}
}

/*browser check*/ 
function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}
