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;
	}
}   
