// AJAX stuff - alert if not supported
function getHTTPObject(){
   if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP");
   else if (window.XMLHttpRequest) return new XMLHttpRequest();
   else {
      alert("Your browser does not support AJAX. You will have to place any orders manually by phone");
      return null;
   }
}   
 
 


function addtocart(type, id){ 
	httpObject = getHTTPObject();
    if (httpObject != null) {
        httpObject.open("GET", "scripts/cartfunctions.php?&type=" + type + "&id=" + id + "&action=add", true);
        httpObject.send(null); 
        httpObject.onreadystatechange = setOutput;	
    }
}


function deletefromcart(id){
	
	httpObject = getHTTPObject();
   
    if (httpObject != null) { 
        httpObject.open("GET", "scripts/cartfunctions.php?id=" + id +"&action=del", true);
        httpObject.send(null); 
        httpObject.onreadystatechange = setOutput;
    }
    
    

}








function deletefromorder(id){
	
	httpObject = getHTTPObject();
   
    if (httpObject != null) { 
        httpObject.open("GET", "scripts/orderfunctions.php?id=" + id +"&action=del", true);
        httpObject.send(null); 
        httpObject.onreadystatechange = setOutputOrder;
    }
	
}




function updateqty(type, id, qty){ 

	var qty = document.getElementById(id).value	 ;
	
	
	httpObject = getHTTPObject();
    if (httpObject != null) {
        httpObject.open("GET", "scripts/orderfunctions.php?&type=" + type + "&id=" + id + "&qty=" + qty + "&action=add", true);
        httpObject.send(null); 
        httpObject.onreadystatechange = setOutputOrder;	
    }
}



function hosting(){
	
        window.open("http://www.lunarpages.com/id/feeziman007","_blank");
	
}




function setOutput(){
   
	    if(httpObject.readyState == 4){ 
		document.getElementById('hosting').innerHTML= httpObject.responseText; 
		}
 
}


function setOutputOrder(){
   
	    if(httpObject.readyState == 4){ 
		document.getElementById('order').innerHTML= httpObject.responseText; 
		}
 
}






function printSelection(node){

  var content=node.innerHTML
  var pwin=window.open('','print_content','width=768');

  pwin.document.open();
  pwin.document.write('<html><body onload="window.print()">'+content+'</body></html>');
  pwin.document.close();
 
  setTimeout(function(){pwin.close();},2000);

}


function enablespecial(id) {
			

			
	httpObject = getHTTPObject();

    if (httpObject != null) { 
        httpObject.open("POST", "scripts/orderfunctions.php?id=" + id + "&action=enablespecial" , true);
        httpObject.send(null); 
        httpObject.onreadystatechange = setOutputOrder; 
       
    }
}


function updatespecial(id) {
			
	var instructions = document.getElementById(id + 'special').value ;	
			
	httpObject = getHTTPObject();

    if (httpObject != null) { 
        httpObject.open("POST", "scripts/orderfunctions.php?id=" + id +"&instructions=" + instructions + "&action=updatespecial" , true);
        httpObject.send(null); 
        httpObject.onreadystatechange = setOutputOrder; 
       
    }
}
	