
$(document).ready(function () {
    $('li:first-child').addClass('first_item');
    $('li:last-child').addClass('last_item');
    $('li:nth-child(4)').addClass("fourth_item");
    $('li:nth-child(3n)').addClass("third_item");

    $(".simple-listing01 ul li").hover(function () {
        $(this).addClass("active");
    }, function () {
        $(this).removeClass("active");
    });
	
	$('.nave li').hover(function()
		{
			$(this).children('div').show();
			//$(this).children('a').addClass('active');
		},function()
		{
			$(this).children('div').hide();
			//$(this).children('a').removeClass('active');
		}
		);


    // JavaScript Document Autoheight

    function equalHeight(group) {
        tallest = 0;
        group.each(function () {
            thisHeight = $(this).height();
            if (thisHeight > tallest) {
                tallest = thisHeight;
            }
        });

        group.height(tallest);

    }
    $(document).ready(function () {
        equalHeight($(".equal_height01, .box-03-top, .small-box-01-middle"));
    });



    // Fancy check box 	
    $('.filter li a.checker').children('img').attr('src', 'images/miniuncheck2.gif');
    $('.filter li a.checker').click(function () {
        if ($(this).children('input').attr("checked") == true) {
            $(this).children('input').attr('checked', false);
            $(this).children('img').attr('src', 'images/miniuncheck2.gif');
        }
        else {
            $(this).children('input').attr('checked', true);
            $(this).children('img').attr('src', 'images/minicheck2.gif');
            $(this).parent().parent().siblings('a.quick-link2').addClass('active');

        }
        return false;
    });


//checkFancy



    $('.checkFancy a.checkCls').click(function () {
        if ($(this).children('input').attr("checked") == true) {
            $(this).children('input').attr('checked', false);
           
        }
        else {
            $(this).children('input').attr('checked', true);
                       

        }
        return false;
    });



    // Accordon functions
	
    $('.list-04 li>div, .list-06 li>div, .list-02 li>div, .list-11 li>div').hide();

$('.list-06 li ul li>div').show();
    $('.list-04 li>span, .list-06 li>span, .list-02 li>span .list-11 li>h3').css('cursor', 'pointer');
    $('.list-04 li>span, .list-06 li>span, .list-02 li>span, .list-11 li>h3').click(function () {
        $('.list-04 li>span, .list-06 li>span, .list-02 li>span, .list-11 li>h3').next('div').slideUp();
        if ($(this).next().css("display") == "none") {
            $(this).next('div').slideDown();
            $('.list-04 li, .list-06 li, .list-02 li, .list-11 li').removeClass('active');
            $(this).parent().addClass('active');
        }
        else {
			
			
            $(this).next('div').slideUp();
            $('.list-04 li, .list-06 li, .list-02 li, .list-11 li').removeClass('active');
        }
    });



    // Tab
    //Default Action
    $(".tab_content").hide(); //Hide all content
    $("ul.tab-btn li:last").addClass("active").show(); //Activate first tab
    $(".tab_content:last").show(); //Show first tab content


    //On Click Event
    $("ul.tab-btn li").click(function () {
        $("ul.tab-btn li").removeClass("active"); //Remove any "active" class
        $(this).addClass("active"); //Add "active" class to selected tab
        $(".tab_content").hide(); //Hide all tab content
        var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
        $(activeTab).fadeIn(); //Fade in the active content
        return false;
    });
	

//Examples of how to assign the ColorBox event to elements
			$("a[rel='example1']").colorbox();
			$("a[rel='example2']").colorbox({transition:"fade"});
			$("a[rel='example3']").colorbox({transition:"none", width:"75%", height:"75%"});
			$("a[rel='example4']").colorbox({slideshow:true});
			$(".example5").colorbox();
			$(".example6").colorbox({iframe:true, innerWidth:425, innerHeight:344});
			$(".example7").colorbox({width:"400px", height:"345px", iframe:true});
			$(".example9").colorbox({
				onOpen:function(){ alert('onOpen: colorbox is about to open'); },
				onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
				onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
				onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
				onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
			});
			
			//Example of preserving a JavaScript event for inline calls.
			$("#click").click(function(){ 
				$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
				return false;
			});		
	
	


    // checkbox click functions
    $('a.uncheck, a.uncheck-01').next('input').attr('checked', false);   // initializing the checkbox as unchecked on page load.
    $('a.uncheck, a.uncheck-01').removeClass('checked', 'checked-01');

    $('a.uncheck, a.uncheck-01').click(function () 
	{
		
        if ($(this).next('input').attr('checked') == true) 
		{
            $(this).next('input').attr('checked', false);
			
			
        }
        else 
		{
            $(this).next('input').attr('checked', true);
			
        }
       		refreshHidden($(this).next('input').attr('name'));
        	return false;
    });

});

function refreshHidden(name) 
{
    $(':radio.hidden[name=' + name + ']').prev('a').removeClass('checked');
    $(':radio.hidden:checked[name=' + name + ']').prev('a').addClass('checked');
}



