$(document).ready(function() {
    if ($.browser.msie && $.browser.version <= 6) {
        // drop down menu position tweak
        $("#mainNav ul li ul").css({ "margin-left": "-3.4em" });
    }

    // mainButton simple highlighting
    var mouseOver = 0.7;
    var mouseOut = 1;

    // set opacity on load (prevents glitching in IE)
    $(".mainButton").css({ "opacity": mouseOut });


    $(".mainButton").hover(
	function() {
	    $(this).fadeTo(1, mouseOver);
	},
	function() {
	    $(this).fadeTo(1, mouseOut);
	});


    //-----------------------------------


    // side nav on home page (slight transparency on mouseovers)
    var mouseOverAlt = "#0C0D0E";
    var mouseOutAlt = "transparent";

    // set opacity on load (prevents glitching in IE)
    $("#sideLinks a").css({ "background-color": mouseOutAlt, "opacity": "none" });

    $("#sideLinks a").hover(
	function() {
	    $(this).css({ "background-color": mouseOverAlt, "opacity": 0.85 });
	},
	function() {
	    $(this).css({ "background-color": mouseOutAlt, "opacity": "none" });
	});


    //-----------------------------------


    // make main linked images light up

    var imageMouseOver = 0.5;
    var imageMouseOut = 1;

    $("#mainContainer a").hover(
	function() {
	    $(this).children("img").css({ "opacity": imageMouseOver });
	},
	function() {
	    $(this).children("img").css({ "opacity": imageMouseOut });
	});




    //-----------------------------------


    // columnBoxOut bg images and threeColumn links
    var bgOver = 0.7;
    var bgOut = 1;

    // set opacity on load (prevents glitching in IE)
    $(".columnBoxOut a").css({ "opacity": bgOut });
    $(".threeColumnContainer div h3").css({ "opacity": bgOut });

    $(".columnBoxOut a, .threeColumnContainer div h3 a").hover(
	function() {
	    $(this).parent().css({ "opacity": bgOver });
	},
	function() {
	    $(this).parent().css({ "opacity": bgOut });
	});



    //-----------------------------------

    // autoselect input field
    $defaultValue = "Enter your search";

    $("input[name=searchText]").focus(function() {
        //$(this).select();
        this.value = "";
        $(this).css({ "color": "#0E367F" });
    });
    $("input[name=searchText]").blur(function() {
        //$(this).select();
        this.value = $defaultValue;
        $(this).css({ "color": "#777777" });
    });


    //-------------------------------------


    // homeSidePanel bg images
    var bgOver2 = 0.7;
    var bgOut2 = 1;

    // set opacity on load (prevents glitching in IE)
    $("#homeSidePanel a").css({ "background-color": "#EDEDEE", "opacity": bgOut2 });

    $("#homeSidePanel a").hover(
	function() {
	    $(this).css({ "background-color": "#D8D5E1", "opacity": bgOver2 });
	},
	function() {
	    $(this).css({ "background-color": "#EDEDEE", "opacity": bgOut2 });
	});


    //-----------------------------------------


    // fading images (added JAN 2010)
    $("#homeFadingImages").crossSlide(
	{
	    sleep: 3,
	    fade: 0.8
	},
	[
		{ src: 'images/TravelChoice/home/TC Home1_flower.jpg' },
		{ src: 'images/TravelChoice/home/TC Home2_bus.jpg' },
		{ src: 'images/TravelChoice/home/TC Home3_underpass.jpg' },
		{ src: 'images/TravelChoice/home/TC Home4.jpg' }
	]);

});
