var DDSPEED = 10;
var DDTIMER = 15;
function direction(redirect,s)
{
/*for(var x=0;x<=s;x++)
{
 var st=String.fromCharCode(x);
 alert(st);
 //ddMenu(st,-1);
}*/
directs='window.location="'+redirect+'"; ';
 window.setTimeout(directs,700);
 
}
// main function to handle the mouse events //
function ddMenu(id,d){
  var h = document.getElementById(id + '-ddheader');
  var c = document.getElementById(id + '-ddcontent');
  clearInterval(c.timer);
  if(d == 1){
    clearTimeout(h.timer);
    if(c.maxh && c.maxh <= c.offsetHeight){return}
    else if(!c.maxh){
      c.style.display = 'block';
      c.style.height = 'auto';
      c.maxh = c.offsetHeight;
      c.style.height = '0px';
    }
    c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER);
  }else{
    h.timer = setTimeout(function(){ddCollapse(c)},50);
	
  }
}

// collapse the menu //
function ddCollapse(c){
  c.timer = setInterval(function(){ddSlide(c,-1)},DDTIMER);
  c.style.height = '0px';
}

// cancel the collapse if a user rolls over the dropdown //
function cancelHide(id){
  var h = document.getElementById(id + '-ddheader');
  var c = document.getElementById(id + '-ddcontent');
  clearTimeout(h.timer);
  clearInterval(c.timer);
  if(c.offsetHeight < c.maxh){
    c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER);
  }
}

// incrementally expand/contract the dropdown and change the opacity //
function ddSlide(c,d){
  var currh = c.offsetHeight;
  var dist;
  if(d == 1){
    dist = (Math.round((c.maxh - currh) / DDSPEED));
  }else{
    dist = (Math.round(currh / DDSPEED));
  }
  if(dist <= 1 && d == 1){
    dist = 1;
  }
  c.style.height = currh + (dist * d) + 'px';
  c.style.opacity = currh / c.maxh;
  c.style.filter = 'alpha(opacity=' + (currh * 100 / c.maxh) + ')';
  if((currh < 2 && d != 1) || (currh > (c.maxh - 2) && d == 1)){
    clearInterval(c.timer);
  }
}
// JavaScript Document
function date(){
var date = new Date();

var month=new Array(12);
month[0]="Jan";
month[1]="Feb";
month[2]="March";
month[3]="April";
month[4]="May";
month[5]="June";
month[6]="July";
month[7]="August";
month[8]="Sept";
month[9]="Oct";
month[10]="Nov";
month[11]="Dec";

var day=new Array(7);
day[0]="Sunday";
day[1]="Monday";
day[2]="Tuesday";
day[3]="Wednesday";
day[4]="Thursday";
day[5]="Friday";
day[6]="Saturday";
 
var date1 = date.getDate();
var day1 = day[date.getDay()];
var month1 = month[date.getMonth()];
var year = date.getFullYear();
document.write("Today is " + month1 + " " + date1 + ", " + year + " [ " + day1 + " ]");
}


function checkclear(word){
if(!word._haschanged){
  word.value=''
};
word._haschanged=true;
}

function checkblur(word){
if(word._haschanged&&word.value=='')
{word.value='Search';
 word._haschanged=false;}
else word._haschanged=true;
}

