/**************************************************
CityofMesa.org/CommonOutside/com.js - 12-21-2006
***************************************************/
/* header */
function headerDoSearch(){
	var box = document.getElementById("headerSearchTextBox");
	window.location="/Search/Default.aspx?search="+box.value;
}
function headerDoSearchFromTextbox(){
    if (window.event){
        if (window.event.keyCode ==13){
          event.returnValue=false;
            event.cancel=true;
            var box = document.getElementById("headerSearchTextBox");
    	    window.location="/Search/Default.aspx?search="+box.value;
        }
    }
}
function headerDoSearch2(site){
	var box = document.getElementById("headerSearchTextBox");
	window.location = site+"/Search/Default.aspx?search="+box.value;
}
function headerDoSearchFromTextbox2(site){
    if (window.event){
        if (window.event.keyCode ==13){
          event.returnValue=false;
            event.cancel=true;
            var box = document.getElementById("headerSearchTextBox");
    	    window.location = site+"/Search/Default.aspx?search="+box.value;
        }
    }
}
function turnOn(imageId,site) {
	if (document.images) {
		var number = parseInt(imageId.substring(3));
		var but = document.getElementById(imageId);
		but.src = '/CommonOutside/'+site+'/images/nav'+number+'_on.gif';
	}
}
function turnOff(imageId,site) {
	if (document.images) {
		var number = parseInt(imageId.substring(3));
		var but = document.getElementById(imageId);
		but.src = '/CommonOutside/'+site+'/images/nav'+number+'_off.gif';
	}
}
function preloadImages(count,site) {
	if (document.images) {
		count=count+1;
		var imageName=new Array();
		var imageOn = new Array(count);
		var imageOff= new Array(count);
		imageName[0] = "";
		
		for (i=1; i<count; i++){
			imageName[i] = "nav"+i;
			imageOn[i] = new Image();
			imageOff[i]= new Image();
			imageOn[i].src = '/CommonOutside/'+site+'/images/'+imageName[i] + '_on.gif';
			imageOff[i].src = '/CommonOutside/'+site+'/images/'+imageName[i] + '_off.gif';
		}
	}
}

/* general use */
function closeWindow() {
	window.open('','_parent','');
	window.close();
}
function listGoTo(source){
	var list = document.getElementById(source);
	var url = list.options[list.selectedIndex].value;
	if (url!=''){
	
		// maybe open in new window
		var newWindow = false;
		var endIndex ;
		endIndex = url.toLowerCase().indexOf(" target=")
		if (endIndex > -1){
			newWindow = true; 
			url = url.substring(0,endIndex);
		}
		
		if (newWindow){
			var win = window.open(url,"","");
			win.focus();
		}else{
			window.location=url;
		}
	}
 }
function popupNoBorder(url,width,height) {
	var props = "fullscreen=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width="+width+",height="+height+",top=20,left=20";
	Win = window.open( url,"", props);
	Win.focus();
}
function setFocus(id) {
	document.getElementById(id).focus();
}

/********* LEGACY - leave in for early headers still out there *****/
function doSearch(){
	var box = document.getElementById("headerSearchTextBox");
	window.location="/Search/Default.aspx?search="+box.value;
}
