/*
component:base64
remark:
new Base64().decode(s) / new Base64().encode(s)
*/

var B64_LOOKUP_TABLE = new Array("A", "B", "C", "D", "E", "F", "G", "H","I", "J", "K", "L", "M", "N", "O", "P","Q", "R", "S", "T", "U", "V", "W", "X","Y", "Z", "a", "b", "c", "d", "e", "f","g", "h", "i", "j", "k", "l", "m", "n","o", "p", "q", "r", "s", "t", "u", "v","w", "x", "y", "z", "0", "1", "2", "3","4", "5", "6", "7", "8", "9", "+", "/");var B64_REVERSE_LOOKUP_TABLE = new Array();for (var revTableIdx = 0; revTableIdx < 64; ++revTableIdx) {B64_REVERSE_LOOKUP_TABLE[B64_LOOKUP_TABLE[revTableIdx]] = revTableIdx;}function Base64() {}Base64.prototype.encode = function(stringToEncode) {var source = stringToEncode;var counter = 0;if (stringToEncode == null || stringToEncode.length == 0) {return "";}var ret = "";var chunk = this.getNextEncodeChunk_(source, counter);counter += 3;while (chunk.length > 0) {ret += B64_LOOKUP_TABLE[(chunk[0] >> 2) & 0x3f];if (chunk.length > 1) {ret += B64_LOOKUP_TABLE[((chunk[0] << 4) & 0x30) | ((chunk[1] >> 4) & 0x3f)];if (chunk.length > 2) {ret += B64_LOOKUP_TABLE[((chunk[1] << 2) & 0x3c) | ((chunk[2] >> 6) & 0x3f)];ret += B64_LOOKUP_TABLE[chunk[2] & 0x3f];} else {ret += B64_LOOKUP_TABLE[(chunk[1] << 2) & 0x3c];ret += "=";}} else {ret += B64_LOOKUP_TABLE[(chunk[0] << 4) & 0x30];ret += "==";}chunk = this.getNextEncodeChunk_(source, counter);counter += 3;}return ret;};Base64.prototype.decode = function(stringToDecode) {var source = stringToDecode;var counter = 0;if (stringToDecode == null || stringToDecode.length == 0) {return "";}var ret = "";var chunk = this.getNextDecodeChunk_(source, counter);counter += 4;while (chunk.length > 0) {ret += String.fromCharCode((chunk[0] << 2) & 0xff | (chunk[1] >> 4) & 0x3f);if (chunk.length > 2) {ret += String.fromCharCode((chunk[1] << 4) & 0xff | (chunk[2] >> 2) & 0x3f);if (chunk.length > 3) {ret += String.fromCharCode((chunk[2] << 6) & 0xff | chunk[3]);}}chunk = this.getNextDecodeChunk_(source, counter);counter += 4;}return ret;};Base64.prototype.getNextEncodeChunk_ = function(source, counter) {var chunk = new Array();for (var x = 0; x < 3; ++x) {if (counter < source.length) {chunk[x] = source.charCodeAt(counter);}++counter;}return chunk;};Base64.prototype.getNextDecodeChunk_ = function(source, counter) {var chunk = new Array();for (var x = 0; x < 4; ++x) {if (counter < source.length) {var c = source.charAt(counter);if (c != '=') {chunk[x] = B64_REVERSE_LOOKUP_TABLE[c];}++counter;}}return chunk;};

/**/
this.LinkTooltip = function(){	
    xOffset = 10;yOffset = 30;
	
	$("a.tooltip").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "" + this.t : "";
		var d = $(this).children('img').attr('src');
		if (typeof d == 'undefined')
		    $("body").append("<p id='tooltip' style=';z-index:99999;*z-index:99999;border:solid 1px #FFDBAE;background:#FFF8E8;padding:6px 20px;font-size:11px'>"+ c +"</p>");								 
		else
		    $("body").append("<p id='tooltip' style='padding:5px;border:solid 1px #ddd;background:#efefef'><img src='"+ d +"' alt='' style='border:solid 5px #fff' /></p>");								 
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
    
	function(){this.title = this.t;	$("#tooltip").remove();});	
	
	$("a.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});	
	
	
    $("a.needlogin").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "" + this.t : "";
		var d = $(this).children('img').attr('src');
		if (typeof d == 'undefined')
		    $("body").append("<p id='tooltip' style=';z-index:99999;*z-index:99999;border:solid 1px #FFDBAE;background:#FFF8E8;padding:6px 20px;font-size:11px'>"+ c +"</p>");								 
		else
		    $("body").append("<p id='tooltip' style='padding:5px;border:solid 1px #ddd;background:#efefef'><img src='"+ d +"' alt=''  style='border:solid 5px #fff' width='200px' /></p>");								 
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
    
	function(){this.title = this.t;	$("#tooltip").remove();});	
	
	$("a.needlogin").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});	
			
};

/**********************************************************************/
if(typeof LabNet == "undefined") LabNet={};


/*cbProduct*/
LabNet.Product = {
    timeout : 10000,
	domain: "",
	url: "/Daemon/Product/",
	
    Edit : function (ProductID , Name , ManufacturerSKU , Keywords)
    {
        $.blockUI({ message: $('#Product-Form') }); 
        $('#mProductForm-ProductID').val(ProductID);
        $('#mProductForm-Name').val(Name);
        $('#mProductForm-ManufacturerSKU').val(ManufacturerSKU);
        $('#mProductForm-Keywords').val(Keywords);
    },
    
    Update : function ()
    {
         $.getJSON(
	        this.url , 
            { channel: "Update", ProductID: $('#mProductForm-ProductID').val() , Name : $('#mProductForm-Name').val() , ManufacturerSKU : $('#mProductForm-ManufacturerSKU').val() , Keywords : $('#mProductForm-Keywords').val()},
            function(e)
            { 
               var ProductID = e.ProductID.toString();
               if (document.getElementById('product-list-item-name-' + ProductID)) $('#product-list-item-name-' + ProductID).html(e.Name.toString());
               $.unblockUI();
            }
        )
        
        
    }
}

/*cbmail*/
LabNet.Mail = {
    Subscribe : function (mail)
    {
        if (!/(\,|^)([\w+._]+@\w+\.(\w+\.){0,3}\w{2,4})/.test(mail.replace(/-|\//g,"")))
            alert ("Please Check your email address.\nYour email addresses should look like 'myname@wholesalej.com'");
         else
         {
            LabNet.BlockUI.Show();
            window.location.href = 'index.php?main_page=subscribe&act=subscribe&email_format=HTML&email=' + mail;
          }
    }
    
}

/*cbFavorite*/
LabNet.Favorite = {
     timeout : 10000,
	domain: "",
	url: "/Daemon/Favorites/",
	
    Add : function (ProductID,CustomName)
    {
         LabNet.BlockUI.Show();
         $.getJSON(
	        this.url , 
            { channel: "Add", ProductID: ProductID , CustomName : CustomName},
            function(e)
            {
               var ItemID = e.ProductID.toString();
               var UserID = e.UserID.toString();
               if (UserID == "0") {if (confirm("Please login first. Click OK to login.")){location.href='/Account/Login/?Source=Favorites';}}
               else
               {if (document.getElementById('product-item-fav-list-message-' + ItemID)) $('#product-item-fav-list-message-' + ItemID).html('<span style="color:#C63919;font-size:11px;font-weight:bold">Add to Favorites success</span>');}
               LabNet.BlockUI.Hide();
            }   
        )
    },  
    
    Update : function(FavoriteID , CustomName)
    {
          LabNet.BlockUI.Show();
         $.getJSON(
	        this.url , 
            { channel: "Update", FavoritesID: FavoriteID , CustomName : CustomName},
            function(e)
            {
               var ItemID = e.FavoritesID.toString();
               if (document.getElementById('product-fav-list-name-' + ItemID)) $('#product-fav-list-name-' + ItemID).html(e.CustomName);
               LabNet.BlockUI.Hide();
            }   
        )       
    },
    Delete : function (FavoriteID) 
    {
         LabNet.BlockUI.Show();
         $.getJSON(
	        this.url , 
            { channel: "Delete", FavoritesID: FavoriteID },
            function(e)
            {
               var ItemID = e.FavoritesID.toString();
               if (document.getElementById('product-fav-list-' + ItemID)) $('#product-fav-list-' + ItemID).css("display","none");
               LabNet.BlockUI.Hide();
            }   
        )      
    }
}

/*cbWishList*/
LabNet.WishList = {
    timeout : 10000,
	domain: "",
	url: "/Daemon/WishLists/",
	
    ShowAdd : function (ProductID,OptionIDs,DesiredQuantity,LineMessage)
    {
        $.blockUI({ message: $('#WishList-EditForm') }); 
        $('#WishList-EditForm-ProductID').val(ProductID);
        $('#WishList-EditForm-OptionIDs').val(OptionIDs);
        $('#WishList-EditForm-Quantity').val(DesiredQuantity);
        $('#WishList-EditForm-LineMessage').val(LineMessage);
        $('#WishList-EditForm-StockIsNotifiy').attr("checked",true);
    },
    
    Add : function ()
    {
         LabNet.BlockUI.Show();
         $.getJSON(
	        this.url , 
            {   channel: "Add", 
                ProductID : $('#WishList-EditForm-ProductID').val() ,
                OptionIDs : $('#WishList-EditForm-OptionIDs').val() ,
                Quantity : $('#WishList-EditForm-Quantity').val(),
                LineMessage : $('#WishList-EditForm-LineMessage').val(),
                ExpireDT : $('#WishList-EditForm-ExpireDT').val(),
                StockIsNotifiy : ($('#WishList-EditForm-StockIsNotifiy').attr("checked") ? "1" : "0")
             },
            function(e){ LabNet.WishList.RenderData(e);}
         )    
    },
    ShowUpdate : function (WishListProductID,OptionIDs,DesiredQuantity,LineMessage , ExpireDT,StockIsNotifiy)
    {
        $.blockUI({ message: $('#WishList-EditForm') }); 
        $('#WishList-EditForm-WishListProductID').val(WishListProductID);
        $('#WishList-EditForm-OptionIDs').val(OptionIDs);
        $('#WishList-EditForm-Quantity').val(DesiredQuantity);
        $('#WishList-EditForm-LineMessage').val(LineMessage);
        $('#WishList-EditForm-ExpireDT').val(ExpireDT);
        $('#WishList-EditForm-StockIsNotifiy').attr("checked",StockIsNotifiy);
    },
    Update : function()
    {
       
         LabNet.BlockUI.Show();
         $.getJSON(
	        this.url , 
            {   channel: "Update", 
                WishListProductID : $('#WishList-EditForm-WishListProductID').val() ,
                OptionIDs : $('#WishList-EditForm-OptionIDs').val() ,
                Quantity : $('#WishList-EditForm-Quantity').val(),
                LineMessage : $('#WishList-EditForm-LineMessage').val(),
                ExpireDT : $('#WishList-EditForm-ExpireDT').val(),
                StockIsNotifiy : ($('#WishList-EditForm-StockIsNotifiy').attr("checked") ? "1" : "0")
             },
            function(e){ window.location.href=window.location.href.toString();}   
        )
    },
    
    Delete : function(WishListProductID)
    {
         LabNet.BlockUI.Show();   
         $.getJSON(
	        this.url , 
            {channel: "Delete", WishListProductID: WishListProductID},
            function(json){ 
                
                var WishListProductID = json.WishListProductID.toString();
                if (document.getElementById('wishlist-item-' + WishListProductID)) $('#wishlist-item-' + WishListProductID).css("display","none");        
                LabNet.BlockUI.Hide();
            }  
        )        
    },
    
    RenderData : function(json)
    {
        var ProductID = json.ProductID.toString();
        if (document.getElementById('product-item-wishlist-message-' + ProductID)) $('#product-item-wishlist-message-' + ProductID).html('<span style="color:#079511;font-weight:bold;line-height:20px;font-size:11px">Add to WishList success</span>');
        LabNet.BlockUI.Hide();
    }
    
}


LabNet.BlockUI = {

    Show : function(msg)
    {
        if (typeof(msg) == 'undefined') msg = 'Please wait...';
         $.blockUI(msg); 
    },
    
    Hide : function(){$.unblockUI();}
}
/*cbCart class*/
LabNet.Cart = 
{
    timeout : 10000,
	domain: "",
	url: "/Daemon/Carts/",
	
	Update : function(ProductID , Quantity , LineMessage) 
	{  
	   
	    LabNet.BlockUI.Show();
         $.getJSON(
	        this.url , 
            { channel: "update", ProductID: ProductID , Quantity : Quantity , LineMessage : LineMessage },
            function(e)
            { 
                if (e.StockState == "False") 
	                alert('we are very sorry that this product is out-of-stock, if you want to bulk order the product, please contact us,thanks.');
	           else
                    LabNet.Cart.RenderToPage(e);
               LabNet.BlockUI.Hide();
            }
        )
	},
	
	Remove : function(ProductID)
	{
	   LabNet.BlockUI.Show();
        $.getJSON(
	        this.url , 
            { channel: "delete", ProductID: ProductID },
            function(e)
            {   
                var ItemID = e.ProductID.toString();
                if (document.getElementById('shopping-cart-item-' + ItemID)) $('#shopping-cart-item-' + ItemID).css('display','none');
                LabNet.Cart.RenderToPage(e);
                LabNet.BlockUI.Hide();
            }
        )	    
	},
	
	ShowTotalQuantities : function()
	{
	    $.getJSON(
	        "/Daemon/Carts/" , 
	        {channel: "ShowTotalQuantities"},
	        function(e){$("#buyerCartCountNumber").html(e.TotalQuantities) ;}
	     )
	},

	RenderToPage : function(json)
	{
	    var ItemID = json.ProductID.toString();
	    if (document.getElementById('buyerCartCountNumber')) $('#buyerCartCountNumber').html(json.TotalQuantities);
	    
	    if (document.getElementById('TotalAmount-Head')) $('#TotalAmount-Head').html(json.TotalAmount);
	    if (document.getElementById('TotalQuantities-Head')) $('#TotalQuantities-Head').html(json.TotalQuantities);
	    
	    if (document.getElementById('TotalAmount')) $('#TotalAmount').html(json.TotalAmount);
	    if (document.getElementById('LineMessage-' + ItemID)) $('#LineMessage-' + ItemID).val(json.LineMessage);
	    if (document.getElementById('Total-' +ItemID )) $('#Total-' + ItemID).html(json.Total);
	    if (document.getElementById('Quantity-' +ItemID )) $('#Quantity-' + ItemID).val(json.Quantity);
	    if (document.getElementById('product-item-message-' +ItemID )) $('#product-item-message-' + ItemID).html("<span style='line-height:20px;color:#C63818;font-weight:bold;font-size:11px'>Add to Cart success</span>");
	    
	}
	
}
/**********************************************************************/
LabNet.Comment = 
{
    timeout : 10000,
	domain: "",
	url: "/daemon/comment/",
	Post : function(ProductID , UserName , Content)
	{
	    
	    if ($.trim(UserName) != '' && $.trim(Content) != '' && Content.length>5)
	    {
	        LabNet.BlockUI.Show();
            $.getJSON(
	            this.url , 
                { channel: "post", ProductID: ProductID  , UserName : UserName , Content : Content},
                function(e){ location.href=location.href;}
            )		 
        }else {alert('Please Enter your product review,thanks')}   	
	},
	Delete : function(ProductID,CommentID)
	{
	    LabNet.BlockUI.Show();
        $.getJSON(
	        this.url , 
            { channel: "Delete",ProductID : ProductID, CommentID: CommentID },
            function(e)
            {
                if (e.ItemID = 0)
                    alert('wow');
                else
                    location.href=location.href;
                
                LabNet.BlockUI.Hide();
            }
        )		    
	},
	Update : function(ProductID,CommentID , Content)
	{
	    if ($.trim(Content) != '' && Content.length>5)
	    {
	        LabNet.BlockUI.Show();
            $.getJSON(
	            this.url , 
                { channel: "Update",ProductID : ProductID, CommentID: CommentID ,Content:Content},
                function(e)
                {
                    if (e.ItemID = 0)
                        alert('wow');
                    else
                        location.href=location.href;
                        
                        
                    LabNet.BlockUI.Hide();
                }
            )	
        }	    
	}
}
/**********************************************************************/
//LabNet.Tracker = 
//{
//    timeout : 10000,
//	domain: "",
//	url: "/daemon/tracker/",
//	Log : function(ProductID , Filed , Value)
//	{
//        $.getJSON(
//	        this.url , 
//            { channel: "log", ProductID: ProductID  , Filed : Filed , Value : Value},
//            function(e)
//            {
//                
//                var ItemID = e.ProductID.toString();
//                var a = "Item-Goods-" + ItemID;
//                var b = "Item-Bads-" + ItemID;
//                
//                if (document.getElementById(a))
//                {
//                    $('#'+a).html(e.Goods.toString());
//                }
//                if (document.getElementById(b))
//                {
//                    
//                     $('#'+b).html(e.Bads.toString());
//                }
//            }
//        )		    	
//	},
//	AddRecentHistory : function(ProductID)
//	{
//        $.getJSON(
//	        this.url , 
//            { channel: "AddRecentHistory", ProductID: ProductID},
//            function(e){}
//        )	    
//	}
//}

/**********************************************************************/
LabNet.Search =
{
    timeout : 10000,
	domain: "",
	url: "/daemon/search/",
	Query : function(Words,Records)
	{
	        $.getJSON(
	        this.url , 
            { channel: "query",Words: Words  , Records : Records},
            function(e){}
        )	    
	},

	SearchWords : function(Catalog , Words)
	{
	    Words = $.trim(Words).replace('\'','').replace('    ','').replace('   ','+').replace('  ','+').replace(' ','+')

	    if (Words.length < 1)
	    {
	        alert('Please Enter search keywords here');
	        return;
	    }
	    var url = 'advanced_search_result.html?keyword=' + encodeURI(Words);
	    LabNet.BlockUI.Show();
	    window.location.href = url;
	}
}
/**********************************************************************/
LabNet.Currency = 
{
    timeout : 10000,
	domain: "",
	url: "/daemon/currency/",
	Setting : function(ISOCode)
	{
        $.getJSON(
	        this.url , 
            { channel: "setting", ISOCode: ISOCode},
            function(e){window.location.href=e.url;}
        )
	 }
}
/**********************************************************************/
LabNet.Checkout = 
{
    timeout : 10000,
	domain: "",
	url: "/daemon/checkout/",

	Calculate : function()
	{
	    var f = document.getElementById("MainForm");
	    if(f == null || f.tagName != "FORM") return;
	    
	    var shipmentID = 0;
	    for (i=0; i<f.ShipmentID.length; i++)
            if (f.ShipmentID[i].checked) shipmentID = f.ShipmentID[i].value;
        if (shipmentID == 0) shipmentID = f.ShipmentID.value;
            
	    var paymentID = 0;
	    for (i=0; i<f.PaymentID.length; i++)
            if (f.PaymentID[i].checked) paymentID = f.PaymentID[i].value;
        if (paymentID == 0) paymentID = f.PaymentID.value;
            
	    var couponCode = f.CouponCode.value;

        $.getJSON(
	        this.url , 
            { channel: "calculate", shipmentID : shipmentID , paymentID : paymentID , couponCode : couponCode},
            function(e)
            {  
  //              $('#checkout-subtotal-div')
                $('#checkout-subtotal').html(e.SubTotal);
//                $('#checkout-shippingcharges-div')
                $('#checkout-shippingcharges').html(e.ShippingCharges);
                
                if (e.PaymentSavings == '0')
                 {   $('#checkout-paymentsavings-div').hide();$('#checkout-paymentsavings').html('');}
                else
                {
                    $('#checkout-paymentsavings-div').show();
                    if (e.PaymentSavings.indexOf('-') == -1)
                    {
                        $('#checkout-paymentsavings').html("<span style='color:red'>" + e.PaymentSavings.toString() + "</span>");
                        $('#checkout-paymentsavings-name').html('<span style="color:red">Use PayPal (<strong>+3.9%</strong></span>)');
                    }
                    else
                    {
                        $('#checkout-paymentsavings').html("<span style='color:green'>" + e.PaymentSavings.toString() + "</span>");
                        $('#checkout-paymentsavings-name').html('<span style="color:green">Use WESTERN UNION (<strong>-3.0%</strong></span>)');
                   }
                }
                    
                if (e.CouponCodeSavings == '0')
                {
                    $('#checkout-couponcodesavings-div').hide();$('#checkout-couponcodesavings').html('');
                    if ($('#CouponCode').val().length > 0)
                    {
                        $('#ApplyCouponCodeError').html('<div class="error" style="width:120px">Coupon code invalid.</div>');
                    }
                }
                else
                {
                    $('#checkout-couponcodesavings-div').show();
                    $('#checkout-couponcodesavings').html(e.CouponCodeSavings);
                    $('#dbCouponCode').val($('#CouponCode').val());
                    $('#ApplyCouponCodeError').html('');
                    
                }
                
                $('#checkout-grandtotal').html(e.GrandTotal);
            }
        )	    
	}
}
/************************************************************************************************************
 ************************************************************************************************************
Golbal Client Code
remark:
*/
$( function(){


	$("Li[delvinfo]").each(function(){
		var delvinfo = $(this).attr("delvinfo");
		$(this).hover(
			function(){
			    $(this).css("background" , delvinfo);
			    $(this).find("label").show();
			},
			function(){$(this).css("background" , "");$(this).find("label").hide();}
		);
	});
	
	$("Tr[delvinfo]").each(function(){
		var delvinfo = $(this).attr("delvinfo");
		$(this).hover(
			function(){$(this).css("background" , delvinfo);},
			function(){$(this).css("background" , "");}
		);
	});

    
    /*Show Head buyerCartCountNumber data */
    //if (document.getElementById('buyerCartCountNumber')){LabNet.Cart.ShowTotalQuantities();}
    
    //*********************************************************************************************************************
    //channel:comment

    if (document.getElementById('channel-page') && $('#channel-page').val()=='Comment')
    {
		var iframe_height = document.body.scrollHeight+"px" ;
		try{parent.document.getElementById("iframe-comment").height=iframe_height;}catch(e){}
        
    }  
    
    if ( document.getElementById('MainForm') != null )  
    {
  	    var formId = document.getElementById('MainForm');
	    if(formId == null || formId.tagName != "FORM"){ alert("", null , "error");return;}
	    var elArr = formId.elements;
	    for(i=0; i<elArr.length; i++) 
	    {
	        if((elArr[i].tagName === "INPUT" && (elArr[i].type === "text" || elArr[i].type === "password"))||elArr[i].tagName === "TEXTAREA")
	        {
				    elArr[i].onfocus = function(){this.style.backgroundColor = "#FFFEE1";}
				    elArr[i].onblur = function(){this.style.backgroundColor = "#ffffff";}
		    }
	    }      
    }

    //*********************************************************************************************************************
    //show page Hdr Image
    LinkTooltip();

    //HOME EVENT
    $("#mFeaturedProducts-li").click(function(){$('#mFeaturedProducts-li').addClass('select');$('#mBestSelling-li').removeClass('select');$('#mNewArrival-li').removeClass('select');$('#mBestSelling').fadeOut();$('#mNewArrival').fadeOut();$('#mFeaturedProducts').fadeIn(500);})
    $("#mBestSelling-li").click(function(){$('#mFeaturedProducts-li').removeClass('select');$('#mBestSelling-li').addClass('select');$('#mNewArrival-li').removeClass('select');$('#mFeaturedProducts').fadeOut();$('#mNewArrival').fadeOut();$('#mBestSelling').fadeIn(500); })
    $("#mNewArrival-li").click(function(){$('#mFeaturedProducts-li').removeClass('select');$('#mBestSelling-li').removeClass('select');$('#mNewArrival-li').addClass('select');$('#mFeaturedProducts').fadeOut();$('#mBestSelling').fadeOut();$('#mNewArrival').fadeIn(500);})

//***********************************************************************************************
//end golbal
});

(function($){
var timeout= 1;var closetimer=0;var ddmenuitem=0;function jsddm_open(){jsddm_canceltimer();jsddm_close();ddmenuitem = $(this).find('ul').eq(0).css('visibility', 'visible');}function jsddm_close(){if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');}function jsddm_timer(){	closetimer = window.setTimeout(jsddm_close, timeout);}function jsddm_canceltimer(){	if(closetimer){	window.clearTimeout(closetimer);closetimer = null;}}

$(document).ready(function(){	$('#topBar > li').bind('mouseover', jsddm_open);$('#topBar > li').bind('mouseout',  jsddm_timer);});	

document.click = jsddm_close;
}) (jQuery)




