﻿/////////////////////////////////////////////////////////////////
//
//  App_Master.Page.js JScript File
//  This file contains functions specific to App_Master.Page.
//
//---------------------------------------------------------------
//  (C) 2008 Copyright JVC Canada 
//---------------------------------------------------------------

var ifr = null;

masterPageInit();

function masterPageInit() 
{
    ifr = document.getElementById("masterIframe");

    MM_preloadImages("../Img/Button/WinClose.png","../Img/Bkg/ProdOnBkg.jpg","../Img/Button/Worldwide_Hot.png","../Img/Button/ButtonBlackOn.png")

    ////////////////////////////
    // cmdSearch - hover effect
    AttachEvent("ctl00_cmdSearch", "mouseover", function(){MM_swapImage('ctl00_cmdSearch', '', '../Img/Button/Search_Hot.jpg',0)}, false);
    AttachEvent("ctl00_cmdSearch", "mouseout",  function(){MM_swapImage('ctl00_cmdSearch', '', '../Img/Button/Search.jpg',0)}, false);

    ////////////////////////////////////
    //  PRODUCTS CONSUMER MENU
    AttachEvent("NavMenuProdConsumerBubble", "mouseover", function(){clearTimeout(BubbleTimer)}, false);
    AttachEvent("NavMenuProdConsumerBubble", "mouseout",  function(){BubbleOff("NavMenuProdConsumerBubble",false)}, false);

    ///////////////////////////////////
    // WORLDWIDE MENU - hover effect
    //
    AttachEvent("WorldwidePlaceHolder", "mouseover", WorldwideOn, false);
    AttachEvent("WorldwidePlaceHolder", "mouseout",  WorldwideOff, false);
    // Worldwide Bubble 
    AttachEvent("MenuJVCWorldwideBubble", "mouseover", function(){clearTimeout(BubbleTimer)}, false);
    AttachEvent("MenuJVCWorldwideBubble", "mouseout",  function(){BubbleOff("MenuJVCWorldwideBubble",false)}, false);
    
}
    
    
// Hover ON
function WorldwideOn()
{
    // hilite effect
    document.getElementById("imgWorldwide").className = "WorldwideOn";
    document.getElementById("ctl00_lblWorldwide").style.color = "#FFFFFF";
    
    // Show menu
    var yOffSet = 74;
    if (_Theme=="IE6") yOffSet = 71;
    BubbleOn("MenuJVCWorldwideBubble","WorldwidePlaceHolder", yOffSet, -93, BubbleON_delay)
}
// Hover OFF
function WorldwideOff()
{
    // turn off hilite effect
    document.getElementById("imgWorldwide").className = "WorldwideOff";
    document.getElementById("ctl00_lblWorldwide").style.color = "#FF0000";
    // Hide menu
    BubbleOff("MenuJVCWorldwideBubble",false)
}

//////////////////////////////////////////////////////////////
// MPEOpen: open the main popup window in the master page
//
// url: url to open in the iFrame
// width: popup width in pixels
// height: popup height in pixels
// overflow: auto, inherit, hidden, scroll, visible
function MPEOpen(url, width, height, overflow, PopupTitle)
{
    if (width==null) width="540px";
    if (height==null) height="300px";
    if (overflow==null) overflow = "hidden";
    if (PopupTitle==null) PopupTitle = "JVC Canada";

    width+="";height+=""; // Mozilla browsers
    if (width.indexOf("px")==-1) width+="px"; // Mozilla browsers
    if (height.indexOf("px")==-1) height+="px"; // Mozilla browsers
    
    ifr.src = url;
    
    document.getElementById("ctl00_lblPopupTitle").innerHTML = PopupTitle;
    
    var mpe = document.getElementById("MasterPopupDiv"); 
    mpe.style.width=width;
    mpe.style.height=height;
    document.getElementById("MasterPopupDivContent").style.height=height;
    MPEShow(true);
    
}

var iCount = 0;
function MPEShow(isReset)
{
    if (isReset) iCount=0;
    if (iCount < 60) {
        (ifr.readyState=="complete" || ifr.readyState==4 || ifr.readyState==undefined ? $find("MPE").show() : setTimeout('MPEShow()',500)  );    
    }
    else {
        alert("System time-out. You may want to try the operation again.");
    }
    iCount++;

}

//////////////////////////////////////////////////////////////////////////
// MPEClose: close the main popup window in the master page
//
// NavigateTo: after closing the popup window, redirect main page to this url (optional).
function MPEClose(NavigateTo)
{   

    $find("MPE").hide();
    document.getElementById("masterIframe").src = "";  
    
    if (NavigateTo!=null) {
        window.location.href = NavigateTo; }
        
}

function ValidateSearch()
{
    if (document.getElementById("ctl00_txtLookFor").value == "")
        window.event.returnValue = false; 

}


// Set "Please Wait..." message to progress indicator.
// The variable _Wait is created with the page render according to the culture selected.
try{$get("ProgressMessage").innerHTML = _Wait;}catch(e){}
