var currentNav=-1;
var x,y;
var clockTimer;
function getWindowWidth()
{
  if (self.innerHeight) // all except Explorer
  {
    x = self.innerWidth;
    y = self.innerHeight;
  }
  else if (document.documentElement && document.documentElement.clientHeight)
    // Explorer 6 Strict Mode
  {
    x = document.documentElement.clientWidth;
    y = document.documentElement.clientHeight;
  }
  else if (document.body) // other Explorers
  {
    x = document.body.clientWidth;
    y = document.body.clientHeight;
  }
}
function blueBox(imgID,state)
{
  var d = document.getElementById(imgID);
  if (state == "over") { swapImage(imgID,"images/nav/nav-box-grey.gif"); }
  else { swapImage(imgID,"images/nav/nav-box-line.gif"); }
}
function getClockTime()
{
   var now    = new Date();
   var hour   = now.getHours();
   var minute = now.getMinutes();
   var second = now.getSeconds();
   if (hour   == 0) { hour = 12;             }
   if (hour   < 10) { hour   = "0" + hour;   }
   if (minute < 10) { minute = "0" + minute; }
   if (second < 10) { second = "0" + second; }
   var timeString = hour + ':' + minute + ':' + second;
   return timeString;
}
function showTime()
{
	//alert('time');
	//window.clearTimeout(clockTimer);
  document.getElementById("myTime").value = getClockTime();
  //clockTimer = setTimeout("showTime()",1000);
}
function showClock(timer)
{
	setInterval("showTime()",timer);
}
function fadeImage(which,newImage,delay)
{
  if (document.all && window.print)
  {
    if (delay == null) { delay = 1; }
    document.getElementById(which).style.filter="blendTrans(duration="+delay+")";
    document.getElementById(which).filters.blendTrans(duration=delay).Apply();
    document.getElementById(which).filters.blendTrans.Play();
  }
  document.getElementById(which).src = siteDir+newImage;
}
function swapImage(which,newImage) { document.getElementById(which).src = siteDir+newImage; }
function topNavOver(which,page) { if (("img"+page) != which) { fadeImage(which,"images/nav/"+which+"-on.gif",0.5); } }
function topNavOff(which,page)
{
  if (page == "" && which == "imghome") { fadeImage(which,"images/nav/"+which+"-orig.gif"); }
  else if (("img"+page) != which) { fadeImage(which,"images/nav/"+which+"-off.gif"); }
}
function topNavOverNoFade(which,page) { if (("img"+page) != which) { swapImage(which,"images/nav/"+which+"-on.gif",0.5); } }
function topNavOffNoFade(which,page)
{
  if (page == "" && which == "imghome") { swapImage(which,"images/nav/"+which+"-orig.gif"); }
  else if (("img"+page) != which) { swapImage(which,"images/nav/"+which+"-off.gif"); }
}
function MM_preloadImages()
{ //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=siteDir+a[i];}}
}
function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}
function init()
{
  MM_preloadImages('images/nav/imghome-on.gif','images/nav/imgabout-on.gif','images/nav/imgtutorials-on.gif','images/nav/imgwork-on.gif','images/nav/imglogin-on.gif','images/nav/imgnews-on.gif','images/nav/imgservices-on.gif','images/nav/imgcontact-on.gif','images/nav/nav-box-grey.gif','images/nav/nav-box-blue.gif');
}
function initwork()
{
  MM_preloadImages('images/nav/imghome-on.gif','images/nav/imgabout-on.gif','images/nav/imgtutorials-on.gif','images/nav/imgwork-on.gif','images/nav/imglogin-on.gif','images/nav/imgnews-on.gif','images/nav/imgservices-on.gif','images/nav/imgcontact-on.gif','images/nav/nav-box-grey.gif','images/nav/nav-box-blue.gif','images/work/laptop_top.jpg','images/work/laptop_left.jpg','images/work/laptop_right.jpg','images/work/laptop_bottom.jpg','flash/laptop.swf','flash/close-laptop.swf');
  drawAnimation();
}
function pausecomp(millis)
{
  date = new Date();
  var curDate = null;

  do { var curDate = new Date(); }
  while(curDate-date < millis);
}
function clientJobReact(id)
{
  if (document.getElementById("divJob"+id))
  {
    d = document.getElementById("divJob"+id);
    if (d.style.display == "none") { d.style.display = "block"; }
    else if (d.style.display == "block") { d.style.display = "none"; }
  }
}
function hov(loc,cls) { if (loc.className) { loc.className=cls; } }
