function get_cities()
 {
 document.getElementById("flyers").innerHTML=""
 if(document.getElementById("province").value=="none"){
 document.getElementById("cities").length=0
 document.getElementById("cities").options[0]= new Option("Pick your community","none")
 document.getElementById("stores").length=0
 document.getElementById("stores").options[0]= new Option("Pick your store","none")
 return
 }
 var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
        }
        }
    xmlHttp.onreadystatechange=function(){
      if(xmlHttp.readyState==4){
      	x=xmlHttp.responseText
//		alert(xmlHttp.responseText)
      	y=x.split(";")
      	document.getElementById("cities").options.length=0
 	document.getElementById("cities").options[0]= new Option("Pick your community","none")
      	for (i=0;i<y.length;i++){
 	document.getElementById("cities").options[i+1]= new Option(y[i],y[i])
 	}
 document.getElementById("stores").length=0
 document.getElementById("stores").options[0]= new Option("Pick your store","none")
       }
      }
      url="getcities.asp"+"?what="+document.getElementById("province").value
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
    }
function get_stores()
 {
 document.getElementById("flyers").innerHTML=""
 if(document.getElementById("cities").value=="none"){
 document.getElementById("stores").length=0
 document.getElementById("stores").options[0]= new Option("Pick your store","none")
 return
 }
 var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
        }
        }
    xmlHttp.onreadystatechange=function(){
      if(xmlHttp.readyState==4){
      	x=xmlHttp.responseText
      	y=x.split(";")
      	document.getElementById("stores").options.length=0
 	document.getElementById("stores").options[0]= new Option("Pick your store","none")
      	for (i=0;i<y.length;i++){
 	document.getElementById("stores").options[i+1]= new Option(y[i],y[i])
 	}
       }
//		document.getElementById("stores").innerHTML="<option value='none'>Pick your store</option>"+x
      }
      url="getstores.asp"+"?what="+document.getElementById("cities").value
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
    }
    function get_flyers(){
 {
 document.getElementById("flyers").innerHTML=""
 if(document.getElementById("stores").value=="none"){
 return
 }
 var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
        }
        }
    xmlHttp.onreadystatechange=function(){
      if(xmlHttp.readyState==4){
      	x=xmlHttp.responseText
      	y=x.split(";")
      	output1="na"
      	output2="na"
      	output3="na"
      	output0=y[0]+"<br/>"
      	if(y[0].indexOf("A") !=-1){
      		if(y[2]!="na"){
      			output2="ag_gm_"+y[2]
      		}
      		if(y[0].indexOf("EAST")!=-1 && y[1]!="na"){
      			output1="ae_fz_"+y[1]
      		}
      		if(y[0].indexOf("WEST")!=-1 && y[1]!="na"){
      			output1="aw_fz_"+y[1]
      		}
      		if(y[3]!="na"){
      			output3="nl_"+y[3]
      		}
      	}
      	if(y[0].indexOf("B1") !=-1){
      		if(y[2]!="na"){
      			output2="b1g_gm_"+y[2]
      		}
      		if(y[0].indexOf("EAST")!=-1 && y[1]!="na"){
      			output1="b1e_fz_"+y[1]
      		}
      		if(y[0].indexOf("WEST")!=-1 && y[1]!="na"){
      			output1="b1w_fz_"+y[1]
      		}
      		if(y[3]!="na"){
      			output3="nl_"+y[3]
      		}
      	}
      	if(y[0].indexOf("B2") !=-1){
      		if(y[2]!="na"){
      			output2="b2g_gm_"+y[2]
      		}
      		if(y[0].indexOf("EAST")!=-1 && y[1]!="na"){
      			output1="b2e_fz_"+y[1]
      		}
      		if(y[0].indexOf("WEST")!=-1 && y[1]!="na"){
      			output1="b2w_fz_"+y[1]
      		}
      		if(y[3]!="na"){
      			output3="nl_"+y[3]
      		}
      	}
      	if(y[0].indexOf("C") !=-1){
      		if(y[2]!="na"){
      			output2="c_gm_"+y[2]
      		}
      		if(y[1]!="na"){
      			output1="c_fz_"+y[1]
      		}
      		if(y[3]!="na"){
      			output3="nl_"+y[3]
      		}
      	}
      	if(y[0].indexOf("D") !=-1){
      		if(y[2]!="na"){
      			output2="d_gm_"+y[2]
      		}
      		if(y[1]!="na"){
      			output1="d_fz_"+y[1]
      		}
      		if(y[3]!="na"){
      			output3="nl_"+y[3]
      		}
      	}
      	if(y[0].indexOf("B2") ==-1 && y[0].indexOf("B1") ==-1 && y[0].indexOf("A") ==-1 && y[0].indexOf("C") ==-1 && y[0].indexOf("D") ==-1){
      		if(y[3]!="na"){
      			output3="nl_"+y[3]
      		}
      	}
      	output="<p><strong>Current flyers for this region:</strong></p>"
document.getElementById("junk1").value=output1
document.getElementById("junk2").value=output2
document.getElementById("junk3").value=output3
/*
      	if(output1!="na"){
      		output=output+"<p><a href='flyers/"+output1+"'>fz flyer</a></p>"
      	}
      	if(output2!="na"){
      		output=output+"<p><a href='flyers/"+output2+"'>gm flyer</a></p>"
      	}
      	if(output3!="na"){
      		output=output+"<p><a href='flyers/"+output3+"'>nl flyer</a></p>"
      	}
*/      	
 document.getElementById("flyers").innerHTML=""
/*
document.getElementById("flyers").innerHTML=output
*/
       }
      }
      url="getflyers.asp"+"?what="+document.getElementById("stores").value
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
    }
    }
    function getflyertitle()
     {
     var xmlHttp;
      try
        {
        // Firefox, Opera 8.0+, Safari
        xmlHttp=new XMLHttpRequest();
        }
      catch (e)
        {
        // Internet Explorer
        try
          {
          xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
          }
        catch (e)
          {
          try
            {
            xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
          catch (e)
            {
            alert("Your browser does not support AJAX!");
            return false;
            }
            }
            }
        xmlHttp.onreadystatechange=function(){
          if(xmlHttp.readyState==4){
	document.getElementById("unlock_flyers").style.display="block"
	document.getElementById("lock_flyers").style.display="none"
          	document.getElementById("province").disabled=true
          	document.getElementById("cities").disabled=true
          	document.getElementById("stores").disabled=true
          	document.getElementById("province").style.display="none"
          	document.getElementById("cities").style.display="none"
          	document.getElementById("stores").style.display="none"
          	document.getElementById("flyers").innerHTML=xmlHttp.responseText

          	 
     	  }
        }
          url="get_flyer_title.asp?what1="+document.getElementById("junk1").value+"&what2="+document.getElementById("junk2").value+"&what3="+document.getElementById("junk3").value
//          alert(url)
        xmlHttp.open("GET",url,true);
        xmlHttp.send(null);
        }
function unlock_flyers(){
	document.getElementById("unlock_flyers").style.display="none"
	document.getElementById("lock_flyers").style.display="block"
          	document.getElementById("province").style.display="block"
          	document.getElementById("cities").style.display="block"
          	document.getElementById("stores").style.display="block"
document.location.href="unlock_flyers.asp"
}