function isEmpty( inputStr ) {
   result = ( null == inputStr || "" == inputStr )
   return result; 
}

function showsub(){
   hoveron('hover_3');
   if (document.all){
      sub_product.style.visibility = "visible";
      product.style.height = "170px";
   } 
   else{
	  document.getElementById("sub_product").style.visibility = "visible";
	  document.getElementById("product").style.height = "170px";
   }
}

function hidesub(){
   hoveroff('hover_3');
   if (document.all){
      sub_product.style.visibility = "hidden";
      product.style.height = "62px";
   }
   else{
      document.getElementById("sub_product").style.visibility = "hidden";
      document.getElementById("product").style.height = "62px";
   }
}

function hoveron(objid){
	obj = chosediv(objid);
	obj.style.backgroundImage = "url(images/" + objid + ".gif)";
}
function hoveroff(objid){
	obj = chosediv(objid);
	obj.style.backgroundImage = "url()";
}



var currentdiv, id = 0;
var step, steptop, stepleft, stepfsize, stepcur;
var top, left, fsize;

function showing(){
   currentdiv = chosediv("spot");
   currentdiv.style.visibility = "visible";
   currentdiv.innerHTML = showdata[id][0];
   initialize (showdata[id][1], showdata[id][2], showdata[id][3], showdata[id][4], showdata[id][5], showdata[id][6], showdata[id][7])
   movestep();
}

function initialize(topf, topl, leftf, leftl, fsizef, fsizel, stp){
   steptop = (topl - topf) / stp;
   stepleft = (leftl - leftf) / stp;
   stepfsize = (fsizel - fsizef) / stp;
   step = stp;
   stepcur = 0;
   top = topf;
   left = leftf;
   fsize = fsizef;
}

function movestep(){
   top = top + steptop 
   left = left + stepleft
   fsize = fsize + stepfsize
   currentdiv.style.top = parseInt(top) + "px";
   currentdiv.style.left = parseInt(left) + "px";
   currentdiv.style.fontSize = parseInt(fsize) + "pt";
   stepcur = stepcur + 1;
   if (stepcur > step) { 
      if (id < 4 ) {
   	     id = id + 1;
	  }
	  else{
	     id = 0;
	  }
	  setTimeout("showing()",1500);
   }
   else{
      setTimeout("movestep()",50);
   }
}

function chosediv(divid){
   var docall = document.all;
   var doclyr = document.layers;
   var docbyid = document.getElementById&&!document.all;

   if (docbyid)
   	  var el = document.getElementById(divid);
   else if (docall)
      var el = document.all[divid];
   else if (doclyr)
      var el = document.layers[divid];
   
   return el;
}

var images = new Array("images/anime/1.gif","images/anime/2.gif","images/anime/3.gif","images/anime/4.gif","images/anime/5.gif","images/anime/6.gif","images/anime/7.gif","images/anime/8.gif");
var animecount = 0;
var animeid = 0;

var animedivA, animedivB, imgA, imgB, imgC;
var opval = 0;
var testdiv;

function anime(){
   var i = 0;
   imageObj = new Image();

   for(i=1; i<=8; i++) {
      imageObj.src=images[i];
   }
   animedivA = chosediv("header_anime_A");
   animedivB = chosediv("header_anime_B");
   animecount = -1;
   animedivA.style.background = "url(" + images[0] +") no-repeat";
   setTimeout("animestep()",1);
}

function opacity(obj, step){
   // obj.style.MozOpacity -= step/10
    obj.style.opacity = step/100
	//obj.style.filters.alpha.opacity -= step*10
}

function animestep(){
   if (animecount<3){
      animecount++;
   }
   else{
      animecount=0;
   }
   animeid = animecount * 2;
	
   faderimg = new Array( images[animeid], images[animeid+1], images[((animeid+3)%8)], images[((animeid+2)%8)]);
   setTimeout("fadestart()",5000);
}

var fadestep = -1;
var divselect = -1;

function fadestart(){
   divselect = (divselect+1)%2;
   if (divselect == 0) {
      fadeFrom = animedivA;
	  fadeTo = animedivB;
   }
   else{
      fadeFrom = animedivB;
	  fadeTo = animedivA;
   }
   fadestep++;
   if (fadestep<3){
      //   fadeTo.style.opacity = 0;
      fadeTo.style.background = "url(" + faderimg[fadestep+1] +") no-repeat";
	  opval = 0;

	  setTimeout("fade()",1);
   }
   else{
      fadestep = -1;
	  setTimeout("animestep()",1);
   }
}

function fade(){
   opval += 5
   if (opval<101){
      opacity(fadeFrom, 100-opval)
      opacity(fadeTo, opval)
      setTimeout("fade()",100);
   }
   else{
      setTimeout("fadestart()",100); 
   }
}


function startonload(){
   imageObj = new Image();
   imageObj.src = "images/hover_1.gif";
   imageObj.src = "images/hover_2.gif";
   imageObj.src = "images/hover_3.gif";
   imageObj.src = "images/hover_4.gif";
   imageObj.src = "images/button_red.gif"; 
   
   if(typeof menuload == 'function') menuload(); // alternate test --> if (window.menuLoad)
   showing();
   anime();
   if(typeof slogan == 'function') slogan();
}
