 var browser = new Array(3);
 var onLoads = new Array();
 var onReflows = new Array();
 var drawWindowArray = new Array();

 if(navigator.platform.match(/win/i))
  browser[2]="win";
 else if(navigator.platform.match(/mac/i))
  browser[2]="mac";
 else
  browser[2]="x";

 var permMonth='';

 if(navigator.appName=="Netscape")
 {
   browser[0]="ns";
   browser[1]=parseInt(navigator.appVersion);
 }
 else if(navigator.appName=="Microsoft Internet Explorer")
 {
  browser[0]="ie";
  string=navigator.appVersion;
  match=string.match(/MSIE ([0-9]+\.[0-9]+)/);
  browser[1]=match[1];
 }
 if(browser[1] < 5)
 {
  window.location.href='http://www.browser.thesmallbox.com';
 }
 function array_push(array, Element)
 {
  if(array.length == 1 && !array[0]) 
   New = 0;
  else
   New = array.length;
  array[New] = Element;
  return array;
 }

 function shower_swap()
 {
  for (var i=0; i<shower_swap.arguments.length; i+=2)
  {
   document[shower_swap.arguments[i]].src = shower_swap.arguments[i+1];
  }
 }
 function png_on(thisId, rollImage)
 {
//  if(!document[thisId])
//  return false;
 if(browser[0] =='ie' && browser[1] >=5.5 && browser[2]=='win')
 {
  document.all[thisId].style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+rollImage+"', sizingMethod='scale')"
 }
 else
 {
  thisId+='_img';
  document[thisId].src=rollImage;
 }
 }
function png_off(thisId, rollImage)
{
 if(browser[0]=='ie' && browser[1] >=5.5 && browser[2]=='win')
 document.all[thisId].style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+rollImage+"', sizingMethod='scale')"
 else
 {
  thisId+='_img';
  document[thisId].src=rollImage;
 }
}

 function centerObj(thisId)
 {
  thisId.style.top  = document.body.scrollTop + (document.body.clientHeight / 2) - (thisId.offsetHeight/2);
  thisId.style.left = document.body.scrollLeft + (document.body.clientWidth / 2) - (thisId.offsetWidth/2);
 }
 function rightObj(Obj1, Obj2)
 {
  Obj2.style.left = getLeft(Obj1) + Obj1.offsetWidth;
  Obj2.style.top = getTop(Obj1) ;
 }

function getTop(thisId)
{
 thisTop=0;
 if(thisId.nodeName == 'TD' && browser[0] == 'ie' && browser[2] == 'mac')
 {
  while(thisId.nodeName != 'TR')
   thisId = thisId.parentNode;  
 }
 while(thisId.offsetParent)
  {
   thisTop+= thisId.offsetTop;
   thisId=thisId.offsetParent;
  }
  return thisTop;
}

function getLeft(thisId)
{
 thisLeft=0;
 if(thisId.nodeName == 'TD' && browser[0] == 'ie' && browser[2] == 'mac')
 {
  while(thisId.nodeName != 'TR')
   thisId = thisId.parentNode;  
 }
 while(thisId.offsetParent)
  {
   thisLeft+= thisId.offsetLeft;
   thisId=thisId.offsetParent;
  }
  return thisLeft;
}

function setOpacity(Obj, Level)
{
 if(browser[0] == 'ns')
  Obj.style.MozOpacity=Level / 100;
 else if(browser[2]!='mac')
  Obj.style.filter='alpha(opacity='+Level+')';
}

function open_it(Link, Name, Size)
{
 window.open(Link, Name, Size);
}


function getCookie(Variable)
{   
 temp = document.cookie.split(';');
 for(i=0; i< temp.length;i++)
 {
  temp2=temp[i].split('=');
  if(trim(temp2[0])==Variable)
   return temp2[1];
 }
 return false;
}

function trim(Str)
{   
 return Str.replace(/^[ ]+|[ ]+$/, '');
}   

function nsFlashVer()
{
 if (navigator.plugins != null && navigator.plugins.length > 0)
 {
  var flashPlugin = navigator.plugins['Shockwave Flash'];
  if (typeof flashPlugin == 'object')   
  {
   Ver = flashPlugin.description.split(' ');
   return  Ver[2];
  }
 }
 else
 return 6.0;
}

function colorChange(thisId, Color)
{
  thisId.style.backgroundColor = Color;
}

function urlChange(URL)
{
 window.location.href=URL;
}


function loadEvent()
{
 if(!onLoads)
  return false;
 for(var i =0; i < onLoads.length; i++)
 {
  eval(onLoads[i]);
 }
}
window.onload = loadEvent;

function reflowEvent()
{

}

function maxLength(thisId, Max)
{
 if(thisId.value.length  >= Max)
  thisId.value = thisId.value.substr(0, Max);
}
function formEnter(evt, Func)
{
 if(browser[0] == 'ie')
  if(event.keyCode==13)
   eval(Func);
 if(browser[0] == 'ns')
  if(evt.keyCode==13)
   eval(Func);
}

function number_format(num, decimal) {
 var str = "" + Math.round(num * Math.pow(10, decimal));
 while(str.length <= decimal) {
  str = "0" + str;
 }
 var position = str.length - decimal;
 return str.substr(0, position)+"."+str.substr(position, str.length);
}

function iePNG(thisId) {
 if(browser[0] == 'ie' && browser[2]=='win') {
  DIV  = thisId.parentNode;	
  DIV.style.height = thisId.offsetHeight;
  DIV.style.width  = thisId.offsetWidth;
  DIV.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+thisId.src+"', sizingMethod='scale')";
 }
 else
  thisId.style.visibility = 'visible';
}

function undrawWindow()
{
 ieLayerOff()
 if(!drawWindowArray)
  return false;
 document['onkeypress']='';
 for(var f=0; f < drawWindowArray.length; f++) {
  document.getElementById(drawWindowArray[f]).style.visibility='hidden';
 }
}

function drawWindowOn(Win) {
 if(ieLayerOn()) {
  document['onkeypress']=escapeWin;
  Win.style.visibility='visible';
 }
}

function escapeWin(evt)
{
 if(browser[0] == 'ie')
  if(event.keyCode==27)
   undrawWindow();
 if(browser[0] == 'ns')
  if(evt.keyCode==27)
   undrawWindow();
}

