// JavaScript 
function LoadPage(id,usediv) {
		var qty=getElement(["qty"+id]).value;
		page="orders/addToCart.php?pid="+id+"&qty="+qty; 
		
        try {xmlhttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");}  
		catch (e) { alert("Error: Could not load page.");}      
        document.getElementById(usediv).innerHTML = 'Loading Page...';
		scroll(0,0);
        xmlhttp.onreadystatechange = function(){
                //Check page is completed and there were no problems.
                if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {
                       //Write data returned to page
                       document.getElementById(usediv).innerHTML = xmlhttp.responseText;
                }
        }
		
        xmlhttp.open("GET", page);
        xmlhttp.send(null);
        return;
}

function LoadPageMsg(page,usediv) {
        try {xmlhttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");}  
		catch (e) { alert("Error: Could not load page.");}     
        document.getElementById(usediv).innerHTML = 'Sending...';    
        scroll(0,0);
        xmlhttp.onreadystatechange = function(){
                //Check page is completed and there were no problems.
                if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {
                       //Write data returned to page
                       document.getElementById(usediv).innerHTML = xmlhttp.responseText;
                }
        }
        xmlhttp.open("GET", page);		
        xmlhttp.send(null);
        return ;
}

function Loading(page,usediv) {

        try {xmlhttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");}  
		catch (e) { alert("Error: Could not load page.");}      
        document.getElementById(usediv).innerHTML = '';
		scroll(0,0);
        xmlhttp.onreadystatechange = function(){
                //Check page is completed and there were no problems.
                if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {
                       //Write data returned to page
                       document.getElementById(usediv).innerHTML = xmlhttp.responseText;
                }
        }
        xmlhttp.open("GET", page);
        xmlhttp.send(null);
        return;
}


function regPrompt(){
	var ans=confirm("To purchase from this store you must become a Rewards Program member first, or login if you are a returning member. \n\nWould you like to become a Rewards Program member? Click OK. \n\n Click Cancel to login.");
	if(ans==true ){url="http://www.duncansdirect.com.au/rewards.php"; location=url; return}		

}

function getElement(id) {
   return document.getElementById ? document.getElementById(id) : document.all ? document.all(id) : null;
}

function disDiv(n){
var  dp=getElement([n]);
if (dp.style.display=="block"){ 
dp.style.display="none";
}
else{
dp.style.display="block"
}
}