// special_functions.js
// functions for master header home page include
var pollCancel = false; 

    function validateOnlinePollForm(form) {                                                                   
        if (pollCancel) 
      return true; 
        else 
       return validateRequired(form); 
   } 

    function required () { 
     this.aa = new Array("answerId", "An answer to the Online Poll is required.", new Function ("varName", " return this[varName];"));
    } 


//<!-- FLASH w/AUDIO CONTROL BEGIN v1.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_controlShockwave(objStr,x,cmdName,frameNum) { //v3.0
  var obj=MM_findObj(objStr);
  if (obj) eval('obj.'+cmdName+'('+((cmdName=='GotoFrame')?frameNum:'')+')');
}
//Cookie function on home page
function setCookie(name, value, expires, path, domain, secure) {
   var curCookie = name + "=" + escape(value) +
       ((expires) ? "; expires=" + expires : "") +
       ((path) ? "; path=" + path : "") +
       ((domain) ? "; domain=" + domain : "") +
       ((secure) ? "; secure" : "");
   document.cookie = curCookie;
}
function getCookie(name) {
   var dc = document.cookie;
   var prefix = name + "=";
   var begin = dc.indexOf("; " + prefix);
   if (begin == -1) {
     begin = dc.indexOf(prefix);
     if (begin != 0) return null;
   } else
     begin += 2;
   var end = document.cookie.indexOf(";", begin);
   if (end == -1)
     end = dc.length;
   return unescape(dc.substring(begin + prefix.length, end)); } function fixDate(date) {
   var base = new Date(0);
   var skew = base.getTime();
   if (skew > 0)
     date.setTime(date.getTime() - skew); } // --> </SCRIPT>


function processCookie()
{
var now = new Date();
fixDate(now);

//now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000); 

//Set timeout to 30 minutes since the last visit
now.setMinutes(now.getMinutes() + 30);

homeVisits = getCookie("counter"); 
if (!homeVisits) {
   homeVisits = 1;
   document.write("<!-- -->");
} 
else {
   homeVisits = parseInt(homeVisits) + 1;
   document.write("<!--  -->"); 
}

setCookie("counter", homeVisits, now.toGMTString());
}

// Functions that are specific to single pages (mainly include jsp files) are moved here to facilitate the Java script move to external file
function openPopupExtraParams(name, url, height, width, menubar, location, toolbar, scrollbars, status, resizable){
	var tmpPopup; var strProperties = "menubar=" + menubar + ",location=" + location + ",toolbar=" + toolbar + ",scrollbars=" + scrollbars + ",status=" + status + ",resizable=" + resizable + ",width=" + width + ",height=" + height + ",left=0, top=0";
	tmpPopup = window.open(url, name, strProperties); tmpPopup.focus();
}

function openPopup(name, url, height, width, menubar, location, toolbar, scrollbars, status, resizable){
	var tmpPopup; var strProperties = "menubar=" + menubar + ",location=" + location + ",toolbar=" + toolbar + ",scrollbars=" + scrollbars + ",status=" + status + ",resizable=" + resizable + ",width=" + width + ",height=" + height + ",left=0, top=0";
	tmpPopup = window.open(url, name, strProperties); tmpPopup.focus();
}
function openWindow(url, name, width, height) {popupWin = window.open(url, name, "resizable=no,location=no,scrollbars=yes,width="+width+",height="+height); 
}

