var cancel_click=0

function progress_bar_ob_start(primaryOrSecondary,txt){
	if(typeof progress_bar_ob!="undefined" && !!progress_bar_ob){
		progress_bar_ob.start(primaryOrSecondary,txt)	
	}
}
function  menu_change(thisone){
	//page_num MUST BE SET BACK TO ONE IF THIS CHANGES
	clear_only_status()
	document.forms["search_form"].page_num.value=1
	
	if(thisone.name=="source_org_ID"){
		//IF SOURCE ORG CHANGES, RESET FREQUENCY
		document.forms["search_form"].current_action.value="source"
		if(document.forms["search_form"].frequency_ID.options.length>0){
			document.forms["search_form"].frequency_ID.options[0].selected=1
		}
	}else{
		document.forms["search_form"].current_action.value="frequency"
	}
	
	progress_bar_ob_start("primary","Searching...")
	
	document.forms["search_form"].do_search.value=0
	remember_and_submit_form(1)
}

function clear_freetext(){
	//CLEAR TEXT SEARCH BOX
	document.forms["search_form"].freetext.value=""

	progress_bar_ob_start("primary","Searching...")
	
	document.forms["search_form"].do_search.value=0
	remember_and_submit_form(1)
}
function freetext_change(thischar){
	//CALLED AS USER TYPES INTO SEARCH BOX 
	txt=document.forms["search_form"].freetext.value
	document.forms["search_form"].current_action.value="freetext"
	if(txt!=""){
		ob=document.getElementById("submit_button")
		if(ob.className.indexOf(" disabled")!=-1){
			ob.className=ob.className.split(" disabled")[0]	
		}
		//ob.style.backgroundColor=""
	}
	return true
}
function check_freetext(evt){
	
	if(evt.keyCode){
		md="ie"
		cd=evt.keyCode
	}else{
		md="moz"
		cd=evt.charCode
	}

	if(cd==13){
		if(md=="moz"){
			evt.preventDefault()
		}
		
		search_for_results()

		return true
	}else{
		

		return freetext_change(String.fromCharCode(cd))
	}
	
	
}
function search_criteria_change(thisaction){
	//page_num MUST BE SET BACK TO ONE IF THIS CHANGES
	clear_only_status()
	document.forms["search_form"].page_num.value=1
	document.forms["search_form"].current_action.value=thisaction

	progress_bar_ob_start("primary","Searching...")
	
	document.forms["search_form"].do_search.value=0
	remember_and_submit_form(1)
}

function town_select(twnid){
	if(typeof document.forms["search_form"].town!="undefined" && !!document.forms["search_form"].town){
		for(i=0;i<document.forms["search_form"].town.length;i++){
			if(	document.forms["search_form"].town[i].value==twnid){
				document.forms["search_form"].town[i].checked=1
			}else{
				document.forms["search_form"].town[i].checked=0
			}
		}
		filter_results()
	}
}

function filter_results(thisone){

	progress_bar_ob_start("primary","Filtering...")
	if(thisone.name=="town"){
		
		if(typeof document.forms["search_form"].pct!="undefined" && !!document.forms["search_form"].pct){
			if(typeof document.forms["search_form"].pct.length=="undefined"){
				document.forms["search_form"].pct.checked=0
			}else{
				for(var i=0;i<document.forms["search_form"].pct.length;i++){
					document.forms["search_form"].pct[i].checked=0
				}	
			}
		}
	}
	if(thisone.name=="pct"){
		if(typeof document.forms["search_form"].town!="undefined" && !!document.forms["search_form"].town){
			if(typeof document.forms["search_form"].town.length=="undefined"){
				document.forms["search_form"].town.checked=0
			}else{
				for(var i=0;i<document.forms["search_form"].town.length;i++){
					document.forms["search_form"].town[i].checked=0
				}
			}
		}
	}
	document.forms["search_form"].current_action.value="filter"
	document.forms["search_form"].do_search.value=1
	remember_and_submit_form(1)
}
function sort_click(thiscol,sortmenu){
	//page_num MUST BE SET BACK TO ONE IF THIS CHANGES
	if(thiscol==""){
		dropindex=sortmenu.selectedIndex
		thiscol=sortmenu.options[dropindex].value
		
	}
	if(thiscol.indexOf("igpoints")!=-1 && summarydisplay=="address"){
		alert("Cannot sort by points when address is displayed")
		sortmenu.options[0].selected=1
	}else{
		if(thiscol.indexOf("igpoints")!=-1){
			alert("The Information Centre does not recommend or endorse the use of QOF data for league tables as the number of QOF points only reflects part of the work that a general practice is responsible for.\n\nQOF points do not reflect practice workload issues such as the size of the population that a practice covers or the number of patients with long term conditions such as diabetes and asthma - that is why practices' QOF payments include adjustments for such factors.\n\nQOF achievement does not take account of the underlying social and demographic characteristics of the populations concerned. The delivery of services will be related, for example, to population age/sex, ethnicity or deprivation characteristics that are not included in QOF data collection processes. See the FAQs page for further details. ")
		}
		document.forms["search_form"].page_num.value=1
		
		progress_bar_ob_start("secondary","Sorting...")
		
		currentsort=document.forms["search_form"].sortby.value
		currentdir=document.forms["search_form"].sortdir.value
		if(currentsort==thiscol){
			if(currentdir=="asc"){
				currentdir="desc"
			}else{
				currentdir="asc"
			}
			document.forms["search_form"].sortdir.value=currentdir
		}else{
			document.forms["search_form"].sortby.value=thiscol
		}
		document.forms["search_form"].current_action.value="sort"
		document.forms["search_form"].do_search.value=1
		remember_and_submit_form(1)
	}
}

function row_rollon(thisid){
	//SUMMARY ROW IS ROLLED OVER
	obnum=1
	foundone=1
	safety=0
	while(foundone==1 && safety<10){
		safety++
		ob=document.getElementById(thisid+"_"+obnum)
		if(typeof ob!="undefined" && !!ob){
			ob.className="result_row_hover"
			obnum++
		}else{
			foundone=0
			safety=20
		}
	}
	
}

function row_rolloff(thisid){
	//SUMMARY ROW IS ROLLED OFF
	obnum=1
	foundone=1
	safety=0
	while(foundone==1 && safety<10){
		safety++
		ob=document.getElementById(thisid+"_"+obnum)
		if(typeof ob!="undefined" && !!ob){
			ob.className="result_row"
			obnum++
		}else{
			foundone=0
			safety=20
		}
	}
}

function chart_row_rollon(thisob){
	//INDICATOR CHART ROW IS ROLLED OVER
	if(typeof thisob!="undefined" && !!thisob){
		thisob.className="chart_row_hover"
	}
	
}

function chart_row_rolloff(thisob){
	//INDICATOR CHART ROW IS ROLLED OFF
	if(typeof thisob!="undefined" && !!thisob){
		thisob.className="chart_row"
	}
	
}



function submit_rollon(thisone){
	//SUBMIT BUTTON IS ROLLED OVER
	//thisone.className="submit_button_hover"	
}

function submit_rolloff(thisone){
	//SUBMIT BUTTON IS ROLLED OFF
	//thisone.className="submit_button"	
}
function change_page_num(thisone,dtype){
	//MOVE BETWEEN PAGES WHEN VIEWING EITHER SUMMARY OR DETAIL
	if(thisone.name.indexOf("1")!=-1){
		
		menu2=document.forms["search_form"].page_num_list2
	}else{
		
		menu2=document.forms["search_form"].page_num_list1
	}
	dropindex=thisone.selectedIndex
	val=thisone.options[dropindex].value
	if(val.indexOf("_")!=-1){
		posval=val.substr(0,val.indexOf("_"))
		IDval=val.substr(val.indexOf("_")+1,val.length-val.indexOf("_"))
	}
	if(typeof menu2!="undefined" && !!menu2){
		if(menu2.options.length>dropindex && menu2.options.length>0){
			menu2.options[dropindex].selected=1
		}
	}
	if(dtype=="summary"){
		 change_page(val)
	}else{
		change_detail_page(posval,IDval)
	}
}
function change_page(tothis){
	//CHANGE SUMMARY PAGE
	progress_bar_ob_start("secondary","Loading...")
	
	document.forms["search_form"].page_num.value=tothis
	document.forms["search_form"].current_action.value="pagenum"	
	document.forms["search_form"].do_search.value=1
	remember_and_submit_form(1)
}

function change_detail_page(tothis,thisid){
	//CHANGE DETAIL PAGE
	
	progress_bar_ob_start("secondary","Loading...")
	
	document.forms["search_form"].current_record_num.value=tothis
	document.forms["search_form"].detail_ID.value=thisid
	switch(result_display_type){
		case "detail":
			document.forms["search_form"].current_action.value="pagenum_detail"	
			break;
		case "detail2":
			document.forms["search_form"].current_action.value="pagenum_detail2"	
			break;
	}
	document.forms["search_form"].do_search.value=1
	remember_and_submit_form(1)
}
function change_domain_group_menu(thismenu){
	
	if(thismenu=="DOMAIN_ID"){
		//SET IGROUP TO BLANK
		dropindex=0
		document.forms["search_form"].INDICATOR_GROUP_ID.options[0].selected=1
	
	}
	
	document.forms["search_form"].current_action.value="view_detail_level2"
	
	progress_bar_ob_start("secondary","Loading...")
	
	document.forms["search_form"].do_search.value=1
	remember_and_submit_form(1)
}
function change_display_criteria_submit(thisone){
	var and_submit=1
	if(typeof thisone!="undefined" && !!thisone){
		if(thisone.name=="summarydisplay"){
			
			//A RADIO BUTTON HAS BEEN SELECTED
			for(i=0;i<document.forms["search_form"].summarydisplay.length;i++){
				//LOOP THROUGH ALL THE summarydisplay RADIO BUTTONS, AND IF THEY HAVE AN ASSOCIATED DROPDOWN, SET DROPDOWN'S FIRST ITEM TO SELECTED
				idstr=document.forms["search_form"].summarydisplay[i].id.toString()
				thisnum=idstr.substr(("summarydisplay").length,idstr.length)
				
				obnam="summarydisplay_g"+thisnum
				ob=document.getElementById(obnam)
				if(typeof ob!="undefined" && !!ob){
					if(thisone.id==document.forms["search_form"].summarydisplay[i].id+"dis"){
						
				
						ob.disabled=0
						and_submit=0
					}else{
						ob.options[0].selected=1
					}
				}
				
				
			}
		
		}else{
			if(thisone.name.indexOf("summarydisplay_g")==0){
				//A DROPDOWN HAS BEEN SELECTED
				idstr=thisone.id.toString()
				thisnum=idstr.substr(("summarydisplay_g").length,idstr.length)
				obnam="summarydisplay"+thisnum+"dis"
				ob=document.getElementById(obnam)
				if(typeof ob!="undefined" && !!ob){
					ob.checked=1
				}
				document.forms["search_form"].summarydisplay_g.value=thisone.options[thisone.selectedIndex].value
			}	
		}
	}
	if(and_submit==1){
		change_display_criteria()
		refresh_display_criteria()
		remember_and_submit_form(1)
	}
}
function change_display_criteria(thisone){
	//DISPLAY CRITERIA IS CHANGES SO REACITVATE REFRESH BUTTON

	if(result_display_type=="summary"){
		val=""
		for(i=0;i<document.forms["search_form"].summarydisplay.length;i++){
			if(document.forms["search_form"].summarydisplay[i].checked){
				val=document.forms["search_form"].summarydisplay[i].value
			}
		}

	}
	
	if(result_display_type=="summaryx"){
		if(xmlob_loaded_arr["comparisons"]==1){
			comparison_nodes=xmlob_doc_arr["comparisons"].selectNodes("//item")
			val=""
			for(i=0;i<document.forms["search_form"].summarydisplay.length;i++){
				if(document.forms["search_form"].summarydisplay[i].checked){
					val=document.forms["search_form"].summarydisplay[i].value
				}
			}
			
			boxdiv=FIND("comparison_input_div")
			if(val!="address"){
				//boxdiv.style.display="block"
			}
			for(i=0;i<comparison_nodes.length;i++){
				boxob=FIND("comparison_box"+comparison_nodes[i].getAttribute("ordinal"))
				hiddenob=FIND("comparison_hidden"+comparison_nodes[i].getAttribute("ordinal"))
				if(val=="address"){
					boxob.disabled=1
					hiddenob.disabled=0
				}else{
					boxob.disabled=0
					hiddenob.disabled=1
				}
			}
			if(val=="address"){
				//boxdiv.style.display="none"
			}
			
		}
	}
	if(result_display_type=="detail"){
		if(typeof thisone!="undefined" && !!thisone){
			if(thisone.name.indexOf("LDomain")!=-1){
				
				refresh_detail_display_criteria()
				remember_and_submit_form(1)
			}
		}
	}

}
function change_view_num(){
	//NUMBER OF RESULT PRE PAGE HAS CHANGED SO REACITVATE REFRESH BUTTON
	ob=document.getElementById("refresh_button")
	ob.style.backgroundColor=""
}
var exportTimer

function inline_export(){
	document.forms["export_form"].submit()	
}
function export_summary(thistype){
	////start_progress("Exporting data...")
	document.forms["search_form"].do_search.value=1
	document.forms["search_form"].exporttype.value=thistype

	document.forms["search_form"].current_action.value="refresh"	
	document.forms["search_form"].action="library/export_data.asp"
	document.forms["search_form"].target="exportwindow"
	x=window.open("library/blank.asp","exportwindow","status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=640,height=480");
	x.focus()
	remember_and_submit_form(1)
	
	exportTimer=setInterval(postExportAction,2000)
	
}
function postExportAction(){
	
	clearInterval(exportTimer)
	exportTimer=0
	document.forms["search_form"].do_search.value=0
	document.forms["search_form"].exporttype.value=""
	document.forms["search_form"].action="search.asp"
	document.forms["search_form"].target="_self"
}
function refresh_display_criteria(){
	//start_progress("Updating display...")
	
	progress_bar_ob_start("secondary","Updating display...")
	document.forms["search_form"].do_search.value=1

	document.forms["search_form"].current_action.value="refresh"
	
}
function refresh_detail_display_criteria(){
	
	progress_bar_ob_start("secondary","Updating display...")
	
	document.forms["search_form"].do_search.value=1

	switch(result_display_type){
		case "detail":
			document.forms["search_form"].current_action.value="refresh_detail"
			break;
		case "detail2":
			document.forms["search_form"].current_action.value="refresh_detail2"
			break;
	}
			
}



function refresh_comparisons(){
	
	show_local=1
	if(typeof xmlob_loaded_arr=="undefined"){
		show_local=0
	}else{
		if(typeof xmlob_loaded_arr["comparisons"]=="undefined"){
			show_local=0
		}else{
			if(xmlob_loaded_arr["comparisons"]!=1 || xmlob_loaded_arr["domain_groups"]!=1){
				show_local=0
			}
		}
	}
	show_local=0
	if(show_local==1){
		
		comparison_nodes=xmlob_doc_arr["comparisons"].selectNodes("//item")
	
		endval=0
		var comp_element_count_ob =document.getElementById("comp_element_count")
		if(typeof comp_element_count_ob!="undefined" && !!comp_element_count_ob){
			startval=0
			endval=comp_element_count_ob.value+1
		}
		
		if(endval>0 && comparison_nodes.length>0){
			rcount=0
		
			for(g=startval;g<endval;g++){
				rcount=rcount+1
				
				id_val=g
				
				has_comp=0
				has_point=0
				overlay_count=-1
				
				for(c=0;c<comparison_nodes.length;c++){
					cinput=document.forms["search_form"].elements["comparison"+comparison_nodes[c].getAttribute("ordinal")]
					
					main_anot_ob=null
					comp_anot_ob=null
					comp_bar_ob=null
					comp_desc_ob=null
					
					overlay_ob=null
					comma_ob=null
					text_ob=null
					

						
					
					if(comparison_nodes[c].getAttribute("type")=="overlay"){
						overlay_count=overlay_count+1
						overlay_ob=FIND("overlay_"+id_val+"_"+comparison_nodes[c].getAttribute("ordinal"))
						if(typeof overlay_ob!="undefined" && !!overlay_ob){
							if(cinput.checked){
								//TURN COMPARISON BAR ON
								overlay_ob.style.display="block"
								has_comp=1
							}else{
								//TURN COMPARISON BAR OFF
								overlay_ob.style.display="none"
							}
						}
						comma_ob=FIND("comp_comma_"+id_val+"_"+comparison_nodes[c].getAttribute("ordinal"))
						//alert(comma_ob)
						if(typeof comma_ob!="undefined" && !!comma_ob){
							if(cinput.checked){
								if(overlay_count>0){
									//COMMA APPEARS TO THE LEFT OF THE TEXT SO IGNORE THE FIRST COMPARISION
									if(document.forms["search_form"].elements["comparison"+comparison_nodes[c-1].getAttribute("ordinal")].checked){
										//PREVIOUS COMPARISON IS TURNED ON SO SHOW THE COMMA
										comma_ob.style.display="inline"
									}else{
										comma_ob.style.display="none"
									}
								}else{
									comma_ob.style.display="none"
								}
							}else{
								comma_ob.style.display="none"
							}
						}
						text_ob=FIND("comp_text_"+id_val+"_"+comparison_nodes[c].getAttribute("ordinal"))
						if(typeof text_ob!="undefined" && !!text_ob){
							if(cinput.checked){
								text_ob.style.display="inline"
								if(text_ob.innerHTML.indexOf("same as")==-1){
									//CONTAINS A PERCENTAGE POINT VALUE
									point_ob=FIND("comp_point_"+id_val+"_"+comparison_nodes[c].getAttribute("ordinal"))	
									
									if(typeof point_ob!="undefined" && !!point_ob){
										if(overlay_count==0){
											//IF FIRST COMPARISON THEN SHOW PERCENTAGE POINT TEXT	
											point_ob.style.display="inline"
											has_point=1
										}else{
											if(has_point==0){
												point_ob.style.display="inline"
												has_point=1
											}else{
												point_ob.style.display="none"
											}
										}
									}
								}	
							}else{
								text_ob.style.display="none"
							}
							
						}
					}
				}
				start_ob=FIND("comp_start_"+id_val)
				if(typeof start_ob!="undefined" && !!start_ob){
					//IF ANY COMPARISONS ARE TURNED ON, SHOW THE FIRST COLON
					if(has_comp==1){
						start_ob.style.display="inline"
					}else{
						start_ob.style.display="none"
					}
				}
			}
		}

	}else{
		switch(result_display_type){
			case "summary":
				change_display_criteria()
				refresh_display_criteria()
				remember_and_submit_form(1)
			default:
				change_display_criteria()
				refresh_detail_display_criteria()
				remember_and_submit_form(1)
				break;
		}
		
	}
}



function search_for_results(){
	//START SEARCH

	progress_bar_ob_start("primary","Searching...")
	
	document.forms["search_form"].do_search.value=1
	ob=document.getElementById("submit_button")
	
	if(ob.className.indexOf(" disabled")==-1){
		ob.className=ob.className+" disabled"
	}

	document.forms["search_form"].current_action.value="search"
	
	remember_and_submit_form(0)
}


function row_click(thispos,thisid){
	//CLICK ON SUMMARY ROW TO GO TO DETAIL PAGE
	
	if(cancel_click==0){
		document.forms["search_form"].current_action.value="view_detail"
		
		document.forms["search_form"].current_record_num.value=thispos
		document.forms["search_form"].detail_ID.value=thisid

		progress_bar_ob_start("secondary","Loading...")
		
		document.forms["search_form"].do_search.value=1
		remember_and_submit_form(1,1)
		
	}
	cancel_click=0
}

function chart_row_click(domain,indicator){
	//CLICK ON SUMMARY ROW TO GO TO DETAIL PAGE
	
	if(cancel_click==0){
		document.forms["search_form"].current_action.value="view_detail_level2"
	
		document.forms["search_form"].DOMAIN_ID.value=domain
		document.forms["search_form"].INDICATOR_GROUP_ID.value=indicator
		
		progress_bar_ob_start("secondary","Loading...")
		
		document.forms["search_form"].do_search.value=1
		remember_and_submit_form(1,1)
	
		
	}
	cancel_click=0
}

var returning=0
function return_to_results(thistype){
		
	//GOES BACK TO A RESULT PAGE FROM A DETAIL PAGE
	returning=1

	progress_bar_ob_start("secondary","Loading...")
	
	
	switch(thistype){
		case "summary":
			document.forms["search_form"].current_action.value="view_summary"
			break;
		case "detail":
			document.forms["search_form"].current_action.value="view_detail"
			break;
	}
	document.forms["search_form"].do_search.value=1
	remember_and_submit_form(1)
	
}

function remember_and_submit_form(andsubmit,noscroll){
		
	var search_form=document.forms["search_form"]
	var remember_str=""
	var used_fields=""
		
	if(typeof search_form!="undefined" && !!search_form){
		if(typeof noscroll=="undefined" || !noscroll){
			noscroll=0
		}
		if(noscroll==0){
			if(browser.isIE){
				var page_scrollTop=(window.document.documentElement.scrollTop==0)? window.document.body.scrollTop : window.document.documentElement.scrollTop
				var page_scrollLeft=(window.document.documentElement.scrollLeft==0)? window.document.body.scrollLeft : window.document.documentElement.scrollLeft
			}else{
				var page_scrollTop= window.document.body.scrollTop
				var page_scrollLeft= window.document.body.scrollLeft
			}
			search_form.elements["vscroll"].value=page_scrollTop
		}else{
			search_form.elements["vscroll"].value=""
		}
		//GET ALL FORM ELEMENTS
		for(var i=0;i<search_form.elements.length;i++){
			if(search_form.elements[i].name!="remember" && search_form.elements[i].name!="vscroll" && used_fields.indexOf("|"+search_form.elements[i].name+"|")==-1){
				var nm=""
				var val=""
				
				switch(search_form.elements[i].type){
					case "radio":
					
						//for(var j=0;j<search_form.elements[i].length;j++){
							if(search_form.elements[i].checked==1){
								if(search_form.elements[i].value!=""){
									nm=search_form.elements[i].name
									val=search_form.elements[i].value
								}
							}
						//}
					break;
					case "checkbox":
							if(search_form.elements[i].checked==1){
								if(search_form.elements[i].value!=""){
									nm=search_form.elements[i].name
									val=search_form.elements[i].value
								}
							}
						
						break;
					case "select-one":
							if(search_form.elements[i].options[search_form.elements[i].selectedIndex].value!=""){
								nm=search_form.elements[i].name
								val=search_form.elements[i].options[search_form.elements[i].selectedIndex].value
								
							}
						break;
					case "text":
					case "textarea":	
					case "hidden":	
						if(search_form.elements[i].value!=""){
							nm=search_form.elements[i].name
							val=search_form.elements[i].value
						}
				}
				if(nm!="" && val!=""){
					used_fields=used_fields+"|"+nm+"|"
					remember_str=remember_str+nm+"="+val+"&"
				}
			}
		}
		if(remember_str!=""){
			remember_str=remember_str.substr(0,remember_str.length-1)
		}
		

		search_form.elements["remember"].value=remember_str
		if(andsubmit==1){
			search_form.submit()
		}
	}

}

 
function get_bigger_map(pth,nm,params){
	x=window.open(pth,nm,params);
	x.focus()
}

function FIND(thisstr){
	return document.getElementById(thisstr)	
}

function repos_scroll(){
	//if(typeof scrollv_value!="undefined"){
//	if (typeof window.pageYOffset=="undefined"){ //must be ie
//			document.body.scrollTop=scrollv_value
//		}else{
//		
//			window.scroll(0,scrollv_value)
//		}	
//	}
//	window.scroll(0,scrollv_value)
}

function safari_labels () {	
	//THIS IS CALLED ON LOAD NAD FIXES SAFARI'S PROBLEM WITH FORM LABELS
	if (navigator.userAgent.toLowerCase().indexOf("safari") != -1) {
		var element,type;
		
		for (var x = 0; x < document.getElementsByTagName("label").length; x++ ) {
			if (document.getElementsByTagName("label")[x].getAttribute("for") != null) {
			
				element = document.getElementsByTagName("label")[x].getAttribute("for");
				type = document.getElementById(element).getAttribute("type");
				
				switch (type) {
					
					default:
					case "text":
					case "search":
					case "slider":
						document.getElementsByTagName("label")[x].onclick = function() {
							document.getElementById(this.getAttribute("for")).focus();
						}
						break;
						
					case "radio":
						document.getElementsByTagName("label")[x].onclick = function() {
							document.getElementById(this.getAttribute("for")).checked = true;
							//IF THIS IS A TOWN FILTER ITEM
							if(this.getAttribute("for").indexOf("town")!=-1){
								filter_results(document.getElementById(this.getAttribute("for")))	
							}
							//IF THIS IS A SUMMARY DISPLAY ITEM
							if(this.getAttribute("for").indexOf("summarydisplay")!=-1){
								change_display_criteria_submit(document.getElementById(this.getAttribute("for")))	
							}
						}
						break;
						
					case "checkbox":
						document.getElementsByTagName("label")[x].onclick = function() {
							document.getElementById(this.getAttribute("for")).checked = !document.getElementById(this.getAttribute("for")).checked;
							//IF THIS IS A COMPARISONS DISPLAY ITEM
							if(this.getAttribute("for").indexOf("comparison")!=-1){
								change_display_criteria()
								refresh_comparisons()
							}
							
						}
						break;
					
					case "hidden": break;
					
				}
				
			}
		}
	}
}

function show_info_panel(thisname,thispage){

	document.getElementById("search_content_holder").style.display="none"
	
	document.getElementById("progress_bar_tab1").style.display="none"
	document.getElementById("progress_bar_tab1").style.display="none"
	document.getElementById("progress_bar_tab1_show_search").style.display=""
	document.getElementById("progress_bar_tab1_show_search").parentNode.style.visibility="visible"
	document.getElementById("info_panel").style.display="block"
	document.getElementById("progress_bar_tab_info_selected").style.display=""
	document.getElementById("progress_bar_tab_info_selected").innerHTML=thisname
	document.getElementById("info_panel_content").innerHTML=""
	//start_load_xml("library/get_info_panel_content_xml.asp?page="+thispage,"infopanel")
	//window.open(thispage)
	start_load_xml(thispage,"infopanel")
	
}

function show_info_panel_content(thistext){
	document.getElementById("info_panel_content").innerHTML=thistext
}

function hide_info_panel(){

	document.getElementById("search_content_holder").style.display="block"
	
	document.getElementById("progress_bar_tab1").style.display=""
	document.getElementById("progress_bar_tab1_show_search").style.display="none"
	document.getElementById("progress_bar_tab1_show_search").parentNode.style.visibility="hidden"
	document.getElementById("info_panel").style.display="none"
	document.getElementById("progress_bar_tab_info_selected").style.display="none"
	document.getElementById("progress_bar_tab_info_selected").innerHTML=""
}

