﻿var imgCtrl=null;
var prevImgUrl=null;
var selectedCtrl=null;
function MM_swapImage(ImgControl,obj1,ImgUrl,obj2)
{
    var _imgCtrl = document.getElementById(ImgControl);
    imgCtrl= _imgCtrl;
    prevImgUrl = imgCtrl.src;
    _imgCtrl.src = ImgUrl;
}
function MM_swapImgRestore()
{
    document.getElementById(imgCtrl.id).src = prevImgUrl;
}

function MenuSelected(SelectedCtrl,ImgUrl)
{
   selectedCtrl = SelectedCtrl;
   document.getElementById(selectedCtrl.id).src = ImgUrl;
}

function ToggelDropDown(thisControl,dropdownControlID)
{
    $(document).ready(function(){
    
        if($("#"+dropdownControlID).is(":visible"))
        {
           return;
        }
        
        //clear all dropdown
        $(".dropdown_container").hide();
        
        if(navigator.appCodeName.indexOf('Mozilla') > -1)
        {
           //dropdown  the menu
           $("#"+dropdownControlID).fadeIn('medium');
        }else
        {
           $("#"+dropdownControlID).slideDown('slow')
        }
       
       //$("#"+dropdownControlID).mouseout(function(){$("#"+dropdownControlID).delay('fast').hide('slow');});
       
       //$(".dropdown_container").blur(function(){alert('test');});
       
       $("#"+dropdownControlID).css({'left':$(thisControl).position().left,'top':$(thisControl).position().top + 15});
       
   });
}

function InitDropDown()
{
    //hide all
     HideAllDropDown();
    
    $(document).ready(function(){
        $(".dropdown_container").hover(
            function()
            {
                if($(".dropdown_container").is(":visible"))
                {
                    //$(this).stop();
                    return;
                }
                
            },
            function()
            {
                $(this).delay('1000').slideUp('slow');
            });
       
       $(".menu td a.no-dropdown").hover(function(){HideAllDropDown();},function(){HideAllDropDown();});
        //no to hide if mouseout at that dropdown
    });
}

function HideAllDropDown()
{
    $(document).ready(function(){
        $(".dropdown_container").hide();
    });
}


