function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		nav_02_over = newImage("images/nav_02-over.gif");
		nav_03_over = newImage("images/nav_03-over.gif");
		nav_04_over = newImage("images/nav_04-over.gif");
		nav_05_over = newImage("images/nav_05-over.gif");
		nav_06_over = newImage("images/nav_06-over.gif");
		nav_07_over = newImage("images/nav_07-over.gif");
		nav_08_over = newImage("images/nav_08-over.gif");
		preloadFlag = true;
	}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}


	function validLogin()
	{
		if ((document.form1.username.value == "")||(document.form1.username.value == "username"))
		{
			alert ('Please Enter Username');
			document.form1.username.focus();
			return false;
		}
		if ((document.form1.pass.value == "")||(document.form1.pass.value == "password"))
		{
			alert ('please Enter Password');
			document.form1.pass.focus();
			return false;
		}
		return true;
	}
	
	function clearTip(field)
	{
		if(field.defaultValue == field.value)
		field.value = "";
	}

	function writeTip(field)
	{
		if(field.value == "")
			field.value = field.defaultValue;
	}	


	
	function myReset()
	{
		//alert('resetting');
		document.frmContact.fname.value= "";
		document.frmContact.lname.value= "";
		document.frmContact.email.value= "";
		document.frmContact.feedback.value= "";
		//document.frmContact.reset();
		return true;
	}
	
	
		function validationContact()
	{
		var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
		var matchArray = frmContact.email.value.match(emailPat);
		if ((document.frmContact.fname.value == "")||(document.frmContact.fname.value == " "))
		{
			alert ('Please Enter Your First Name.');
			document.frmContact.fname.value="";
			document.frmContact.fname.focus();
			return false;
		}
		if ((document.frmContact.lname.value == "")||(document.frmContact.lname.value == " "))
		{
			alert ('Please Enter Your Last Name.');
			document.frmContact.lname.value="";
			document.frmContact.lname.focus();
			return false;
		}
		if (matchArray == null)
		{
			alert ('Please Enter your valid Email Address.');
			document.frmContact.email.focus();
			return false;
		}
		if ((document.frmContact.feedback.value == "")||(document.frmContact.feedback.value == "Comments"))
		{
			alert ('Please Enter your comments.');
			document.frmContact.feedback.value="";
			document.frmContact.feedback.focus();
			return false;
		}
		if (document.frmContact.verificationCode.value == "")
		{
			alert ("Please enter your Security Code.");
			document.frmContact.verificationCode.focus();
			return false;
		}
		if (document.frmContact.verificationCode.value == "")
		{
			alert ('Sorry, the Security Code entered did not match that displayed.\nPlease ensure that cookies are enabled on your browser.');
			document.frmContact.verificationCode.focus();
			return false;
		}
		window.open('', 'mailingList', 'toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=1,width=400,height=150')
		return true;
	}
function setOpacity( value,divid ) {
	document.getElementById(divid).style.opacity = value / 10;
	document.getElementById(divid).style.filter = 'alpha(opacity=' + value * 10 + ')';
}

function fadeInMyPopup(dividfIn) {
	for( var i = 0 ; i <= 100 ; i++ )
		//alert("setOpacity(" + (i / 10) +",'"+dividfIn+ "')");
		setTimeout( "setOpacity(" + (i / 10) +",'"+dividfIn+ "')" , 8 * i );
}

function fadeOutMyPopup(dividfOut) {
	for( var i = 0 ; i <= 100 ; i++ ) {
		//setTimeout( 'setOpacity(' + (10 - i / 10) +','+dividfOut+ ')' , 8 * i );
		setTimeout( "setOpacity(" + (10 - i / 10) +",'"+dividfOut+ "')" , 8 * i );
	}

	setTimeout("closeMyPopup('"+dividfOut+"')", 800 );
}

function closeMyPopup(divid) {
	document.getElementById(divid).style.display = "none"
}

function fireMyPopup(Id) {
	setOpacity( 0,Id );
	//alert(alert(document.getElementById(Id).style.display));
	if(document.getElementById(Id).style.display == "block")
	{
		
		document.getElementById(Id).style.display = "none";
		fadeOutMyPopup(Id);
	}
	else
	{
		
		document.getElementById(Id).style.display = "block";
		fadeInMyPopup(Id);
	}
	
}
