var mouse_x=0;
var mouse_y=0;
function getMousePos(eobj)
{
	if(mouse_x==0 && mouse_y==0)
	{
		mouse_x=eobj.clientX;
		mouse_y=eobj.clientY;
	}
}

function getCityName(state,cmb,cityval){
  
  //alert(stateid);return false;
  //var xmlHttp=getHTTPObject();
  //var xmlObj = new Object();
  if(cityval == ""){   	
  	document.getElementById("clsextquote_city").style.display="none";
  	document.getElementById("load").style.display="";
  }
  var http = getHTTPObject(); // We create the HTTP Object
  http.open("GET", HTTP+"getCityval.php?state=" + state, true);
  http.onreadystatechange =function(){
  	 if (http.readyState == 4) {
	              if(http.status==200) {
	                  var results=http.responseText;
	             		text = results.split('#');
						  //alert(text);return false; 
						  /*cmb=document.frmmain.clsbrowsedj_city;
						  cityval=document.frmmain.clsbrowsedj_city.value;*/
						  //state=document.frmmain.clsbrowsedj_state.value;
						  //document.getElementById("city").style.display="";
						  
						  var no = text.length;
						  var arval = new Array();
						  var icnt = 0
						 
						  
						  arval[icnt]=new Option("Please Select City"," ");
						  icnt++;
						 
						  for(i=0;i<no-1;i += 2){
						    arval[icnt]=new Option(text[i+1],text[i]);
							
						    icnt++;
						  } 
						  for (m=cmb.options.length-1;m>0;m--) {
						    cmb.options[m]=null
						  }
						  select="";
						  //alert(cityval);return false;
						  selectedarray=eval(arval)
						  //alert(selectedarray.length);return false;
						  for (i=0;i<selectedarray.length;i++) {
						     cmb.options[i]=new Option(selectedarray[i].text,selectedarray[i].value)
						     if (cityval==selectedarray[i].value){
						         select="true"
						         cmb.options[i].selected=true
						     }
						   }						   
						   if(cityval == "")
						   {
						   	   	document.getElementById("load").style.display="none";	
						   	   	document.getElementById("clsextquote_city").style.display="block";
						   }
						   
						   
	              }
             }
  }
  http.send(null); 
  //xmlHttp.open("GET", "getCityval.php?state=" + state, true);
 /*xmlHttp.send(xmlObj);
  
  var xmlDocument = xmlHttp.responseText;
  text = xmlDocument.split('#');
 
  
  var no = text.length;
  var arval = new Array();
  var icnt = 0
 
  
  arval[icnt]=new Option("Please Select City"," ");
  icnt++;
 
  for(i=0;i<no-1;i += 2){
    arval[icnt]=new Option(text[i+1],text[i]);
	
    icnt++;
  } 
  for (m=cmb.options.length-1;m>0;m--) {
    cmb.options[m]=null
  }
  select="";
  
  selectedarray=eval(arval)

  for (i=0;i<selectedarray.length;i++) {
     cmb.options[i]=new Option(selectedarray[i].text,selectedarray[i].value)
     if (cityval==selectedarray[i].value){
         select="true"
         cmb.options[i].selected=true
     }
     }*/
     //getDjCount(state,'','');
     
}
 function handleHttpResponse() {   
       
        }      
       
function getDjCount(state,city,djtype)
{
  		  var xmlHttp=getHTTPObject();
		  var xmlObj = new Object();
		  xmlHttp.open("GET",HTTP+"getDjCount.php?state="+state+"&city="+city+"&djtype="+djtype, true);
		  xmlHttp.send(xmlObj);
		  //document.write(xmlHttp.responseText);
		  var xmlDocument = xmlHttp.responseText;
		 
		  text = xmlDocument.split('#');
		  //alert(text);return false;
		  document.getElementById("djcount").innerHTML = "Available Djs: <strong> "+text[0]+"</strong>";
}
function getZipcode(state,city)
{
  		  
	  var http = getHTTPObject(); // We create the HTTP Object
	  http.open("GET",HTTP+"getZipcode.php?state="+state+"&city="+city, true);
	  http.onreadystatechange =function(){
	  	 if (http.readyState == 4) {
		              if(http.status==200) {
		                  var results=http.responseText;
								/*var xmlHttp=getHTTPObject();
							  var xmlObj = new Object();
							  xmlHttp.open("GET", "getZipcode.php?state="+state+"&city="+city, true);
							  xmlHttp.send(xmlObj);
							  //document.write(xmlHttp.responseText);
							  var xmlDocument = xmlHttp.responseText;*/
		 
							  text = results.split('#');
							 
							  if(text[0]!="")
							  	document.frmmain.clsextquote_zipcode.value =text[0];
							  if(text[1]!="")
							  	document.frmmain.clsextquote_county_name.value =text[1];
		              }
	  	 }
	  }
	 http.send(null);		  
}
/*function getHTTPObject() {
  var xmlhttp;
  try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
     try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
     } catch (E) {
        xmlhttp = false;
     }
  }

  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}	*/
function getHTTPObject() {
  var xmlhttp;

  if(window.XMLHttpRequest){
    xmlhttp = new XMLHttpRequest();
  }
  else if (window.ActiveXObject){
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    if (!xmlhttp){
        xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
   
}
  return xmlhttp;

 
}
 
function ValidatePhone(obj,p){
var n;
n=obj.name;
if(p.length==3){
	//d10=p.indexOf('(')
	pp=p;
	d4=p.indexOf('(')
	d5=p.indexOf(')')
	if(d4==-1){
		pp="("+pp;
	}
	if(d5==-1){
		pp=pp+")";
	}
	//pp="("+pp+")";
	obj.value="";
	obj.value=pp;
}
if(p.length>3){
	d1=p.indexOf('(')
	d2=p.indexOf(')')
	if (d2==-1){
		l30=p.length;
		p30=p.substring(0,4);
		//alert(p30);
		p30=p30+")"
		p31=p.substring(4,l30);
		pp=p30+p31;
		//alert(p31);
		obj.value="";
		obj.value=pp;
	}
	}
if(p.length>5){
	p11=p.substring(d1+1,d2);
	if(p11.length>3){
	p12=p11;
	l12=p12.length;
	l15=p.length
	//l12=l12-3
	p13=p11.substring(0,3);
	p14=p11.substring(3,l12);
	p15=p.substring(d2+1,l15);
	obj.value="";
	pp="("+p13+")"+p14+p15;
	obj.value=pp;
	//obj1.value="";
	//obj1.value=pp;
	}
	l16=p.length;
	p16=p.substring(d2+1,l16);
	l17=p16.length;
	if(l17>3&&p16.indexOf('-')==-1){
		p17=p.substring(d2+1,d2+4);
		p18=p.substring(d2+4,l16);
		p19=p.substring(0,d2+1);
		//alert(p19);
	pp=p19+p17+"-"+p18;
	obj.value="";
	obj.value=pp;
	//obj1.value="";
	//obj1.value=pp;
	}
}
//}
//setTimeout(ValidatePhone,100)
}

/* End */