var newwindow = 500;
var time = 3000;
var numofitems = 4;

function doors(index) {
  for (var i=1; i<= 4; i++){
    var shutdiv =eval("door"+i);
    if(index==i) {
      shutdiv.style.visibility='visible';
      if(i==1) {
		if(document.howtoorder.door_thickness.value=="1.375") {
		  all_doors.style.height='250px';
		  fire_types.style.visibility='hidden';
		  fire_div.style.height='0';
		} else {
		  all_doors.style.height='308px';
		  fire_types.style.visibility='visible';
		  fire_div.style.height='58px';
		}
        document.howtoorder.models[21].checked = true;
        document.howtoorder.sticking_options[0].checked = true;
		glass_sticking.style.visibility='hidden';
        panel_sticking.style.visibility='visible';
		panel_profiles.style.visibility='visible';
		panel_div.style.height='135px';
		glass_types.style.visibility='hidden';
		glass_div.style.height='0';
		louver_types.style.visibility='hidden';
		louver_div.style.height='0';

      } else if(i==2) {
        all_doors.style.height='160px';
        document.howtoorder.models[30].checked = true;
		document.howtoorder.sticking_options[4].checked = true;
		fire_types.style.visibility='hidden';
		fire_div.style.height='0';
        panel_sticking.style.visibility='hidden';
        glass_sticking.style.visibility='visible';
		panel_profiles.style.visibility='visible';
		panel_div.style.height='135px';
		glass_types.style.visibility='visible';
		glass_div.style.height='210px';
		louver_types.style.visibility='hidden';
		louver_div.style.height='0';
      } else if(i==3) {
        all_doors.style.height='160px';
        document.howtoorder.models[45].checked = true;
		document.howtoorder.sticking_options[4].checked = true;
		fire_types.style.visibility='hidden';
		fire_div.style.height='0';
        panel_sticking.style.visibility='hidden';
        glass_sticking.style.visibility='visible';
		panel_profiles.style.visibility='hidden';
		panel_div.style.height='0';
		glass_types.style.visibility='visible';
		glass_div.style.height='210px';
		louver_types.style.visibility='hidden';
		louver_div.style.height='0';
      } else if(i==4) {
        all_doors.style.height='160px';
        document.howtoorder.models[47].checked = true;
		document.howtoorder.sticking_options[0].checked = true;
		fire_types.style.visibility='hidden';
		fire_div.style.height='0';
        glass_sticking.style.visibility='hidden';
        panel_sticking.style.visibility='visible';
		panel_profiles.style.visibility='visible';
		panel_div.style.height='135px';
		glass_types.style.visibility='hidden';
		glass_div.style.height='0';
		louver_types.style.visibility='visible';
		louver_div.style.height='120';
      }
    } else {
      shutdiv.style.visibility='hidden';
    }

  }
}

//menu constructor
function menu(allitems,thisitem,startstate){ 
  callname= "gl"+thisitem;
  divname="subglobal"+thisitem;  
  this.numberofmenuitems = 4;
  this.caller = document.getElementById(callname);
  this.thediv = document.getElementById(divname);
  this.thediv.style.visibility = startstate;
}

//menu methods
function ehandler(event,theobj){
  for (var i=1; i<= theobj.numberofmenuitems; i++){
    var shutdiv =eval( "menuitem"+i+".thediv");
    shutdiv.style.visibility="hidden";
  }
  theobj.thediv.style.visibility="visible";
}
				
function closesubnav(event){
  if (((event.clientY + document.body.scrollTop) <120)||((event.clientY + document.body.scrollTop) > 180)){
    for (var i=1; i<= numofitems; i++){
      var shutdiv =eval('menuitem'+i+'.thediv');
      shutdiv.style.visibility='hidden';
    }
  }
}
				
function closesubnav2(){
  for (var i=1; i<= numofitems; i++){
    var shutdiv =eval('menuitem'+i+'.thediv');
    shutdiv.style.visibility='hidden';
  }
}

function reDoPage(init) { 
  if (init==true) with (navigator) {
    if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
      document.pgW=innerWidth; 
      document.pgH=innerHeight; 
      onresize=reDoPage; 
    }
  } else if (innerWidth!=document.pgW || innerHeight!=document.pgH) 
    location.reload();
}
reDoPage(true);

function showHide(){
  var a = showHide.arguments;
  if(a.length>0) 
    a = new Array('sub'+a[0],'close'+a[0],a[0]);

  if(!document.layerSet) {
    if(a.length > 0){
      aLayers = new Array();
      for(i=0; i<a.length-1;i++)
        aLayers[i] = a[i];document.layerSet = true;
    }
  } else {
    theIndex = aLayers[0].charAt(3);

    if(document.layers) {
      hideImage = document.layers['top'].document.images['trig'+theIndex];
    } else {
      hideImage = document.images['trig'+theIndex];
    }

    hideImage.src = eval('out' + theIndex + '.src');

    for(i=0;i<aLayers.length;i++){
      if(document.layers)
        document.layers[aLayers[i]].visibility='hide';
      else if(document.getElementById)
        document.getElementById(aLayers[i]).style.visibility='hidden';
      else if(document.all)
        document.all(aLayers[i]).style.visibility='hidden';
    }
  }

  if(a.length > 0){
    for(i=0; i<a.length-1;i++){
      aLayers[i] = a[i];
      if(document.layers)
        document.layers[aLayers[i]].visibility='show';
      else if(document.getElementById)
        document.getElementById(aLayers[i]).style.visibility='visible';
      else if(document.all)
        document.all(aLayers[i]).style.visibility='visible';
    }

    if(document.layers){
      document.layers['top'].document.images['trig'+a[2]].src=eval('over' + a[2] +'.src');
    } else {
      document.images['trig'+a[2]].src = eval('over' + a[2] +'.src');
    }
  }
}

function karonapopup(a,b,c,d,e,f){
  newwindow++;
  window.open (a,newwindow,'width=' + b + ',height=' + c + ',left=' + d + ',top=' + e + ',resizable=0,status=0,menubar=0,scrollbars=' + f);
}

function rootpage(obj){	
  with (document.products){router(obj[obj.selectedIndex].value);}
}

function router(val){
  switch (val)			
  {
    case '11':
      window.location.href="20min.php";
      document.products.FireDoors.value=10;
      break;
    case '12':
      window.location.href="20minpos.php";
      document.products.FireDoors.value=10;
      break;
    case '13':
      window.location.href="45minpos.php";
      document.products.FireDoors.value=10;
      break;
    case '14':
      window.location.href="60minpos.php";
      document.products.FireDoors.value=10;
      break;
    case '15':
      window.location.href="90minpos.php";
      document.products.FireDoors.value=10;
      break;	
    case '21':
      window.location.href="comdistributors.php";
      document.products.sales.value=20;
      break;
    case '22':
      window.location.href="resdistributors.php";
      document.products.sales.value=20;
      break;
    case '23':
      window.location.href="arch.pdf";
      document.products.sales.value=20;
      break;
    case '24':
      window.location.href="res.pdf";
      document.products.sales.value=20;
      break;
    case '31':
      window.location.href="commercialwarranty.php";
      document.products.warranty.value=30;
      break;
    case '32':
      window.location.href="residentialwarranty.php";
      document.products.warranty.value=30;
      break;
    case '33':
      window.location.href="claims.html";
      document.products.warranty.value=30;
      break;	
  }
}