if(document.images)
{
	preload_image = new Image(220,19); 
	preload_image.src = "images/loading.gif"; 
}
function getXMLHTTP() { //fuction to return the xml http object
		var xmlhttp=false;	
		try{
			xmlhttp=new XMLHttpRequest();
		}
		catch(e)	{		
			try{			
				xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				try{
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e1){
					xmlhttp=false;
				}
			}
		}
		 	
		return xmlhttp;
    }
	
	function getHasil(mainId,page,divnya) {		
		
		var strURL=page+"?page="+mainId;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById(divnya).innerHTML=req.responseText;						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}else {document.getElementById(divnya).innerHTML = ' <div style="width:90%; margin-left:20px; text-align:center; padding:10px;">Loading... <br><img src="images/loading.gif" alt="Loading..." /></div> ';
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}		
	}
	function getBeli(mainId,page,divnya) {		
		
		var strURL=page+"?produk="+mainId;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById(divnya).innerHTML=req.responseText;						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}else {document.getElementById(divnya).innerHTML = ' <div style="width:90%; margin-left:20px; text-align:center; padding:10px;">Loading... <br><img src="images/loading.gif" alt="Loading..." /></div> ';
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}		
	}

