function set_heights(){
	// set the heights of the divs in the main section by working out which are visible or not

	var winheight = winH();
	var availheight = winheight -155

	//$("div_left_nav").style.height=  availheight +"px"
	$("div_main_content").style.height=  availheight +"px"
	$("div_help").style.height=  availheight +"px"
}



function showhelp(divtype){
	if (divtype == 'description'){
		$('div_help_description').style.display=""
		$('div_help_example').style.display="none"

		$('li_help_desc').className="help_tab_active"
		$('li_help_exam').className="help_tab_inactive"
	} else {
		$('div_help_description').style.display="none"
		$('div_help_example').style.display=""

		$('li_help_desc').className="help_tab_inactive"
		$('li_help_exam').className="help_tab_active"
	}
}

function formupdated(){

	var updated = false;
	if (document.forms['frm_Metadata']) {
		var ctls = document.forms['frm_Metadata'].elements
		for (i=0;i<ctls.length;i++){
			if (ctls[i].name != ''){
				var cur_val = ctls[i].value;
				var org_val = ctls[i].defaultValue;

				cur_val = cur_val.replace(/\s/g,'')
				org_val = org_val.replace(/\s/g,'')

				if (cur_val != org_val) updated=true;
			}
		}
	}
	return (updated);

}


function checkupdated(str_result){

	var okay = false;
	if (formupdated()==true){
		if (confirm('You have unsaved changes, these will be lost if you continue.\nAre you sure you want to continue ?')) {
			okay = true;
		}
	} else {
		okay = true;
	}

	if (okay==true){
		switch (str_result){
			case 'open':
				filewindow('open')
				break;
			case 'new':
				update_div('div_main_content','metaeditor.asp?file=xml/new_spatial.lyr.xml','','file_on_load("new")')
				$('but_save').disabled = true;
				break;
			case 'search':
				document.forms.frmSiteSearch.submit()
				break;
			case 'home':
				window.location = '../default.asp'
				break;
		}
	}
}




