// JavaScript Document



function fHideFocus(tName){
  aTag=document.getElementById("nav").getElementsByTagName(tName);
  for(i=0;i<aTag.length;i++){
    aTag[i].hideFocus=true;
  }
}

$(document).ready(function(){					
  fHideFocus("A");
//    $("#submain,#nav").mouseout(function() {if(!this.contains(event.toElement)) {$("#submain").slideUp("fast");$("#"+currentShow).removeClass("mouseover");$("#"+currentShow).addClass("mouseout");}});
  $("#submain,#nav").mouseout(function() {if(!this.contains(event.toElement)) {$("#submain").hide();$("#"+currentShow).removeClass("mouseover");$("#"+currentShow).addClass("mouseout");}});
});
  
var currentShow;

function popMenu(id) {

  if(currentShow!=id) {
	  $("#submain").hide();
	}
	
  if(currentShow!=undefined) {
    $("#"+currentShow).removeClass("mouseover");
  	$("#"+currentShow).addClass("mouseout");
		$("#"+currentShow+"_sub").hide();
	}

  $("#"+id).removeClass("mouseout");
	$("#"+id).addClass("mouseover");

	if($("#"+id+"_sub").length>0) {
	  $("#submain").html($("#"+id+"_sub").html());			 
  	//var autoLeft = (window.screen.availWidth - document.body.clientWidth) / 2;
//    var autoLeft = document.body.offsetLeft;
//		if(autoLeft < 0){
  //    autoLeft = 0;
   // }

		var offset = $("#"+id).offset();
		var menu = $("#menu").offset();
		
		var left= offset.left - menu.left;					 
//	  var top=  offset.top;	  
	  
		document.getElementById("submain").style.left=left+'px';
//		document.getElementById("submain").style.top=top+'px';
		$("#submain").show();
//			 $("#submain").slideDown("fast");
//		$("#submain div").mouseover(function() { $(this).css("background-color","#ffff66") });
		$("#submain div.subitem").mouseover(function() { $(this).css("background-color","#FFFF66") });
		$("#submain div.subitem").mouseout(function() { $(this).css("background-color","#EEEEEE") });
	}
	currentShow=id;
}
