function sh_ShowHide()
{
  groupname=arguments[0];
  rows=arguments[1];
  if(arguments.length > 2)
  {
    if (arguments[2]==1)
    {
      var currRow = document.getElementById(groupname);
  		currRow.style.display="";
  		document.getElementById(groupname+"img").src = sh_HideImg;
    }
    else if (arguments[2]==0)
    {
      var currRow = document.getElementById(groupname);
  		currRow.style.display="none";
  		document.getElementById(groupname+"img").src = sh_ShowImg;
    }
  }
  else
  {
    if (rows == 0) 
    { /* for a single item */
      sh_RowShowHide(groupname);
  	}
    else
    { /* for multiple rows of a table */
      for(i=1; i <= rows; i++)
      {
        var tempRow = groupname + "" + i;
        sh_RowShowHide(tempRow);
      }
    }
  }
}
//****************************************************************************************************

function sh_RowShowHide(sh_RowID) {
	var currRow = document.getElementById(sh_RowID);
	if (currRow.style.display=="none") {
		currRow.style.display="";
		document.getElementById(sh_RowID+"img").src = sh_HideImg;
	} else {
		currRow.style.display="none";
		document.getElementById(sh_RowID+"img").src = sh_ShowImg;
	}	
}
//****************************************************************************************************

function randomPic() {
  var randomNum = Math.random() ;
  var picnum = Math.floor(randomNum*13)+1;
  document.write('<img src=images/home_pic'+picnum+'.jpg name="homepic" width="453" height="238" border="0">');
}
//****************************************************************************************************

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_jumpMenu(targ,selObj,restore) { //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//****************************************************************************************************

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_preloadImages() { //v3.0
document.Loginform.username.focus();
  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_showHideLayers() { //v3.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 MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//****************************************************************************************************

function openPictureWindow_Fever(imageName,imageWidth,imageHeight,alt,posLeft,posTop) {
	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">'); 
	newWindow.document.write('<img src='+imageName+' width='+imageWidth+' height='+imageHeight+' alt='+alt+'>'); 
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}
//****************************************************************************************************

function ShowMenu(x,y,z,a,b,c) { 
    document.getElementById(x).style.visibility = "visible";
   	if(document.getElementById(y)){
		document.getElementById(y).style.visibility = "hidden";
		}
   	if(document.getElementById(z)){
		document.getElementById(z).style.visibility = "hidden";
		}
 	if(document.getElementById(a)){
		document.getElementById(a).style.visibility = "hidden";
		}
	if(document.getElementById(b)){
		document.getElementById(b).style.visibility = "hidden";
		}
	if(document.getElementById(c)){
		document.getElementById(c).style.visibility = "hidden";
		}
}

var subMenus = new Array("sub_Corp", "sub_Prod", "sub_Inv", "sub_Edu", "sub_Emp");

function HideMenu(x,y,z,a,b) {
  for (var i=0;i<5;i++) {
    document.getElementById(subMenus[i]).style.visibility = 'hidden';
   }
	if(document.getElementById(x)){
		document.getElementById(x).style.visibility = 'visible';
		}
   	if(document.getElementById(y)){
		document.getElementById(y).style.visibility = 'visible';
		}
 	if(document.getElementById(z)){
		document.getElementById(z).style.visibility = 'visible';
		}
	if(document.getElementById(a)){
		document.getElementById(a).style.visibility = 'visible';
		}
	if(document.getElementById(b)){
		document.getElementById(b).style.visibility = 'visible';
		}
}


//****************************************************************************************************

function checkForm() {
    if(document.EEOform.firstName.value=="")
        {
        alert("Please type in your first name.");
        document.EEOform.firstName.focus();
        return false;
        }

	if(document.EEOform.lastName.value=="")
        {
        alert("Please type in your last name.");
        document.EEOform.lastName.focus();
        return false;
        }

	if(document.EEOform.address.value=="")
        {
        alert("Please type in your mailing address.");
        document.EEOform.address.focus();
        return false;
        }

	var eStatus = true;
// check whether we include the @ symbol
	if (document.EEOform.email.value.indexOf("@") == -1) eStatus = false;
// check whether the . character is in the address
	if (document.EEOform.email.value.indexOf(".") == -1) eStatus = false;

	if (!eStatus) {
		alert('Please type in a properly formatted e-mail address.');
		document.EEOform.email.focus();
		return false;
	}

Salary = document.EEOform.compensation

	if (Salary.value=="")	
		{
		alert("Please type in a dollar amount for your desired compensation.");
        Salary.focus();
        return false;
		}
		
	if ((isNaN(Salary.value)) && (Salary.value.indexOf(",") == -1))
			{
        	alert("Please type in a numerical dollar amount for your desired compensation.");
        	Salary.focus();
        	return false;
			}

		

}

//****************************************************************************************************

function checkeRocksForm() {
// check Name, Email, Company, LoginID, Password
	if (checkeRocksInfo() == 1)
	{
		return false;
	}
// check Invoice data for the first row only
	if (checkeRocksSet(1) == 1)
	{
		return false;
	}
// check Invoice data for the remaining 4 rows only if they are not completely empty
	for(var i=2; i<6; i++)
	{
		Customer=eval("document.eRocksEnroll.Customer"+[i]+".value")
		Invoice=eval("document.eRocksEnroll.Invoice"+[i]+".value")
		Payment=eval("document.eRocksEnroll.Payment"+[i]+".value")
     	if (!((Customer == "") && (Invoice == "") && (Payment == "")))
     	{
	 		if (checkeRocksSet(i) == 1)
			{			
				return false;
			}
     	}

  	}
}
//****************************************************************************************************

function checkeRocksSet(Num) {
// Variables
	Customer=eval("document.eRocksEnroll.Customer"+[Num])
	Invoice=eval("document.eRocksEnroll.Invoice"+[Num])
	Payment=eval("document.eRocksEnroll.Payment"+[Num])

// Customer #
	if(Customer.value=="")
        {
        alert("Please enter a Customer Number on line " + Num + ".");
        Customer.focus();
        return 1;
        }
		
	if (isNaN(Customer.value) || !(Customer.value.length == 6)) 
		{
        alert("The Customer Number on line " + Num + " should be a 6 digit number.");
        Customer.focus();
        return 1;
        }
		
// Invoice #	
    if(Invoice.value=="")
        	{
        	alert("Please enter the Invoice Number on line " + Num + ".");
        	Invoice.focus();
        	return 1;
        	}
		
		if (isNaN(Invoice.value)) 
			{
        	alert("The Invoice Number on line " + Num + " should only include numbers.");
        	Invoice.focus();
        	return 1;
        	}
			
// Payment Due		
		if(Payment.value=="")
        	{
        	alert("Please enter the matching Payment Due on line " + Num + ".");
        	Payment.focus();
        	return 1;
        	}

		var PaymentFilter=/^-?\d{1,3}(,\d{3})*\.\d{2}$/;
		if (!(PaymentFilter.test(Payment.value))) 
			{ 
        	alert("The Payment Due on line " + Num + " is not formatted correctly. Please correct it.");
			Payment.focus();
			return 1;
			}
}
//****************************************************************************************************

function checkeRocksInfo() {
Name = document.eRocksEnroll.Name
Email = document.eRocksEnroll.Email
Company = document.eRocksEnroll.Company
LoginID = document.eRocksEnroll.LoginID
Password1 = document.eRocksEnroll.Password1
Password = document.eRocksEnroll.Password
	
// Customer Name		
	if(Name.value=="")
        {
        alert("Please type in your First and Last Name.");
        Name.focus();
        return 1;
        }
// Email
	var emailFilter=/^.+@.+\..{2,3}$/;
	if (!(emailFilter.test(Email.value))) 
		{ 
        alert('Please type in a properly formatted e-mail address.');
		Email.focus();
		return 1;
		}
		
	var illegalChars3= /[\(\)\<\>\,\;\:\\\/\"\[\]]/
	if (Email.value.match(illegalChars3)) 
		{
   		alert('Your Email address contains illegal characters.');
		Email.focus();
		return 1;
		}
// Company Name	
	if(Company.value=="")
        {
        alert("Please type in your Company Name.");
        Company.focus();
        return 1;
        }
// Login Name		
    if(LoginID.value.length < 6)
        {
        alert("Your User Name must be at least 6 characters with no spaces.");
        LoginID.focus();
        return 1;
        }
	
	var illegalChars = /\W/;
  // allow only letters, numbers, and underscores
    if (illegalChars.test(LoginID.value)) 
		{
        alert("Your User Name can only contain letters, numbers and underscores.");
        LoginID.focus();
        return 1;
    	} 
// Password	
	var illegalChars2 = /[\W_]/; // allow only letters and numbers
    if (illegalChars2.test(Password1.value)) 
	    {
      	alert("Your Password can only contain letters and numbers.");
	  	Password1.focus();
        return 1;
    	}
		
	if(Password1.value.length < 6)
        {
        alert("Your Password must be at least 6 characters with no spaces.");
        Password1.focus();
        return 1;
        }

	var re = /^\w*(?=\w*\d)\w*$/
	if (!re.test(Password1.value))
		{ alert("Your Password must contain at least one number."); 
		Password1.focus();
    	return 1;
		}
		
	if (Password.value != Password1.value)
		{ alert("Your Password was not \"retyped\" correctly."); 
		Password1.focus();
    	return 1;
		}
}
//****************************************************************************************************

function formValidate() {
	var eSendFrom = document.mailform.sendFrom;
//var eSendSubject = document.mailform.sendSubject.value;
//var eSendMessage = document.mailform.sendMessage.value;
	if(eSendFrom.value=="")
        {
        alert("Please type in your email address.");
        eSendFrom.focus();
        return false;
        }
	
// Email
	var emailFilter=/^.+@.+\..{2,3}$/;
	if (!(emailFilter.test(eSendFrom.value))) 
		{ 
        alert('Please type in a properly formatted e-mail address.');
		eSendFrom.focus();
		return false;
		}
		
	if(document.mailform.sendMessage.value=="")
        {
        alert("Please type in your message\n in the message box.");
        document.mailform.sendMessage.focus();
        return false;
        }

}
//****************************************************************************************************

function sendForm2() { 
         window.open('webcast.asp','webcast','scrollbars,resizable,width=760,height=500');           
         document.webcast.submit();
}

//****************************************************************************************************

function sendForm() { 
         window.open('webcast.asp','webcast','scrollbars,resizable,width=782,height=405');           
         document.webcast.submit();
}

//****************************************************************************************************

function toWebcast(webcastURL) { 
         var url = webcastURL;
		 myString = String(url);
		 rExp = /&/g;
		 newString = new String ("AMPERSAND");
		 results = myString.replace(rExp, newString);

		 window.open('webcast.asp?weburl=' + results + '','webcast','scrollbars,resizable,width=782,height=405'); 
		 
		 //var url = webcastURL;
		 //window.open('webcast2.asp?weburl=' + url + '','webcast','scrollbars,resizable,width=782,height=405'); 
}

//****************************************************************************************************
//table link rollovers
function tableRollouts(theparent,color) {
	theparent.style.backgroundColor=color;
}

function tableRollovers(theparent,color) {
	theparent.style.backgroundColor=color;
}

//****************************************************************************************************
// Pop up Tool Tip box

// Examples, put in links:
// onMouseOver="toolTip('more good stuff', '#FFFF00', 'orange')" onMouseOut="toolTip()"
// -or-
// onMouseOver="initToolTips(); toolTip('Click for NC locations')" onMouseOut="toolTip()"

var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var ie4 = document.all;
var toolTipSTYLE="";

offsetX = 0;
offsetY = 20;

function initToolTips() { // make tooltip DIV tag visible and initiate following the mouse
  if(ns4||ns6||ie4)
  {
    if(ns4) toolTipSTYLE = document.toolTipLayer;
    else if(ns6) toolTipSTYLE = document.getElementById("toolTipLayer").style;
    else if(ie4) toolTipSTYLE = document.all.toolTipLayer.style;
    if(ns4) document.captureEvents(Event.MOUSEMOVE);
    else
    {
      toolTipSTYLE.visibility = "visible";
      toolTipSTYLE.display = "none";
    }
    document.onmousemove = moveToMouseLoc; // follow mouse
  }
}

function toolTip(msg, fg, bg) // create tooltip box if text is included or 
							  // hide the tooltip box & stop following the mouse 
							  // if no text is included
{
  if(toolTip.arguments.length < 1) // hide
  {
    if(ns4) toolTipSTYLE.visibility = "hidden";
    else toolTipSTYLE.display = "none";	
	document.onmousemove = stopMoving; // to keep tooltip DIV tag from following mouse and
									   // messing up nav menus
  }
  else // show
  {
    if(!fg) fg = "#777777";
    if(!bg) bg = "#FFFFFF";

    var content =
    '<table border="0" cellspacing="0" cellpadding="1" bgcolor="' + fg + '"><td>' +
    '<table border="0" cellspacing="0" cellpadding="1" bgcolor="' + bg + 
    '"><td align="center"><font face="sans-serif" color="' + fg +
    '" size="-2">&nbsp\;' + msg +
    '&nbsp\;</font></td></table></td></table>';

    if(ns4)
    {
      toolTipSTYLE.document.write(content);
      toolTipSTYLE.document.close();
      toolTipSTYLE.visibility = "visible";
    }
    if(ns6)
    {
      document.getElementById("toolTipLayer").innerHTML = content;
      toolTipSTYLE.display='block'
    }
    if(ie4)
    {
      document.all("toolTipLayer").innerHTML=content;
      toolTipSTYLE.display='block'
    }
  }
}

function stopMoving(e) // stop following mouse
{
 return false;
}

function moveToMouseLoc(e) // start following mouse
{
  if(ns4||ns6)
  {
    x = e.pageX;
    y = e.pageY;
  }
  else
  {
    x = event.x + document.body.scrollLeft;
    y = event.y + document.body.scrollTop;
  }
  toolTipSTYLE.left = x + offsetX;
  toolTipSTYLE.top = y + offsetY;
  return true;
}