/**
	AJAX functions 
	@date 2010-12-1
*/
//get the xml object via various navagator!
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");
		  }
	 }

	 if( xmlHttp == null ) {
		  alert( 'Browser does not support xmlHTTP Request' );
	 }
	return xmlHttp;
}

function addLoadEvent( func ){
	var oldload = window.onload;
	if( typeof window.onload != "function"){
		window.onload = func;
	}
	else{
		window.onload = function(){
			oldload();
			func();
		}
	}
}

function insertAfter( newElement, targetElement ){
	var parent = targetElement.parentNode;
	if( parent.lastChild == targetElement ){
		parent.appendChild( newElement );
	}else{
		parent.inserBefore( newElement, targetElement.nextSibling );
	}
}

function addClass( element, value ){
	if( !element.className ){
		element.className = value;
	}else{
		var newClassName = element.className;
		newClassName += " ";
		newClassName += value;
		element.className = newClassName;
	}
}
