// JavaScript Document

function xmlhttpPost(strURL,strResponse) {
    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('GET',strURL, true);
	self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
			temp = self.xmlHttpReq.responseText;
			sendResponse(strResponse);
		}
    }
    self.xmlHttpReq.send(null);
}

function sendResponse(strResponse){
	if(strResponse=='addtodisplay'){
		document.productForm.btnSubmit.disabled=false;
		alert('Card added to display!');
		document.productForm.quantity.value=1;
			obj = document.getElementById('loading');
			obj.innerHTML = 'Card added display successfully.';
	}else if(strResponse=='addtodisplay2'){
			alert('Card added to display!');
			obj = document.getElementById('loading');
			obj.innerHTML = 'Card added display successfully.';
	}else if(strResponse=='batchaddtodisplay'){
			alert('Range added to display!');
			obj = document.getElementById('loading');
			obj.innerHTML = 'Range added to display.';
	
	}else if(strResponse=='calc'){
		//alert(temp);
		var result = temp.split("^");
		document.getElementById('total_qty').innerHTML =result[0] ;
		document.getElementById('total_price').innerHTML = result[1];
	}else{ 
		obj = document.getElementById(strResponse);
		obj.innerHTML = temp;
	}
}