
var active ="";

function setCurrent(id){
   //swapImage(id)
   if (active != id){
      if (active.length > 0 ){
         if (document.all) { document.all[active].style.visibility = "hidden"; }
         if(document.layers){ document.layers[active].visibility = "hide";}
         if(document.getElementById) {document.getElementById(active).style.visibility='hidden';}
      }
   
      active = id;
   
      if (document.all) { document.all[active].style.visibility = "visible";}
      if(document.layers) { document.layers[active].visibility = "show" ;}
      if(document.getElementById) {document.getElementById(active).style.visibility='visible';}
   }
}






function ShowLayer(id) {

if (document.all) { document.all[active].style.visibility = "hidden"; }
if(document.layers){ document.layers[active].visibility = "hide";}
if(document.getElementById) {document.getElementById(active).style.visibility='hidden';}

active = id;

if (document.all) { document.all[active].style.visibility = "visible";}
if(document.layers) { document.layers[active].visibility = "show" ;}
if(document.getElementById) {document.getElementById(active).style.visibility='visible';}
}


function swapImage(sDiv) {
   var sExt = ".jpg";
   /*if (sDiv.indexOf("cafe")!=-1){
      sExt = ".gif";
   }*/
   if (sDiv.indexOf("contacts")!=-1){
      randVal = Math.ceil(rnd()*3);
      //alert (randVal);
      sDiv= sDiv+"0"+randVal;
      
   }
      document['brandImg'].src = "./images/brand"+sDiv+sExt
      return(false);
}

rnd.today=new Date();
rnd.seed=rnd.today.getTime();

function rnd() {
        rnd.seed = (rnd.seed*9301+49297) % 233280;
        return rnd.seed/(233280.0);
}

function simpleBrowserTest(){
var bname = navigator.appName;
   if (bname.search(/netscape/i) == 0)
      {
         returnStr ="ns";
      }
      else if (bname.search(/microsoft/i) == 0)
         {
         returnStr="msie";
         }
   else
      {
         returnStr="other";
      }
      return returnStr;
}

function writeBR(doc){
   
   if (simpleBrowserTest().indexOf("msie")!=-1){
      doc.open();
      doc.writeln("<br/><br/>");
      doc.close;
   }
}

function writeDynTable(doc){
   
   if (simpleBrowserTest().indexOf("msie")!=-1){
      doc.open();
      doc.writeln("<table border='0' cellspacing='0' cellpadding='0'>");
      doc.close;
   }else{
      doc.open();
       doc.writeln("<table width='450' border='0' cellspacing='0' cellpadding='0'>");
      doc.close;
   }
}
function swap(obj){
   sPath="";
   if (obj.src.indexOf("_gs.jpg") != -1){
      sPath = replace(obj.src, "_gs", "_c") 
      obj.src = sPath
      
   }else{
      sPath = replace(obj.src, "_c","_gs") 
      obj.src = sPath
   }
   if (sPath.indexOf("_c.jpg") != -1){
      //write the detail into the content area
      newArr = sPath.split("/");
      //alert(newArr[newArr.length-1]);
      setCurrent(newArr[newArr.length-1]);
   }
}

function replace(s, t, u) {
  /*
  **  Replace a token in a string
  **    s  string to be processed
  **    t  token to be found and removed
  **    u  token to be inserted
  **  returns new String
  */
  i = s.indexOf(t);
  r = "";
  if (i == -1) return s;
  r += s.substring(0,i) + u;
  if ( i + t.length < s.length)
    r += replace(s.substring(i + t.length, s.length), t, u);
  return r;
  }

 
