﻿$(document).ready(function() {
    $('.iframePopupstart').bind('click', function(){
        mdlModalBoxPopup($(this).find('a').attr('href'));
        return false;
    });
    
    $('.iframePopupstart_Login').bind('click', function(){
        mdlModalBoxPopup('custlogin.aspx');
    });
    
    $('.iframePopupclose').bind('click', function(){
        $find('mdlModalBox').hide();
        $('#iframeModalBoxPopup').attr('src', '');
    });
    
});

function mdlModalBoxPopup(ImageURL){
    $('#iframeModalBoxPopup').attr('src', ImageURL);
    $find('mdlModalBox').show();
    $('#mdlModalBox_backgroundElement').bind('click', function(){
        $find('mdlModalBox').hide();
        $('#iframeModalBoxPopup').attr('src', ImageURL).close;  
        return false;         
    }); 
}





$(document).ready(function(){
    
    //applies to the top navigation menu
    $("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"
    });

    //applies to the left navigation tree menu
    $("#navigation").treeview({
        persist: "location",
        collapsed: true,
        unique: true
    });
    
    $('#navigation').show('slow', function() {
        // renders animation
    });

});

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();
            $('#iframeModalBoxPopup').attr('src', ImageURL).close; 
        });
    }
            
$.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":""}      
    ];     
    
    
function clearText(element)
    {
        if (element.value == "Search...")
        {
            element.value = ""
        }
    }
function resetText(element)
    {
        if (element.value == "")
        {
            element.value = "Search..."
        }
    }
