var previousMenuImage;
var menuInit = false;
var onmenu = false;
var appsWin;

function adapterMenuClick(url, help){
  moveArrow(url);
  document.forms["urlsaver"].helpURL.value = help;
  return false;
}

function tdClick(thisTD, id)
{
  alert(thisTD.all);
  thisTD.all[id].click();
}

function menuClick(url, target) {


  switch (target)
  {

    case "body":
  	  parent[target].window.location.href= url;
	  break;
    default:   
          window.open(url, target, "directories=no,location=yes,menubar=yes,scrollbars=yes,status=yes,toolbar=yes,resizable=yes");
	  break;
  }

  menuMove(url, target);

  return false;
}


function menuMove(url, target) {

  if (target=="body")
  	moveArrow(url);

}

function IE() {
	if (navigator.appName == "Microsoft Internet Explorer")
		return true;
	return false;

}
function menuMouseOver(object, id) {
	object.style.background='#FFFFFF';
	window.status= id;
}
function menuMouseOut(object) {
	object.style.background='#EFEFEF';
	window.status='';

}

function moveArrow(item)
{
	if(menuInit)
	{
  		if(previousMenuImage != null) 
			previousMenuImage.src="images/blank.gif";

  		var temp = previousMenuImage;
  		previousMenuImage=document.images[item];

  		if(previousMenuImage == null) 
			previousMenuImage = temp;

  		previousMenuImage.src="images/selectedarrow.gif";
	}
}


function initMenu(firstImage)
{
	previousMenuImage = document.images[firstImage];
	previousMenuImage.src="images/selectedarrow.gif";
	menuInit = true;
	return true;
}

function showMenu(id, objPos){

	if(document.getElementById){
		var x = 0;
		var y = 0;
		
		if (objPos != null) {
		  x = getElementLeft(objPos);
		  y = getElementBottom(objPos);
		  setElementProperty(id, 'left', x + "px");
		  setElementProperty(id, 'top', y + "px");
		}
		
		//alert("Left " + x + " Bottom " + y);
		/*if(!window.event){
			y-=1;
		}*/

		setElementProperty('leftMenu', 'display', 'none');
		setElementProperty('middleMenu', 'display', 'none');
		setElementProperty('rightMenu', 'display', 'none');
		setElementProperty('blankMenu', 'display', 'none');
		
		setElementProperty(id, 'display', '');
	}
}

function hideMenu(e, id, menuImg, imgSrc){
    var posx,posy;
	var objleft, objright, objbottom, objexttop;
    posx=0;
    posy=0;

    if(e.pageX||e.pageY){
          posx=e.pageX;
          posy=e.pageY;
    }
    else if(e.clientX||e.clientY){
          posx = e.clientX + document.documentElement.scrollLeft;
          posy = e.clientY + document.documentElement.scrollTop;
    }
    
    objleft = getElementLeft(id);
    objright = getElementRight(id) + 20;  // Add buffer to make it less picky...
    objexttop = getElementTop(id) - 24;
    objbottom = getElementBottom(id) + 20;
    //alert("Obj: " + objleft + " " + objright + " " + objexttop + " " + objbottom + "  " +
    //	  "Mouse: " + posx + " " + posy);    
    if ((posx <= objleft) || (posx >= objright) || (posy <= objexttop) || (posy >= objbottom)) {
	 setElementProperty(id, 'display', 'none');
	 document.getElementById(menuImg).src = imgSrc;
	 setElementProperty('blankMenu', 'display', '');
	}
}

/**
 * Return the left px position of the element 
 **/
function getElementLeft(p_elm) {
	var x = 0;
	var elm;
	if(typeof(p_elm) == "object"){
		elm = p_elm;
	} else {
		elm = document.getElementById(p_elm);
	}
	while (elm != null) {
		x+= elm.offsetLeft;
		elm = elm.offsetParent;
	}
	return parseInt(x);
}

/**
 * Return the px width of the element 
 **/
function getElementWidth(p_elm){
	var elm;
	if(typeof(p_elm) == "object"){
		elm = p_elm;
	} else {
		elm = document.getElementById(p_elm);
	}
	return parseInt(elm.offsetWidth);
}

/**
 * Return the px distances from right border of the element to left border of window
 **/
function getElementRight(p_elm){
	return getElementLeft(p_elm) + getElementWidth(p_elm);
}

/**
 * Return the px distances from top border of the element to top border of the window
 **/
function getElementTop(p_elm) {
	var y = 0;
	var elm;
	if(typeof(p_elm) == "object"){
		elm = p_elm;
	} else {
		elm = document.getElementById(p_elm);
	}
	while (elm != null) {
		y+= elm.offsetTop;
		elm = elm.offsetParent;
	}
	return parseInt(y);
}

/**
 * Return the px heght of the element
 **/
function getElementHeight(p_elm){
	var elm;
	if(typeof(p_elm) == "object"){
		elm = p_elm;
	} else {
		elm = document.getElementById(p_elm);
	}
	return parseInt(elm.offsetHeight);
}

/**
 * Return the px distances from bottom border of the element to border top of the window
 **/
function getElementBottom(p_elm){
	return getElementTop(p_elm) + getElementHeight(p_elm);
}

/**
 * Return a style property of the elemnt , it return null if does not exist
 **/
function getElementProperty(p_elm, p_property){
	var elm = null;
	if(typeof(p_elm) == "object"){
		elm = p_elm;
	} else {
		elm = document.getElementById(p_elm);
	}
	if (elm != null){
		if(elm.style){
			elm = elm.style;
			if(elm[p_property]){
				return elm[p_property];
			} else {
				return null;
			}
		} else {
			return null;
		}
	}
}

/**
 * Set a property of style type of the element
 **/
function setElementProperty(p_elm, p_property, p_value){
	var elm = null;
	if(typeof(p_elm) == "object"){
		elm = p_elm;
	} else {
		elm = document.getElementById(p_elm);
	}
	if((elm != null) && (elm.style != null)){
		elm = elm.style;
		elm[ p_property ] = p_value;
	}
}

/**
 *	Search functions.
 **/
	function displaySearchHelp(){
		var sMsg = "To Find:\n";
	    sMsg += "\nAll Records - Leave the search fields empty.\n";
	    sMsg += "\nExact Match - enter the value in the text field (Case not considered)\n";
	    sMsg += "\nBegins With - Use % to indicate the missing data";
	    sMsg += "\n    e.g Fur% = begins with 'Fur'\n";
	    sMsg += "\nEnds With - Use % to indicate the missing data"
	    sMsg += "\n    e.g. %ouse = ends with 'ouse'\n";
	    sMsg += "\nContains - Use two % to surround the target";
	    sMsg += "\n    e.g %lan% = contains 'lan' anywhere in the value\n";
	    sMsg += "\nNote: When using more than one search field, the searchs are connected with an 'AND'.";
	    sMsg += "\n    e.g.  Site Name begins with 'S' AND Facility Name ends with 'G'";
		
		alert(sMsg);
	}

	  function openWin(inAddr) {
		window.open(inAddr, "appsWin", "width=800,height=600,toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes");
      }
      	function searchResetForm(){
		var f = document.searchCingularSiteForm
		f['criteria.siteName'].value='';
		f['criteria.siteID'].value='';
		f['criteria.CSStatusID'].selectedIndex=0;
		f['criteria.towerTypeID'].selectedIndex=0;
	        f['criteria.countyID'].selectedIndex=0;
		f['criteria.state'].selectedIndex=0;
		f['criteria.city'].value='';
		f['criteria.zipOrPostcode'].value='';
		f['criteria.addressLine1'].value='';
	  }
      
    function baseSaveMySites(){

		var el = document.forms['cingularSiteBaseSearchForm'].elements;
		var check;
		
		if(el.length>0) {
			for(i=0; i <el.length;i++) {
			  if((el[i].type == "checkbox") && (el[i].checked == true)){
			   check = true;
			   break;
			 }
			 else {
			   check=false;
			 }
		   }
		}

		if(check) {
			 document.forms['cingularSiteBaseSearchForm'].action.value = "savesites";
			 document.forms['cingularSiteBaseSearchForm'].Search.value = "search";
			 document.forms['cingularSiteBaseSearchForm'].submit();
			 document.forms['cingularSiteBaseSearchForm'].action.value = "/baseSitesearch";    	
		}
		else { 
		      alert("Please select rows to add");
			  return;
		}
    }

    function bulkSaveMySites(){

		var el = document.forms['cingularSiteBulkSearchForm'].elements;
		var check;
		
		if(el.length>0) {
			for(i=0; i <el.length;i++) {
			  if((el[i].type == "checkbox") && (el[i].checked == true)){
			   check = true;
			   break;
			 }
			 else {
			   check=false;
			 }
		   }
		}

		if(check) {
			 document.forms['cingularSiteBulkSearchForm'].action.value = "savesites";
			 document.forms['cingularSiteBulkSearchForm'].Search.value = "search";
			 document.forms['cingularSiteBulkSearchForm'].submit();
			 document.forms['cingularSiteBulkSearchForm'].action.value = "/bulkSearch";    	
		}
		else { 
		      alert("Please select rows to add");
			  return;
		}
    }

    function mapSaveMySites(){

		var el = document.forms['cingularSiteMapSearchForm'].elements;
		var check;
		
		if(el.length>0) {
			for(i=0; i <el.length;i++) {
			  if((el[i].type == "checkbox") && (el[i].checked == true)){
			   check = true;
			   break;
			 }
			 else {
			   check=false;
			 }
		   }
		}

		if(check) {
			 document.forms['cingularSiteMapSearchForm'].action.value = "savesites";
			 document.forms['cingularSiteMapSearchForm'].Search.value = "search";
			 document.forms['cingularSiteMapSearchForm'].submit();
			 document.forms['cingularSiteMapSearchForm'].action.value = "/mapSitesearch";    	
		}
		else { 
		      alert("Please select rows to add");
			  return;
		}
    }
    
    function baseRemoveMySites(){

		var el = document.forms['cingularSiteBaseSearchForm'].elements;
		var check;
		
		if(el.length>0) {
			for(i=0; i <el.length;i++) {
			  if((el[i].type == "checkbox") && (el[i].checked == true)){
			   check = true;
			   break;
			 }
			 else {
			   check=false;
			 }
		   }
		}

		if(check) {
			document.forms['cingularSiteBaseSearchForm'].action.value = "removesites";
			document.forms['cingularSiteBaseSearchForm'].Search.value = "search";
			document.forms['cingularSiteBaseSearchForm'].submit();
		}
		else { 
		      alert("Please select rows to remove");
			  return;
		}
    }
    
    function bulkRemoveMySites(){

		var el = document.forms['cingularSiteBulkSearchForm'].elements;
		var check;
		
		if(el.length>0) {
			for(i=0; i <el.length;i++) {
			  if((el[i].type == "checkbox") && (el[i].checked == true)){
			   check = true;
			   break;
			 }
			 else {
			   check=false;
			 }
		   }
		}

		if(check) {
			document.forms['cingularSiteBulkSearchForm'].action.value = "removesites";
			document.forms['cingularSiteBulkSearchForm'].Search.value = "search";
			document.forms['cingularSiteBulkSearchForm'].submit();
		}
		else { 
		      alert("Please select rows to remove");
			  return;
		}
    }
    
    function mapRemoveMySites(){

		var el = document.forms['cingularSiteMapSearchForm'].elements;
		var check;
		
		if(el.length>0) {
			for(i=0; i <el.length;i++) {
			  if((el[i].type == "checkbox") && (el[i].checked == true)){
			   check = true;
			   break;
			 }
			 else {
			   check=false;
			 }
		   }
		}

		if(check) {
			document.forms['cingularSiteMapSearchForm'].action.value = "removesites";
			document.forms['cingularSiteMapSearchForm'].Search.value = "search";
			document.forms['cingularSiteMapSearchForm'].submit();
		}
		else { 
		      alert("Please select rows to remove");
			  return;
		}
    }
    
      function baseExportPDFSites(){
        document.forms['cingularSiteBaseSearchForm'].fileFormat.value = "PDF";
        document.forms['cingularSiteBaseSearchForm'].action.value = "exportPDF";
        document.forms['cingularSiteBaseSearchForm'].submit();
        document.forms['cingularSiteBaseSearchForm'].action.value = "/baseSitesearch";
      }

    function baseExportXLSSites(){

		var el = document.forms['cingularSiteBaseSearchForm'].elements;
		var check;
		
		if(el.length>0) {
			for(i=0; i <el.length;i++) {
			  if((el[i].type == "checkbox") && (el[i].checked == true)){
			   check = true;
			   break;
			 }
			 else {
			   check=false;
			 }
		   }
		}

		if(check) {
			document.forms['cingularSiteBaseSearchForm'].fileFormat.value = "XLS";
			document.forms['cingularSiteBaseSearchForm'].action.value = "exportXLS";
			document.forms['cingularSiteBaseSearchForm'].submit();
			document.forms['cingularSiteBaseSearchForm'].action.value = "/baseSitesearch";
		}
		else { 
		      alert("Please select rows to export");
			  return;
		}
    }

    function bulkExportPDFSites(){
        document.forms['cingularSiteBulkSearchForm'].fileFormat.value = "PDF";
        document.forms['cingularSiteBulkSearchForm'].action.value = "exportPDF";
        document.forms['cingularSiteBulkSearchForm'].submit();
        document.forms['cingularSiteBulkSearchForm'].action.value = "/bulkSearch";
    }

    function bulkExportXLSSites(){

		var el = document.forms['cingularSiteBulkSearchForm'].elements;
		var check;
		
		if(el.length>0) {
			for(i=0; i <el.length;i++) {
			  if((el[i].type == "checkbox") && (el[i].checked == true)){
			   check = true;
			   break;
			 }
			 else {
			   check=false;
			 }
		   }
		}

		if(check) {
			document.forms['cingularSiteBulkSearchForm'].fileFormat.value = "XLS";
			document.forms['cingularSiteBulkSearchForm'].action.value = "exportXLS";
			document.forms['cingularSiteBulkSearchForm'].submit();
			document.forms['cingularSiteBulkSearchForm'].action.value = "/bulkSearch";
		}
		else { 
		      alert("Please select rows to export");
			  return;
		}
    }

    function mapExportXLSSites(){

		var el = document.forms['cingularSiteMapSearchForm'].elements;
		var check;
		
		if(el.length>0) {
			for(i=0; i <el.length;i++) {
			  if((el[i].type == "checkbox") && (el[i].checked == true)){
			   check = true;
			   break;
			 }
			 else {
			   check=false;
			 }
		   }
		}

		if(check) {
			document.forms['cingularSiteMapSearchForm'].fileFormat.value = "XLS";
			document.forms['cingularSiteMapSearchForm'].action.value = "exportXLS";
			document.forms['cingularSiteMapSearchForm'].submit();
			document.forms['cingularSiteMapSearchForm'].action.value = "/mapSitesearch";
		}
		else { 
		      alert("Please select rows to export");
			  return;
		}
    }

      function saveSearch(){
        var searchName = document.forms['cingularSiteSearchForm'].searchName.value; 
       	document.forms['cingularSiteSearchForm'].action.value = "savesearch";
       	document.forms['cingularSiteSearchForm'].saveButton.value = "Save";       	
       	document.forms['cingularSiteSearchForm'].submit();
        document.forms['cingularSiteSearchForm'].action.value = "/searchSite";
      }
       
    function saveMySites(){

		var el = document.forms['cingularSiteSearchForm'].elements;
		var check;
		
		if(el.length>0) {
			for(i=0; i <el.length;i++) {
			  if((el[i].type == "checkbox") && (el[i].checked == true)){
			   check = true;
			   break;
			 }
			 else {
			   check=false;
			 }
		   }
		}

		if(check) {
			 document.forms['cingularSiteSearchForm'].action.value = "savesites";
			 document.forms['cingularSiteSearchForm'].Search.value = "search";
			 document.forms['cingularSiteSearchForm'].submit();
			 document.forms['cingularSiteSearchForm'].action.value = "/searchSite";    	
		}
		else { 
		      alert("Please select rows to add");
			  return;
		}
    }
      
    function removeMySites(){

		var el = document.forms['cingularSiteSearchForm'].elements;
		var check;
		
		if(el.length>0) {
			for(i=0; i <el.length;i++) {
			  if((el[i].type == "checkbox") && (el[i].checked == true)){
			   check = true;
			   break;
			 }
			 else {
			   check=false;
			 }
		   }
		}

		if(check) {
			document.forms['cingularSiteSearchForm'].action.value = "removesites";
			document.forms['cingularSiteSearchForm'].Search.value = "search";
			document.forms['cingularSiteSearchForm'].submit();
		}
		else { 
		      alert("Please select rows to remove");
			  return;
		}
    }
 
       function exportPDFSites(){
        document.forms['cingularSiteSearchForm'].fileFormat.value = "PDF";
        document.forms['cingularSiteSearchForm'].action.value = "exportPDF";
        document.forms['cingularSiteSearchForm'].submit();
        document.forms['cingularSiteSearchForm'].action.value = "/searchSite";
      }

	  function populateList() {
	  
	    var el = document.forms['cingularSiteSearchForm'].elements;
		var check;
		
		if(el.length>0) {
			for(i=0; i <el.length;i++) {
			  if((el[i].type == "checkbox") && (el[i].checked == true)){
			   check = true;
			   break;
			 }
			 else {
			   check=false;
			 }
		   }
		}

		if(check) {
			document.forms['cingularSiteSearchForm'].action.value = "popChecked";
			document.forms['cingularSiteSearchForm'].submit();
			document.forms['cingularSiteSearchForm'].action.value = "/searchSite";
		}
		else { 
		       return;
		}

	  }

    function exportXLSSites(){

		var el = document.forms['cingularSiteSearchForm'].elements;
		var check;
		
		if(el.length>0) {
			for(i=0; i <el.length;i++) {
			  if((el[i].type == "checkbox") && (el[i].checked == true)){
			   check = true;
			   break;
			 }
			 else {
			   check=false;
			 }
		   }
		}

		if(check) {
			document.forms['cingularSiteSearchForm'].fileFormat.value = "XLS";
			document.forms['cingularSiteSearchForm'].action.value = "exportXLS";
			document.forms['cingularSiteSearchForm'].submit();
			document.forms['cingularSiteSearchForm'].action.value = "/searchSite";
		}
		else { 
		      alert("Please select rows to export");
			  return;
		}
    }

      function loadCounty() {
	      var stateIndex= document.forms['cingularSiteSearchForm'].state.selectedIndex; 
	      var stateID = document.forms['cingularSiteSearchForm'].state.options[stateIndex].value;
	      document.forms['cingularSiteSearchForm'].stateID.value=stateID
          document.forms['cingularSiteSearchForm'].action.value = "loadCounty";
          document.forms['cingularSiteSearchForm'].submit();
          document.forms['cingularSiteSearchForm'].action.value = "/searchSite";	   
	 }

	function actionFirst(){
	document.forms['cingularSiteSearchForm'].actionNav.value = "first";
	document.forms['cingularSiteSearchForm'].submit();
	document.forms['cingularSiteSearchForm'].action.value = "/searchSite";
   }

   function actionPrevious(){
	document.forms['cingularSiteSearchForm'].actionNav.value = "prev";
	document.forms['cingularSiteSearchForm'].submit();
	document.forms['cingularSiteSearchForm'].action.value = "/searchSite";
   }
       
   function actionNext(){
	document.forms['cingularSiteSearchForm'].actionNav.value = "next";
	document.forms['cingularSiteSearchForm'].submit();
	document.forms['cingularSiteSearchForm'].action.value = "/searchSite";
   }

   function actionLast(){
	document.forms['cingularSiteSearchForm'].actionNav.value = "last";
	document.forms['cingularSiteSearchForm'].submit();
	document.forms['cingularSiteSearchForm'].action.value = "/searchSite";
   }
     
     function baseActionFirst(){
		document.forms['cingularSiteBaseSearchForm'].actionNav.value = "first";
		document.forms['cingularSiteBaseSearchForm'].submit();
		document.forms['cingularSiteBaseSearchForm'].action.value = "/baseSitesearch";
	 }

	 function baseActionPrevious(){
		document.forms['cingularSiteBaseSearchForm'].actionNav.value = "prev";
		document.forms['cingularSiteBaseSearchForm'].submit();
		document.forms['cingularSiteBaseSearchForm'].action.value = "/baseSitesearch";
     }
       
     function baseActionNext(){
		document.forms['cingularSiteBaseSearchForm'].actionNav.value = "next";
		document.forms['cingularSiteBaseSearchForm'].submit();
		document.forms['cingularSiteBaseSearchForm'].action.value = "/baseSitesearch";
     }

      function baseActionLast(){
		document.forms['cingularSiteBaseSearchForm'].actionNav.value = "last";
		document.forms['cingularSiteBaseSearchForm'].submit();
		document.forms['cingularSiteBaseSearchForm'].action.value = "/baseSitesearch";
      }

	  function baseSelectAll() {
        document.forms['cingularSiteBaseSearchForm'].Search.value = "AllBaseSelect";
		document.forms['cingularSiteBaseSearchForm'].selectAll.value="selectAll"
        document.forms['cingularSiteBaseSearchForm'].submit();
        document.forms['cingularSiteBaseSearchForm'].action.value = "/baseSitesearch";
       
       } 

	   function baseUnselectAll() {
        document.forms['cingularSiteBaseSearchForm'].Search.value = "AllBaseUnSelect";
		document.forms['cingularSiteBaseSearchForm'].unSelectAll.value="unSelectAll"
        document.forms['cingularSiteBaseSearchForm'].submit();
        document.forms['cingularSiteBaseSearchForm'].action.value = "/baseSitesearch";
      }

      function baseSaveSearch(){
        var searchName = document.forms['cingularSiteBaseSearchForm'].searchName.value; 
       	document.forms['cingularSiteBaseSearchForm'].action.value = "savesearch";
       	document.forms['cingularSiteBaseSearchForm'].saveButton.value = "Save";       	
       	document.forms['cingularSiteBaseSearchForm'].submit();
       	document.forms['cingularSiteBaseSearchForm'].action.value = "/baseSitesearch";
      }
       
      function baseExportPDFSites(){
        document.forms['cingularSiteBaseSearchForm'].fileFormat.value = "PDF";
        document.forms['cingularSiteBaseSearchForm'].action.value = "exportPDF";
        document.forms['cingularSiteBaseSearchForm'].submit();
        document.forms['cingularSiteBaseSearchForm'].action.value = "/baseSitesearch";
      }

     function bulkActionFirst(){
		document.forms['cingularSiteBulkSearchForm'].actionNav.value = "first";
		document.forms['cingularSiteBulkSearchForm'].submit();
		document.forms['cingularSiteBulkSearchForm'].action.value = "/bulkSearch";
     }

     function bulkActionPrevious(){
		document.forms['cingularSiteBulkSearchForm'].actionNav.value = "prev";
		document.forms['cingularSiteBulkSearchForm'].submit();
		document.forms['cingularSiteBulkSearchForm'].action.value = "/bulkSearch";
     }
       
     function bulkActionNext(){
		document.forms['cingularSiteBulkSearchForm'].actionNav.value = "next";
		document.forms['cingularSiteBulkSearchForm'].submit();
		document.forms['cingularSiteBulkSearchForm'].action.value = "/bulkSearch";
     }

      function bulkActionLast(){
		document.forms['cingularSiteBulkSearchForm'].actionNav.value = "last";
		document.forms['cingularSiteBulkSearchForm'].submit();
		document.forms['cingularSiteBulkSearchForm'].action.value = "/bulkSearch";
      }

     function bulkSelectAll() {
        document.forms['cingularSiteBulkSearchForm'].Search.value = "AllBulkSelect";
	document.forms['cingularSiteBulkSearchForm'].selectAll.value="selectAll"
        document.forms['cingularSiteBulkSearchForm'].submit();
        document.forms['cingularSiteBulkSearchForm'].action.value = "/bulkSearch";
       
      } 

      function bulkUnselectAll() {
        document.forms['cingularSiteBulkSearchForm'].Search.value = "AllBulkUnSelect";
	document.forms['cingularSiteBulkSearchForm'].unSelectAll.value="unSelectAll"
        document.forms['cingularSiteBulkSearchForm'].submit();
        document.forms['cingularSiteBulkSearchForm'].action.value = "/bulkSearch";
      }

      function bulkSaveSearch(){
        var searchName = document.forms['cingularSiteBulkSearchForm'].searchName.value; 
       	document.forms['cingularSiteBulkSearchForm'].action.value = "savesearch";
       	document.forms['cingularSiteBulkSearchForm'].saveButton.value = "Save";       	
       	document.forms['cingularSiteBulkSearchForm'].submit();
       	document.forms['cingularSiteBulkSearchForm'].action.value = "/bulkSearch";
      }
       
      function bulkExportPDFSites(){
        document.forms['cingularSiteBulkSearchForm'].fileFormat.value = "PDF";
        document.forms['cingularSiteBulkSearchForm'].action.value = "exportPDF";
        document.forms['cingularSiteBulkSearchForm'].submit();
        document.forms['cingularSiteBulkSearchForm'].action.value = "/bulkSearch";
      }

      function mapActionFirst(){
		document.forms['cingularSiteMapSearchForm'].actionNav.value = "first";
		document.forms['cingularSiteMapSearchForm'].submit();
		document.forms['cingularSiteMapSearchForm'].action.value = "/mapSitesearch";
      }

     function mapActionPrevious(){
		document.forms['cingularSiteMapSearchForm'].actionNav.value = "prev";
		document.forms['cingularSiteMapSearchForm'].submit();
		document.forms['cingularSiteMapSearchForm'].action.value = "/mapSitesearch";
     }
       
     function mapActionNext(){
		document.forms['cingularSiteMapSearchForm'].actionNav.value = "next";
		document.forms['cingularSiteMapSearchForm'].submit();
		document.forms['cingularSiteMapSearchForm'].action.value = "/mapSitesearch";
     }

      function mapActionLast(){
		document.forms['cingularSiteMapSearchForm'].actionNav.value = "last";
		document.forms['cingularSiteMapSearchForm'].submit();
		document.forms['cingularSiteMapSearchForm'].action.value = "/mapSitesearch";
      }

      function mapSelectAll() {
        document.forms['cingularSiteMapSearchForm'].Search.value = "AllMapSelect";
	document.forms['cingularSiteMapSearchForm'].selectAll.value="selectAll"
        document.forms['cingularSiteMapSearchForm'].submit();
        document.forms['cingularSiteMapSearchForm'].action.value = "/mapSitesearch";
       
       } 

	   function mapUnselectAll() {
        document.forms['cingularSiteMapSearchForm'].Search.value = "AllMapUnSelect";
		document.forms['cingularSiteMapSearchForm'].unSelectAll.value="unSelectAll"
        document.forms['cingularSiteMapSearchForm'].submit();
        document.forms['cingularSiteMapSearchForm'].action.value = "/mapSitesearch";
      }

      function mapSaveSearch(){
        var searchName = document.forms['cingularSiteMapSearchForm'].searchName.value; 
       	document.forms['cingularSiteMapSearchForm'].action.value = "savesearch";
       	document.forms['cingularSiteMapSearchForm'].saveButton.value = "Save";       	
       	document.forms['cingularSiteMapSearchForm'].submit();
       	document.forms['cingularSiteMapSearchForm'].action.value = "/mapSitesearch";
      }
       
      function mapExportPDFSites(){
        document.forms['cingularSiteMapSearchForm'].fileFormat.value = "PDF";
        document.forms['cingularSiteMapSearchForm'].action.value = "exportPDF";
        document.forms['cingularSiteMapSearchForm'].submit();
        document.forms['cingularSiteMapSearchForm'].action.value = "/mapSitesearch";
      }

      function baseLoadCounty() {
	      var stateIndex = document.forms['cingularSiteBaseSearchForm'].state.selectedIndex; 
	     // document.forms['cingularSiteBaseSearchForm'].stateSelect.value=stateID
	      var stateID = document.forms['cingularSiteBaseSearchForm'].state.options[stateIndex].value;
	      document.forms['cingularSiteBaseSearchForm'].stateID.value=stateID
          document.forms['cingularSiteBaseSearchForm'].action.value = "loadCounty";
          document.forms['cingularSiteBaseSearchForm'].submit();
          document.forms['cingularSiteBaseSearchForm'].action.value = "/baseSitesearch";	   
	 }

      function mapLoadCounty() {
	      var stateIndex = document.forms['cingularSiteMapSearchForm'].state.selectedIndex; 
	     // document.forms['cingularSiteMapSearchForm'].stateSelect.value=stateID
	      var stateID = document.forms['cingularSiteMapSearchForm'].state.options[stateIndex].value;
	      document.forms['cingularSiteMapSearchForm'].stateID.value=stateID
          document.forms['cingularSiteMapSearchForm'].action.value = "loadCounty";
          document.forms['cingularSiteMapSearchForm'].submit();
          document.forms['cingularSiteMapSearchForm'].action.value = "/mapSitesearch";	   
      }

      function welcomeLoadCounty() {
	      var stateIndex = document.forms['cingularSiteBaseSearchForm'].state.selectedIndex; 
	      //document.forms['cingularSiteBaseSearchForm'].stateSelect.value=stateID
	      var stateID = document.forms['cingularSiteBaseSearchForm'].state.options[stateIndex].value;
	      document.forms['cingularSiteBaseSearchForm'].stateID.value=stateID;
          document.forms['cingularSiteBaseSearchForm'].action.value = "welcomeLoadCounty";
          document.forms['cingularSiteBaseSearchForm'].submit();
          document.forms['cingularSiteBaseSearchForm'].action.value = "/baseSitesearch";	      
      }
	 
      function saveOnlineApp(){
		document.forms['onlineAppForm'].actionNav.value = "SaveApp";
		document.forms['onlineAppForm'].submit();
		document.forms['onlineAppForm'].action.value = "/onlineApp";
	 }

	 function submitOnlineApp(){
		document.forms['onlineAppForm'].actionNav.value = "SubmitApp";
		document.forms['onlineAppForm'].submit();
		document.forms['onlineAppForm'].action.value = "/onlineApp";
     }
      
	 function printo() {
			var OLECMDID_PRINT = 6;
			var OLECMDEXECOPT_DONTPROMPTUSER = 2;
			var OLECMDEXECOPT_PROMPTUSER = 1;
			var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
			document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
			oldHandler = window.onerror;
			window.onerror = deal;
			WebBrowser1.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_PROMPTUSER);
			WebBrowser1.outerHTML = "";
			window.onerror = oldHandler;
      }
	
	 	function printit(){  
		  if (window.print) {
		      document.getElementById("printForm").style.display='none';
		      window.print();
		      document.getElementById("printForm").style.display='block';
		  } else {
		      var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
		  	  document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
		      WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
		  }
		 }
		
	function sortSiteID(){
		document.forms['cingularSiteSearchForm'].actionNav.value = "first";
		document.forms['cingularSiteSearchForm'].sort.value = "CS.siteID";
		document.forms['cingularSiteSearchForm'].sortParam.value = "siteID";
		document.forms['cingularSiteSearchForm'].sortAction.value = "sortAction";
		document.forms['cingularSiteSearchForm'].submit();
		document.forms['cingularSiteSearchForm'].action.value = "/searchSite";
    }
	function sortSiteName(){
		document.forms['cingularSiteSearchForm'].actionNav.value = "first";
		document.forms['cingularSiteSearchForm'].sort.value = "CS.siteName";
		document.forms['cingularSiteSearchForm'].sortAction.value = "sortAction";
		document.forms['cingularSiteSearchForm'].sortParam.value = "siteName";
		document.forms['cingularSiteSearchForm'].submit();
		document.forms['cingularSiteSearchForm'].action.value = "/searchSite";
    }
	function sortAddress(){
		document.forms['cingularSiteSearchForm'].actionNav.value = "first";
		document.forms['cingularSiteSearchForm'].sort.value = "CS.addressLine1";
		document.forms['cingularSiteSearchForm'].sortParam.value = "addressLine1";
		document.forms['cingularSiteSearchForm'].sortAction.value = "sortAction";
		document.forms['cingularSiteSearchForm'].submit();
		document.forms['cingularSiteSearchForm'].action.value = "/searchSite";
    }
	function sortCity(){
		document.forms['cingularSiteSearchForm'].actionNav.value = "first";
		document.forms['cingularSiteSearchForm'].sort.value = "CS.city";
		document.forms['cingularSiteSearchForm'].sortParam.value = "city";
		document.forms['cingularSiteSearchForm'].sortAction.value = "sortAction";
		document.forms['cingularSiteSearchForm'].submit();
		document.forms['cingularSiteSearchForm'].action.value = "/searchSite";
    }
	function sortState(){
		document.forms['cingularSiteSearchForm'].actionNav.value = "first";
		document.forms['cingularSiteSearchForm'].sort.value = "CS.state";
		document.forms['cingularSiteSearchForm'].sortParam.value = "state";
		document.forms['cingularSiteSearchForm'].sortAction.value = "sortAction";
		document.forms['cingularSiteSearchForm'].submit();
		document.forms['cingularSiteSearchForm'].action.value = "/searchSite";
    }
	function sortTower(){
		document.forms['cingularSiteSearchForm'].actionNav.value = "first";
		document.forms['cingularSiteSearchForm'].sortParam.value = "towerHeight";
		document.forms['cingularSiteSearchForm'].sort.value = "CS.towerHeight";
		document.forms['cingularSiteSearchForm'].submit();
		document.forms['cingularSiteSearchForm'].action.value = "/searchSite";
    }

	function baseSortSiteID(){
		document.forms['cingularSiteBaseSearchForm'].actionNav.value = "first";
		document.forms['cingularSiteBaseSearchForm'].sort.value = "CS.siteID";
		document.forms['cingularSiteBaseSearchForm'].sortParam.value = "siteID";
		document.forms['cingularSiteBaseSearchForm'].submit();
		document.forms['cingularSiteBaseSearchForm'].action.value = "/baseSitesearch";
    }
	function baseSortSiteName(){
		document.forms['cingularSiteBaseSearchForm'].actionNav.value = "first";
		document.forms['cingularSiteBaseSearchForm'].sort.value = "CS.siteName";
		document.forms['cingularSiteBaseSearchForm'].sortAction.value = "sortAction";
		document.forms['cingularSiteBaseSearchForm'].sortParam.value = "siteName";
		document.forms['cingularSiteBaseSearchForm'].submit();
		document.forms['cingularSiteBaseSearchForm'].action.value = "/baseSitesearch";
    }
	function baseSortAddress(){
		document.forms['cingularSiteBaseSearchForm'].actionNav.value = "first";
		document.forms['cingularSiteBaseSearchForm'].sort.value = "CS.addressLine1";
		document.forms['cingularSiteBaseSearchForm'].sortParam.value = "addressLine1";
		document.forms['cingularSiteBaseSearchForm'].submit();
		document.forms['cingularSiteBaseSearchForm'].action.value = "/baseSitesearch";
    }
	function baseSortCity(){
		document.forms['cingularSiteBaseSearchForm'].actionNav.value = "first";
		document.forms['cingularSiteBaseSearchForm'].sortParam.value = "city";
		document.forms['cingularSiteBaseSearchForm'].sort.value = "CS.city";
		document.forms['cingularSiteBaseSearchForm'].submit();
		document.forms['cingularSiteBaseSearchForm'].action.value = "/baseSitesearch";
    }
	function baseSortState(){
		document.forms['cingularSiteBaseSearchForm'].actionNav.value = "first";
		document.forms['cingularSiteBaseSearchForm'].sort.value = "CS.state";
		document.forms['cingularSiteBaseSearchForm'].sortParam.value = "state";
		document.forms['cingularSiteBaseSearchForm'].submit();
		document.forms['cingularSiteBaseSearchForm'].action.value = "/baseSitesearch";
    }
	function baseSortTower(){
		document.forms['cingularSiteBaseSearchForm'].actionNav.value = "first";
		document.forms['cingularSiteBaseSearchForm'].sortParam.value = "towerHeight";
		document.forms['cingularSiteBaseSearchForm'].sort.value = "CS.towerHeight";
		document.forms['cingularSiteBaseSearchForm'].submit();
		document.forms['cingularSiteBaseSearchForm'].action.value = "/baseSitesearch";
    }
	
	function bulkSortSiteID(){
		document.forms['cingularSiteBulkSearchForm'].actionNav.value = "first";
		document.forms['cingularSiteBulkSearchForm'].sort.value = "CS.siteID";
		document.forms['cingularSiteBulkSearchForm'].sortParam.value = "siteID";
		document.forms['cingularSiteBulkSearchForm'].submit();
		document.forms['cingularSiteBulkSearchForm'].action.value = "/bulkSearch";
    }
	function bulkSortSiteName(){
		document.forms['cingularSiteBulkSearchForm'].actionNav.value = "first";
		document.forms['cingularSiteBulkSearchForm'].sort.value = "CS.siteName";
		document.forms['cingularSiteBulkSearchForm'].sortAction.value = "sortAction";
		document.forms['cingularSiteBulkSearchForm'].sortParam.value = "siteName";
		document.forms['cingularSiteBulkSearchForm'].submit();
		document.forms['cingularSiteBulkSearchForm'].action.value = "/bulkSearch";
    }
	function bulkSortAddress(){
		document.forms['cingularSiteBulkSearchForm'].actionNav.value = "first";
		document.forms['cingularSiteBulkSearchForm'].sort.value = "CS.addressLine1";
		document.forms['cingularSiteBulkSearchForm'].sortParam.value = "addressLine1";
		document.forms['cingularSiteBulkSearchForm'].submit();
		document.forms['cingularSiteBulkSearchForm'].action.value = "/bulkSearch";
    }
	function bulkSortCity(){
		document.forms['cingularSiteBulkSearchForm'].actionNav.value = "first";
		document.forms['cingularSiteBulkSearchForm'].sortParam.value = "city";
		document.forms['cingularSiteBulkSearchForm'].sort.value = "CS.city";
		document.forms['cingularSiteBulkSearchForm'].submit();
		document.forms['cingularSiteBulkSearchForm'].action.value = "/bulkSearch";
    }
	function bulkSortState(){
		document.forms['cingularSiteBulkSearchForm'].actionNav.value = "first";
		document.forms['cingularSiteBulkSearchForm'].sort.value = "CS.state";
		document.forms['cingularSiteBulkSearchForm'].sortParam.value = "state";
		document.forms['cingularSiteBulkSearchForm'].submit();
		document.forms['cingularSiteBulkSearchForm'].action.value = "/bulkSearch";
    }
	function bulkSortTower(){
		document.forms['cingularSiteBulkSearchForm'].actionNav.value = "first";
		document.forms['cingularSiteBulkSearchForm'].sortParam.value = "towerHeight";
		document.forms['cingularSiteBulkSearchForm'].sort.value = "CS.towerHeight";
		document.forms['cingularSiteBulkSearchForm'].submit();
		document.forms['cingularSiteBulkSearchForm'].action.value = "/bulkSearch";
    }
	
	function mapSortSiteID(){
		document.forms['cingularSiteMapSearchForm'].actionNav.value = "first";
		document.forms['cingularSiteMapSearchForm'].sort.value = "CS.siteID";
		document.forms['cingularSiteMapSearchForm'].sortParam.value = "siteID";
		document.forms['cingularSiteMapSearchForm'].submit();
		document.forms['cingularSiteMapSearchForm'].action.value = "/mapSitesearch";
    }
	function mapSortSiteName(){
		document.forms['cingularSiteMapSearchForm'].actionNav.value = "first";
		document.forms['cingularSiteMapSearchForm'].sort.value = "CS.siteName";
		document.forms['cingularSiteMapSearchForm'].sortAction.value = "sortAction";
		document.forms['cingularSiteMapSearchForm'].sortParam.value = "siteName";
		document.forms['cingularSiteMapSearchForm'].submit();
		document.forms['cingularSiteMapSearchForm'].action.value = "/mapSitesearch";
    }
	function mapSortAddress(){
		document.forms['cingularSiteMapSearchForm'].actionNav.value = "first";
		document.forms['cingularSiteMapSearchForm'].sort.value = "CS.addressLine1";
		document.forms['cingularSiteMapSearchForm'].sortParam.value = "addressLine1";
		document.forms['cingularSiteMapSearchForm'].submit();
		document.forms['cingularSiteMapSearchForm'].action.value = "/mapSitesearch";
    }
	function mapSortCity(){
		document.forms['cingularSiteMapSearchForm'].actionNav.value = "first";
		document.forms['cingularSiteMapSearchForm'].sortParam.value = "city";
		document.forms['cingularSiteMapSearchForm'].sort.value = "CS.city";
		document.forms['cingularSiteMapSearchForm'].submit();
		document.forms['cingularSiteMapSearchForm'].action.value = "/mapSitesearch";
    }
	function mapSortState(){
		document.forms['cingularSiteMapSearchForm'].actionNav.value = "first";
		document.forms['cingularSiteMapSearchForm'].sort.value = "CS.state";
		document.forms['cingularSiteMapSearchForm'].sortParam.value = "state";
		document.forms['cingularSiteMapSearchForm'].submit();
		document.forms['cingularSiteMapSearchForm'].action.value = "/mapSitesearch";
    }
	function mapSortTower(){
		document.forms['cingularSiteMapSearchForm'].actionNav.value = "first";
		document.forms['cingularSiteMapSearchForm'].sortParam.value = "towerHeight";
		document.forms['cingularSiteMapSearchForm'].sort.value = "CS.towerHeight";
		document.forms['cingularSiteMapSearchForm'].submit();
		document.forms['cingularSiteMapSearchForm'].action.value = "/mapSitesearch";
    }
	
		function deal() {
			WebBrowser1.outerHTML = "";
			window.onerror = oldHandler;
			return true;
		}
		
      function  subSearch(){
        var stateIndex = document.forms['cingularSiteSearchForm'].state.selectedIndex; 
        var stateID= document.forms['cingularSiteSearchForm'].state.options[stateIndex].value; 
		document.forms['cingularSiteSearchForm'].stateID.value=stateID;
        document.forms['cingularSiteSearchForm'].Search.value = "newSearch";
        document.forms['cingularSiteSearchForm'].submit();
        document.forms['cingularSiteSearchForm'].action.value = "/searchSite";
      }

      function  mapSubSearch(searchType) {
        var foo = document.getElementById("loadImg"); 
        document.forms['cingularSiteMapSearchForm'].preserveResults.checked = false;
        document.forms['cingularSiteMapSearchForm'].Search.value = searchType;
        document.forms['cingularSiteMapSearchForm'].submit();
        document.forms['cingularSiteMapSearchForm'].action.value = "/mapSearch";
        if ((searchType != null) && (searchType != "clear")) {
		  foo.style.display="";	   
		}
      }

      function selectAll() {
        document.forms['cingularSiteSearchForm'].Search.value = "AllAdvSelect";
		document.forms['cingularSiteSearchForm'].selectAll.value="selectAll"
        document.forms['cingularSiteSearchForm'].submit();
        document.forms['cingularSiteSearchForm'].action.value = "/searchSite";
       
       } 

	   function unselectAll() {
        document.forms['cingularSiteSearchForm'].Search.value = "AllAdvUnSelect";
		document.forms['cingularSiteSearchForm'].unSelectAll.value="unSelectAll"
        document.forms['cingularSiteSearchForm'].submit();
        document.forms['cingularSiteSearchForm'].action.value = "/searchSite";
      }
      
      function  baseSubSearch(){
        var stateIndex = document.forms['cingularSiteBaseSearchForm'].state.selectedIndex; 
        var stateID= document.forms['cingularSiteBaseSearchForm'].state.options[stateIndex].value; 
        document.forms['cingularSiteBaseSearchForm'].Search.value = "newSearch";
		document.forms['cingularSiteBaseSearchForm'].stateID.value=stateID
        document.forms['cingularSiteBaseSearchForm'].submit();
        document.forms['cingularSiteBaseSearchForm'].action.value = "/baseSitesearch";
      }
 
	 function baseCheckForm(){

		   var city = document.forms['cingularSiteBaseSearchForm'].city.value;
		   var zipOrPostcode = document.forms['cingularSiteBaseSearchForm'].zipOrPostcode.value;
		   var latitude = document.forms['cingularSiteBaseSearchForm'].latitude.value;
		   var longitude = document.forms['cingularSiteBaseSearchForm'].longitude.value;
		   var miles = document.forms['cingularSiteBaseSearchForm'].miles.value;
		    var stateIndex = document.forms['cingularSiteBaseSearchForm'].state.selectedIndex;
		    var state = document.forms['cingularSiteBaseSearchForm'].state.options[stateIndex].value;

		   if(!city.length>0 && !zipOrPostcode.length>0 && state==0 && miles==0){
				
				          alert("Please enter your search criteria before searching");
						  return false;
				}
		   	
				if(city.length>0) {
					if (city.match(/^[a-z\sA-Z%]+$/)) {
							return true; 
					}
					else {
						  alert("Please enter a valid city");
						  return false;
					}
			   }

			   if(zipOrPostcode.length>0) {
				   if (zipOrPostcode.match(/^[0-9\-]+$/)){
					    return true;
				   }
				   else {
						alert("Please enter a valid zip code");
						return false;
				   }
			   }

			    if(latitude.length>0) {
				   if (latitude.match(/^[0-9.\s]+$/)){
					    return true;
				   }
				   else {
						alert("Please enter a valid latitude");
						return false;
				   }
			   }

			    if(longitude.length>0) {
				   if (longitude.match(/^[0-9.\s]+$/)){
					    return true;
				   }
				   else {
						alert("Please enter a valid longitude");
						return false;
				   }
			   }

			    if(miles.length>0) {
				   if (miles.match(/^[0-9.]+$/)){
					    return true;
				   }
				   else {
						alert("Please enter valid miles");
						return false;
				   }
			   }	    			   
		}


      function  bulkSubSearch(){
        document.forms['cingularSiteBulkSearchForm'].Search.value = "newSearch";
        document.forms['cingularSiteBulkSearchForm'].submit();
        document.forms['cingularSiteBulkSearchForm'].action.value = "/bulkSearch";
      }
 
      function bulkCheckForm(){

		   var miles = document.forms['cingularSiteBulkSearchForm'].miles.value;
		   var bulkList = document.forms['cingularSiteBulkSearchForm'].bulkLatLong.value;

		   if(miles==0){
				
				          alert("Please enter your search radius before searching");
						  return false;
				}
		   	

		   if(bulkList.length == 0) {
					 	alert("Please enter a valid list of latitude-longitude pairs.");
						return false; 
					}
					else {
						  return true;
					}
		}

	 function checkSearchForm(){

		   var city = document.forms['cingularSiteSearchForm'].city.value;
		   var siteName = document.forms['cingularSiteSearchForm'].siteName.value;
		   var siteID = document.forms['cingularSiteSearchForm'].siteID.value;
		   var fccID = document.forms['cingularSiteSearchForm'].fccID.value;
		   var addressLine1 = document.forms['cingularSiteSearchForm'].addressLine1.value;
		   var zipOrPostcode = document.forms['cingularSiteSearchForm'].zipOrPostcode.value;
		   var latitude = document.forms['cingularSiteSearchForm'].latitude.value;
		   var longitude = document.forms['cingularSiteSearchForm'].longitude.value;
		   var stateIndex = document.forms['cingularSiteSearchForm'].state.selectedIndex;
		   var state = document.forms['cingularSiteSearchForm'].state.options[stateIndex].value;
		   var miles = document.forms['cingularSiteSearchForm'].miles.value;
		   var towerIndex = document.forms['cingularSiteSearchForm'].towerTypeName.selectedIndex;
		   var towerType = document.forms['cingularSiteSearchForm'].towerTypeName.options[towerIndex].value;
		   	
				if(!city.length>0 && !zipOrPostcode.length>0 && state==0 && miles==0 && !siteName.length>0 && !siteID.length>0 && !fccID.length>0 && !addressLine1.length>0 && !towerType.length>0){
				
				          alert("Please enter your search criteria before searching");
						  return false;
				}
				
				if(city.length>0) {
					if (city.match(/^[a-z\sA-Z\%]+$/)) {
							return true; 
					}
					else {
						  alert("Please enter a valid city");
						  return false;
					}
			   }

			   if(zipOrPostcode.length>0) {
				   if (zipOrPostcode.match(/^[0-9\-]+$/)){
					    return true;
				   }
				   else {
						alert("Please enter a valid zip code");
						return false;
				   }
			   }

			    if(latitude.length>0) {
				   if (latitude.match(/^[0-9.\s]+$/)){
					    return true;
				   }
				   else {
						alert("Please enter a valid latitude");
						return false;
				   }
			   }

			    if(longitude.length>0) {
				   if (longitude.match(/^[0-9.\s]+$/)){
					    return true;
				   }
				   else {
						alert("Please enter a valid longitude");
						return false;
				   }
			   }

			    if(miles.length>0) {
				   if (miles.match(/^[0-9.]+$/)){
					    return true;
				   }
				   else {
						alert("Please enter valid miles");
						return false;
				   }
			   }
		}

	 function checkMapSearchForm(){

		   var siteName = document.forms['cingularSiteMapSearchForm'].siteName.value;
		   var siteID = document.forms['cingularSiteMapSearchForm'].siteID.value;
		   var addressLine1 = document.forms['cingularSiteMapSearchForm'].addressLine1.value;
		   var city = document.forms['cingularSiteMapSearchForm'].city.value;
		   var stateIndex = document.forms['cingularSiteMapSearchForm'].state.selectedIndex;
		   var state = document.forms['cingularSiteMapSearchForm'].state.options[stateIndex].value;
		   var zipOrPostcode = document.forms['cingularSiteMapSearchForm'].zipOrPostcode.value;
		   var latitude = document.forms['cingularSiteMapSearchForm'].latitude.value;
		   var longitude = document.forms['cingularSiteMapSearchForm'].longitude.value;
		   var miles = document.forms['cingularSiteMapSearchForm'].miles.value;
		   	
				if(miles==0 && !city.length>0 && !stateIndex > 0 && !zipOrPostcode.length>0 || addressLine1.length>0 && miles==0 || !siteName.length>0 && !siteID.length>0 && !addressLine1.length>0 && !city.length>0 && !stateIndex > 0 && !zipOrPostcode.length>0 && !latitude.length>0 && !longitude.length>0){
				
				          alert("Please enter your search criteria before searching");
						  return false;
				}
				
			    if(latitude.length>0) {
				   if (latitude.match(/^[0-9.\s]+$/)){
					    return true;
				   }
				   else {
						alert("Please enter a valid latitude");
						return false;
				   }
			   }

			    if(longitude.length>0) {
				   if (longitude.match(/^[0-9.\s]+$/)){
					    return true;
				   }
				   else {
						alert("Please enter a valid longitude");
						return false;
				   }
			   }

			    if(miles.length>0) {
				   if (miles.match(/^[0-9.]+$/)){
					    return true;
				   }
				   else {
						alert("Please enter valid radius");
						return false;
				   }
			   }

			    			   
		}
