﻿startList = function() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("nav");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}
window.onload=startList;


function copyBillingFields(box, f) {
	if(box.checked == false) { return; }
		f.billingAddress.value  = f.address.value;
        f.billingCity.value  = f.city.value;
        f.billingState.value  = f.state.value;
        f.billingZip.value = f.zip.value;		
}

function validateCC(f) {
  var s = f.value;
  if (checkCC(s))
    return true;
  else
    alert("Invalid Credit Card Number.");
  	return false;
}

function checkCC(s) {

  var i, n, c, r, t;

  // First, reverse the string and remove any non-numeric characters.

  r = "";
  for (i = 0; i < s.length; i++) {
    c = parseInt(s.charAt(i), 10);
    if (c >= 0 && c <= 9)
      r = c + r;
  }

  // Check for a bad string.

  if (r.length <= 1)
    return false;

  // Now run through each single digit to create a new string. Even digits
  // are multiplied by two, odd digits are left alone.

  t = "";
  for (i = 0; i < r.length; i++) {
    c = parseInt(r.charAt(i), 10);
    if (i % 2 != 0)
      c *= 2;
    t = t + c;
  }

  // Finally, add up all the single digits in this string.

  n = 0;
  for (i = 0; i < t.length; i++) {
    c = parseInt(t.charAt(i), 10);
    n = n + c;
  }

  // If the resulting sum is an even multiple of ten (but not zero), the
  // card number is good.

  if (n != 0 && n % 10 == 0)
    return true;
  else
    return false;
}
// eof checkCC


var new_fieldname = ""

//this is the onclick that calls this function
//
// onClick="return check(form,form.elements.length)"
//

function check(form,x)
{

	var message = ""
	var more_message = new Array //(4)
	var showmsg = "no"
	var doItNow = "yes"
	var required = new Array (12)
	if (doItNow == "yes") 	{

			var i = 0;


						
						////////
						
						/*if (form.email.value == "")

							{more_message [i++] = "\nPlease Enter Your Email Address"}

						else*/
						if (form.email.value != "")
						{
							if ((form.email.value.indexOf ('@', 0) < 3) || (form.email.value.indexOf ('.', 0) < 5))
	
								{more_message [i++] = "\nPlease Confirm Your Email Address is Correct"}
						}
						/*if (form.email2.value == "")

							{more_message [i++] = "\nPlease Enter The Second Email Address"}

						else*/
						if (form.email2.value != "")
						{
						 if ((form.email2.value.indexOf ('@', 0) < 3) || (form.email2.value.indexOf ('.', 0) < 5))

							{more_message [i++] = "\nPlease Confirm Your Second Email Address is Correct"}
						}
						/////////	
						
						if (more_message != "") {

								if (message == "") {message = more_message}

									else

									{message = message + "\n" + more_message}

				        }

						if (message > "")

								{showmsg = "yes"}																

						if (showmsg == "yes")

			{
				alert("The following form field(s) were incomplete or incorrect:\n\n" + message + "\n\n Please complete or correct the form and submit again.")
				return false;
			}
			else
			{ 
				form.submit()
				return true;
			}

		}

	}
	

function show_hide(dropVal)
{

	if (dropVal == "candidate")
	{
		document.getElementById('ext_copy').innerHTML = 'To Submit this form to your sales manager for additional comments, please provide information:';
	}
	else if (dropVal == "sales_manager")
	{
		document.getElementById('ext_copy').innerHTML = 'To Submit this form to your candidate for additional comments, please provide information:';
	}
	else
	{
		document.getElementById('ext_copy').innerHTML = '';
	}

}

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 MM_displayStatusMsg(msgStr) { //v1.0
	status=msgStr;
	document.MM_returnValue = true;
}

function swLayer(){
	var i,p,v,obj,args=swLayer.arguments;
	for(i=0;i<(args.length-1);i+=2){
	if((obj=MM_findObj(args[i]))!=null){
	v=args[i+1];if(obj.style){
	obj=obj.style;v=(v=='show')?'visible':(v='hide')?'hidden':v;}}
	obj.visibility=v;}
}

function dispLayer(){
	var i,p,v,obj,args=dispLayer.arguments;
	for(i=0;i<(args.length-1);i+=2){
	if((obj=MM_findObj(args[i]))!=null){
	v=args[i+1];if(obj.style){
	obj=obj.style;v=(v=='block')?'block':'none';}}
	obj.display=v;}
}

function checkOther(el){
	//alert(el[el.selectedIndex].value);
	if(el[el.selectedIndex].value == "Other"){
		dispLayer("other","block")
	}else{
		dispLayer("other","none")
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
	var w = window.open(theURL,winName,features);
	w.focus();
}

function Scroll(LPos){
	var obj = MM_findObj('scroll');
	LPos = -1*(LPos-1)*siteOffset;
	nmoveScroll(obj,LPos)
}

function sScroll(LPos){
	var obj = MM_findObj('s_scroll');
	LPos = -1*(LPos-1)*siteOffset;	
	smoveScroll(obj,LPos)
}

function nmoveScroll(obj,pos){
	if(obj != null) {
		window.nmoveScrollAgain=function() {
			var currPos = parseInt(obj.style.left);
			var posDiff = currPos-Math.abs(pos);
			posDiff = Math.floor(posDiff/jump);
			obj.style.left=posDiff+"px";
			if(currPos!=pos){
				setTimeout("nmoveScrollAgain()",40);
			}  
		}
		nmoveScrollAgain();
	}
}

function smoveScroll(obj,pos){
	if(obj != null) {
		window.smoveScrollAgain=function() {
			var currPos = parseInt(obj.style.left);
			var posDiff = currPos-Math.abs(pos);
			posDiff = Math.floor(posDiff/jump);
			obj.style.left=posDiff+"px";
			if(currPos!=pos){
				setTimeout("smoveScrollAgain()",40);
			}  
		}
		smoveScrollAgain();
	}
}

var nIndex = 1;
var sIndex = 1;
var timerID = null;
var stimerID = null;

function rotateNews(){
	var len = sites;
	if(nIndex > len)
		nIndex = 1;
	
	Scroll(nIndex);
	nIndex++;
	timerID = setTimeout('rotateNews()',2000);
}
function pauseNews() {
	if (timerID != null) {
		clearTimeout(timerID);
		timerID = null;
	}
}

function playNews() {
	if (timerID == null) {
		timerID = setTimeout('rotateNews()', 2000);
	}
}

function rotateSpotlight(){
	var len = spot;
	if(sIndex > len)
		sIndex = 1;
	
	sScroll(sIndex);
	sIndex++;
	stimerID = setTimeout('rotateSpotlight()',2800);
}
function pauseSpotlight() {

	if (stimerID != null) {
		clearTimeout(stimerID);
		stimerID = null;
	}
}


function playSpotlight() {
	if (stimerID == null) {
		stimerID = setTimeout('rotateSpotlight()', 2800);
	}
}