﻿// JScript File
$(document).ready(function() {
    $("img.imgWithCaptionRight, img.imgWithCaptionLeft").load(function() {
        $(this).removeClass('caption');
        var thisClass = $(this).attr("class"); // finds out if image is left or right aligned
        var theCaptionText = $(this).attr("alt");
        var captionClass = thisClass;
        var captionWidth = $(this).width();
        var theCaption = ("<div class='caption'><p>" + theCaptionText + "</p></div>");
        $(this).wrap("<div class='pageModule photo " + captionClass + "'><div class='container'></div></div>").addClass(captionClass);
        $(this).after(theCaption);
        $('.captionBlock div').width(captionWidth);
        $(this).removeClass(thisClass);
    });
    $('a[href^="http://"]').attr("target", "_blank");
    $('a[href*="class=link&link=http://"]').attr("target", "_blank");
    $('a[href$=".pdf"]').attr("target", "_blank");
    $('a[rel="external"]').attr("target", "_blank");

    //hide or show initial search box text
    $("#sField").focus(
        function() {
            if (this.value == "search site")
            { this.value = ""; }
        })
    $("#sField").blur(
    function() {
        if (this.value == "")
        { this.value = "search site"; }
    })
});
    
