var newWindow;
function openNewWindow(newUrl,width,height) { 
    if (!width) {
      width = 600;
    }
    
    if (!height) {
      height = 800;
    }
	if(!newWindow || newWindow.closed){
		newWindow = window.open(newUrl,"newWindow","status,height="+height+",width="+width+",screenX=400,resizable,scrollbars");
		if(!newWindow.opener){
			newWindow.opener = window;
		}
	}else{
		newWindow.focus();
		newWindow.location.href=newUrl;
	}
}

function openTagWindow(newUrl) { 
	if(!newWindow || newWindow.closed){
		newWindow = window.open(newUrl,"tagWindow","status,height=100,width=300,screenX=100,resizable,scrollbars");
		if(!newWindow.opener){
			newWindow.opener = window;
		}
	}else{
		newWindow.focus();
		newWindow.location.href=newUrl;
	}
}

function doSearch(searchUrl){
	var selectObj = document.getElementById('searchBy');
	var selectedValue = selectObj.options[selectObj.selectedIndex].value;
	var searchTextObj = document.getElementById('searchText');
	var searchTextValue = searchTextObj.value;
	var googleSearchUrl = 'http://hawaii.google.cdc.nicusa.com/search?q=' + escape(searchTextValue) + '&site=hi_main&proxystylesheet=hawaii&client=hawaii&output=xml_no_dtd&x=&y=';
	var tagSearchUrl = window.location.protocol + '//' + window.location.host + searchUrl + searchTextValue;
	if(selectedValue == 'all'){
		document.location.href=googleSearchUrl;
	}else if(selectedValue == 'tag'){
		document.location.href=tagSearchUrl;
	}else{
		document.location.href='http://www.ehawaii.gov';
	}
}

function popUpLiveHelp(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=400,height=400,left = 312,top = 184');");
}