//Function to change page from option list
function linkURL(URL) {
	
	if (URL.options[URL.selectedIndex].value != "") self.location.href = URL.options[URL.selectedIndex].value;	
	return true;
}

//Function to open pop up window
function winOpener(theURL, winName, scrollbars, resizable, width, height) {
	
	winFeatures = 'left=' + (screen.availWidth-10-width)/2 + ',top=' + (screen.availHeight-30-height)/2 + ',scrollbars=' + scrollbars + ',resizable=' + resizable + ',width=' + width + ',height=' + height + ',toolbar=0,location=0,status=1,menubar=0'
  	window.open(theURL, winName, winFeatures);
}

	function handleCatClick(){
		var obj=document.getElementById("catForm")
		var selectedStr=""
		for (var i=0;i<obj.Category.length;i++){
			if (obj.Category[i].checked){
				selectedStr+=obj.Category[i].value + ","
			}
		}
		if(document.getElementById("Welcome")){
			rs_call('loadPage',selectedStr + '-1')
		}else{
			rs_call('resetCategories',selectedStr)
			document.location.reload()
		}
	}
	
	function loadPage(){
		handleCatClick()
	}
	
	function updateDiv(divid,value){
		var obj=document.getElementById(divid)
		if(obj){
			obj.innerHTML=value
		}
	}
	
	function toggle(catID){
		obj=document.getElementById("catForm").elements('Category')
		for(var i=0;i<obj.length;i++){
			if(obj[i].id=='Category' && obj[i].value==catID){
				obj[i].checked=!obj[i].checked
				handleCatClick()
			}
		}
	}