function xmlhttpPost(strURL,return_div) {
    var xmlHttpReq = false;
    var self = this;
	var str_response;
    // 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)
		{
            updatepage(self.xmlHttpReq.responseText,return_div);
        }
    }
	str_response = "wilsonsblinds1";
    self.xmlHttpReq.send(str_response);
}

function getquerystring() {
	var qstr;
    return qstr;
}

function updatepage(str,return_div){
	//alert(str);
    document.getElementById("return_div").innerHTML = str;
}

function get_price(radioname, taperladders, notrequiredid, maxwidth, maxdrop, minwidth, mindrop)
{	
	document.getElementById('calculateclicked').value = "y";
	
	var obj_drop_down,xx,obj_drop_down_value;
	
	var unit_combo = document.getElementById('unit_combo');
	
	var width = document.getElementById('width');
	var drop = document.getElementById('drop');
	var id = document.getElementById('id');
	var widthinches = document.getElementById('width_inches');
	var dropinches = document.getElementById('drop_inches');
	var option1id = document.getElementById('option1id');
	var option2id = document.getElementById('option2id');
	var option3id = document.getElementById('option3id');
	var blindwidth = parseFloat(width.value);
	var blinddrop = parseFloat(drop.value);

	for (i=0;i<document.frm_extra_property.unit_combo.length;i++){
		if (document.frm_extra_property.unit_combo[i].checked==true){
			unit_combo=document.frm_extra_property.unit_combo[i].value
			break //exist for loop, as target acquired.
		}
	}
	
	if (unit_combo == 'cm' && (blindwidth > maxwidth || blinddrop > maxdrop)) {
		alert("Please check the maximum width and height available.");
		return false;
	}
	
	if (unit_combo == 'cm' && (blindwidth < minwidth || blinddrop < mindrop)) {
		alert("Please check the minimum width and height available.");
		return false;
	}
	
	var blindwidthinch = blindwidth * 2.54;
	var blinddropinch = blinddrop * 2.54;
	
	if (unit_combo == 'inch' && (blindwidthinch > maxwidth || blinddropinch > maxdrop)) {
		alert("Please check the maximum width and height available.");
		return false;
	}
	
	if (unit_combo == 'inch' && (blindwidthinch < minwidth || blinddropinch < mindrop)) {
		alert("Please check the minimum width and height available.");
		return false;
	}
	
	if(width.value=='')
	{
		alert('Please input width');
		width.focus();
		return;
	}
	if(drop.value=='')
	{
		alert('Please input drop');
		drop.focus();
		return;
	}
	
	var totoallength = document.frm_extra_property.radio1.length;
	var myOption = -1;
	if (totoallength == undefined ){
		if (document.frm_extra_property.radio1.checked) {  
			myOption = 0;
		}
	}
	else {
		for (var iii= 0 ; iii < totoallength; iii++) {
			 if(document.frm_extra_property.radio1[iii].checked){
				myOption = 0;
			 }
		}
	}
	if (myOption == -1) {
		alert("Please select the " + radioname + " that you require...");
		return false;
	}
	
	var option2id = document.getElementById('option2id')	
	
	if (unit_combo == 'cm' && blindwidth > 200 && option2id.value != notrequiredid && option2id.value > 0) {
		if (taperladders == 'Tape Ladders') {
			alert("Tapes are not available on blinds over 200cm wide. Please reset and select 'Not Required'.");
			return false;
		}		
		if (taperladders == 'Fabric Lining') {
			alert("Blackout lining is not available on blinds over 200cm wide. Please reset and select 'Standard'.");
			return false;
		}
	}
	if (unit_combo == 'inch' && blindwidth > 78.74 && option2id.value != notrequiredid && option2id.value > 0) {
		if (taperladders == 'Tape Ladders') {
			alert("Tapes are not available on blinds over 200cm wide. Please reset and select 'Not Required'.");
			return false;
		}		
		if (taperladders == 'Fabric Lining') {
			alert("Blackout lining is not available on blinds over 200cm wide. Please reset and select 'Standard'.");
			return false;
		}
	}
	
	var option3id = document.getElementById('option3id')	
	
	//CHK OPTION SELECTIONS
	var width_value,drop_value,id_value,unit_combo,unit_;
	width_value = width.value;
	drop_value = drop.value;
	width_inches_value = widthinches.value;
	drop_inches_value = dropinches.value;
	id_value = id.value;
	option1id_value = option1id.value;
	option2id_value = option2id.value;
	option3id_value = option3id.value;
	unit_value = unit_combo;
	
	xmlhttpPost('/products-detail-price-temp.asp?unit='+unit_value+'&width='+width_value+'&drop='+drop_value+'&width_inches_value='+width_inches_value+'&drop_inches_value='+drop_inches_value+'&id='+id_value+'&option1id='+option1id_value+'&option2id='+option2id_value+'&option3id='+option3id_value+'');
}
