		function createRequestObject() {
    		var ro;
    		var browser = navigator.appName;
    		if(browser == "Microsoft Internet Explorer"){
        		ro = new ActiveXObject("Microsoft.XMLHTTP");
    		}else{
        		ro = new XMLHttpRequest();
    		}
    		return ro;
		}

		var http = createRequestObject();

		function sndReq(action) {
    		http.open("GET", action, true);
    		http.onreadystatechange = handleResponse;
    		http.send(null);
		}

		function sndReq2(action) {
    		http.open("GET", action, true);
    		http.onreadystatechange = handleResponse2;
    		http.send(null);
		}

		function getphoneinfo(action) {
    		http.open("GET", action, true);
    		http.onreadystatechange = handleResponse3;
    		http.send(null);
		}

		function handleResponse3() {
			if(http.readyState != 4){
				document.getElementById('phoneinfo').innerHTML = '<img src=images/indicator.gif />';		
			}
			if(http.readyState == 4){
				var responseblogs2 = http.responseText;
				document.getElementById('phoneinfo').innerHTML = responseblogs2;
			}
		}

		function handleResponse() {
		    if(http.readyState == 4){
        		var response = http.responseText;
				var update = new Array();
				var update2 = new Array();
				update = response.split('|');
					for (var r=0; r<=update.length-1; r++) {
						if (update[r]!='') {
							update2 = update[r].split('~');
							document.inputForm1.model.options[r+1]=new Option(update2[0],update2[1]);
						}
					}
			}
		}
		
		function handleResponse2() {
		    if(http.readyState == 4){
        		var response = http.responseText;
				var update = new Array();
				var update2 = new Array();
				update = response.split('|');
					for (var r=0; r<=update.length-1; r++) {
						if (update[r]!='') {
							update2 = update[r].split('~');
							document.inputForm1.brand.options[r+1]=new Option(update2[0],update2[1]);
						}
					}
			}
		}


		function showBrand() {
			for (var i=0;i<document.inputForm1.brand.options.length;i++)
				{
					document.inputForm1.brand.options[i]=null;
				}
			document.inputForm1.brand.options.length=0;
			document.inputForm1.brand.options[0]=new Option('','');	
			sndReq2('phonebrands.php?carrierid='+document.inputForm1.carrier.value);
		}

		function showModel() {
			for (var i=0;i<document.inputForm1.model.options.length;i++)
				{
					document.inputForm1.model.options[i]=null;
				}
			document.inputForm1.model.options.length=0;
			document.inputForm1.model.options[0]=new Option('','');	
			sndReq('phones2.php?carrierid='+document.inputForm1.carrier.value+'&brandid='+document.inputForm1.brand.value);
		}
		
		
		function validate() {
			if (document.inputForm1.carrier.value=="")
				{
					alert("please enter your carrier");
					document.inputForm1.carrier.focus();
					return false;
				}

			if (document.inputForm1.brand.value=="")
				{
					alert("please enter your phone make");
					document.inputForm1.brand.focus();
					return false;
				}
			if (document.inputForm1.model.value=="")
				{
					alert("please enter your phone model");
					document.inputForm1.model.focus();
					return false;
				}
		}

		function validatepurchase() {
			if (document.inputForm1.carrier.value=="")
				{
					alert("please enter your carrier");
					document.inputForm1.carrier.focus();
					return false;
				}

			if (document.inputForm1.brand.value=="")
				{
					alert("please enter your phone make");
					document.inputForm1.brand.focus();
					return false;
				}
			if (document.inputForm1.model.value=="")
				{
					alert("please enter your phone model");
					document.inputForm1.model.focus();
					return false;
				}
			if (document.inputForm1.mobile.value=="")
				{
					alert("please enter your phone number");
					document.inputForm1.mobile.focus();
					return false;
				}

		}

