// ========================================
//  Stylesheets
// Code retained in case there is a need for
// additional stylesheets
// ========================================
version=0;
if(navigator.appName.indexOf("Internet Explorer") != -1)
{
   temp=navigator.appVersion.split("MSIE");
   version=parseFloat(temp[1]);
}
if (version == 0) //NON IE browser will return 0
{
//   if (screen.width < 850){document.write('<link rel="stylesheet" href="standard.css" type="text/css" title="LowRes-Standard" />');}
//   else{document.write('<link rel="stylesheet" href="standard.css" type="text/css" title="HiRes-Standard" />');}
}
else
{
   if(screen.width < 850)
   {
      if(version == 6){document.write('<link rel="stylesheet" href="IE6.css" type="text/css" title="LowRes-IE6" />');}
      else{document.write('<link rel="stylesheet" href="IE7.css" type="text/css" title="LowRes-IE7" />');}
   }
   else
   {
      if(version == 7){document.write('<link rel="stylesheet" href="IE7.css" type="text/css" title="HiRes-IE7" />');}
      else{document.write('<link rel="stylesheet" href="IE6.css" type="text/css" title="HiRes-IE6" />');}
   }
}
// ========================================
//  Redirect
// ========================================
function goto_URL(object)
{
    window.location.href = object.options[object.selectedIndex].value;
}
// ========================================
// Clear prompt text in form field
// ========================================
function clickclear(thisfield, defaulttext)
{
   if (thisfield.value == defaulttext)
   {
      thisfield.value = "";
   }
}
// ========================================
//  Recall prompt text in form field
// ========================================
function clickrecall(thisfield, defaulttext)
{
   if (thisfield.value == "")
   {
      thisfield.value = defaulttext;
   }
}
// ========================================
//  Toggle element to display or not
// ========================================
function Toggle(item,graphicOpen,graphicClose,w1,h1,w2,h2)
{
   obj=document.getElementById(item);
   visible=(obj.style.display!="none")
   key=document.getElementById("x" + item);
   if (visible)
   {
      obj.style.display="none";
      // set session cookie
      document.cookie=item + "=none";
      key.innerHTML="<img src='images/" + graphicOpen + "' width='" + w1 + "' height='" + h1 + "' hspace='0' vspace='0' border='0' alt='' />";
   }
   else
   {
      obj.style.display="block";
      // set session cookie
      document.cookie=item + "=block";
      key.innerHTML="<img src='images/" + graphicClose + "' width='" + w2 + "' height='" + h2 + "' hspace='0' vspace='0' border='0' alt='' />";
   }
}

function HideThis(object)
{
   var hidebox = document.getElementById(object);
   hidebox.style.display = "none";
}
// ========================================
//  GetCookie - JavaScript Session Cookie
// ========================================
function GetCookie(Name)
{
   var search = Name + "="
   var returnvalue = "";
   if (document.cookie.length > 0)
   {
      offset = document.cookie.indexOf(search)
      // if cookie exists
      if (offset != -1)
      {
         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;
         returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
   return returnvalue;
}
// ========================================
//  Form field Limiter script- By Dynamic Drive
//  For full source code and more DHTML scripts,
//  visit http://www.dynamicdrive.com
//  This credit MUST stay intact for use
// ========================================
var ns6=document.getElementById&&!document.all
function restrictinput(maxlength,e,placeholder)
{
   if (window.event&&event.srcElement.value.length>=maxlength)
      return false
   else if (e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength)
   {
      var pressedkey=/[a-zA-Z0-9\.\,\/]/ //detect alphanumeric keys
      if (pressedkey.test(String.fromCharCode(e.which)))
         e.stopPropagation()
   }
}
function countlimit(maxlength,e,placeholder)
{
   var theform=eval(placeholder)
   var lengthleft=maxlength-theform.value.length
   var placeholderobj=document.all? document.all[placeholder] : document.getElementById(placeholder)
   if (window.event||e.target&&e.target==eval(placeholder))
   {
      if (lengthleft<0)
         theform.value=theform.value.substring(0,maxlength)
         placeholderobj.innerHTML=lengthleft
   }
}
function displaylimit(thename, theid, thelimit)
{
   var theform=theid!=""? document.getElementById(theid) : thename
   var limit_text='<span style="font-size:10px;" id="'+theform.toString()+'">'+thelimit+'</span><span style="font-size:10px;"> characters</span>'
   if (document.all||ns6)
      document.write(limit_text)
   if (document.all)
   {
      eval(theform).onkeypress=function(){ return restrictinput(thelimit,event,theform)}
      eval(theform).onkeyup=function(){ countlimit(thelimit,event,theform)}
   }
   else if (ns6)
   {
      document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true);
      document.body.addEventListener('keyup', function(event) { countlimit(thelimit,event,theform) }, true);
   }
}


