﻿$(document).ready(function() {
    // Add pdf icons to pdf links
    $("a[href$='.pdf']").addClass("pdf");
    // Add txt icons to document links (doc, rtf, txt)
    $("a[href$='.doc'], a[href$='.txt'], a[href$='.rft']").addClass("txt");
    // Add zip icons to Zip file links (zip, rar)
    $("a[href$='.zip'], a[href$='.rar']").addClass("zip");
    // Add email icons to email links
    $("a[href^='mailto:']").addClass("email");
    //Add external link icon to external links - 
    //                            $('a').filter(function() {
    //                                //Compare the anchor tag's host name with location's host name
    //                                return this.hostname && this.hostname !== location.hostname;
    //                            }).addClass("external");

   
    //Standard Grid
    $('table.StandardTable').attr('cellspacing', '0').attr('cellpadding', '5').attr('border', '0').css('background-color', '#FEFFFF').css('width', '90%').css('border-collapse', 'collapse');
    $('table.StandardTable tr td').attr('valign', 'top');
    $('table.StandardTable tr:has(th):not(:has(td))').addClass('StandardGridHeaderStyle');
    $('table.StandardTable tr.StandardGridHeaderStyle th').css('text-align', 'left');
    $('table.StandardTable tr:has(td):not(tr.StandardGridFooterStyle):odd, table.StandardGrid tr:has(td):not(tr.StandardGridPagerStyle):odd').addClass('StandardGridRowStyle');
    $('table.StandardTable tr:has(td):not(tr.StandardGridFooterStyle):even, table.StandardGrid tr:has(td):not(tr.StandardGridPagerStyle):even').addClass('StandardGridAltRowStyle');
    $('table.StandardTable').removeClass('StandardTable').addClass('StandardGrid');

    //Grid with Red Header
    $('table.StandardTableRed').attr('cellspacing', '0').attr('cellpadding', '5').attr('border', '0').css('background-color', '#FEFFFF').css('width', '90%').css('border-collapse', 'collapse');
    $('table.StandardTableRed tr td').attr('valign', 'top');
    $('table.StandardTableRed tr:has(th):not(:has(td))').addClass('StandardGridRedHeaderStyle');
    $('table.StandardTableRed tr.StandardGridRedHeaderStyle th').css('text-align', 'left');
    $('table.StandardTableRed tr:has(td):not(tr.StandardGridFooterStyle):odd, table.StandardTableRed tr:has(td):not(tr.StandardGridPagerStyle):odd').addClass('StandardGridRowStyle');
    $('table.StandardTableRed tr:has(td):not(tr.StandardGridFooterStyle):even, table.StandardTableRed tr:has(td):not(tr.StandardGridPagerStyle):even').addClass('StandardGridAltRowStyle');
    $('table.StandardTableRed').removeClass('StandardTableRed').addClass('StandardGrid');

    //Grid with Blue Header
    $('table.StandardTableBlue').attr('cellspacing', '0').attr('cellpadding', '5').attr('border', '0').css('background-color', '#FEFFFF').css('width', '90%').css('border-collapse', 'collapse');
    $('table.StandardTableBlue tr td').attr('valign', 'top');
    $('table.StandardTableBlue tr:has(th):not(:has(td))').addClass('StandardGridBlueHeaderStyle');
    $('table.StandardTableBlue tr.StandardGridBlueHeaderStyle th').css('text-align', 'left');
    $('table.StandardTableBlue tr:has(td):not(tr.StandardGridFooterStyle):odd, table.StandardTableBlue tr:has(td):not(tr.StandardGridPagerStyle):odd').addClass('StandardGridRowStyle');
    $('table.StandardTableBlue tr:has(td):not(tr.StandardGridFooterStyle):even, table.StandardTableBlue tr:has(td):not(tr.StandardGridPagerStyle):even').addClass('StandardGridAltRowStyle');
    $('table.StandardTableBlue').removeClass('StandardTableBlue').addClass('StandardGrid');

    //Creates the button effects when mouseover 
    $('.button').hover(function() {
        $(this).attr("src", $(this).attr('src').replace('1', '2'));
    },
           function() {
               $(this).attr("src", $(this).attr('src').replace('2', '1'));
           });

    $('.SubmitButton').hover(function() {
        $(this).attr("src", $(this).attr('src').replace('1', '2'));
    },
           function() {
               $(this).attr("src", $(this).attr('src').replace('2', '1'));
           });

    $('.mouseover').hover(function() {
        $(this).attr("src", $(this).attr('src').replace('1', '2'));
    },
           function() {
               $(this).attr("src", $(this).attr('src').replace('2', '1'));
           });
});