/*
	Deal with menu hover
*/
var timeout         = 500; //close menu time
var closetimer		= 0;   //window.setTimeout object
var ddmenuitem      = 0;   //menu ul element object
/*
	open menu
*/
function zannstore_open(){	
	zannstore_canceltimer();
	zannstore_close();
	ddmenuitem = $(this).find('ul').eq(0).css('visibility', 'visible');
	/*
	 * Added by Paul to fix bug on IE
	 */
	showMaskIFrame();
}
/*
	close menu
*/
function zannstore_close(){	
	if(ddmenuitem){
		
		ddmenuitem.css('visibility', 'hidden');
		/*
		 * Added by Paul to fix bug on IE
		 */
		hideMaskIFrame();
	}
}

function showMaskIFrame(){
	/*
	 * Added by Paul to fix bug on IE
	 */
	if(!$.browser.msie){return};
    var iframe=ddmenuitem.parent().eq(0).children("iframe").eq(0);
    
    iframe.width(ddmenuitem.attr("offsetWidth"));
    
    iframe.height(ddmenuitem.attr("offsetHeight"));
    iframe.css("top",ddmenuitem.attr("offsetTop"));
    iframe.css("left",ddmenuitem.attr("offsetLeft"));
	iframe.css("display","block");
}

function hideMaskIFrame(){
	/*
	 * Added by Paul to fix bug on IE
	 */
	if(!$.browser.msie){return};

	ddmenuitem.parent().eq(0).children("iframe").eq(0).css("display","none");

}
/*
	close menu lazy 
*/
function zannstore_timer(){	
	closetimer = window.setTimeout(zannstore_close, timeout);
}
/*
	clear  timer object
*/
function zannstore_canceltimer(){	
	if(closetimer)
	{	
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}
/*
	bind event to all li element within menu container when load page 
*/
$(document).ready(
	function(){	
		$('#zannstore_menu > li').bind('mouseover', zannstore_open); //zannstore_menu is menu id
		$('#zannstore_menu > li').bind('mouseout',  zannstore_timer);
		
	}
);
