// JavaScript Document
function createObject() {
	var request_type;
	try  { request_type=new XMLHttpRequest(); } // Firefox, Opera 8.0+, Safari
 	catch (e)  { try {request_type=new ActiveXObject("Msxml2.XMLHTTP"); }// Internet Explorer
  	catch (e){ try {request_type=new ActiveXObject("Microsoft.XMLHTTP"); }
  	catch (e){ alert("Your browser does not support AJAX!"); return false;}}}
  	return request_type;
}

function show_price() {
	
	document.getElementById('pp').innerHTML = '<img src ="./images/loader.gif" width="100" height="20" />';	
	
	if(document.getElementById('post_code').selectedIndex == '') {
		alert('Please select Postcode');
		return false;
	} else {
		var postcode = document.getElementById('post_code').value;
	}
	
	if(document.getElementById('qty').selectedIndex == '') {
		alert('Please select Quantity');
		return false;
	} else {
		var qty = document.getElementById('qty').value;
	}
		
	var xmlHttp = createObject();
		
	xmlHttp.open("GET","./ajax/php/show_price.php?post_code="+postcode+"&qty="+qty);
	xmlHttp.send(null);
	
	xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState==4) {
			document.getElementById('pp').innerHTML = xmlHttp.responseText;
		}
	}
}


function show_price2() {
	
	
	var qnty = document.getElementById('qnty').value;
	
	if(qnty == 'other') {
		
		if(document.getElementById('qnty').selectedIndex == '') {
			alert('Select Quantity');
			return false;
		} else {
			if(document.getElementById('qnty').value == 'other') {
				document.getElementById('other_div').style.display='block';
				document.getElementById('other_div1').style.display='block';
				document.getElementById('other_div1').innerHTML = 'Other Amount';
			} else {
				document.getElementById('other_div').style.display='none';
				document.getElementById('other_div1').style.display='none';
			}
		
		}
	} else {
		
		
		var xmlHttp = createObject();
		
			
		xmlHttp.open("GET","./ajax/php/show_price2.php?qty="+qnty);
		xmlHttp.send(null);
		
		xmlHttp.onreadystatechange=function() {
			if(xmlHttp.readyState==4) {
				document.getElementById('other_div1').style.display='block';
				document.getElementById('other_div1').innerHTML = xmlHttp.responseText;
				document.getElementById('other_div').style.display='none';
				
			}
		}
	}
}

function count() {
	
	alert(document.getElementById('price_1').value);
	
}
