// JavaScript Document

function toggle_element(id) {
	if (document.getElementById(id).style.display=='inline') {
		document.getElementById(id).style.display='none';
	}
	else {
		document.getElementById(id).style.display='inline';
	}
}

function reset_nav(item_id) {
	selected_state(item_id);
	if (item_id!='tab_1') {
		original_state('tab_1');
	}
	if (item_id!='tab_2') {
		original_state('tab_2');
	}
	if (item_id!='tab_3') {
		original_state('tab_3');
	}
	if (item_id!='tab_4') {
		original_state('tab_4');
	}
	if (item_id!='tab_5') {
		original_state('tab_5');
	}
}

function original_state(item_id) {
	document.getElementById(item_id).style.background='#DDE';
	document.getElementById(item_id).style.borderBottom='1px solid #778';		
	document.getElementById(item_id).style.color='#000';		
}

function selected_state(item_id) {
	document.getElementById(item_id).style.background='white';
	document.getElementById(item_id).style.borderBottom='1px solid white';		
}		

function select_nav_tab(item_id) {
	reset_nav(item_id);
	selected_state(item_id);
}

function fullscreen() {
  try {
	if (document.body.offsetWidth < 800) {
		parent.moveTo(0,0);
		parent.resizeTo(1024,950);
	}
  } catch(e) {
  }
}

function imposeMaxLength(Object, MaxLen)
{
  return (Object.value.length <= MaxLen);
}

function validateEmail(strValue) {
/************************************************
DESCRIPTION: Validates that a string contains a
  valid email pattern.

 PARAMETERS:
   strValue - String to be tested for validity

RETURNS:
   True if valid, otherwise false.

REMARKS: Accounts for email with country appended
  does not validate that email contains valid URL
  type (.com, .gov, etc.) or valid country suffix.
*************************************************/
var objRegExp  = /(^[a-z]([a-z_\.\d\+\-]*)@([a-z_\.\d\+\-]*)([.][a-z]{3})$)|(^[a-z]([a-z_\.\d\+\-]*)@([a-z_\.\d\+\-]*)(\.[a-z]{2,4})(\.[a-z]{2})*$)/i;
  //check for valid email
  return objRegExp.test(strValue);
  //return true;
}