﻿//  Specialized
//-------------------------------------------------------------------------//

window.onload = function()
{
    // fix safari issue
    try
    {
        isSafari = false;
        var vendorStr = navigator.vendor;
        
        if(vendorStr.indexOf('Apple') == 0) isSafari = true;
        
        if(isSafari)
        {
            for(var i=1; i<=10; i++)
            {
                var obj = document.getElementById('topLevel_mainMenu_' + i);
                
                obj.style.fontSize = '0.9em !important';
                obj.style.paddingRight = '9px !important';
            }
        }
    }
    catch (_error)
    {
    }
}

// Right hand news expanding / collapsing
//-------------------------------------------------------------------------//

function toggleSection(sectionId)
{
    if(toggleSectionCurrentObj != null)
    {
        var toggleObj = $(toggleSectionCurrentObj);
        var toggleTitle = $(toggleSectionCurrentObj.replace('subSection_more_', 'subTitle_'));
        
        Effect.BlindUp(toggleObj, {duration:.4});
        toggleTitle.style.backgroundPosition = '0px 0px';
        
        toggleSectionCurrentObj = null;
    }
    
    var obj = $(sectionId);
    var titleId = $(sectionId.replace('subSection_more_', 'subTitle_'));
    
    var style = obj.style.display;
    
    if(style == '')
    {
        Effect.BlindUp(obj, {duration:.4});
        titleId.style.backgroundPosition = '0px 0px';
    }
    else
    {
        Effect.BlindDown(obj, {duration:.4});
        titleId.style.backgroundPosition = '0px 30px';
    }
    
    toggleSectionCurrentObj = sectionId;
}

function toggleSectionPlus(sectionId){

	var obj = $(sectionId);
	var titleId = document.getElementById(sectionId+"_toggle")
	var style = obj.style.display;
	
	if (style=="none"){
		titleId.style.backgroundPosition = "0px 30px";
		Effect.BlindDown(obj, {duration:.4});
		} else {
		titleId.style.backgroundPosition = "0px 0px";
		Effect.BlindUp(obj, {duration:.4});
		
	}
	
	
}


// Ordering/Availability Menu
//-------------------------------------------------------------------------//



function om_menu(idx) {

    var menu_obj = $('orderingSubMenu'+idx);

    if (om_open == true) {
    
        om_blind(menu_obj);
        om_open = false;

        if (om_openChild_id != -1) {
            om_blind('om_child_' + om_openChild_id);
            om_openChild_id = -1;
        }
        
		
		
    }
    else {
    
        om_blind(menu_obj);
        om_open = true;
        
    }
}



function om_child(child_id) {

	
	if (om_openChild_id==null){
		om_openChild_id = -1
		}

    if (om_openChild_id != -1) {
        om_blind('om_child_' + om_openChild_id);
    }

    if (om_openChild_id != child_id) {
        var child_obj = $('om_child_' + child_id);
        om_blind(child_obj);

        om_openChild_id = child_id;
    }
    else {
        om_openChild_id = -1;
    }
}

function om_blind(obj) {
    Effect.toggle(obj, 'Blind', { duration: 0.4 });
}


