// JavaScript Document
<!--
// ***************************************************************************************
// Upload images Functions
// ***************************************************************************************

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_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_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];}
}

//**************************************************************************************
// Rotating banner
// *************************************************************************************
/* Banner Up! - Copyright 1999-2000 By Heidi Allen 
Knowledge Hound: The How-To Hunter - Learn how to do almost anything...for free!
Please visit us at http://www.knowledgehound.com
License for use of this script is granted if and only if
this entire copyright notice is included with it. We do not provide
support for this script. It is provided solely as a friendly gesture.
Use at your own risk. Thanks! */
// Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/
var image="";
var banners=0;
function cycle() {
  if (++banners > 7) banners=1;
    loadbanners();
    document.banner1.src = image;
    window.setTimeout('cycle();',5000);
  }
function loadbanners() {
   if (banners==1)
      {
      image="../Web/images/programBanners/brownfields.gif";
      }
   if (banners==2)
      {
      image="../Web/images/programBanners/cleanWaters.gif";
      }
   if (banners==3)
      {
      image="../Web/images/programBanners/stormWaters.gif";
      }
     if (banners==4)
      {
      image="../Web/images/programBanners/p2.gif";
      }
	if (banners==5)
      {
      image="../Web/images/programBanners/zone.gif";
      }
	if (banners==6)
      {
      image="../Web/images/programBanners/survey.gif";
      }
}

var link = "http://sacberc.org/Web/programs/brownfields/"
function urlswitch() {
	if (banners==1)
	{
		link = "http://sacberc.org/Web/programs/brownfields/";
	}
	if (banners==2)
	{
		link = "http://www.sacstormwater.org/";
	}
	if (banners==3)
	{
		link = "http://www.msa.saccounty.net/waterresources/Programs/compliance/Compliance.asp";
	}
	if (banners==4)
	{
		link = "http://sacberc.org/Web/programs/p2/";
	}
	if (banners==5)
	{
		link = "http://sacramentormdz.org/";
	}
	if (banners==6)
	{
		link = "http://sacberc.org/Web/survey.php";
	}
	return link;
}

// **********************************************************************************
// Navigation from the drop-down menu
// **********************************************************************************
function go()
{
	//box = document.forms[0].navi;	
	box = document.selectedLanguage.navi;
	destination = box.options[box.selectedIndex].value;
	if (destination) location.href = destination;
}

// **********************************************************************************
// Confirm actions
// **********************************************************************************
function confirmSubmit()
{
var agree=confirm("Are you sure you wish to continue?");
if (agree)
	return true ;
else
	return false ;
}

var id,pause=0,position=0;

// **********************************************************************************
// Banner -- Running stroke
// **********************************************************************************
function ticker() {
	var k;
	var msg="   Help Us to Serve You Better -- Take Our Online Survey!    ";
 	k=(75/msg.length)+1;
 	for (i = 0; i <= k; i++) {
		msg+=" "+msg;
		document.tik.tick.value=msg.substring(position,position+75);
 	}
 	if (position++==msg.length)  { position=0; }
 	id=setTimeout("ticker()",200);
} 

// *****************************************************************************
// Phone number validation (888) 888-8888
//******************************************************************************
function isPhoneNumber(s) 
{
 
     // Check for correct phone number
     rePhoneNumber = new RegExp(/^\([1-9]\d{2}\)\s?\d{3}\-\d{4}$/);
 
     if (!rePhoneNumber.test(s)) {
          alert("Phone Number Must Be Entered As: (555) 555-1234");
          return false;
     }
 
return true;
}
// ***********************************************************************************

function maillink(mailprefix, maildomain, mailsuffix, mailname)
{
  if (mailname == null) { mailname = "e-mail"; }

  document.write('<a href="mailto:' + mailprefix + '%40' + maildomain + '.' + mailsuffix + '">' + mailname + '</a>');
}



