﻿$(document).ready(function() {
    $('.iframeNewsPopupstart_asia').bind('click', function(){
        ShowNewsIframeBox('Contact_Asia.aspx');
    });
    $('.iframeNewsPopupstart_me').bind('click', function(){
        ShowNewsIframeBox('Contact_MiddleEast.aspx');
    });
    $('.iframeNewsPopupstart_euro').bind('click', function(){
        ShowNewsIframeBox('Contact_Europe.aspx');
    });
    $('.iframeNewsPopupstart_intl').bind('click', function(){
        ShowNewsIframeBox('Contact_International.aspx');
    });
    $('.iframeNewsPopupstart').bind('click', function(){
        ShowNewsIframeBox('default.aspx');
    });
    $('.iframePopupclose').bind('click', function(){
        $find('mdlImageNewsBox').hide();    
    });
});


function ShowNewsIframeBox(ImageURL){
    $('#iframeNewsPopup').attr('src', ImageURL);
    $find('mdlImageNewsBox').show();
    $('#mdlImageNewsBox_backgroundElement').bind('click', function(){
        $find('mdlImageNewsBox').hide();
    });
}

$(document).ready(function(){

    $("ul.topnav li a").hover(function() { //Drop it down

        //Following events are applied to the subnav itself (moving subnav up and down)
        $(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click

        $(this).parent().hover(function() {
        }, function(){
            $(this).parent().find("ul.subnav").slideUp('fast'); //When the mouse hovers out of the subnav, move it back up
        });

        //Following events are applied to the trigger (Hover events for the trigger)
        }).hover(function() {
            $(this).addClass("subhover"); //On hover over, add class "subhover"
        }, function(){	//On Hover Out
            $(this).removeClass("subhover"); //On hover out, remove class "subhover"
    });

});

function stMouseOver(id, left_img_css, right_img_css, text_css)
    {
        var left_img_id = "left_img_" + id;
        var right_img_id = "right_img_" + id;
        var text_id = "text_" + id;
        
        var leftImgElement = document.getElementById(left_img_id);
        var rightImgElement = document.getElementById(right_img_id);
        var textElement = document.getElementById(text_id);
        
        leftImgElement.className = left_img_css;
        rightImgElement.className = right_img_css;
        textElement.className = text_css;
    }
function stMouseOut(id, left_img_css, right_img_css, text_css)
    {
        var left_img_id = "left_img_" + id;
        var right_img_id = "right_img_" + id;
        var text_id = "text_" + id;
        
        var leftImgElement = document.getElementById(left_img_id);
        var rightImgElement = document.getElementById(right_img_id);
        var textElement = document.getElementById(text_id);
        
        leftImgElement.className = left_img_css;
        rightImgElement.className = right_img_css;
        textElement.className = text_css;
    }

function ShowIframeBox(ImageURL)
    {
        $('#iframePopup').attr('src', ImageURL);
        $find('mdlImageBox').show();
        $('#mdlImageBox_backgroundElement').bind('click', function(){
            $find('mdlImageBox').hide();
        });
    }
            
$.preloadImages = function()  
{         
    for(var i = 0; i<arguments.length; i++)         
    {                 
    $("<img />").attr("src", arguments[i]);         
    }  
}    
    $(document).ready(function()  
{         
    $.preloadImages(
        "images/logo.jpg",
        "images/banner_images/webbanner_01.png"
    );  
});  

if(!window.slider) 
    var slider={};
    slider.data=[
        {"id":"slide-img-1","client":"","desc":""},
        {"id":"slide-img-2","client":"","desc":""},
        {"id":"slide-img-3","client":"","desc":""},
        {"id":"slide-img-4","client":"","desc":""}      
    ];     
