<!--
//Region Global Variables
var isIE6=false;
var skm_SelectedMenuStyleInfos=new Object();
var skm_UnselectedMenuStyleInfos=new Object();
var skm_MenuFadeDelays=new Object();
var skm_clockValue=0;
var skm_ticker;
var skm_highlightTopMenus=new Object();
var skm_images=new Array();
var skm_OpenMenuItems = new Array();
//EndRegion
//Region Methods to hook up a menu to the global variables
function skm_registerMenu(menuID, selectedStyleInfo, unselectedStyleInfo, menuFadeDelay, highlightTopMenu){
	skm_SelectedMenuStyleInfos[menuID]=selectedStyleInfo;
	skm_UnselectedMenuStyleInfos[menuID]=unselectedStyleInfo;
	skm_MenuFadeDelays[menuID]=menuFadeDelay;
	skm_highlightTopMenus[menuID]=highlightTopMenu;
}
//Region The methods and contructor of the skm_styleInfo object.
function skm_applyStyleInfoToElement(element){
	element.style.backgroundColor=this.backgroundColor;
	element.style.borderColor=this.borderColor;
	element.style.borderStyle=this.borderStyle;
	element.style.borderWidth=this.borderWidth;
	element.style.color=this.color;
	if (this.fontFamily!='')
		element.style.fontFamily=this.fontFamily;
	element.style.fontSize=this.fontSize;
	element.style.fontStyle=this.fontStyle;
	element.style.fontWeight=this.fontWeight;
	if (this.className!=''& element.id.indexOf('subMenu')>0)
	{
		element.className=this.className;
	}
}
function skm_styleInfo(backgroundColor,borderColor,borderStyle,borderWidth,color,fontFamily,fontSize,fontStyle,fontWeight,className){
	this.backgroundColor=backgroundColor;
	this.borderColor=borderColor;
	this.borderStyle=borderStyle;
	this.borderWidth=borderWidth;
	this.color=color;
	this.fontFamily=fontFamily;
	this.fontSize=fontSize;
	this.fontStyle=fontStyle;
	this.fontWeight=fontWeight;
	this.className=className;
	this.applyToElement=skm_applyStyleInfoToElement;
}

var swipetimer = null ;
var bottomclip = null ;

function showMenu(child)
{
	mychild = child ;
	
	if ( bottomclip < parseInt(child.offsetHeight) )
	{
		bottomclip += 10+(bottomclip/10) //unclip drop down menu visibility gradually
		child.style.clip = "rect(0 auto "+bottomclip+"px 0)"
		swipetimer = setTimeout('showMenu(mychild);','30');
	}
	else
	{
		bottomclip = 0 ;
	}
}
function hidMenu(child)
{
	mychild = child ;
	//alert(bottomclip) ;
	//alert(child.offsetHeight)
	if ( bottomclip > 0 )
	{
		bottomclip -= 10+(bottomclip/10)
		child.style.clip = "rect(0 auto "+bottomclip+"px 0)"
		swipetimer = setTimeout('hidMenu(mychild);','10');
	}
	else
	{
		clearTimeout(swipetimer)
		bottomclip = 0 ;
	}
}

var viewTextTimer=null;
var tempElemTD=null;
var tempViewStr=null;
function viewText(elemTD,viewStr)
{
    elemTD.innerHTML="."+viewStr.substring(1,13);
    if(viewStr.length>13)
    {
        viewStr=viewStr.substring(1,viewStr.length);
        tempElemTD=elemTD;
        tempViewStr=viewStr;
        elemTD.innerHTML=elemTD.innerHTML+".";
        viewTextTimer=setTimeout('viewText(tempElemTD,tempViewStr);','200');
    }
}


var oldElem=null;
var oldImageSource='';
//Region MouseEventHandlers
function skm_mousedOverMenu(menuID,elem,parent,displayedVertically,imageSource){
    if(elem.id.indexOf('subMenu')<0)
    {
	    var idStr=elem.id.substring(elem.id.length-1,elem.id.length);
            changeLogo(idStr);
            setCookie('logoID',idStr);
    }
    else
    {
		clearTimeout(viewTextTimer);
		
        if(elem.getAttribute("oText"))
        {
            viewText(elem,elem.getAttribute("vText"));
        }
    }
	skm_stopTick();
	skm_closeSubMenus(elem);
	var MenuArrow=document.getElementById("menuArrow");
	
	var childID=elem.id+"-subMenu";  // Display child menu if needed
	if (document.getElementById(childID)!=null){  // make the child menu visible and specify that its position is specified in absolute coordinates
		document.getElementById(childID).style.display='block';
		document.getElementById(childID).style.position='absolute';
		skm_OpenMenuItems = skm_OpenMenuItems.concat(childID);
		if (displayedVertically){ // Set the child menu's left and top attributes according to the menu's offsets
			document.getElementById(childID).style.left=skm_getAscendingLefts(parent)+parent.offsetWidth+9+'px';
			document.getElementById(childID).style.top=skm_getAscendingTops(elem)+'px';
			MenuArrow.style.left=skm_getAscendingLefts(parent)+parent.offsetWidth-1+'px';
			MenuArrow.style.top=skm_getAscendingTops(elem)+1+'px';
			
			var visibleWidth=parseInt(window.outerWidth?window.outerWidth-9:document.body.clientWidth,10);
			if ((parseInt(document.getElementById(childID).offsetLeft,10)+parseInt(document.getElementById(childID).offsetWidth,10))>visibleWidth) {
				document.getElementById(childID).style.left=visibleWidth-parseInt(document.getElementById(childID).offsetWidth,10)+'px';
			}
		}else{  // Set the child menu's left and top attributes according to the menu's offsets
			document.getElementById(childID).style.left=skm_getAscendingLefts(elem)-17+'px';
			document.getElementById(childID).style.top=skm_getAscendingTops(parent)+parent.offsetHeight - 10 +'px';
			
            document.getElementById(childID).style.width=98+'px';
			setCellWidth(document.getElementById(childID));
			document.getElementById(childID).clip="rect(0 auto 0 0)" //hide menu via clipping
			if (typeof this.swipetimer!="undefined")
					clearTimeout(this.swipetimer)
			showMenu(document.getElementById(childID));
		}
	}
	
	if (skm_SelectedMenuStyleInfos[menuID] != null) skm_SelectedMenuStyleInfos[menuID].applyToElement(elem);
	
	if (skm_highlightTopMenus[menuID]){
		var eId=elem.id+'';
		var step=0;
		while (eId.indexOf('-subMenu')>=0){
		    step++;
			eId=eId.substring(0, eId.lastIndexOf('-subMenu'));
			skm_SelectedMenuStyleInfos[menuID].applyToElement(document.getElementById(eId));
			if(step>1||document.getElementById(childID)!=null)
			{
			MenuArrow.style.display='block';
			MenuArrow.style.position='absolute';
			}
		}
	}	
	if (imageSource!=''&&elem!=oldElem){
		setimage(elem,imageSource)
		
		reSetImage(elem);
	    if (oldImageSource!=''){
		    setimage(oldElem,oldImageSource);
		    reSetImage(oldElem);
	    }
	}	
	
}

function alertZindex(par)
{
    alert(par.style.zIndex+" "+par.id);
    
 
}

function setCellWidth(menuTable)
{
    for(var i=0;i<menuTable.rows.length;i++)
    {
        for(var j=0;j<menuTable.rows[i].cells.length;j++)
        {
        
          var a=menuTable.rows[i].cells[j].clientWidth;
          var b=menuTable.style.width.replace("px","");
          if(a<b)
          {
            menuTable.rows[i].cells[j].style.width=menuTable.style.width;
          }
          else if(!menuTable.rows[i].cells[j].getAttribute("oText"))
          {          
            var conterText=menuTable.rows[i].cells[j].innerHTML;
            if(conterText.length>12)
            {
                menuTable.rows[i].cells[j].innerHTML=conterText.substring(0,12)+"...";
                menuTable.rows[i].cells[j].setAttribute('oText',menuTable.rows[i].cells[j].innerHTML);
                menuTable.rows[i].cells[j].setAttribute('vText',conterText);
            }
          }
        }
    }
}

function skm_mousedOverClickToOpen(menuID,elem,parent,imageSource){
	skm_stopTick();
	if (skm_SelectedMenuStyleInfos[menuID] != null) skm_SelectedMenuStyleInfos[menuID].applyToElement(elem);
	if (skm_highlightTopMenus[menuID]){
		var eId=elem.id+'';
		while (eId.indexOf('-subMenu')>=0){
			eId=eId.substring(0, eId.lastIndexOf('-subMenu'));
			skm_SelectedMenuStyleInfos[menuID].applyToElement(document.getElementById(eId));
		}
	}	
	if (imageSource!=''){
		setimage(elem,imageSource)
	}
	
}
function skm_mousedOverSpacer(menuID,elem,parent){
	skm_stopTick();
}
function skm_mousedOutMenu(menuID,elem,imageSource){
	skm_doTick(menuID);
	clearTimeout(viewTextTimer);
	
	if(elem.getAttribute("oText"))
	{
	    elem.innerHTML=elem.getAttribute("oText");
	}
	
	if (skm_UnselectedMenuStyleInfos[menuID] != null) skm_UnselectedMenuStyleInfos[menuID].applyToElement(elem);
	
	if (skm_highlightTopMenus[menuID]){
		var eId=elem.id+'';
		while (eId.indexOf('-subMenu')>=0){
			eId=eId.substring(0, eId.lastIndexOf('-subMenu'));
			skm_UnselectedMenuStyleInfos[menuID].applyToElement(document.getElementById(eId));			
		}
	    var MenuArrow=document.getElementById("menuArrow");
		MenuArrow.style.display='none';
	}
	
	if (imageSource!='')
	{	
	    oldElem=elem;
	    oldImageSource=imageSource;
	}
}
function skm_mousedOutSpacer(menuID, elem){
	skm_doTick(menuID);
}
//Region Utility Functions
function skm_closeSubMenus(parent){
	if (skm_OpenMenuItems == "undefined") return;
	for (var i=skm_OpenMenuItems.length-1; i>-1;i--) {
		if (parent.id.indexOf(skm_OpenMenuItems[i]) != 0) {
			document.getElementById(skm_OpenMenuItems[i]).style.display = 'none';
			skm_shimSetVisibility(false, skm_OpenMenuItems[i]);
			skm_OpenMenuItems = new Array().concat(skm_OpenMenuItems.slice(0, i), skm_OpenMenuItems.slice(i+1));
  		} 
	}
	    var MenuArrow=document.getElementById("menuArrow");
		MenuArrow.style.display='none';
}
function skm_shimSetVisibility(makevisible, tableid){
	var tblRef=document.getElementById(tableid);
	var IfrRef=document.getElementById('shim'+tableid);
	if (tblRef!=null && IfrRef!=null){
		if(makevisible){
			IfrRef.style.width=tblRef.offsetWidth;
			IfrRef.style.height=tblRef.offsetHeight;
			IfrRef.style.top=tblRef.style.top;
			IfrRef.style.left=tblRef.style.left;
			IfrRef.style.zIndex=tblRef.style.zIndex-1;
			IfrRef.style.display="block";
		}else{
			IfrRef.style.display="none";
		}
	}
}
function skm_IsSubMenu(id){
	if(typeof(skm_subMenuIDs)=='undefined') return false;
	for (var i=0;i<skm_subMenuIDs.length;i++)
	  if (id==skm_subMenuIDs[i]) return true;
	return false;
}
function skm_getAscendingLefts(elem){
	if (elem==null)
		return 0;
	else
	{
		if ((elem.style.position=='absolute' || elem.style.position=='relative' || elem.offsetLeft>300) && !skm_IsSubMenu(elem.id)) return 0;
		return elem.offsetLeft+skm_getAscendingLefts(elem.offsetParent);
	}
}
function skm_getAscendingTops(elem){
	if (elem==null)
		return 0;
	else {
		if ((elem.style.position=='absolute' || elem.style.position=='relative' || elem.offsetTop>1000) && !skm_IsSubMenu(elem.id)) return 0;
		return elem.offsetTop+skm_getAscendingTops(elem.offsetParent);
	}
}
//Region Fade Functions
function skm_doTick(menuID){
	if (skm_clockValue>=skm_MenuFadeDelays[menuID]){
		skm_stopTick();
		skm_closeSubMenus(document.getElementById(menuID));
		if (oldImageSource!=''){
		    setimage(oldElem,oldImageSource)
	    }
	    reSetImage(oldElem);
        oldElem=null;
        oldImageSource='';
        
        
		
	} else {
		skm_clockValue++;
		skm_ticker=setTimeout("skm_doTick('"+menuID+"');", 500);
	}
}
function skm_stopTick(){
	skm_clockValue=0;
	clearTimeout(skm_ticker);
}
function preloadimages(){
	for (i=0;i<preloadimages.arguments.length;i++){
		skm_images[i]=new Image();
		skm_images[i].src=preloadimages.arguments[i];
	}
}
function setimage(elem,imageSource){
    //if(imageSource)
	var i=elem.getElementsByTagName("img")[0];
	i.src=imageSource;
}
function reSetImage(elem)
{
   if(isIE6)
   {
       var menuImage3=elem.all[0];
           menuImage3.style.width=66+"px";
           menuImage3.style.height=53+"px";
           setPngImage(menuImage3);
   }
}
//-->
