/* 
  ------------------------------------
  PVII Menu CSS Express Drop-Down Menu
  by Project Seven Development
  www.projectseven.com
  ------------------------------------
*/


var THIS_SITE			= window.location.host;
var theDefaultText 		= "search this site";
var theElement;
var theElement_id		= "p7menubar";
var theHideCounter		= 0;
var theSearchThingy;
var theState;
var theUrl				= "/getnavigation.php";
var xmlHttp


//=====================================
function ToggleHide(theElementID, doHide){ 
	if (document.getElementById(theElementID)) {
		myObject = document.getElementById(theElementID);
		if ((myObject.style.visibility == "hidden")&&(doHide == "show")) {
			myObject.style.visibility 	= "visible";
			myObject.style.display 		= "inline";
		}
		else {
			myObject.style.visibility 	= "hidden";
			myObject.style.display 		= "none";
		}
	}
}


//=====================================
function DoUnhide(theElementID){ 
	theHideCounter++
	if (document.getElementById(theElementID)) {
		myObject = document.getElementById(theElementID);
		if (theHideCounter > 3) {
			theHideCounter = 0;
			myObject.style.visibility 	= "visible";
			myObject.style.display 		= "inline";
		}
		else {
			myObject.style.visibility 	= "hidden";
			myObject.style.display 		= "none";
		}
	}
}

 
//=====================================
function UpdateLinkCount(linkID, typeCount){ 

	// post to db
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
		return;
	}
	else {
		if (typeCount == "asp") {
			theUrl = "/aspfiles/start/linkcounter2.asp";
		}
		else {
			theUrl = "/linkcounter.php";
		}
		xmlHttp.onreadystatechange=stateChanged_linkcount;
		theUrl =  theUrl + "?linkID=" + linkID;
		xmlHttp.open("GET",theUrl,true);
		xmlHttp.send(null);
	}
}

//=====================================
function SetSWFtekst(){ 
	var tekst1				= "-";
	var tekst2				= "-";

	if (document.getElementById) {
		if (document.getElementById("lichtkrant")) {
			document.getElementById("lichtkrant").innerHTML = "";
			if (document.getElementById("tekst1")) {
				tekst1				= document.getElementById("tekst1").value;
			}
			if (document.getElementById("tekst2")) {
				tekst2				= document.getElementById("tekst2").value;
			}
			
			if (tekst1 + tekst2 == "jouw tekst 1jouw tekst 2") {
				window.alert("Hm, lekker originele tekst: \n" + tekst1 + "\n" + tekst2);
			}
			
			var fo2 = new FlashObject("/download/2007/05/lichtkrant3.swf?tekst1=" + tekst1 + "&tekst2=" + tekst2, "lichtkrant2", "502", "105", 8, "#ffffff");
			fo2.addVariable("tekst1", tekst1);
			fo2.addVariable("tekst2", tekst2);
			fo2.write("lichtkrant");

			// post to db
			xmlHttp=GetXmlHttpObject()
			if (xmlHttp==null) {
				alert ("Browser does not support HTTP Request");
				return;
			}
			else {
				xmlHttp.onreadystatechange=addToDB;
				theUrl =  "/lichtkrant.php?tekst1=" + tekst1 + "&tekst2=" + tekst2;
				xmlHttp.open("GET",theUrl,true);
				xmlHttp.send(null);
			}
			
		}
	}
}	



//=====================================
function P7_ExpMenu_set(){ //v1.1.0.2 by PVII-www.projectseven.com
	if(navigator.appVersion.indexOf("MSIE")==-1){return;}
	var i,k,g,lg,r=/\s*p7hvr/,nn='',c,cs='p7hvr',bv='p7menubar';
	for(i=0;i<10;i++){g=document.getElementById(bv+nn);if(g){
	lg=g.getElementsByTagName("LI");if(lg){for(k=0;k<lg.length;k++){
	lg[k].onmouseover=function(){c=this.className;cl=(c)?c+' '+cs:cs;
	this.className=cl;};lg[k].onmouseout=function(){c=this.className;
	this.className=(c)?c.replace(r,''):'';};}}}nn=i+1;}
}
//=====================================
function GetNavigation() { 

	xmlHttp=GetXmlHttpObject()
	
	// check for local host
	var loc1	= location.href;
	var in1		= loc1.indexOf("aspfiles");

	if (in1 > 0) {
		theUrl = "http://localhost:81" + theUrl;
	}

	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request");
		return;
	}
	else {
		xmlHttp.onreadystatechange=stateChanged;
		theUrl =  theUrl + "?url=" + window.location.pathname;
		xmlHttp.open("GET",theUrl,true);
		xmlHttp.send(null);
	}
}

//=====================================
function addToDB() {
	theResponse				= xmlHttp.responseText
	if (document.getElementById("anderenschreven")) {
		theElement				= document.getElementById("anderenschreven");
		if (theResponse.length > 0) {
			theElement.innerHTML	= theResponse; 
		}
	}
}
//=====================================
function stateChanged() {

	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
		theResponse				= xmlHttp.responseText
		if (document.getElementById(theElement_id)) {
			theElement				= document.getElementById(theElement_id);
			if (theResponse.length > 0) {
				theElement.innerHTML	= theResponse; 
			}
		}
	} 
	P7_ExpMenu_set();
} 
//=====================================
function stateChanged_linkcount() {

	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
		theResponse				= xmlHttp.responseText;
	} 
} 


//=====================================
function GetXmlHttpObject() { 

	var XMLHttp=null
	if (window.XMLHttpRequest)	{
		XMLHttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)	{
		XMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	//=====================================
	return XMLHttp;
}

function searchform() {

	if (document.getElementById) {
		if (document.getElementById("s")) {
			var theSearchThingy = document.getElementById("s");

			if (theSearchThingy.value == theDefaultText) {
				theSearchThingy.value = "";
			}

			if (theSearchThingy.className != "focused") {
				// maybe either lostfocus or unfocused 
				theSearchThingy.className = "focused";
			}
			else {
				// recieved focus
				theSearchThingy.className = "lostfocus";
			}
		}
	}
}

function zoekform(theElementID, theElementID2){ 
	var myZoek;
	var myResult;
	if (document.getElementById(theElementID2)) {
		theElement_Startid = theElementID2;
	}
	if (document.getElementById(theElementID)) {
		myObject = document.getElementById(theElementID);
		if (myObject.value != "") {
			xmlHttp=GetXmlHttpObject()
			var imageID = "<img src=\"/images/effe-wachten.gif\" border=\"0\" alt=\"even wachten\" />";
			theUrl = "/aspfiles/start/zoeklink.asp?zoek=" + myObject.value;
			
//			document.getElementById(theElementID2).innerHTML = imageID + '<a href="' + theUrl + '">"' + theUrl + '</a>';
			document.getElementById(theElementID2).innerHTML = imageID;
			
			xmlHttp.onreadystatechange=zoekFormResult;
			xmlHttp.open("GET",theUrl,true);
			xmlHttp.send(null);
		}
	}
	return false;
}

function zoekFormResult() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
		theResponse				= xmlHttp.responseText
		if (document.getElementById(theElement_Startid)) {
			theElement				= document.getElementById(theElement_Startid);
			theElement_Startid = "";
			if (theResponse.length > 0) {
				theElement.innerHTML	= theResponse; 
			}
		}
	} 
} 

//=====================================
function P7_ExpMenu(){ // MODIFIED pabu
	if (document.getElementById) {
		GetNavigation();
	}
}
 








function setOutsideLinks(_checked) {
	where = _checked?"_blank":"_self";
	for (var i=0; i<=(document.links.length-1); i++)   {
		/*
		* If THIS_SITE is not in the URL then set the link to
		*/
		if(document.links[i].href.indexOf(THIS_SITE)<0) {
			document.links[i].target = where;
		}
	}
}



		$(function () {
			var tabContainers = $('div.tabs > div');
			$(this).addClass('selected');
			tabContainers.hide().filter(':first').show();
			
			$('div.tabs ul.tabNavigation a').click(function () {
				tabContainers.hide();
				tabContainers.filter(this.hash).show();
				$('div.tabs ul.tabNavigation a').removeClass('selected');
				$(this).addClass('selected');
				return false;
			}).filter(':first').click();
		});

//=====================================
function Start_ShowAll(classID, htmlID, strCriteria){  
	// post to db
	xmlHttp=GetXmlHttpObject()
	theElement_Startid = htmlID;
	theUrl = "/aspfiles/start/loadelements.asp";
	theUrl =  theUrl + "?classID=" + classID;
	
	
	if (document.getElementById(htmlID)) {

		if (document.getElementById("img_" + htmlID).className == "right loadall") {
			document.getElementById("img_" + htmlID).className = "right loadsome";
		}
		else {
			document.getElementById("img_" + htmlID).className = "right loadall";
			theUrl =  theUrl + "&" + strCriteria;
		}
		var imageID = "<img src=\"/images/effe-wachten.gif\" border=\"0\" id=\"img_" + htmlID + "\" />";
		document.getElementById(htmlID).innerHTML = imageID;
	}
	if (xmlHttp==null) {
		return;
	}
	else {
		xmlHttp.onreadystatechange=stateChanged_Start_ShowAll;
		xmlHttp.open("GET",theUrl,true);
		xmlHttp.send(null);
	}
}

//=====================================
function stateChanged_Start_ShowAll() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
		theResponse				= xmlHttp.responseText
		if (document.getElementById(theElement_Startid)) {
			theElement				= document.getElementById(theElement_Startid);
			theElement_Startid = "";
			if (theResponse.length > 0) {
				theElement.innerHTML	= theResponse; 
			}
		}
	} 
} 
//=====================================
