// JavaScript Document

						  
						  
function xmlhttpPostCa(strURL,formid, pageid) {
   var notwaiting = "<img align=center src=images/spinner.gif><font color = red>Please Wait...</font>";
    document.getElementById("notwaiting").innerHTML = notwaiting; 

    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            updatepageCa(self.xmlHttpReq.responseText);
			
        }
		
    }
    self.xmlHttpReq.send(getquerystringCa(formid, pageid));
	
}

function getquerystringCa(formid, pageid) {
    var form     = document.forms[formid];
    qstr = 'mode='+ pageid +'&w=' + formid;  // NOTE: no '?' before querystring
    return qstr;
}

function updatepageCa(str){
   document.getElementById("notwaiting").innerHTML = '';
	document.getElementById("shopping").innerHTML = str;
	
	 
} 






function xmlhttpPost(displayarea,strURL, mode , pid) {
	 var notwaiting = "<img align=center src=images/spinner.gif><font color = red>Please Wait...</font>";
    document.getElementById("notwaiting").innerHTML = notwaiting; 
	
    var xmlHttpReq = false;
    var self = this;
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
		document.getElementById("notwaiting").innerHTML = '';
	    document.getElementById(displayarea).innerHTML = self.xmlHttpReq.responseText;
		
        }
    }
    qstr = "&pid=" + pid;

if(mode == 0){
addtoc();
}

if(mode == 1){
addtoc1();
}

if(mode == 2){
addtoc2();
}

if(mode == 3){
addtoc3();
}

if(mode == 4){
addtoc4();
}

if(mode == 5){
addtoc5();
}

if(mode == 6){
addtoc6();
}

if(mode == 7){
addtoc7();
}

if(mode == 8){
addtoc8();
}
	  
if(mode == 9){
addtoc9();
}

if(mode == 'adjust0'){
adjust0();
}
	   
    
   self.xmlHttpReq.send(qstr);
}


function addtoc(){
	qstr = qstr + '&parent=' + document.voucher0["parent"].value;
		
}
function addtoc1(){
	qstr = qstr + '&parent=' + document.voucher1["parent"].value;
		
}
function addtoc2(){
	qstr = qstr + '&parent=' + document.voucher2["parent"].value;
		
}
function addtoc3(){
	qstr = qstr + '&parent=' + document.voucher3["parent"].value;
		
}
function addtoc4(){
	qstr = qstr + '&parent=' + document.voucher4["parent"].value;
		
}
function addtoc5(){
	qstr = qstr + '&parent=' + document.voucher5["parent"].value;
		
}
function addtoc6(){
	qstr = qstr + '&parent=' + document.voucher6["parent"].value;
		
}
function addtoc7(){
	qstr = qstr + '&parent=' + document.voucher7["parent"].value;
		
}
function addtoc8(){
	qstr = qstr + '&parent=' + document.voucher8["parent"].value;
		
}
function addtoc9(){
	qstr = qstr + '&parent=' + document.voucher9["parent"].value;
		
}

function adjust0(){
	
	qstr = qstr + '&quantity=' + document.adjustform0["quantity"].value;
	qstr = qstr + '&voucher=' + document.adjustform0["voucher"].value;
	qstr = qstr + '&outlet=' + document.adjustform0["outlet"].value;

}




