var menuService={
	root:'/menu'
};

var menuItems;
var couponMenuItems;

function menuNewInit() {
    // update by daniel for normal special page
    if (info.UI == "express") {
        menuInit();
    }
    if ($('carousel-wrapper') != undefined) {
        new Carousel('carousel-wrapper', $$('#carousel-content .slide'), $$('a.carousel-control'), { wheel: false, visibleSlides: 2 });
    }
}
function menuInit() {
    if(info.category == 'select_shop' || info.category == 'select_address')
    {
        $('bodyRightShoppingCart').hide();
    }
    var currentDay = info.systemTime.getDay();
    
    /*if (info.category == 'express_menu') {
        var weekdayList = info.express_weekday.split(',');
        var holidayList = info.express_holiday.split(',');
             for(var i = 0;i<weekdayList.length;i++){
                if(currentDay == weekdayList[i] && 
                    (   (info.systemTimeFormattedHour.substring(0, 2) < info.express_weekday_open_time.substring(0,2)) 
                        || ( (info.systemTimeFormattedHour.substring(0, 2) == info.express_weekday_open_time.substring(0,2))
                              && (info.systemTimeFormattedHour.substring(3, 5) < info.express_weekday_open_time.substring(3,5))
                            )
                     ) 
                )          
                {
                        
                    alert(label["order.js.express.weekday.time.start." + info.region]);
                    window.location = "/" + info.lang + "/home.html";                        
                }
            }       

             for(var j = 0;j<holidayList.length;j++){
                if(currentDay == holidayList[j] && 
                    (   (info.systemTimeFormattedHour.substring(0, 2) < info.express_holiday_open_time.substring(0,2)) 
                        || ( (info.systemTimeFormattedHour.substring(0, 2) == info.express_holiday_open_time.substring(0,2))
                              && (info.systemTimeFormattedHour.substring(3, 5) < info.express_holiday_open_time.substring(3,5))
                            )
                     ) 
                )
                {
                    alert(label["order.js.express.holiday.time.start." + info.region]);
                    window.location = "/" + info.lang + "/home.html"; 
                               
                }
            }        
    }*/
    if (info.category!='startup'){	
	if ((info.category=='home')|(info.category=='login')|(info.category=='order_type')|(info.category=='select_address')|(info.category=='confirm')|(info.category=='finish')|(info.category=='logout')){
	var url = "";
	if (info.category == 'home') url = menuService.root + "/" + info.version + "/" + info.region + "/" + info.lang + "/home.js";
	else url = "/templates/olos/js/dummy.js";
	new Ajax.Request( url, {
		onSuccess:updateMenu,
		onFailure:function(transpot){},
		method: 'get'
	});
	}
	
	else {
	var url=menuService.root+"/"+info.version+"/"+info.region+"/"+info.lang+"/"+info.category+".js";
  new Ajax.Request( url, {
		onSuccess:updateMenu,
		onFailure:function(transpot){},
		method: 'get'
	});
	}
	try
	{
	    $('currency').update(label["order.js.currency."+info.region]+' ');
	}catch(e){}
	
	}
}

function getMenuItem(id) {
    if (menuItems) {
        for (var i = 0; i < menuItems.length; i++) {
            if (menuItems[i].id == id) return menuItems[i];
        }
        if (menuItems.id == id) {
            return menuItems;
        }
    }
    if (couponMenuItems) {
        for (var i = 0; i < couponMenuItems.length; i++) {
            if (couponMenuItems[i].id == id) return couponMenuItems[i];
        }
        if (couponMenuItems.id == id) {
            return couponMenuItems;
         }
    }   
}

function updateMenu(transport,json){
    try {
	        menuItems=('/*-secure-\n'+transport.responseText+'\n*/').evalJSON();
	        if (info.UI == "express") {
	            callOrderService("init", "", updateExpressCartCallBack);
	            updateExpressMenu(menuItems);
	        } else {
	            updateNormalMenu(menuItems);
	        }
	    } catch (e) {
	        //alert(e)
       return;
    }
	
}

function updateNormalMenu(menuItems) {
    var menuHighlightHtml = "";
    var menuHtml = "";
    var menuDDOHtml = "";
    var comparison = false;
    var today = info.systemTime;
    if(cart.advOrder)
    {
        var tempd = new Date();
        tempd.setFullYear(cart.advOrderDate.split("-")[0],cart.advOrderDate.split("-")[1] -1 ,cart.advOrderDate.split("-")[2]);
        today = tempd;
    }
    var cyop = false;
    //alert(menuItems.length)
    if (menuItems.length == undefined) cyop = true;
    if (!cyop) {
        menuItems.each(
		function(item) {
		    if (item.effective > today || item.expire < today) return;
		    item.info = info;
		    item.label = label;
		    if (!item.highlight) {
		        if (item.comparison) { comparison = true; }
		        if (item.type == 'redeem') {
		            menuHtml += templates.menuRedeemItem.evaluate(item);
		        } else if (item.type == 'upgrade') {
		            menuHtml += templates.menuUpgradeItem.evaluate(item);
		        } else if (item.type == 'combo') {
		            menuHtml += templates.menuComboItem.evaluate(item);
		        } else if (item.type == 'pizza') {
		            menuHtml += templates.menuPizzaItem.evaluate(item);
		        } else if (item.type == 'food') {
		            menuHtml += templates.menuFullItem.evaluate(item);
		        } else if (item.type == 'daydayoffer') {
		            var isValid = true;
		            var currentDate = info.systemTimeFormattedDate;
		            var currentDay = info.systemTime.getDay();
		            var currentTime = info.systemTimeFormattedHour;

		            if (cart.advOrder) {
		                currentTime = cart.advOrderHour + ":" + cart.advOrderMinutes + ":00";
		                var tempd = new Date();
		                tempd.setFullYear(cart.advOrderDate.split("-")[0], cart.advOrderDate.split("-")[1] - 1, cart.advOrderDate.split("-")[2]);
		                currentDay = tempd.getDay();
		                currentDate = cart.advOrderDate;
		            }
		            
		            if (item.excludingDays.length != 0) {
		                for (var i = 0; i < item.excludingDays.length; i++) {
		                    var d = item.excludingDays[i];
		                    if (currentDate == d.date) {
		                        excludeingDay = false;
		                    }
		                }
		            }
		            if (info.publicHolidays.length != 0) {
		                for (var i = 0; i < info.publicHolidays.length; i++) {
		                    var d = info.publicHolidays[i];
		                    if (currentDate == d) {
		                        isValid = false;
		                    }
		                }
		            }
		            if (isValid) {
		                if (item.availableDays.length != 0) {
		                    for (var i = 0; i < item.availableDays.length; i++) {
		                        var d = item.availableDays[i];
		                        if (currentDay == d.day && d.from != '' && d.to != '') {
		                            if (d.from + ":00" <= currentTime && d.to + ":00" >= currentTime) {
		                                menuDDOHtml += templates.menuDayDayOfferItem.evaluate(item);
		                            }
		                        }
		                    }
		                }
		            }
		        }
		    } else {
		        if (item.comparison) comparison = true;
		        if ((item.type == 'redeem') && (parseInt(currentMember.points) >= parseInt(item.bp))) {
		            menuHighlightHtml += templates.menuRedeemHighlightItem.evaluate(item);
		        } else if (item.type == 'upgrade') {
		            menuHighlightHtml += templates.menuUpgradeHighlightItem.evaluate(item);
		        } else if (item.type == 'combo') {
		            menuHighlightHtml += templates.menuComboHighlightItem.evaluate(item);
		        } else if (item.type == 'pizza') {
		            menuHighlightHtml += templates.menuPizzaItem.evaluate(item);
		        } else if (item.type == 'food') {
		            menuHighlightHtml += templates.menuFullItem.evaluate(item);
		        }
		    }
		}
	    );

		if (menuDDOHtml != "") {
		    $('ddo_group').show();
		    $('menu_ddo_items').update(menuDDOHtml);
		} else { $('ddo_group').hide(); }
        if (menuHighlightHtml != "") {
            $('menu_highlight_items').update(menuHighlightHtml);
            $('menu_highlight_items').show();
            $('menu_highlight_title').show();
        } else {
            $('menu_highlight_items').hide();
            $('menu_highlight_title').hide();
        }
        if (menuHtml != "") {
            $('menu_items').update(menuHtml);
            $('menu_items').show();
            $('menu_title').show();
        } else {
            $('menu_items').hide();
            $('menu_title').hide();
        }

        if (comparison) {
            $('comparison_button').show();
        } else {
            $('comparison_button').hide();
        }

    } else {
    if (request.itemIndex != "" && cart.items[request.itemIndex]) {
            editCyop();
        } else {
        var toppingsHtml = "<div>" + label["order.js.cyop.toppings.price"] + "</div><table><tr>";
            var toppingIndex = 0;
            var baseTypeHtml = "";
            var arVersion = navigator.appVersion.split("MSIE")
            var version = parseFloat(arVersion[1])

            menuItems.options.each(
		function(ot, otIndex) {
		    if (otIndex == menuItems.options.length - 1) {
		        cyopJSObject.maxItem = ot.qty;
		    }
		    ot.products.each(function(item, index) {
		        if (item.effective > today || item.expire < today) return;
		        item.info = info;
		        item.label = label;
		        item.index = index;
		        item.jsName = item.name.replace(/'/g, '&amp;#39;');
		        if (item.type == "base") {
		            menuHtml += templates.menuCyopBase.evaluate(item);
		        }
		        else if (item.type == "baseType") {
		            baseTypeHtml += templates.menuCyopBaseType.evaluate(item);
		        } else if (item.type == "toppings") {
		            item.moving = toppingArray[toppingIndex];
		            if ((version >= 5.5) && (version <= 6) && (document.body.filters)) {
		                toppingsHtml += templates.toppingsIE.evaluate(item);
		            } else {
		                toppingsHtml += templates.toppings.evaluate(item);
		            }
		            if (toppingIndex % 10 == 9)
		                toppingsHtml += "</tr><tr>";
		            toppingIndex++;
		        } else if (item.type == "dummyToppings") {
		            cyopJSObject.dummyItem = item.id;
		         }
		    })
		});

		toppingsHtml += "</tr></table>";
            if (menuHtml != "") {
                var tempObj = { menuHtml: menuHtml, baseTypeHtml: baseTypeHtml, toppingsHtml: toppingsHtml }
                $('menu_items').update(templates.cyop.evaluate(tempObj));
                $('menu_items').show();
                $('menu_title').show();
            } else {
                $('menu_items').hide();
                $('menu_title').hide();
            }
        }
    }
}

function editCyop(cyopData) {
    try {

        $('menu_title').update(label["order.js.cyop.step4"]);

        var currentCyop = cyopData ? cyopData : $(cart.items[request.itemIndex]);

        var toppingsHtml = "<div>"+label["order.js.cyop.toppings.price"]+"</div><table><tr>";
        var toppingIndex = 0;
        var baseTypeHtml = "";
        var arVersion = navigator.appVersion.split("MSIE")
        var version = parseFloat(arVersion[1])

        var today = info.systemTime;
        if (cart.advOrder) {
            var tempd = new Date();
            tempd.setFullYear(cart.advOrderDate.split("-")[0], cart.advOrderDate.split("-")[1] - 1, cart.advOrderDate.split("-")[2]);
            today = tempd;
        }
        cyopJSObject.reset();
        menuItems.options.each(
		function(ot, otIndex) {
        if (otIndex == menuItems.options.length - 1) {
            cyopJSObject.maxItem = ot.qty;
        }
		    ot.products.each(function(item, index) {
		        if (item.effective > today || item.expire < today) return;
		        item.info = info;
		        item.label = label;
		        item.index = index;
		        item.jsName = item.name.replace(/'/g, '&amp;#39;');
		        if (currentCyop.products[0].id == item.id) {
		            cyopJSObject.base = { id: item.id, name: item.name, price: item.price, referenceType: item.referenceType };
		        }
		        if (currentCyop.products[1].id == item.id) {
		            cyopJSObject.baseType = { id: item.id, name: item.name, price: item.price, price1: item.price1 };
		        }
		        if (currentCyop.products[2].id == item.id) {
		            cyopJSObject.sauce = { id: item.id, name: item.name, price: item.price, price1: item.price1 };
		        }
		        if (item.type == "toppings") {
		            for (var i = 3; i < currentCyop.products.length; i++) {
		                if (currentCyop.products[i].id == item.id) {
		                    cyopJSObject.addToppings(item.id, item.name, 0, 0, item.price, item.price1);
		                    if (currentCyop.products[i].qty > 1) {
		                        for (var j = 1; j < currentCyop.products[i].qty; j++) {
		                            cyopJSObject.addToppings(item.id, item.name, 0, 0, item.price, item.price1);
		                        }
		                    }
		                }
		            }
		            item.moving = toppingArray[toppingIndex];
		            if ((version >= 5.5) && (version <= 6) && (document.body.filters)) {
		                toppingsHtml += templates.toppingsIE.evaluate(item);
		            } else {
		                toppingsHtml += templates.toppings.evaluate(item);
		            }
		            if (toppingIndex % 10 == 9)
		                toppingsHtml += "</tr><tr>";
		            toppingIndex++;
		        }  
		        if (item.type == "dummyToppings") {
		            cyopJSObject.dummyItem = item.id;
		        }
		    })
		});
		toppingsHtml += "</tr></table>";
        if (toppingsHtml != "") {
            var tempObj = { menuHtml: "", baseTypeHtml: "", toppingsHtml: toppingsHtml }
            $('menu_items').update(templates.cyop.evaluate(tempObj));
            $('menu_items').show();
            $('toppingsDiv').show();
            $('cyopChooseBase').src = info.menuFullPath + "/images/cyop/" + cyopJSObject.baseType.id + "_" + cyopJSObject.sauce.id + ".gif";
            $('cyopChooseBase').show();
            $('menu_title').show();
            //top += 42;
            var left = $('cyopChooseBase').positionedOffset().left;
            var top = $('cyopChooseBase').positionedOffset().top;
            var index = 1;
            for (var i = 0; i < cyopJSObject.toppingsList.length; i++) {
                var p = cyopJSObject.toppingsList[i];
                for (var j = 0; j < p.count; j++) {
                    var tempObj = {};
                    tempObj.id = p.id;
                    tempObj.top = top;
                    tempObj.left = left;
                    tempObj.info = info;
                    tempObj.index = index;
                    var arVersion = navigator.appVersion.split("MSIE")
                    var version = parseFloat(arVersion[1])
                    if ((version >= 5.5) && (version <= 6) && (document.body.filters)) {
                        $('toppingFinalHtml').innerHTML += templates.toppingsFinalIE.evaluate(tempObj);
                    } else {
                        $('toppingFinalHtml').innerHTML += templates.toppingsFinal.evaluate(tempObj);
                    }
                    index++;
                 }
            }
            cyopJSObject.showDetailTable('cyopTable');
            updateToppingsLocation();
            //window.setTimeout("cyopJSObject.showDetailTable('cyopTable')", 1500);
        }
    } catch (e) { alert(e)}
 }

function baseMove(obj, id, index, name,price,referenceType) {
    $$('img.pizzaBase').invoke('hide');
    $$('span.pizzaBaseWords').invoke('hide');
    //$('menu_title').update('<span style="cursor:pointer;color:blue" onClick="changeBase()">' + label["order.js.cyop.step1.edit"] + '</span> <span>' + label["order.js.cyop.step2"] + '</span>');
    $('menu_title').update( label["order.js.cyop.step2"]);
    cyopJSObject.base = { id: id, name: name, price: price, referenceType: referenceType };
    cyopJSObject.showDetailTable('cyopTable');
    $(obj).show();
    var moveLength = 140;
    if (index == 1) moveLength = moveLength * -1;
    new Effect.Move(obj, { x: moveLength, y: 0, mode: 'absolute' });
    $$('img.pizzaBaseChoice').invoke('appear');
    $$('span.pizzaBaseChoiceWords').invoke('appear');   
}

function choiceBaseType(obj, id, name, price,price1) {
    $('menu_title').update(label["order.js.cyop.step3"]);
    cyopJSObject.baseType = { id: id, name: name, price: price,price1:price1 };
    cyopJSObject.showDetailTable('cyopTable');
    $$('img.pizzaBase').invoke('fade');
    $$('img.pizzaBaseChoice').invoke('fade');
    $$('span.pizzaBaseChoiceWords').invoke('fade');   
    $('cyopChooseBase').src = info.menuFullPath + "/images/cyop/"+id+"_.gif";
    var sauceHtml = "";
    var today = info.systemTime;
    menuItems.options.each(
		function(ot, itIndex) {
            ot.products.each(function(item, index) {
                if (item.effective > today || item.expire < today) return;
                item.info = info;
                item.label = label;
                item.index = index;
                item.baseID = id;
                if (item.type == "sauce") {
                    sauceHtml += templates.sauce.evaluate(item);
                }    		    
		     })
		});
		$('sauceDIV').update(sauceHtml);
		window.setTimeout("$('sauceDIV').appear()", 1000);	
}

function chooseSauce(baseID, sauceID, name, price,price1) {
    $('menu_title').update(label["order.js.cyop.step4"]);
    cyopJSObject.sauce = { id: sauceID, name: name, price: price, price1: price1 };
    $$('span.sauce').invoke('fade');
    $('cyopChooseBase').src = info.menuFullPath + "/images/cyop/" + baseID + "_" + sauceID + ".gif";
    cyopJSObject.showDetailTable('cyopTable');
    window.setTimeout("loadToppings()", 1000);
}

function loadToppings() {
    $('toppingsDiv').appear();
    $('cyopChooseBase').appear();
    cyopJSObject.showDetailTable('cyopTable',true); 
 }

 function chooseToppings(obj, x, y, id, name, price, price1) {
     var validAdd = cyopJSObject.addToppings(id, name,x,y,price,price1);
     if (!validAdd) {
         alert(label["order.js.cyop.max.item"]);
     }
}
function toppingsFinishMoving(id, max) {
    var index = 1;
    for (var i = 1; i <= max; i++) {
        if ($$('.tf' + i)[0] == undefined) {
            index = i;
            break;
         }
    }
    var objID = "toppings" + id;
    $(objID).hide();
    $(objID).appear().setStyle({ left: "0px", top: "0px" });
    var left = $('cyopChooseBase').positionedOffset().left;
    var top = $('cyopChooseBase').positionedOffset().top;
    var tempObj = {};
    tempObj.id = id;
    tempObj.top = top;
    tempObj.left = left;
    tempObj.info = info;
    tempObj.index = index;
    var arVersion = navigator.appVersion.split("MSIE")
    var version = parseFloat(arVersion[1])
    
    if ((version >= 5.5) && (version <= 6) && (document.body.filters)) {
        $('toppingFinalHtml').innerHTML += templates.toppingsFinalIE.evaluate(tempObj);
    } else {
        $('toppingFinalHtml').innerHTML += templates.toppingsFinal.evaluate(tempObj);
    }
}

function updateExpressMenu(menuItems){
    try{
    var dayValid = new Date();
	writeDebug("express menu init> success");
	
	var comboMenuHtml="";
	var itemMenuHtml="";
	var allCombo="";
    var currentDay=info.systemTime.getDay();
	var currentTime=info.systemTimeFormattedHour;
	var currentDate = info.systemTimeFormattedDate;
	
	var excludeingDay = false;
	var first = 1;
	var hasItems = false;
	menuItems.each(
		function(item){
            excludeingDay = false;
            if(item.excludingDays.length!=0){


                for(var i=0;i<item.excludingDays.length;i++){
                    var d=item.excludingDays[i];
                    if(currentDate==d.date){
                        excludeingDay = true;
                    }
                }                
            }
            if(!excludeingDay){ 
                if(item.availableDays.length!=0){            
                        for(var i=0;i<item.availableDays.length;i++){
                            var d=item.availableDays[i];
                            if(currentDay==d.day && d.from != '' && d.to !=''){
                                if(d.from+":00" <= currentTime &&  d.to+":00" >= currentTime){
                                  if(item.expressType=="package"){	
		                                item.info=info;
		                                item.label=label;
		                                item.default_choice.each(function(c,cIndex){
		                                    var itemsHtml="";
		                                    c.info=info;
		                                    c.options.each(function(o,oIndex){
		                                        o.choice=oIndex+1;
		                                        o.label=label;
		                                        o.info=info;
		                                        itemsHtml+=templates.expressComboItem.evaluate(o);
		                                    });
		                                    c.id=item.id;
		                                    c.choice=cIndex+1;
		                                    c.itemsHtml=itemsHtml;
		                                    c.label=label;        
		                                    item["choiceHtml"+cIndex]=templates.expressComboChoice.evaluate(c);
		                                    item["choiceControlHtml"+cIndex]=templates.expressComboControl.evaluate(c);
		                                });
			                            comboMenuHtml+=templates.expressComboDiv.evaluate(item);		
			                        }else{
                                        if(info.category == 'express_menu'){
                                            if( first == 1){
                                                itemMenuHtml+=templates.expressItem1stDiv.evaluate(item);
                                                first = 0;
                                            }
			                                item.info=info;
			                                item.label=label;
			                                itemMenuHtml+=templates.expressItemDiv.evaluate(item);	
							                hasItems = true;
                                        }		    
			                        }
                                }
                            }
                        }        
                    }                		    
		        }
            }
	    );
    
}catch(e){
writeDebug(e);
}
    if (info.category == 'express_menu' && hasItems )
    {
        itemMenuHtml+="<div class='with_bg_Bottom'>&nbsp;</div>";
    }
    $('express_combo_div').update(comboMenuHtml);  
    $('express_item_div').update(itemMenuHtml);
	  	
}

function showComparison(){
    var items=[];
   disableScreen();
    menuItems.each(
		function(item){
		    if(!item.comparison)return;
		    if(item.name=="" || item.name==null){
		        item.name=item.description;
		    }
		    items[items.length]=item;
		}
	);
	
	var itemTd=$("comparison_table").select('*[class=item]');
	var today = info.systemTime;
	if(cart.advOrder)
    {
        var tempd = new Date();
        tempd.setFullYear(cart.advOrderDate.split("-")[0],cart.advOrderDate.split("-")[1] -1 ,cart.advOrderDate.split("-")[2]);
        today = tempd;   
    }
	var itemIndex = 0
	itemTd.each(
	    function(item,index){
	        var cItem=items[itemIndex];
	        while(cItem.effective > today || cItem.expire < today)
	        {
	            itemIndex++;
	            cItem=items[itemIndex]
	        }
	        if(cItem){
	            cItem.info=info;
	            cItem.label=label;
	            item.update(templates.comparisonItem.evaluate(cItem));
	        }else{
	            item.update("");
	        }
	        itemIndex++;
	    }
	);
	// for ie6
	new Ajax.Request( '/services/systemParam.html', {
		onSuccess:function(transpot){
		var st=document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop;
		$('comparison_popup').style.top=st;
	    $('comparison_popup').t=st;
	    $('comparison_popup').update($('comparison_popup').innerHTML);
	    var left = $('body').positionedOffset().left + 20;
	    $('comparison_popup').show().setStyle({ left: left + "px" });
        updateLocation('comparison_popup');
		},method: 'post'
	});
}

function hideComparison(){
    $('comparison_popup').hide();
    enableScreen();
}

function loadPackage(item,callback){
	var url=menuService.root+"/"+info.version+"/"+info.region+"/"+info.lang+"/"+item+".js";
	new Ajax.Request( url, {
		onSuccess:callback,
		onFailure:function(transpot){writeDebug("menu init> menu not found");},
		method: 'get'
	});
}

function onError(transport){
}

function writeDebug(msg){
	if($('debugDiv')){
		$('debugDiv').value=msg+'\r\n'+$('debugDiv').value;
	}
}

var popupID="";
var popupAction="";
var popupTimer;
var popupDiv;

function showPopupDesc(div,id){
    try{
        clearTimeout(popupTimer);
    }catch(e){};
    
    
    var layer=$('popupLayer');
    if(popupID!=id)hidePopupDelay();
    if(popupID==id && layer.style.display=="")return;   
    popupTimer=setTimeout("showPopupDelay()",500);
    popupDiv=div;
    popupID=id;    
    //alert($(div).positionedOffset);
}

function showPopupDelay(){
      try{
        clearTimeout(popupTimer);
    }catch(e){};
    var pos=$(popupDiv).positionedOffset();
    var layer=$('popupLayer');
    
    menuItems.each(
		function(item){
			if(item.id==popupID){
			    var title=layer.getElementsByClassName('title');
			    var desc=layer.getElementsByClassName('desc');
			    var price=layer.getElementsByClassName('price');
			    title[0].update(item.name);
			    desc[0].update(item.description);
			    price[0].update("$"+item.price);
			}
		}
	);
	
    
    layer.setStyle({display:"",left:(pos.left+3)+"px",top:(pos.top-65)+"px"});   
}

function hidePopupDelay(){
    var layer=$('popupLayer');
    layer.setStyle({display:"none"});
}

function hidePopupDesc(id){
    try{
        clearTimeout(popupTimer);
       }catch(e){};
    popupTimer=setTimeout("hidePopupDelay()",200);
}

Event.observe(window, "load", menuNewInit); 
