<!--
// this hides all menus unless one is stated in the input
function show_hide_mnu(sMnu, v) {
	// check the object exists
	if(document.getElementById(sMnu)){
		// get the object
		obj = document.getElementById(sMnu);
									
		if (obj.style){
			obj=obj.style;
			v=(v=='show')?'visible':(v='hide')?'hidden':v; 
		}
		obj.visibility=v; 
	}
}

// this function takes and object such as a div and a text style and changes the objects style
function obj_change_style(obj, css) {
	obj.className=css;
}

function obj_id_change_style(sID, css) {
	
	obj = document.getElementById(sID);
	obj.className=css;
}

// this is diplsay menu code - it relies on a array mnus the is declared in the main nav include code
function hide_menus(sException) {
	
	var x=0;
	for (x=0; x<mnus.length; x++)
	{
		if (mnus[x] == sException) {
			show_hide_mnu(mnus[x], 'show')
		} else {
			show_hide_mnu(mnus[x], 'hide')
		}
	}
}

function show_hide_itm(sMnu, v) {
	
	// check the object exists
	if(document.getElementById(sMnu)){
		// get the object
		obj = document.getElementById(sMnu);
									
		if (obj.style){
			obj=obj.style;
			//v=(v=='show')?'visible':(v='hide')?'hidden':v; 
			v=(v=='show')?'block':(v='hide')?'none':v; 
		}
		
		obj.display = v;
		
	}
}

function page_load_handler() {
	set_form_focus();
}

function check_length_jump(obj, i_length, s_jump_to) {
	// check the length of the input and jumps the cursor to another form field specified
	// used on date fields
    
	if (obj.value.length >= i_length)
	{
	    if(document.getElementById(s_jump_to)){
		    document.getElementById(s_jump_to).focus();
		}
	}
		
}

function set_form_focus() {
	if (document.forms.length > 0) {
		
		var field = document.forms[0];
		
		for (i = 0; i < field.length; i++) {
		
			if ((field.elements[i].type == "text") || (field.elements[i].type == "textarea") || (field.elements[i].type.toString().charAt(0) == "s")) {
				document.forms[0].elements[i].focus();
				break;
         }
      }
   }
}


function sectionJump(newSection) {
	newPage = newSection.options[newSection.selectedIndex].value;
	if (newPage != "" && newPage != "#") { window.location.href = newPage; }
}

function view_mini_popup(sURL) {
	mini_popup=window.open(sURL,"mini_popup","width=320,height=320,top=40,left=40,resizable=yes,menubar=no,scrollbars=yes,location=no,status=no,toolbar=no,directories=no"); 
	mini_popup.focus();	
}

function view_small_popup(sURL) {
	small_popup=window.open(sURL,"small_popup","width=320,height=600,top=40,left=40,resizable=yes,menubar=no,scrollbars=yes,location=no,status=no,toolbar=no,directories=no"); 
	small_popup.focus();	
}
function view_medium_popup(sURL) {
	medium_popup=window.open(sURL,"medium_popup","width=600,height=400,top=40,left=40,resizable=yes,menubar=no,scrollbars=yes,location=no,status=no,toolbar=no,directories=no"); 
	medium_popup.focus();	
}


// web control custom validations

function validateLength(oSrc, args){ 
	if (args.Value = '') {
		args.IsValid = false;
	} else if (args.Value.length >= 6) {
		args.IsValid = false;
	} 
}

function validateEnquiriesDropDown(oSrc, args) {
	/* 
	This validates the drop down list on the enquries - its for the general enquires page really
	were we don't want the user to select one of the main headings
	*/	
	var bValid = true;
	
	if (args.Value == "INDIVIDUALS" || args.Value == "BUSINESSES" || args.Value == "PROFESSIONAL CONTACTS" || args.Value == "CORPORATE SERVICES" || args.Value == "OTHER ENQUIRIES") {
		bValid = false		
	}
		
	args.IsValid = bValid; 
}

//-->
