function bookmarkit(loc,title){
if (navigator.appName=="Netscape") {
alert('To bookmark this site, click Bookmarks | Add bookmark or press Ctrl+D.');
}
else if (parseInt(navigator.appVersion)>3) {
 window.external.AddFavorite(loc,title);
}

}

function emailtofriend(to,subject,body,url) {
var bodytext = body + " \n" + url;
  window.location = "mailto:" + to + "?subject=" + escape(subject) +  "&body=" + escape(bodytext);   
}



function downloadit(url) {
window.open(url);  
}

 function newWindow(file,name,h,w,scroll,resize,tool,dir,menu) {         
          LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
          TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
          settings ='height='+h+',width='+w+',top='+ TopPosition + ',left='+LeftPosition+',scrollbars='+scroll+',resizable='+resize+',toolbar='+tool+',directories='+dir+'no,menubar='+menu+''
          window.open(file,name,settings);
    }

function isValidEmail(e){
      var email          = e;
      var iAmpersandPos  = email.indexOf('@');
      var iPeriodPos     = email.lastIndexOf(".");
      var iEmailLength   = email.length;
 
      if ((iAmpersandPos > 0) && (iPeriodPos > iAmpersandPos) && ((iEmailLength - 1) > iPeriodPos) && ((iPeriodPos - iAmpersandPos) > 1)) {
        return true;
      }
      else
      {
        return false;   
      }
    }


function show(thistag){

if(thistag == 'a'){
document.getElementById('a').style.display='';
document.getElementById('b').style.display='none';
document.getElementById('c').style.display='none';
}

if(thistag == 'b'){
document.getElementById('a').style.display='none';
document.getElementById('b').style.display='';
document.getElementById('c').style.display='none';
}
if(thistag == 'c'){
document.getElementById('a').style.display='none';
document.getElementById('b').style.display='none';
document.getElementById('c').style.display='';
}

}

function checkForm(objForm){
  
         if (!isZIPCode(objForm.zip_code.value)){
            alert('ZIP code should be 5 digits in length.');
	    return false;
         }

         if (!isAreaCode(objForm.area_code.value)){
            alert('Area code should be 3 digits in length.');
	    return false;
         }

         return true;
}

       // Zip must be integer number 5 digits in len
       function isZIPCode(s){  
         if (isEmpty(s))  return true;
            return (isInteger(s) && ((s.length == 5)))
         }

      // Area Code must be integer number 3 digits in len
      function isAreaCode(s){  
         if (isEmpty(s))  return true;
            return (isInteger(s) && ((s.length == 3)))
      }

      // check for empty
      function isEmpty(s){
            return ((s == null) || (s.length == 0))
      }

      // check for only numbers in string
      function isInteger (s){
         var i;
         if (isEmpty(s)) 
             return false;

             // Search the string char by char until a non-numeric char is found.
            // When we do, return false; if we don't, return true.
            for (i = 0; i < s.length; i++)
            {   
              // Check that current character is number.
              var c = s.charAt(i);
              if (!isDigit(c)) return false;
            }
        // All characters are numbers.
        return true;
      }

  // check for digits only 
  function isDigit (c){
	return ((c >= "0") && (c <= "9"))
  }
	  
function validateEWFSurveyAnswers(idForm,bqNo,eqNo) 
	{ 
	var iTmp = 0;
	for (var q=bqNo;q<=eqNo;q++)
		{
		var  temp = "Q" + q;
		for(var i=0;i<idForm.elements[temp].length;i++) 
			{
			if (idForm.elements[temp][i].checked) 
				{
				iTmp++     
				}
			}
		if (iTmp==0) 
			{
			alert("Please select an answer for each question to proceed to the next page of the survey. Click 'OK' to return to the previous screen.")
			return false
			}
		iTmp = 0;
		}
	}   

// this is for the default page.
//var ar = new Array(); 
//var br = new Array(); 
//var cr = new Array(); 

//ar[0]="<td class='portletheader'>Vestibulum ante ipsum primis";
//br[0]="<p><font face='Arial, Helvetica' size='2'>DMX revises STEP program tiers.</font></p>";
//cr[0]="'>Learn More &gt;&gt;";

//ar[1]="<td class='portletheader'>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.";
//br[1]="<p><font face='Arial, Helvetica' size='2'>Emerging to report second quarter 2006 financial results</font></p>";
//cr[1]="'>Learn More &gt;&gt;";

//ar[2]="<td class='portletheader'>New Workforce Report";
//br[2]="<p><font face='Arial, Helvetica' size='2'>New report in the Emerging Workforce Study series&nbsp;discusses screening and assessment program use trends, along with employers' feelings&nbsp;about the&nbsp;interview process.</font></p>";
//cr[2]="'>Learn More &gt;&gt;";

var num=0;
var brow = navigator.appName;


function getRandomNum() {
num = (Math.floor(Math.random() * (ar.length - 0)) + 0);
}
 
function initgo(){  
  getRandomNum();

  if (brow != "Microsoft Internet Explorer"){
     itsNetscape();
  }else{
     go();
  }  
}

function go(){  
   flttgt.filters[0].Apply(); 
   flttgt.innerHTML ="<table><tr><td><img src='images/spacer.gif' border='0' width='228' height='1'></td></tr><tr>" + ar[num] + 
                     "</td></tr><tr><td class='portletbody'>" + br[num] + 
                     "</td></td></tr><tr><td class='portletbody' align='right'><a href='" + cr[num] +  "</a></td></tr><tr><td><img src='images/spacer.gif' border='0' width='228' height='1'></td></tr></TABLE>";
                     
flttgt.filters[0].Play(); 
   num++;
   if (num == ar.length) num = 0;

   if(ar.length > 1){
     timerID = setTimeout("go()", 10000);
  }                                
}



function itsNetscape(){
  getRandomNum();
  var obj=document.getElementById('flttgt');
  obj.innerHTML="<TABLE><tr><td><img src='images/spacer.gif' border='0' width='228' height='1'></td></tr><tr>" + ar[num] + 
                     "</td></tr><tr><td class='portletbody'>" + br[num] + 
                     "</td></td></tr><tr><td class='portletbody' align='right'><a href='" + cr[num] +  "</a></td></tr><tr><td><img src='images/spacer.gif' border='0' width='228' height='1'></td></tr></TABLE>";
}

function toggle(show, hide) 
	{
	if (show != '')
		{
		document.getElementById(show).style.display='inline';
		document.getElementById(show).style.visibility='visible'
		}

	if (hide != '')
		{
		document.getElementById(hide).style.display='none';
		document.getElementById(hide).style.visibility='hidden'
		}
	return false;
	}
