var msg="";
var whitespace = " \t\n\r";   // whitespace characters
var giSliderTimer = 4000;
var giBwsrWidth;
var giBwsrHeight;

function clickIE ()
{
 if(document.all)
 {
  (msg);
  return false;
 }
}

function clickNS (e)
{
 if(document.layers||(document.getElementById&&!document.all))
 {
  if (e.which==2||e.which==3)
  {
   (msg);
   return false;
  }
 }
}

/*
if(document.layers) 
{
 document.captureEvents(Event.MOUSEDOWN);
 document.onmousedown=clickNS;
}
else
{
 document.onmouseup=clickNS;
 document.oncontextmenu=clickIE;
}

document.oncontextmenu = new Function("return false");
*/

function hidestatus ()
{
 window.status='';
 return true;
}

if (document.layers)
 document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)

document.onmouseover=hidestatus;
document.onmouseout=hidestatus;

function isEmpty (sStr)
{
 return ((sStr == null) || (sStr.length == 0))
}

/***********************************************
popup window for contact us
***********************************************/

function open_contactus (shref)
{
 var sexturlwin;

 sexturlwin = window.open(shref, "exturlwin", "width=575,height=445,left=25,top=23,scrollbars=0,resizable=0,location=0,toolbar=0,menubar=0");
 sexturlwin.focus();
}

/***********************************************
popup window to go to external url
***********************************************/

function open_window (shref)
{
 var sexturlwin;

 sexturlwin = window.open(shref, "exturlwin", "width=850,height=669,left=25,top=23,menubar=1,scrollbars=1,resizable=1,location=1,toolbar=1,status=1");
 sexturlwin.focus();
}

/***********************************************
get inner dimension of user's browser
***********************************************/

function getbrowsersize()
{
 var iWidth = 0, iHeight = 0;
 if( typeof( window.innerWidth ) == 'number' )
 {//Non-IE
  giBwsrWidth = window.innerWidth;
  giBwsrHeight = window.innerHeight;
 }
 else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
 {//IE 6+ in 'standards compliant mode'
  giBwsrWidth = document.documentElement.clientWidth;
  giBwsrHeight = document.documentElement.clientHeight;
 }
 else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
 {//IE 4 compatible
  giBwsrWidth = document.body.clientWidth;
  giBwsrHeight = document.body.clientHeight;
 }

// window.alert( 'Width = ' + myWidth );
// window.alert( 'Height = ' + myHeight );
}

/***********************************************
expand and collapse content
http://www.dustindiaz.com/dhtml-expand-and-collapse-div-menu/
http://webdesign.about.com/od/dhtml/a/aa101507.htm
***********************************************/

function expandcollapse(thistag)
{
 styleObj=document.getElementById(thistag).style;

 if(styleObj.display==='none')
 {
  styleObj.display='block';
  
 }
 else
 {styleObj.display='none';}
}

function toggleSlideDisappear(objname,obj2name)
{
 if(document.getElementById(objname).style.display == "none")
 {
  // div is hidden, so let's slide down
  //slideup(obj2name);
  document.getElementById(obj2name).style.display = "none";
  document.getElementById(objname).style.display = "block";
 }
 else
 {
  // div is not hidden, so slide up
  slideup(objname);
 }
}

/***********************************************
* Switch Menu script- by Martial B of http://getElementById.com/
* Modified by Dynamic Drive for format & NS4/IE4 compatibility
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var persistmenu="yes" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only

if (document.getElementById)
{ //DynamicDrive.com change
 document.write('<style type="text/css">\n')
 document.write('.submenu{display: none;}\n')
 document.write('</style>\n')
}

function SwitchMenu(obj)
{
 if(document.getElementById)
 {
  var el = document.getElementById(obj);
  var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change

  if(el.style.display != "block")
  { //DynamicDrive.com change
   for (var i=0; i<ar.length; i++)
   {
    if (ar[i].className=="submenu") //DynamicDrive.com change
     ar[i].style.display = "none";
   }
	el.style.display = "block";
  }
  else
  {el.style.display = "none";}
 }
}

function get_cookie(Name)
{ 
 var search = Name + "="
 var returnvalue = "";

 if (document.cookie.length > 0)
 {
  offset = document.cookie.indexOf(search)

  if (offset != -1)
  { 
   offset += search.length
   end = document.cookie.indexOf(";", offset);

   if (end == -1) end = document.cookie.length;
    returnvalue=unescape(document.cookie.substring(offset, end))
  }
 }

 return returnvalue;
}

function onloadfunction()
{
 if (persistmenu=="yes")
 {
  var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
  var cookievalue=get_cookie(cookiename)

  if (cookievalue!="")
   document.getElementById(cookievalue).style.display="block"
 }
}

function savemenustate()
{
 var inc=1, blockid=""

 while (document.getElementById("sub"+inc))
 {
  if (document.getElementById("sub"+inc).style.display=="block")
  {
   blockid="sub"+inc
   break
  }

  inc++
 }

 var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
 var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid

 document.cookie=cookiename+"="+cookievalue
}

if (window.addEventListener)
window.addEventListener("load", onloadfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", onloadfunction)
else if (document.getElementById)
window.onload=onloadfunction

//if (persistmenu=="yes" && document.getElementById)
//window.onunload=savemenustate

/********************* end sub menu **************************/


