function SetCriteria(tcCookie,tcName){
   	var lcValue=getCookie(tcCookie) ;
   	if (lcValue != null){
    	for (var i=0; i < eval(tcName+'.length'); i++) {
       		if (eval(tcName+'.options[i].text==lcValue') || eval(tcName+'.options[i].value==lcValue')){
          		eval(tcName+'.selectedIndex=i');
       		}
    	}   
   	}
}

function SetChkValue(tcCookie,tcName){
   var lcValue=getCookie(tcCookie) ;
   if (lcValue == 'Y') { (eval(tcName+'.checked=true'));}
}

function setCookieCheckbox(tcName, frmCheckBox) {
	var today = new Date();
	var expires = new Date();
   	expires.setTime(today.getTime() + 1000*60*60*24*365);
	if (eval("document.forms[0]."+frmCheckBox+".checked")){
	   	document.cookie = tcName + "=" + escape('Y') + "; expires=" + expires.toGMTString();
	}
	else{
		document.cookie = tcName + "=" + escape('N') + "; expires=" + expires.toGMTString();
	}
}

function setCookie(name, value){
	var today = new Date();
	var expires = new Date();
   	expires.setTime(today.getTime() + 1000*60*60*24*365);
   	document.cookie = name + "=" + escape(value) + "; expires=" + expires.toGMTString()+"; path=/"
}

function getCookie(Name) {
   var search = Name + "="
   if (document.cookie.length > 0) { // if there are any cookies
      offset = document.cookie.indexOf(search) 
      if (offset != -1) { // if cookie exists 
         offset += search.length 
         // set index of beginning of value
         end = document.cookie.indexOf(";", offset) 
         // set index of end of cookie value
         if (end == -1) 
            end = document.cookie.length
         return unescape(document.cookie.substring(offset, end))
      } 
   }
}

// name - name of the cookie
// [path] - path of the cookie (must be same as path used to create cookie)
// [domain] - domain of the cookie (must be same as domain used to create cookie)
// * path and domain default if assigned null or omitted if no explicit argument proceeds
function deleteCookie(name, path, domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" + 
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

// date - any instance of the Date object
// * hand all instances of the Date object to this function for "repairs"
function fixDate(date) {
  var base = new Date(0);
  var skew = base.getTime();
  if (skew > 0)
    date.setTime(date.getTime() - skew);
}