//Ajax Functie
//
//var ajax = new Ajax();
//ajax.passthejoint(array, goal, handler);
//
//array is the data that will be send like : var array = new Array("name=test","I=Me");
//goal is the php script that is going to handle the data like : "http://www.mysite.com/ajaxHandler.php"
//handler is the function thats gonna receive the response data, you need to give a reference to that function
//this means you enter the function() without the parantheses "(" & ")" the function needs to receive one parameter, the response object
//
//so the complete function call looks like :
//
//var ajax	= new Ajax();
//var array	= new Array("name=test","I=Me");
//
//ajax.passthejoint(array, "myhandler.php", handler);
//
//function handler(responseObject){
//...
//}
//

function Ajax(){
	var xmlHttp;
	var nFunx;
	var nloading;
	//readyState
	//responseText
	
	function passthejoint(array, goal, Funx, loading){
		nFunx = Funx;
		nloading = loading;
	
		GetXmlHttpObject();
		if(xmlHttp == null){
			alert("Browser ondersteund geen Ajax!");
			return;
		}
		var url = goal;
		for(var i=0;i<array.length;i++){
			if(i==0){
				url+="?"+array[i];
			}else{
				url+="&"+array[i];
			}
		}
		//url+="&sid="+Math.random();
		xmlHttp.onreadystatechange = stateChange;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}
	
	function stateChange(){
		if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){			
			nFunx(xmlHttp.responseText);
		}
		if(xmlHttp.readyState==1||xmlHttp.readyState=="loading"){
			if(typeof nloading == "function"){
				nloading();
			}
		}
	}
								
	function GetXmlHttpObject(){
		xmlHttp = null;
		try{
			xmlHttp = new XMLHttpRequest();
		}catch(e){
			try{
				xmlHttp = new ActiveXObject("Msxm12.XMLHTTP");
			}catch(e){
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
		}
	}
	
	this.stateChange = stateChange;
	this.passthejoint = passthejoint;
	this.GetXmlHttpObject = GetXmlHttpObject;
}

//ATTRIBUTEN OPHALEN

//positie bepalen van een element
function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return new Array(parseInt(curtop),parseInt(curleft));
}

//muis positie opvragen, functie X-as, functie Y-as
function mousePos(evt) {
	var pageX;
	var pageY;
	if (!evt){
		evt = window.event
	};
	if (evt.pageX)pageX =  evt.pageX;
	else if (evt.clientX)pageX = evt.clientX + (document.documentElement.scrollLeft ?  document.documentElement.scrollLeft : document.body.scrollLeft);
	else pageX = 0;
		
	if (evt.pageY)pageY = evt.pageY;
	else if (evt.clientY)pageY = evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
	else pageX = 0;
	
	return new Array(parseInt(pageX),parseInt(pageY));
}

//Hoogte en wijdte van het element ophalen
function getElementWidth(elem) {	
	if (elem.style.pixelWidth) {
		xPos = elem.style.pixelWidth;
	} else {
		xPos = elem.offsetWidth;
	}
	
	if (elem.style.pixelHeight) {
		yPos = elem.style.pixelHeight;
	} else {
		yPos = elem.offsetHeight;
	}
	return new Array(parseInt(xPos),parseInt(yPos));
}

//Hoogte en wijdte van het complete document ophalen
function getWindowHeight(){
	var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return new Array(parseInt(myHeight),parseInt(myWidth));
}

//Object klemmen aan muis aanwijzer
function follow(evt) {
	if (document.getElementById) {
		
		var offX = 0;          
		var offY = -10;        
		
		var obj = document.getElementById('temp');
		
		var divwidth = getElementWidth(obj);
		divwidth = divwidth[0];
		if(divwidth < 400){
			offX = divwidth * -0.6;
		}else{
			offX = divwidth * -0.4;
		}
		
		obj.style.position = 'absolute';
		
		var mouspos = mousePos(evt);
		
		obj.style.left = (mouspos[0]+offX) + 'px';
		obj.style.top = (mouspos[1]+offY) + 'px';
	}
}

var objid;
function startmoveobject(obj){
	try{
		if(obj.id){
			objid = obj.id;
		}
	obj.id = "temp";
	document.onmousemove = follow
	document.onmouseup = stopmoveobject;
	}catch(e){
		var text;
		for(var i in e){
			text += i+": "+e[i];
		}
		alert(text);
	}
}

function stopmoveobject(){
	try{
	var obj = document.getElementById('temp');
	
		if(obj.id){
			obj.id = objid;
		}
	
	document.onmousemove = null;
	document.onmouseup = null;
	}catch(e){
		var text;
		for(var i in e){
			text += i+": "+e[i];
		}
		alert(text);
	}
}
				
var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();

<!-- Idea by:  Nic Wolfe -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
	
<!-- Begin
	function popUp(URL,w,h) {
		if(!w){
			w	=	540;
		}
		if(!h){
			h	=	788;
		}
		
		day = new Date();
		id = day.getTime();
		eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width="+w+",height="+h+",left = 370,top = 118');");
	}
// End -->

function getElementsByClassName(clss){
	var returnTags = new Array();	
	var tags = document.getElementsByTagName("*");
	for(var i=0;i<tags.length;i++){
		if(tags[i].className&&tags[i].className==clss)returnTags.push(tags[i]);
	}
	return returnTags;
}