(function($) {

    $(document).ready(function () {

    // Accordion
    $("#accordion").accordion({ header: "h3" });

    // Dialog			
    $('#dialog').dialog({
        autoOpen: false,
        width: 600,
        buttons: {
            "Ok": function () {
                $(this).dialog("close");
            },
            "Cancel": function () {
                $(this).dialog("close");
            }
        }
    });

    // Dialog Link
    $('#dialog_link').click(function () {
        $('#dialog').dialog('open');
        return false;
    });

    // Datepicker
    $('#calendar').datepicker({
        inline: true,
        dayNamesMin: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
        showOtherMonths: true,
        selectOtherMonths: true
    });

    //hover states on the static widgets
    $('#dialog_link, ul#icons li').hover(
		    function () { $(this).addClass('ui-state-hover'); },
		    function () { $(this).removeClass('ui-state-hover'); }
	    );

    // Carousel
    $(".blockContainer .carousel").jCarouselLite({
        btnNext: ".blockContainer .next",
        btnPrev: ".blockContainer .prev"
    });

    // ticker
    $("ul.tickerList").liScroll();

    $("ul#topnav li").hover(function () { //Hover over event on list item
        $(this).css({ 'background': '#1376c9 url(topnav_active.gif) repeat-x' }); //Add background color and image on hovered list item
        $(this).find("span").show(); //Show the subnav
    }, function () { //on hover out...
        $(this).css({ 'background': 'none' }); //Ditch the background
        $(this).find("span").hide(); //Hide the subnav
    });

    $('.Items').selectbox();

    //            $('area').click(function () {
    //                $('#txtLocationSearch').val($(this).attr('title'));
    //                return false;
    //            });

    $(".jobResultsContainer").hide();
    $(".emailJobForm").hide();


    var j = 0;
    $("div#jobResultsDiv").each(function (a) {
        $(this).attr('id', 'jobResultsDiv' + j++);
    });
    var i = 0;
    $("div#openEmailForm").each(function (x) {
        $(this).attr('id', 'openEmailForm' + i++);
    });
    //            var j = 0;
    //            $("li.rowParent").each(function(x) {
    //                $(this).attr("id", "rowParent" + j++);
    //            });

    //advance slider
    $("#contentSlider").easySlider({
        auto: true,
        numeric: true,
        speed: 1000,
        pause: 5000,
        continuous: true
    });
    //simple slider
    $("#slider").easySlider({
        controlsShow: false,
        auto: true,
        numeric: true,
        speed: 1000,
        pause: 5000,
        continuous: true
    });
    $("#interiorslider").easySlider({
        controlsShow: false,
        auto: true,
        numeric: true,
        speed: 1000,
        pause: 5000,
        continuous: true
    });

    $(".viewdetails").click(function () {
        var ulpar = $(this).parent().parent().parent().next('div');
        $('#' + ulpar.attr('id')).toggle('slow');
    });
    $(".view").click(function () {
        var ulpar = $(this).parent().parent().parent().next('div');
        $('#' + ulpar.attr('id')).toggle('slow');
    });
    $(".collapseButton").click(function () {
        var divpar = $(this).parent().parent();
        $('#' + divpar.attr('id')).toggle('slow');
    });

    $(".downloadablebtn").click(function () {
        $('#light').attr("style", "display:block");
        $('#fade').attr("style", "display:block");
        var a = $(this).attr('id');
        var idofhid = $('.myhiddenval').attr('id');

        $('#' + idofhid).val(function () {
            return a;
        });
    });

    //             $( "#tabs" ).tabs();
});
/*
$(document).ready(function() {
	$("#results1").hide();
	$("#results2").hide();
	$("#results3").hide();
	$("#results4").hide();
	
	$("#openEmailForm1").hide();
	$('#view1').click(function(){
		$('#results1').toggle('slow');
		return false;
	});
	$("#openEmailForm2").hide();
	$('#view2').click(function(){
		$('#results2').toggle('slow');
		return false;
	});
	$("#openEmailForm3").hide();
	$('#view3').click(function(){
		$('#results3').toggle('slow');
		return false;
	});
	$("#openEmailForm4").hide();
	$('#view4').click(function(){
		$('#results4').toggle('slow');
		return false;
	});
	
	$('#collapse1').click(function(){
		$('#results1').hide('slow');
		return false;
	});
	$('#collapse2').click(function(){
		$('#results2').hide('slow');
		return false;
	});
	$('#collapse3').click(function(){
		$('#results3').hide('slow');
		return false;
	});
	$('#collapse4').click(function(){
		$('#results4').hide('slow');
		return false;
	});
	
	$('#openEmail1').click(function(){
		$('#openEmailForm1').toggle();
		$('#openEmailItem1').toggleClass('grayHover');
		return false;
	});
	$('#openEmail2').click(function(){
		$('#openEmailForm2').toggle();
		$('#openEmailItem2').toggleClass('grayHover');
		return false;
	});
	$('#openEmail3').click(function(){
		$('#openEmailForm3').toggle();
		$('#openEmailItem3').toggleClass('grayHover');
		return false;
	});
	$('#openEmail4').click(function(){
		$('#openEmailForm4').toggle();
		$('#openEmailItem4').toggleClass('grayHover');
		return false;
	});
	
});
*/

})(jQuery) 
