var strImageType = 'png';
var x = navigator.userAgent;
var isIE6 = false;
if (x.indexOf('MSIE 6.0') != -1 || x.indexOf('MSIE 5.5') != -1)
{            
    strImageType = 'jpg'; //pngs are not aligning correctly in IE6/55.
    isIE6 = true;    
}

function ChangeBgImages(strItem, strImageTop, strImageBottom, isOver)
{    
    var objTop    = document.getElementById(strItem + 'Top');
    var objBottom = document.getElementById(strItem + 'Bottom');        
    
    if (isIE6)
    {                    
        if (objBottom != null && objTop != null)    
        {                        
            var newImageTop    = 'url(/images/master/' + strImageTop + ')';
            var newImageBottom = 'url(/images/master/' + strImageBottom + ')';  
            objTop.style.backgroundImage    = newImageTop;
            objBottom.style.backgroundImage = newImageBottom;       
        }   
    }
    else
    {
        if (objBottom != null && objTop != null)    
        {                        
            var newImageBottom = 'url(/images/master/' + strImageBottom + ')';  
            if (isOver)
            {
                objTop.style.backgroundPosition = '0px -200px';                
            }
            else
            {
                objTop.style.backgroundPosition = 'top left';
            }
            objBottom.style.backgroundImage = newImageBottom;             
        }   
    }
}

//function SupermarketOver()
//{    
//    ChangeBgImages('Shopping', 'menuOn_03.png', 'menuOnBottom_03.' + strImageType, true); 
//}

//function SupermarketOut()
//{
//    ChangeBgImages('Shopping', 'menuOff_03.png', 'menuOffBottom_03.' + strImageType, false); 
//}

//function CafeOver()
//{
//    ChangeBgImages('Meal', 'menuOn_02.png', 'menuOnBottom_02.' + strImageType, true); 
//}

//function CafeOut()
//{
//    ChangeBgImages('Meal', 'menuOff_02.png', 'menuOffBottom_02.' + strImageType, false); 
//}

//function NewsOver()
//{    
//    ChangeBgImages('News', 'menuOn_04.png', 'menuOnBottom_04.' + strImageType, true); 
//}

//function NewsOut()
//{
//    ChangeBgImages('News', 'menuOff_04.png', 'menuOffBottom_04.' + strImageType, false); 
//}

//function UniOver()
//{
//    ChangeBgImages('News', 'menuOn_03.png', 'menuOnBottom_03.' + strImageType, true);           
//}

//function UniOut()
//{
//    ChangeBgImages('News', 'menuOff_03.png', 'menuOffBottom_03.' + strImageType, false);
//}


//function CalcOver() {
//    ChangeBgImages('Calc', 'menuOn_03.png', 'menuOnBottom_03.' + strImageType, true);
//}

//function CalcOut() {
//    ChangeBgImages('Calc', 'menuOff_03.png', 'menuOffBottom_03.' + strImageType, false);
//}

function getFlashMovie(movieName) 
{
    var isIE = navigator.appName.indexOf('Microsoft') != -1;    
    return (isIE) ? document.getElementById(movieName) : document[movieName];   
  
    /*
    if (window.document[movieName]) 
    {
        return window.document[movieName];
    }
    if (navigator.appName.indexOf("Microsoft Internet")==-1)
    {
        if (document.embeds && document.embeds[movieName])
            return document.embeds[movieName]; 
    }
    else 
    {
        return document.getElementById(movieName);
    }
    */
}

function HomeOverScript()
{      
    HomeOver();
    if (getFlashMovie('myMovie') != null)
    {
        getFlashMovie('myMovie').HouseOver(1);     
    }
}
function HomeOutScript() 
{     
    HomeOut();
    if (getFlashMovie('myMovie') != null)
    {
        getFlashMovie('myMovie').HouseOut(1);
    }
} 

function HomeOver()
{
    ChangeBgImages('Home', 'menuOn_01.png', 'menuOnBottom_01.' + strImageType, true); 
}

function HomeOut()
{
    ChangeBgImages('Home', 'menuOff_01.png', 'menuOffBottom_01.' + strImageType, false); 
}


function HealthyOverScript()
{      
    UniversityOver();
    if (getFlashMovie('myMovie') != null)
    {
        getFlashMovie('myMovie').UniversityOver(1);     
    }
}
function HealthyOutScript() 
{     
    UniversityOut();
    if (getFlashMovie('myMovie') != null)
    {
        getFlashMovie('myMovie').UniversityOut(1);
    }
} 

function UniversityOut()
{
    ChangeBgImages('Healthy', 'menuOff_02.png', 'menuOffBottom_02.' + strImageType, false); 
}

function UniversityOver()
{
    ChangeBgImages('Healthy', 'menuOn_02.png', 'menuOnBottom_02.' + strImageType, true); 
}


function MediaOverScript()
{      
    NewsagentOver();
    if (getFlashMovie('myMovie') != null)
    {
       // getFlashMovie('myMovie').MediaOver(1);    
       getFlashMovie('myMovie').NewsagentOver(1);
    }
}
function MediaOutScript() 
{     
    NewsagentOut();
    if (getFlashMovie('myMovie') != null)
    {
        getFlashMovie('myMovie').NewsagentOut(1);
    }
} 
function NewsagentOver()
{
    ChangeBgImages('PressMedia', 'menuOn_03.png', 'menuOnBottom_03.' + strImageType, true); 
}

function NewsagentOut()
{
    ChangeBgImages('PressMedia', 'menuOff_03.png', 'menuOffBottom_03.' + strImageType, false); 
}


function LearnOverScript() 
{     
    LibraryOver();
    if (getFlashMovie('myMovie') != null)
    {
        getFlashMovie('myMovie').LibraryOver(1);
    }
}
function LearnOutScript() 
{ 
    LibraryOut();
    if (getFlashMovie('myMovie') != null)
    {
        getFlashMovie('myMovie').LibraryOut(1);
    }
}  

function LibraryOver()
{
    ChangeBgImages('Learn', 'menuOn_03.png', 'menuOnBottom_03.' + strImageType, true);           
}

function LibraryOut()
{
    ChangeBgImages('Learn', 'menuOff_03.png', 'menuOffBottom_03.' + strImageType, false);         
}



function ExpertOverScript()
{
    ClinicOver();
    if (getFlashMovie('myMovie') != null)
    {
        getFlashMovie('myMovie').ClinicOver(1);
    }   
}

function ExpertOutScript()
{
    ClinicOut();
    if (getFlashMovie('myMovie') != null)
    {
        getFlashMovie('myMovie').ClinicOut(1);
    }       
}
function CafeOver()
{
    ChangeBgImages('Goodness', 'menuOn_04.png', 'menuOnBottom_04.' + strImageType, true);           
}

function CafeOut()
{
    ChangeBgImages('Goodness', 'menuOff_04.png', 'menuOffBottom_04.' + strImageType, false);         
}



function ClinicOver()
{
    ChangeBgImages('Expert', 'menuOn_04.png', 'menuOnBottom_04.' + strImageType, true);           
}

function ClinicOut()
{
    ChangeBgImages('Expert', 'menuOff_04.png', 'menuOffBottom_04.' + strImageType, false);         
}

function GoodnessOverScript()
{
    CafeOver();
    if (getFlashMovie('myMovie') != null)
    {
        getFlashMovie('myMovie').CafeOver(1);
    }  
}

function GoodnessOutScript()
{
    CafeOut();
    if (getFlashMovie('myMovie') != null)
    {
        getFlashMovie('myMovie').CafeOut(1);
    }   
}

function AboutUsOverScript()
{
    FarmOver();
    if (getFlashMovie('myMovie') != null)
    {
        getFlashMovie('myMovie').FarmOver(1);
    }    
}

function AboutUsOutScript()
{
    FarmOut();
    if (getFlashMovie('myMovie') != null)
    {
        getFlashMovie('myMovie').FarmOut(1);
    }     
}
function FarmOver()
{
    ChangeBgImages('AboutUs', 'menuOn_04.png', 'menuOnBottom_04.' + strImageType, true);           
}

function FarmOut()
{
    ChangeBgImages('AboutUs', 'menuOff_04.png', 'menuOffBottom_04.' + strImageType, false);         
}


//function NewsOverScript()
//{      
//    NewsOver();
//    if (getFlashMovie('myMovie') != null)
//    {
//        getFlashMovie('myMovie').NewsOver(1);     
//    }
//}
//function NewsOutScript() 
//{     
//    NewsOut();
//    if (getFlashMovie('myMovie') != null)
//    {
//        getFlashMovie('myMovie').NewsOut(1);
//    }
//} 
//function SupermarketOverScript()
//{        
//    SupermarketOver();
//    if (getFlashMovie('myMovie') != null)
//    {
//        getFlashMovie('myMovie').SupermarketOver(1);
//    }
//}
//function SupermarketOutScript()
//{      
//    SupermarketOut();
//    if (getFlashMovie('myMovie') != null)
//    {
//        getFlashMovie('myMovie').SupermarketOut(1);
//    }
//}
//function CafeOverScript() 
//{   
//    CafeOver();
//    if (getFlashMovie('myMovie') != null)
//    {
//        getFlashMovie('myMovie').CafeOver(1);
//    }
//} 
//function CafeOutScript() 
//{   
//    CafeOut();
//    if (getFlashMovie('myMovie') != null)
//    {
//        getFlashMovie('myMovie').CafeOut(1);
//    }
//} 
//function CalcOverScript() {
//    CalcOver();
//    if (getFlashMovie('myMovie') != null) {
//        getFlashMovie('myMovie').SupermarketOver(1);
//    }
//}
//function CalcOutScript() {
//    CalcOut();
//    if (getFlashMovie('myMovie') != null) {
//        getFlashMovie('myMovie').SupermarketOut(1);
//    }
//}