// JavaScript Document
function getXMLHttpRequest(){
	if(window.ActiveXObject){
		return new ActiveXObject("Microsoft.XMLHTTP");
	}else if(window.XMLHttpRequest){
		return new XMLHttpRequest();	
	}else alert("Status : Can not create XMLHttpRequest Object");
}
var xmlhttp=getXMLHttpRequest();

function sendRequest(pageURL,ElementID){
	var obj=document.getElementById(ElementID);
	obj.innerHTML='Loading.... please wait.';
	if(xmlhttp.readyState==4 || xmlhttp.readyState==0){
		xmlhttp.open('GET',pageURL,true);
		xmlhttp.onreadystatechange=function(){
			if(xmlhttp.readyState==4 && xmlhttp.status==200){
				obj.innerHTML=xmlhttp.responseText;
			}
		}
		xmlhttp.send(null);
	}
}

function kirimRequest(pageURL,ElementID){
	var obj=document.getElementById(ElementID);
//	obj.innerHTML='Loading.... please wait.';
	if(xmlhttp.readyState==4 || xmlhttp.readyState==0){
		xmlhttp.open('GET',pageURL,true);
		xmlhttp.onreadystatechange=function(){
			if(xmlhttp.readyState==4 && xmlhttp.status==200){
				obj.innerHTML=xmlhttp.responseText;
			}
		}
		xmlhttp.send(null);
	}
}


function cariRequest(str,strdoc,posisi)
{ 
	switch (str)
	{ 
		case 'cekcari.php' : 
				var url = str+"?katakunci="+strdoc.cari.value+"&page_id="+Math.random()*99999;
				break;				
		default : alert("Maaf dalam taraf Perbaikan !! ");
	}
	var obj=document.getElementById(posisi);
	obj.innerHTML='Loading.... please wait.';
	if(xmlhttp.readyState==4 || xmlhttp.readyState==0){
		xmlhttp.open('GET',url,true);
		xmlhttp.onreadystatechange=function(){
			if(xmlhttp.readyState==4 && xmlhttp.status==200){
				obj.innerHTML=xmlhttp.responseText;
			}
		}
		xmlhttp.send(null);
	}
}

function postRequest(str,str1,posisi,nm)
{ 
	var url = str+"?id="+str1+"&nmmenu="+nm+"&page_id="+Math.random()*99999;
	var obj=document.getElementById(posisi);	
	if(xmlhttp.readyState==4 || xmlhttp.readyState==0){
		xmlhttp.open('GET',url,true);
		xmlhttp.onreadystatechange=function(){
			if(xmlhttp.readyState==4 && xmlhttp.status==200){
				obj.innerHTML=xmlhttp.responseText;
			}
		}
		xmlhttp.send(null);
	}
}
