/*
/*	Script titel:  JS library
		Auteur:	   Bram van Mensvoort
		Doel:	   Classes of dynamic effects. Especially for forms.
*/

<!--
var flashinstalled = 0;
var flashversion = 0;
MSDetect = "false";
if (navigator.plugins && navigator.plugins.length) {
	x = navigator.plugins["Shockwave Flash"];
	if (x) {
		flashinstalled = 2;
		if (x.description) {
			y = x.description;
			flashversion = y.charAt(y.indexOf('.')-1);
		}
	} else {
		flashinstalled = 1;
	}
	if (navigator.plugins["Shockwave Flash 2.0"]) {
		flashinstalled = 2;
		flashversion = 2;
	}
} else if (navigator.mimeTypes && navigator.mimeTypes.length) {
	x = navigator.mimeTypes['application/x-shockwave-flash'];
	if (x && x.enabledPlugin) { flashinstalled = 2;} else {flashinstalled = 1;}
} else { 
	MSDetect = "true";
}
// -->

// Detection scripts
var browser;
	var agt=navigator.userAgent.toLowerCase();
	var appVer = navigator.appVersion.toLowerCase();
	var iePos  = appVer.indexOf('msie');
	var is_opera = (agt.indexOf("opera") != -1);
	var is_konq = false;
	var kqPos   = agt.indexOf('konqueror');
    if (kqPos !=-1) {is_konq  = true};
	var is_safari = ((agt.indexOf('safari')!=-1)&&(agt.indexOf('mac')!=-1))?true:false;
  var is_khtml  = (is_safari || is_konq);
	var is_ie   = ((iePos!=-1) && (!is_opera) && (!is_khtml));
	if (is_ie) {var browser="IE";} else {var browser="Niet IE, Firefox of een andere browser";};
	
//var screenHeight = getId(new Object()).styles.innerHeight();	//Opnieuw detecteren 		
//var screenWidth = getId(new Object()).styles.innerWidth();	//Opnieuw detecteren 		

function getId(divID) {
	// Voegt  styles()  toe aan het object.
	if (typeof(divID)=="string") {obj=getIdObj(divID)}; 
	if (typeof(divID)=="object") {obj=divID;}
	if (obj==null || obj==undefined) {return false};
	obj.styles = new Object();
	obj.styles.refObj= obj;
	switch (browser) {
		case "IE":	// Internet explorer of geen Mozilla
			obj.styles.border = 				function(content) {var obj=this.refObj; if (content!=undefined) {obj.style.border=content}; return obj.style.border};		
			obj.styles.background = 			function(content) {var obj=this.refObj; if (content!=undefined) {obj.style.background=content}; return obj.style.background};
			obj.styles.backgroundImage = 		function(content) {var obj=this.refObj; if (content!=undefined) {obj.style.backgroundImage="url("+ content +")"}; return obj.style.backgroundImage};
			obj.styles.pixelTop = 				function(content) {var obj=this.refObj; if (content!=undefined) {obj.style.pixelTop=content}; return obj.style.pixelTop};
			obj.styles.pixelLeft = 				function(content) {var obj=this.refObj; if (content!=undefined) {obj.style.pixelLeft=content}; return obj.style.pixelLeft};
			obj.styles.visibility = 			function(content) {var obj=this.refObj; if (content!=undefined) {obj.style.visibility=content}; return obj.style.visibility};
			obj.styles.position = 				function(content) {var obj=this.refObj; if (content!=undefined) {obj.style.position=content}; return obj.style.position};
			obj.styles.cursor = 				function(content) {var obj=this.refObj; if (content!=undefined) {if (content=="hand") {obj.style.cursor="hand";} else {obj.style.cursor="default";} }; return obj.style.cursor};
			obj.styles.color = 					function(content) {var obj=this.refObj; if (content!=undefined) {obj.style.color=content}; return obj.style.color};
			obj.styles.width = 					function(content) {var obj=this.refObj; if (content!=undefined) {obj.offsetWidth=content}; return obj.offsetWidth};						
			obj.styles.height = 				function(content) {var obj=this.refObj; if (content!=undefined) {obj.offsetHeight=content}; return obj.offsetHeight};
			obj.styles.clip = 					function(content) {var obj=this.refObj; if (content!=undefined) {obj.style.clip="rect("+content[0]+" "+content[1]+" "+content[2]+" "+content[3]+")"}; return obj.style.clip};
		break;
		default:
			obj.styles.border = 				function(content) {var obj=this.refObj; if (content!=undefined) {obj.style.border=content}; return obj.style.border};
			obj.styles.background = 			function(content) {var obj=this.refObj; if (content!=undefined) {obj.style.background=content}; return obj.style.background};
			obj.styles.backgroundImage =		function(content) {var obj=this.refObj; if (content!=undefined) {obj.style.backgroundImage="url("+ content +")"}; return obj.style.backgroundImage};
			obj.styles.pixelTop = 				function(content) {var obj=this.refObj; if (content!=undefined) {obj.style.top=content+"px"}; return parseInt(obj.style.top, 10)};
			obj.styles.pixelLeft = 				function(content) {var obj=this.refObj; if (content!=undefined) {obj.style.left=content+"px"}; return parseInt(obj.style.left, 10)};
			obj.styles.visibility = 			function(content) {var obj=this.refObj; if (content!=undefined) {obj.style.visibility=content}; return obj.style.visibility};
			obj.styles.position = 				function(content) {var obj=this.refObj; if (content!=undefined) {obj.style.position=content}; return obj.style.position};
			obj.styles.cursor = 				function(content) {var obj=this.refObj; if (content!=undefined) {if (content=="hand") {obj.style.cursor="pointer";} else {obj.style.cursor="default";} }; return obj.style.cursor};
			obj.styles.color = 					function(content) {var obj=this.refObj; if (content!=undefined) {obj.style.color=content}; return obj.style.color};
			obj.styles.width = 					function(content) {var obj=this.refObj; if (content!=undefined) {obj.offsetWidth=content}; return obj.offsetWidth};						
			obj.styles.height = 				function(content) {var obj=this.refObj; if (content!=undefined) {obj.offsetHeight=content}; return obj.offsetHeight};
			obj.styles.clip = 					function(content) {var obj=this.refObj; if (content!=undefined) {obj.style.clip="rect("+content[0]+"px "+content[1]+"px "+content[2]+"px "+content[3]+"px)"}; return obj.style.clip};
		break;
	}	
	//Browser independent
	obj.styles.x= 				function(content) {
		var obj=this.refObj;
		var curleft = 0;
		if (obj.offsetParent)
		{
			while (obj.offsetParent)
			{
				curleft += obj.offsetLeft
				obj = obj.offsetParent;
			}
		}
		else if (obj.x)
			curleft += obj.x;
		return curleft;
	};
	obj.styles.y= 				function(content) {
		var obj=this.refObj;
		var curtop = 0;
		if (obj.offsetParent)
		{
			while (obj.offsetParent)
			{
				curtop += obj.offsetTop
				obj = obj.offsetParent;
			}
		}
		else if (obj.y)
			curtop += obj.y;
		return curtop;
	};
	//Get screen resolution
	if (window.innerWidth) {
		obj.styles.innerHeight = 			function(content) {if (content!=undefined) {window.innerHeight=content}; return window.innerHeight};
		obj.styles.innerWidth = 			function(content) {if (content!=undefined) {window.innerWidth=content}; return window.innerWidth};
	}
	else if (document.documentElement && document.documentElement.clientWidth) {
		obj.styles.innerHeight = 			function(content) {if (content!=undefined) {document.documentElement.clientHeight=content}; return document.documentElement.clientHeight};
		obj.styles.innerWidth = 			function(content) {if (content!=undefined) {document.documentElement.clientWidth=content}; return document.documentElement.clientWidth};
	}
	else if (document.body) {	
		obj.styles.innerHeight = 			function(content) {if (content!=undefined) {document.body.clientHeight=content}; return document.body.clientHeight};
		obj.styles.innerWidth = 			function(content) {if (content!=undefined) {document.body.clientWidth=content}; return document.body.clientWidth};
	}
	
	function followmouse(e){
		var truebody= (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
		var xcoord=offsetfrommouse[0]
		var ycoord=offsetfrommouse[1]
		if (typeof(e) != "undefined"){
			xcoord+=e.pageX
			ycoord+=e.pageY
		} else if (typeof window.event !="undefined"){
			xcoord+=truebody().scrollLeft+event.clientX
			ycoord+=truebody().scrollTop+event.clientY
		}
		var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
		var docheight=document.all? Math.max(truebody().scrollHeight, truebody().clientHeight) : Math.max(document.body.offsetHeight, window.innerHeight)
		if (xcoord+widthLayer+3 > docwidth || ycoord+widthLayer > docheight) { 	//prevent scrollbars
			obj.objCaller.display="none"
		} else {
			obj.objCaller.display=""
			obj.objCaller.left=xcoord+"px"
			obj.objCaller.top=ycoord+"px"
		}
	}
	
	obj.styles.mouseX = function (e) {
		var truebody= (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
		var docwidth=document.all? truebody.scrollLeft+truebody.clientWidth : pageXOffset+window.innerWidth-15;
		var docheight=document.all? Math.max(truebody.scrollHeight, truebody.clientHeight) : Math.max(document.body.offsetHeight, window.innerHeight);
		if (typeof(e) != "undefined"){
			xcoord=e.pageX
			ycoord=e.pageY
		} else if (typeof(window.event) !="undefined"){
			xcoord=truebody.scrollLeft+event.clientX
			ycoord=truebody.scrollTop+event.clientY
		}
		return xcoord;
	}
	obj.styles.mouseY = function (e) {
		var truebody= (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
		var docwidth=document.all? truebody.scrollLeft+truebody.clientWidth : pageXOffset+window.innerWidth-15;
		var docheight=document.all? Math.max(truebody.scrollHeight, truebody.clientHeight) : Math.max(document.body.offsetHeight, window.innerHeight);
		if (typeof(e) != "undefined"){
			xcoord=e.pageX
			ycoord=e.pageY
		} else if (typeof(window.event) !="undefined"){
			xcoord=truebody.scrollLeft+event.clientX
			ycoord=truebody.scrollTop+event.clientY
		}
		return ycoord;
	}
	
	//AJAX functions
	obj.styles.XMLHttpRequests = function () { return (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(); }
	
	if (typeof(divID)=="string") {return getIdObj(divID)}; 
	if (typeof(divID)=="object") {return obj;}
};

function getIdObj(divID) {
    if( document.layers) {		//Netscape layers
        return document.layers[divID]};		
    if( document.getElementById ) {		//DOM; IE5, NS6, Mozilla, Opera
        return document.getElementById(divID)};
    if( document.all ) {		//Proprietary DOM; IE4
        return document.all[divID]};
    if( document[divID] ) {		 //Netscape alternative
        return document[divID]};
    return false;
}


//Content events
window.onload = function () {
	getId("cornerLeftTop").styles.cursor("hand");
	getId("navigationbar_top_image").styles.cursor("hand");
}
