//reloads the window if Nav4 resized
function MM_reloadPage(init) {
  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);
//-->


//layer compensator for ie/nn
layerRef = ""
styleRef = ""

if ((navigator.appName=="Netscape")&&(parseInt(navigator.appVersion)==4)){
  layerRef = ".layers"
  styleRef = ""
  }

else if (navigator.appName=="Mozilla") {
  layerRef = ".getElementById"
  styleRef = ".style"
  }

else {
  layerRef = ".all"
  styleRef = ".style"
  }

function showLayer(search) {
  eval( "document" + layerRef + "[search]" + styleRef  + ".visibility = 'visible'")
  }

function hideLayer(search) {
  eval( "document" + layerRef + "[search]" + styleRef + ".visibility = 'hidden'")
  }


//image rollover engine

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.0
  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 && document.getElementById) x=document.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];}
}



// sets cursor focus on the popup search fields
function sf(){document.f.q.focus();}
// sets cursor focus on the main site search field
// function sf2(){document.globalSearch.q.focus();}


//email sign-up syntax validation script
function IsEmailValid(FormName,ElemName)
{
var EmailOk  = true
var Temp     = document.forms[FormName].elements[ElemName]
var AtSym    = Temp.value.indexOf('@')
var Period   = Temp.value.lastIndexOf('.')
var Space    = Temp.value.indexOf(' ')
var Length   = Temp.value.length - 1   // Array is from 0 to length-1

if ((AtSym < 1) ||                     // '@' cannot be in first position
    (Period <= AtSym+1) ||             // Must be atleast one valid char btwn '@' and '.'
    (Period == Length ) ||             // Must be atleast one valid char after '.'
    (Space  != -1))                    // No empty spaces permitted
   {  
      EmailOk = false
      alert('Please enter a valid e-mail address :)')
      Temp.focus()
   }
return EmailOk
}



// popup windows
function privacy() {
window.open('/privacy.html', 'popWindow', 'location=0,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=0,width=196,height=205');
}

function openwin(str) {
window.open(str,'popup','location=1,toolbar=1,status=1,menubar=1,scrollbars=1,resizable=1,height='+ (screen.availHeight * .65) + ',width=' + (screen.availWidth * .75) + ',top=50,left=30');
}


// breadcrumb naver
  function breadcrumbs(){
    sURL = new String;
    bits = new Object;
    var x = 0;
    var stop = 0;
    var output = "<b>&nbsp;you&nbsp;are&nbsp;here</b><img src=\"/assets/arw_r.gif\" width=\"9\" height=\"9\" border=\"0\" hspace=\"5\" align=\"absmiddle\"><a href=\"/\">home</a>";
    var output2 = " &nbsp;...";
    var foo;

    sURL = location.href;
    sURL = sURL.slice(8,sURL.length);
    chunkStart = sURL.indexOf("/");
    sURL = sURL.slice(chunkStart+1,sURL.length)

    while(!stop){
      chunkStart = sURL.indexOf("/");
      if (chunkStart != -1){
        foo = sURL.slice(0,chunkStart);
        if (foo != "ys") {
          bits[x] = sURL.slice(0,chunkStart)
	  if (bits[x]=="cgi-ys") {
	        bits[x] = "jobs";
	  }
        }
        sURL = sURL.slice(chunkStart+1,sURL.length);
      }else{
        bits[x] = sURL; //NEW LINE HERE
	hasQS = bits[x].indexOf("?");
	if (hasQS != -1 && bits[x-1] == "jobs"){
        	bits[x] = bits[x].slice(0,hasQS+1);
	}
        var last = x;   //NEW LINE HERE
        stop = 1;
      }
      x++;
    }

    for(var i in bits){
      output += " &nbsp;:&nbsp; <a href=\"";
      for(y=1;y<x-i;y++){
        output += "../";
      }
      if (i != last) {                                 //NEW LINE HERE
        output += bits[i] + "/\">" + bits[i] + "</a>";
      }                                                //NEW LINE HERE
      else {
  		output += bits[i] + "\"></a>"; 
		if (bits[i].indexOf(".") != -1) {
  			output += bits[i].slice(0,bits[i].indexOf("."));
		} else {
  			output += bits[i];
		}
  		output += "";
	  }
    }
    document.write(output + output2);
  }


// print script for print version pages
function printWindow() {
bV = parseInt(navigator.appVersion);
if (bV >= 4) window.print();
}

  // this function is needed to work around 
  // a bug in IE related to element attributes
  function hasClass(obj) {
     var result = false;
     if (obj.getAttributeNode("class") != null) {
         result = obj.getAttributeNode("class").value;
     }
     return result;
  }   

 function stripe(id) {

    // the flag we'll use to keep track of 
    // whether the current row is odd or even
    var even = false;
  
    // if arguments are provided to specify the colours
    // of the even & odd rows, then use the them;
    // otherwise use the following defaults:
    var evenColor = arguments[1] ? arguments[1] : "#f1efe2";
    var oddColor = arguments[2] ? arguments[2] : "#F6F5E7";
  
    // obtain a reference to the desired table
    // if no such table exists, abort
    var table = document.getElementById(id);
    if (! table) { return; }
    
    // by definition, tables can have more than one tbody
    // element, so we'll have to get the list of child
    // &lt;tbody&gt;s 
    var tbodies = table.getElementsByTagName("tbody");

    // and iterate through them...
    for (var h = 0; h < tbodies.length; h++) {
    
     // find all the &lt;tr&gt; elements... 
      var trs = tbodies[h].getElementsByTagName("tr");
      
      // ... and iterate through them
      for (var i = 0; i < trs.length; i++) {

        // avoid rows that have a class attribute
        // or backgroundColor style
        if (! hasClass(trs[i]) &&
            ! trs[i].style.backgroundColor) {
 		  
          // get all the cells in this row...
          var tds = trs[i].getElementsByTagName("td");
        
          // and iterate through them...
          for (var j = 0; j < tds.length; j++) {
        
            var mytd = tds[j];

            // avoid cells that have a class attribute
            // or backgroundColor style
            if (! hasClass(mytd) &&
                ! mytd.style.backgroundColor) {
        
              mytd.style.backgroundColor =
                even ? evenColor : oddColor;
            
            }
          }
        }
        // flip from odd to even, or vice-versa
        even =  ! even;
      }
    }
  }
// -->

