﻿
// And you can use Prototype with $(...)
function defaultPageEffects() {

    adjustAllBackgroundHeights();
    //adjustMediaInquiries();
     
   // $("#siteDiv").hide();    
   // $("#siteDiv").fadeIn("12000", function() {

    //});
    //$('div.cm').corners();
}

function setHomePageEffects() {
    try{
        
        //$('div.txtPromo').corners();
   }
   catch(err){}
}


function setFeaturePageEffects() {

$('div.pageContentModuleMr a').each(function(i) {
  $(this).addClass('linkCtrl');


});

$('div.pageContentModuleMr div.links a').each(function(i) {
    $(this).addClass('mrLinkList');
});
    
}

function setUtilityPageEffects() {
    if (($('div.utility div.featurePromo').children().length == 0) && ($('div.utility div#divIntroImg').children().length == 0)) {
        $('div.utility div.featureText').css("width", "100%");
        $('div.utility div.featureText').css("margin-left", "0px");
        $('div.utility div.featureText').css("margin-right", "0px");
    }
    else if (($('div.utility div.featurePromo').children().length > 0) && ($('div.utility div#divIntroImg').children().length > 0)) {
        $('div.utility div.featureText').css("width", "330px");
        $('div.utility div#divIntroImg').addClass("introImgDyn");
       

    }
    else if ($('div.utility div.featurePromo').children().length > 0) {

     


    }
    else if ($('div.utility div#divIntroImg').children().length > 0) {

        $('div.utility div#divIntroImg').addClass("introImgDyn");
    }
}

function setListingPageEffects() {

}

function setLandingPageEffects() {
    
    $('div.reportList a').each(function(i) {
     $(this).addClass('linkCtrl');
    });
    $('div.lpDownload a').each(function(i) {
        $(this).addClass('linkCtrl');
    });
    
}
function setRequestInformationEffects() {    

    $('input.req').blur(function() {
        if ($(this).val().trim() == "") {
            $(this).removeClass("inputValid");
            if (!$(this).hasClass("inputInvalid"))
                $(this).addClass("inputInvalid");
            $(this).parent().find('.icError').remove();
            $(this).parent().find('.icValid').remove();
            $(this).after("<img class='icError'  src='/App_Images/Icons/icInvalid.gif'/>");
        }
        else {
            $(this).removeClass("inputInvalid");
            if (!$(this).hasClass("inputValid"))
                $(this).addClass("inputValid");
            $(this).parent().find('.icError').remove();
            $(this).parent().find('.icValid').remove();
            $(this).after("<img class='icValid' src='/App_Images/Icons/icValid.gif'/>");
        }
 

    });

    $('.frmList').blur(function() {
        if ($(this).val().trim() == "-1") {
            $(this).removeClass("inputValid");
            if (!$(this).hasClass("inputInvalid"))
                $(this).addClass("inputInvalid");
            $(this).parent().find('.icError').remove();
            $(this).parent().find('.icValid').remove();
            $(this).after("<img class='icError'  src='/App_Images/Icons/icInvalid.gif'/>");
        }
        else {
            $(this).removeClass("inputInvalid");
            if (!$(this).hasClass("inputValid"))
                $(this).addClass("inputValid");
            $(this).parent().find('.icError').remove();
            $(this).parent().find('.icValid').remove();
            $(this).after("<img class='icValid' src='/App_Images/Icons/icValid.gif'/>");
        }

    });

    initSubmitButton();
}

function initSubmitButton() {
    $('.btnSubmit').attr("src", "/App_Skin/Button_Submit/imgSubmit.png");

    $('.btnSubmit').mouseover(function() {
        $(this).attr("src", "/App_Skin/Button_Submit/imgSubmitHover.png")
        $(this).addClass("btnSubmit_Hover");
    });
    $('.btnSubmit').mouseout(function() {
        $(this).attr("src", "/App_Skin/Button_Submit/imgSubmit.png")
    });
    //$('.btnSearch').get(0).blur();

}

function adjustAllBackgroundHeights() {

    adjustBackgroundHeight("div.expBg", "div.expContainer");
}

function adjustBackgroundHeight(bgSelector, containerSelector) {

    $(bgSelector).each(function(i) {
        var $newHeight = $(this).parent(containerSelector).height();
        if ($newHeight != null)
            $(this).height($newHeight);
    });


}

function adjustMediaInquiries() {
    $('div.promoInfo').load(function() {
        if ($(this).find('p.promoHdrText').text().toLowerCase() == ("media inquiries")) {
            $(this).css("font-size", "10px");
        }

    });


}
function SetSearchText(e) {
    if (e.value.toLowerCase() == "search")
        e.value = "";
    else if (e.value == "")
        e.value = "Search";

}
