function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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 changeColor(cur,color){
	cur.style.background = color;
}

// prompt confirm delete message
function confirmDelete(frm) 
{
  var noChecked = 0; // Change to 1 when a checkbox is checked.

  for(var i=0;i < frm.length;i++) 
  {
	if(frm.elements[i].type == "checkbox" && frm.elements[i].checked == true)
	{
	  noChecked = 1;
	}
  }

  if(noChecked == 0) // No record selected. Prompt error message.
  {
	alert("Please select a record to delete!");
	return false;
  }	
  if (confirm("Are you sure you want to delete this record?") == 0) 
  {
      return false;
	  }
  else
  {
      return true;
  }
}

// prompt confirm delete message
function confirmUpdate(frm) 
{
  var noChecked = 0; // Change to 1 when a checkbox is checked.

  for(var i=0;i < frm.length;i++) 
  {
	if(frm.elements[i].type == "checkbox" && frm.elements[i].checked == true)
	{
	  noChecked = 1;
	}
  }

  if(noChecked == 0) // No record selected. Prompt error message.
  {
	alert("Please select a record to update!");
	return false;
  }	
  if (confirm("Are you sure you want to update this record?") == 0) 
  {
      return false;
	  }
  else
  {
      return true;
  }
}

// prompt confirm delete message
function confirmDel(msg)
{
  if (confirm(msg) == 0) 
  {
      return false;
	  }
  else
  {
      return true;
  }
}

ns4=(navigator.appName.indexOf("Netscape")>=0 && !document.getElementById)? 1 : 0;
ie4=(document.all && !document.getElementById)? 1 : 0;
ie5=(document.getElementById && document.all)? 1 : 0;
ns6=(document.getElementById && navigator.appName.indexOf("Netscape")>=0 )? 1: 0;
w3c=(document.getElementById)? 1 : 0;

wid=(ie4||ie5)?window.document.body.clientWidth-20:window.innerWidth-36

if(ns4){document.write ('<layer name="di1"></layer>')}else{document.write ('<div id="di1" style="position:absolute;z-index:100" ></div>')}

outd=""

if(w3c)div1=document.getElementById('di1')
if(ie4)div1=document.all['di1']
if(ns4)div1=document.layers['di1']

function move_div(x,y){
	if (isNaN(x+y))return
	if(ns4){div1.moveTo(x,y)}else{div1.style.left=x+'px';div1.style.top=y+'px';}
}

function write_div(text){
	if(ns4){
		div1.document.open();
		div1.document.write(text);
		div1.document.close();
	}
	else {div1.innerHTML=text;}
}
 
function big(n){
ondiv=n
		write_div("<a href=javascript:void(0) onmouseout='big_hide()' onmouseover='ondiv=1'><table cellspacing=0 cellpadding=0 border=0 bgcolor=#FFFFE8><tr><td height=1 bgcolor=#000000 colspan=5></td></tr><tr><td width=1 bgcolor=#000000></td><td colspan=3 height=2></td><td width=1 bgcolor=#000000></td></tr><tr><td width=1 bgcolor=#000000></td><td width=2></td><td class=content>"+n+"</td><td width=2></td><td width=1 bgcolor=#000000></td></tr><tr><td width=1 bgcolor=#000000></td><td colspan=3 height=2></td><td width=1 bgcolor=#000000></td></tr><tr><td height=1 bgcolor=#000000 colspan=5></td></tr></table></a>");
		move_div(x,y)
}

function big_hide(){
	ondiv=0;
	t3=window.setTimeout('big_hide2()',100)
}

function big_hide2(){
if (ondiv==0){
	write_div("");
	move_div(-1000,-1000)}
}

y=x=0
function dragIt(evt){if(ie4||ie5){x=window.event.clientX+document.body.scrollLeft; y=window.event.clientY+document.body.scrollTop}else {x=evt.pageX ; y=evt.pageY }}

document.onmousemove = dragIt
if(ns4){document.captureEvents( Event.MOUSEMOVE )}

// valid form fieldboxs
function validFrm(str) 
{
  	// General declare for messages.
  	var i,p,nm,counter,condition,errors='',args,title,val;
  	counter = 0;
  	args = str.split(",");
	// loop through all the fields
  	for (i=1; i<(args.length-1); i+=2) 
  	{  
    	if (counter == 0) 
		{
    		condition=args[i+1];
	 		nm=(findObj(args[i])); 
			title=nm.name;
			check=nm.checked;
			val=nm.value;
			// check for empty fields
			if (val !="") 
	    	{
				if (condition.indexOf('C')!=-1) 
            	{
                	if (check == false)
					{
						errors=title+' box is not check.\n';
						counter = i;
					}
	        	}
				// verify number
            	else if (condition.indexOf('N')!=-1) 
            	{
                	if (isNaN(val))
					{
						errors=title+' must be a number.\n';
						counter = i;
					}
	        	}
				// verify email
				else if (condition.indexOf('E')!=-1) 
				{ 
			    	p=val.indexOf('@');
					x=val.indexOf('.');
					myExp = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
				
               		// if (p<1 || p==(val.length-1)) 
			   		if(myExp.test(val) == false)
					{
						errors=title+' must be a valid e-mail address.\n';
						counter = i;
					}
				}
        	}
        	else if (condition.charAt(0) == 'V') 
			{
				errors =title+' is required.\n'; 
				counter = i;
			}
		}
  	} 
	// 	displays error message
  	if (counter != 0) 
  	{
  		alert(errors);
		nm.focus();
		return false;
  	}
  	else
  	{
	  	if (confirm("Confirm " + args[0] + "?") == 0)
	  	{
		  	(findObj(args[1])).focus();
		  	return false;
	  	}
		else
		{
			return true;
		}
  	}
}


function findObj(n, d) 
{
	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=findObj(n,d.layers[i].document);
  	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function thisMovie(movieName) {
  // IE and Netscape refer to the movie object differently.
  // This function returns the appropriate syntax depending on the browser.
  if (navigator.appName.indexOf ("Microsoft") ==-1) {
    return window[movieName]
  }	else {
    return document[movieName]
  }
}

function getFlashMovieObject(movieName)
{
  if (window.document[movieName]) 
  {
      return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}

function mouseOverNav(pagename,name,id,frameNo)
{
	MM_swapImage('nav_' + name,'','images/nav_' + name + '_over.gif',1);
	if (pagename == 'home.asp')
	{
		if (name == 'home')
		{
			document.getElementById('contentText').innerHTML = content[id];
			document.getElementById('contentTagline').innerHTML = tagline[id];
		}
		if (frameNo != 0)
		{
			if (getFlashMovieObject('photoBanner').IsPlaying() == false)
			{
				document.getElementById('contentText').innerHTML = content[id];
				document.getElementById('contentTagline').innerHTML = tagline[id];
				getFlashMovieObject('photoBanner').GotoFrame(frameNo);
			}
		}
	}
}
