function BwChecker(){
   var isIE, isNS = false;
   var leftMargin, topMargin;
   this.appVer = parseInt(navigator.appVersion)
   this.isIE = (navigator.appName == "Microsoft Internet Explorer")?true:false;
   this.isNS4 = ((navigator.appName == "Netscape") && (this.appVer == 4))?true:false;
   this.isNS5 = ((navigator.appName == "Netscape") && (this.appVer > 4))?true:false;
   this.leftMargin = (this.isIE)?(10):((this.isNS)?8:-1);
   this.topMargin = (this.isIE)?(15):((this.isNS)?8:-1);
}
/*INSTANCE VARIABLES*/
//BROWSER CHECKER
var bwChecker = new BwChecker();
var linkstyle = "style=\"text-decoration:none;\""
function CreateMenu(targetFrame, fixedIndex, menuWidth, mOverBGC, mOutBGC, mOverTextC, mOutTextC){
   var shortcut = false;
   if(bwChecker.isIE)CreateMenuForIE(targetFrame, fixedIndex, menuWidth, mOverBGC, mOutBGC, mOverTextC, mOutTextC, shortcut);
   //if(bwChecker.isNS5)CreateMenuForNS5(targetFrame, fixedIndex, menuWidth, mOverBGC, mOutBGC, mOverTextC, mOutTextC, shortcut);
   if(bwChecker.isNS5)CreateMenuForIE(targetFrame, fixedIndex, menuWidth, mOverBGC, mOutBGC, mOverTextC, mOutTextC, shortcut);   
}
function CreateMenuAndShortCut(targetFrame, fixedIndex, menuWidth, mOverBGC, mOutBGC, mOverTextC, mOutTextC){
   var shortcut = true;
   if(bwChecker.isIE)CreateMenuForIE(targetFrame, fixedIndex, menuWidth, mOverBGC, mOutBGC, mOverTextC, mOutTextC, shortcut);
   //if(bwChecker.isNS5)CreateMenuForNS5(targetFrame, fixedIndex, menuWidth, mOverBGC, mOutBGC, mOverTextC, mOutTextC, shortcut);
   if(bwChecker.isNS5)CreateMenuForIE(targetFrame, fixedIndex, menuWidth, mOverBGC, mOutBGC, mOverTextC, mOutTextC, shortcut);
}
function CreateMenuForNS5(targetFrame, fixedIndex, menuWidth, mOverBGC, mOutBGC, mOverTextC, mOutTextC, shortcut){
   document.writeln("<table width=\""+(menuWidth)+"\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" >");
   for(var i=0;i<menus.length;i++){
      document.write("<tr>");
      document.writeln("<td id=\"menu"+i+"bg1\" height=\"25\" bgcolor=\""+mOutBGC+"\">");
      if(menus[i][4]==0){
         document.writeln("<a href=\""+menus[i][2]+"\" >");
      }else{
         document.writeln("<a href=\""+menus[i][2]+"\" target=\"_top\">");
      }
      document.write(menus[i][0]);
      document.writeln("</a>");
      document.write("</td>");
      document.write("</tr>");
   }
   document.write("</table>");
   if(shortcut)
   	createShortCut("productservice");   
}
function CreateMenuForIE(targetFrame, fixedIndex, menuWidth, mOverBGC, mOutBGC, mOverTextC, mOutTextC, shortcut){
   document.writeln("<table width=\""+menuWidth+"\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" >");
   for(var i=0;i<menus.length;i++){
      document.writeln("<tr height=\"25\">");      
      if(menus[i][4]==-1){
      	    document.writeln("<td id=\"menu"+i+"bg1\" width=\"100%\" bgcolor=\""+((i==fixedIndex)?mOverBGC:mOutBGC)+"\">");
			document.writeln("<a "+linkstyle+" href=\"#\" onclick=\"return false\">");
      }else{
      		document.writeln("<td id=\"menu"+i+"bg1\" style=\"cursor:hand;\" width=\"100%\" bgcolor=\""+((i==fixedIndex)?mOverBGC:mOutBGC)+"\">");	      
      		if(menus[i][4]==0){
         		if(targetFrame == window.self){
            			document.writeln("<a "+linkstyle+" href=\"javascript:changeFrames('"+menus[i][2]+"',"+menus[i][3]+", 0)\">");
         		}else{
            			document.writeln("<a "+linkstyle+" href=\"javascript:changeFrames('"+menus[i][2]+"',"+menus[i][3]+", 1)\">");
         		}
      		}else if(menus[i][4]==1){
         		document.writeln("<a "+linkstyle+" href=\""+menus[i][2]+"\" target=\"_top\">");
      		} else if(menus[i][4]==2){
				document.writeln("<a "+linkstyle+" href=\"#\" onclick=\"javascript:window.open('"+menus[i][2]+"')\">");
      		}
      }
      /*if(bwChecker.isIE)*/
      document.writeln("<div style=\"line-height: 25px;font-weight:bold;color:"+((i==fixedIndex)?mOverTextC:mOutTextC)+"\" id=\"menu"+i+"bg2\" bgcolor=\""+((i==fixedIndex)?mOverBGC:mOutBGC)+"\">");      
      //document.writeln("<font size=\"2\" color=\"white\"><div style=\"line-height: 25px;\"><p style=\"line-height: 25px; \">");
      document.writeln("<font size=\"2\" color=\"white\">");
      document.writeln(menus[i][0]);      
      //document.writeln("</p></div></font>");
      document.writeln("</font>");
      /*if(bwChecker.isIE)*/
      document.writeln("</div>");
      document.writeln("</a>");      
      document.writeln("</td>");
      document.writeln("<td valign=\"center\" id=\"menu"+i+"bg3\" width=\"25\" height=\"25\" bgcolor=\""+((i==fixedIndex)?mOverBGC:mOutBGC)+"\">");
      document.writeln("<a href=\"#fake\">");
      document.writeln("<img name=\"menu"+i+"btn\" id=\"menu"+i+"btn\" src=\""+((i==fixedIndex)?"/its/images/down_arrow1.gif":"/its/images/up_arrow1.gif")+"\"  border=\"0\" align=\"right\"/>");
      document.writeln("</a>");
      document.writeln("</td>");
      document.writeln("</tr>");
      document.writeln("<tr>");
      document.writeln("<Td colspan=\"2\">");
      //if(bwChecker.isIE){
         if(fixedIndex == i){
            document.writeln("<div id=\"menu"+i+"\">");
            document.writeln("<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\" bgcolor=\"#D1D1D1\">");
            for(var j=0;j<menuitems[i].length;j++){
               document.writeln("<tr bgcolor=\"#D1D1D1\" style=\"height:30px;\">");
               document.writeln("<td style=\"height:30px;cursor:hand;border:1px solid white;\" align=\"left\">");               
               if(menuitems[i][j][4]==0){
                  if(targetFrame == window.self){
                     document.writeln("<a "+linkstyle+" href=\"javascript:changeFrames('"+menuitems[i][j][2]+"',"+menuitems[i][j][3]+", 0)\">");
                  }else{
                     document.writeln("<a "+linkstyle+" href=\"javascript:changeFrames('"+menuitems[i][j][2]+"',"+menuitems[i][j][3]+", 1)\">");
                  }
               }else if(menuitems[i][j][4]==1){
                  document.writeln("<a "+linkstyle+" href=\""+menuitems[i][j][2]+"\" target=\"_top\">");
               } else if(menuitems[i][j][4]==2){
					document.writeln("<a "+linkstyle+" href=\"#\" onclick=\"javascript:window.open('"+menus[i][j][2]+"')\">");
           	   }	
               document.write("<font style=\"font-size:11px;\" color=\"#0B4B6A\">"+menuitems[i][j][0]+"</font>");
               document.writeln("</a>");
			   document.writeln("</td>");
               document.writeln("</tr>");
            }
            document.writeln("</table>");
            /*if(bwChecker.isIE)*/document.writeln("</div>");
         }
      //}
      document.writeln("</td>");
      document.writeln("</tr>");
      /*if(bwChecker.isIE*/ if(i != fixedIndex)SetFunction(targetFrame, i, fixedIndex, mOverBGC, mOutBGC, mOverTextC, mOutTextC);
   }
   document.writeln("</table>");
   if(shortcut)   
   	createShortCut("productservice");
}

var flag = 0;
var menuid = -1;

function SetFunction(tf, id, fixedIndex, mOverBGC, mOutBGC, mOverTextC, mOutTextC){
   if(!bwChecker.isNS4){	             
      document.getElementById('menu'+id+'bg1').onmouseover = function(){ShowFunction(tf, id, fixedIndex, mOverBGC, mOutBGC, mOverTextC, mOutTextC);}      
      document.getElementById('menu'+id+'bg2').onmouseover = function(){ShowFunction(tf, id, fixedIndex, mOverBGC, mOutBGC, mOverTextC, mOutTextC);}
      document.getElementById('menu'+id+'bg3').onmouseover = function(){ShowFunction(tf, id, fixedIndex, mOverBGC, mOutBGC, mOverTextC, mOutTextC);}
      /*if(!bwChecker.isNS5)*/document.getElementById('menu'+id+'btn').onmouseover = function(){ShowFunction(tf, id, fixedIndex, mOverBGC, mOutBGC, mOverTextC, mOutTextC);}

      document.getElementById('menu'+id+'bg1').onmouseout = function(){HideFunction(tf, id, fixedIndex, mOverBGC, mOutBGC, mOverTextC, mOutTextC);}
      document.getElementById('menu'+id+'bg2').onmouseout = function(){HideFunction(tf, id, fixedIndex, mOverBGC, mOutBGC, mOverTextC, mOutTextC);}
      document.getElementById('menu'+id+'bg3').onmouseout = function(){HideFunction(tf, id, fixedIndex, mOverBGC, mOutBGC, mOverTextC, mOutTextC);}
      /*if(!bwChecker.isNS5)*/document.getElementById('menu'+id+'btn').onmouseout = function(){HideFunction(tf, id, fixedIndex, mOverBGC, mOutBGC, mOverTextC, mOutTextC);}
      
   }
}
function ShowFunction(tf, id, fixedIndex, mOverBGC, mOutBGC, mOverTextC, mOutTextC){
   menuid = id;

//   if(tf.document.all("menu"+id)){
   if(tf.document.getElementById('menu'+id)){	
      var layerobj = tf.document.getElementById('menu'+id);      
      document.getElementById('menu'+id+'bg1').style.backgroundColor = mOverBGC;
      document.getElementById('menu'+id+'bg2').style.backgroundColor = mOverBGC;
      document.getElementById('menu'+id+'bg2').style.color = mOverTextC;
      document.getElementById('menu'+id+'bg3').style.backgroundColor = mOverBGC;
      /*if(!bwChecker.isNS5)*/document.getElementById('menu'+id+"btn").src = "/its/images/down_arrow1.gif";
      layerobj.style.display = "";
      if(tf != window.self){
         layerobj.style.left = "0px";
         if(fixedIndex > id)layerobj.style.top = 1 + (26*id)+(tf.document.body.scrollTop)+"px";
         if(fixedIndex < id){
            layerobj.style.top = 1 + (26*id)+30*(menuitems[fixedIndex].length)+2*(menuitems[fixedIndex].length+1)+(tf.document.body.scrollTop)+"px";
         }
      }
      layerobj.onmouseover = function(){
         flag=1;
         document.getElementById('menu'+id+'bg1').style.backgroundColor = mOverBGC;
         document.getElementById('menu'+id+'bg2').style.backgroundColor = mOverBGC;
         document.getElementById('menu'+id+'bg2').style.color = mOverTextC;
         document.getElementById('menu'+id+'bg3').style.backgroundColor = mOverBGC;
         document.getElementById('menu'+id+'btn').src = "/its/images/down_arrow1.gif";
         this.style.display = "";
      }
      layerobj.onmouseout = function(){
         flag=0;
         document.getElementById('menu'+id+'bg1').style.backgroundColor = mOutBGC;
         document.getElementById('menu'+id+'bg2').style.backgroundColor = mOutBGC;
         document.getElementById('menu'+id+'bg2').style.color = mOutTextC;
         document.getElementById('menu'+id+'bg3').style.backgroundColor = mOutBGC;
         document.getElementById('menu'+id+'btn').src = "/its/images/up_arrow1.gif";
         this.style.display = "none";
      }
   }
}
function HideFunction(tf, id, fixedIndex, mOverBGC, mOutBGC, mOverTextC, mOutTextC){
	if(tf.document.getElementById('menu'+id)){	
    	if(flag ==0 && menuid ==id){
	      var layerobj = tf.document.getElementById('menu'+id);          
	      document.getElementById('menu'+id+'bg1').style.backgroundColor = mOutBGC;
	      document.getElementById('menu'+id+'bg2').style.backgroundColor = mOutBGC;
	      document.getElementById('menu'+id+'bg2').style.color = mOutTextC;
	      document.getElementById('menu'+id+'bg3').style.backgroundColor = mOutBGC;
	      document.getElementById('menu'+id+'btn').src = "/its/images/up_arrow1.gif";
	      layerobj.style.display = "none";
	   }
   }
}


