var layerStyleRef, layerRef, styleSwitch, useHeight, layerHeight;
var waitForMove, waitTime, speed, opacity, start, topValue;


if (document.layers) {
  layerStyleRef="layer.";
  layerRef="document.layers";
  styleSwitch="";
  useHeight=innerHeight-390;
  layerHeight=innerHeight-260;
  speed=50;
  waitTime=1;
  opacity=".style.MozOpacity"
  step=0.1;
  start=0.1;
  topValue=1;
}
else if(document.all){
  layerStyleRef="layer.style.";
  layerRef="document.all";
  styleSwitch=".style";
  useHeight=(window.screen.availHeight-window.screenTop-400);
  layerHeight=(window.screen.availHeight-window.screenTop-260);
  speed=5;
  waitTime=1000;
  opacity=".filters.alpha.opacity";
  step=4;
  start=10;
  topValue=100;
}
else if(document.getElementById){
  layerStyleRef="layer.style.";
  layerRef="document.getElementById";
  styleSwitch=".style";
  useHeight=innerHeight-390;
  layerHeight=innerHeight-230;
  speed=50;
  waitTime=1;
  opacity=".style.MozOpacity"
  step=0.1;
  start=0.1;
  topValue=1;
}

function showHide(elem){
  if(eval(layerRef + '("' + elem + '")' + styleSwitch + '.display=="none"'))
    eval(layerRef + '("' + elem + '")' + styleSwitch + '.display="block"');
  else{
    eval(layerRef + '("' + elem + '")' + styleSwitch + '.display="none"')
  }
}


function showHideSubMenuDef(elem){
  if(elem !=''){
    for(var i=1;i<=6;i++){
      if(elem!='submenu'+i){
        eval(layerRef + '("submenu' + i + '")' + styleSwitch + '.display="none"');
        eval(layerRef + '("cat' + i + '")' + styleSwitch + '.borderTopWidth="0px"');
        eval(layerRef + '("cat' + i + '")' + styleSwitch + '.borderBottomWidth="0px"');
        eval(layerRef + '("cat' + i + '")' + styleSwitch + '.borderRightWidth="1px"');
      }
      else{
        eval(layerRef + '("submenu' + i + '")' + styleSwitch + '.display="block"')
        eval(layerRef + '("cat' + i + '")' + styleSwitch + '.borderTopWidth="1px"');
        eval(layerRef + '("cat' + i + '")' + styleSwitch + '.borderBottomWidth="1px"');
        eval(layerRef + '("cat' + i + '")' + styleSwitch + '.borderRightWidth="0px"');
      }
    }
  }
  else{
    for(var i=1;i<=7;i++){
      eval(layerRef + '("submenu' + i + '")' + styleSwitch + '.display="none"');
    } 
  }
}



function showHideSubMenu(elem){
  if(elem !=''){
    for(var i=1;i<=6;i++){
      if(elem!='submenu'+i){
        eval(layerRef + '("submenu' + i + '")' + styleSwitch + '.display="none"');
        eval(layerRef + '("cat' + i + '")' + styleSwitch + '.borderTopWidth="0px"');
        eval(layerRef + '("cat' + i + '")' + styleSwitch + '.borderBottomWidth="0px"');
        eval(layerRef + '("cat' + i + '")' + styleSwitch + '.borderRightWidth="1px"');
        eval(layerRef + '("imgCat' + i + '").src="images/plus.gif"');
      }
      else{
        eval(layerRef + '("submenu' + i + '")' + styleSwitch + '.display="block"')
        eval(layerRef + '("cat' + i + '")' + styleSwitch + '.borderTopWidth="1px"');
        eval(layerRef + '("cat' + i + '")' + styleSwitch + '.borderBottomWidth="1px"');
        eval(layerRef + '("cat' + i + '")' + styleSwitch + '.borderRightWidth="0px"');
        eval(layerRef + '("imgCat' + i + '").src="images/minus.gif"');
      }
    }
  }
  else{
    for(var i=1;i<=7;i++){
      eval(layerRef + '("submenu' + i + '")' + styleSwitch + '.display="none"');
    } 
  }
}


function moveArrow(leftPos, imgWidth, barWidth){
    clearInterval(waitForMove);
    eval(layerRef + '("navArrow")' + styleSwitch + '.left='+leftPos);
    eval(layerRef + '("navImage").width=0');
    if (imgWidth==barWidth)
      eval(layerRef + '("navImage").width=' + imgWidth);
    else
      setBarWidth(imgWidth,0);
}

var barWidth, setBarWidthvar=0;

function setBarWidth(imgWidth,barWidth){
  if(barWidth<=imgWidth){
    eval(layerRef + '("navImage").width='+barWidth);
    barWidth=barWidth+3;
    varsetBarWidthvar=setTimeout("setBarWidth("+imgWidth+","+barWidth+")",0);
  }
  else{
    clearTimeout(setBarWidthvar);
    barWidth=0;
  }
}

iens6=document.all||document.getElementById
ns4=document.layers



function movedown(){
if (iens6&&parseInt(crossobj.style.top)>=(contentheight*(-1)+100)){
  crossobj.style.top=parseInt(crossobj.style.top)-speed
  if(crossobj.style.top!='0px')
    eval(layerRef + '("topPage")' + styleSwitch + '.display="block"');
}
else if (ns4&&crossobj.top>=(contentheight*(-1)+100)){
  crossobj.top-=speed
  if(crossobj.top!='0')
    eval(layerRef + '("topPage")' + styleSwitch + '.display="block"');
}
movedownvar=setTimeout("movedown()",20)
}

function moveup(){
if (iens6&&parseInt(crossobj.style.top)<0){
  crossobj.style.top=parseInt(crossobj.style.top)+speed;
  if(crossobj.style.top=='0px')
    eval(layerRef + '("topPage")' + styleSwitch + '.display="none"');
}
else if (ns4&&crossobj.top<=0){
  crossobj.top+=speed;
  if(crossobj.top=='0')
    eval(layerRef + '("topPage")' + styleSwitch + '.display="none"');
}
moveupvar=setTimeout("moveup()",20)

//
}




function moveto(movePos){
//stopscroll()
  if (iens6)
    crossobj.style.top=movePos+"px"
    crossobj.top=movePos
  if(movePos==0)
    eval(layerRef + '("topPage")' + styleSwitch + '.display="none"');
  else
    eval(layerRef + '("topPage")' + styleSwitch + '.display="block"');
}


function getcontent_height(){
if (iens6){
  contentheight=crossobj.offsetHeight-useHeight
  if (contentheight+useHeight>layerHeight){
    eval(layerRef + '("scrollArrows")' + styleSwitch + '.display="block"');
    //eval(layerRef + '("container")' + styleSwitch + '.height=' +(contentheight+useHeight));
  }
}
else if (ns4){
  document.nscontainer.document.nscontent.visibility="show"
  eval(layerRef + '("scrollArrows")' + styleSwitch + '.display="block"');
}
}


function setStatusText(Text){
  window.status = Text;
  return true;
}

function incOpacity(ref){
  eval(layerRef + '("' + ref + '")'+ opacity +'='+topValue);
}

function decOpacity(ref){
  eval(layerRef + '("' + ref + '")'+ opacity +'='+start);
}

/*
function checkEmail(value){
 var apos, dotpos, valueLength
 apos=value.indexOf("@"); 
 dotpos=value.lastIndexOf(".");
 valueLength=value.length-1;
 if (apos<1 || dotpos-apos<2 || valueLength-dotpos>3 || valueLength-dotpos<2)
   return false;
 else 
  return true;
} 
*/

function checkEmail(string) {
  if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
    return true;
  else
    return false;
}



String.prototype.trim=function(){
    return this.replace(/(^\s*)|(\s*$)/g,"");
}


/*
function trim(s) {
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;
}
*/



function inputClick(objectName){
  if( (objectName.style.color != 'black')  ){
    objectName.value="";
    objectName.style.color="black";
  }
}