$(document).ready(function () {



    $(document).ready(function () {
       // $("a[href^='http']").attr('target', '_blank');
    });

    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-23435615-1']);
    _gaq.push(['_trackPageview']);

    (function () {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();


    $("#noflash").hide();
    $("#wrapper").addClass("js");
    $("#wrapper").removeClass("no-js");
    $("p.javascript").addClass("hidden")
    /* striping */
    $("tr:odd").addClass("odd");
    $(".form li:odd").addClass("odd");
    $("#secondary-aside .panel:odd").addClass("odd");
    $("td:first-child").addClass("firstcol"); //something to sort re: forms in tables in events


    /* TABS */
    $(".tabs").accessibleTabs({
        tabhead: 'h2.tabhead',
        tabheadClass: 'tabhead',
        fx: "fadeIn"
    });

    /* downloads - need to add more file types here*/

    $('a[href$=pdf], a[href$=docx], a[href$=doc], a[href$=xls], a[href$=pps]').prepend('<span>&nbsp;</span>').addClass('download');

    $(function () {
        $('A[rel="external"]').click(function () {
            window.open($(this).attr('href'));
            return false;
        }).attr('title', 'Opens in a new window');
    });

    $(function () {
        $("a[href^='http://']").not("a[href^='http://localhost:17005/']").not("a[href^='http://mblox.uat.cds.co.uk/']").not("a[href*='pop=1']").click(function () {
            window.open(this.href, 'external');
            return false;
        }).attr('title', 'Opens in a new window');
    });

    $(function () {

        $("a[href*='http://']:not([href*='" + location.hostname + "'])")
	    .attr({ target: "_blank", title: "External link - opens in a new window" });
    });

    /* input fields clear on click*/
    $(function () {
        $('input[type=text]').focus(function () {
            $(this).val('')
        });

        /* $("#nav li a").prepend("<span>&nbsp;").append("</span>");*/



        // hover effect
        $('div.expandable h4').add('div.expandable2 h4').hover(function () {
            $(this).addClass('hover');
        }, function () {
            $(this).removeClass('hover');
        });
    });
    // independently show and hide
    $('div.expandable:eq(0) > div').hide();
    $('div.expandable:eq(0) > h4').click(function () {
        $(this).addClass('hover');
        $(this).next().slideToggle('slow');
    });

    // hover effect
    $('div.expandable-panel h4').add('div.expandable-panel2 h4').hover(function () {
        $(this).addClass('hover');
    }, function () {
        $(this).removeClass('hover');
    });

    // independently show and hide

    $('div.expandable-panel:eq(0) > div').hide();
    $('div.expandable-panel:eq(0) > h4').click(function () {
        $(this).next().slideToggle('slow');
    });
});

function ClearField(obj) {
    if (document.getElementById(obj).value == 'search') {
        document.getElementById(obj).value = '';
    }
}

