// jquery on doucment ready

$(function() {

	
	// colorbox modals
	$("a[rel='modal'], a[class='modal']").colorbox({transition:"elastic"});
	$(".iframe_modal").colorbox({width:"95%", height:"80%", iframe:true});
	$(".gallery").colorbox();
	$(".youtube").colorbox({iframe:true, innerWidth:500, innerHeight:405});


	
	
	$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)  
  
    $("ul.topnav li").hover(function() { //When trigger ...  
  
        //Following events are applied to the subnav itself (moving subnav up and down)  
        $(this).find("ul.subnav").show(); //Drop down the subnav  
  
        $(this).hover(function() {  
        }, function(){  
            $(this).find("ul.subnav").hide(); //When the mouse hovers out of the subnav, hide the dropdown  
        });  
  
        //Following events are applied to the trigger (Hover events for the trigger)  
        }).hover(function() {  
            $(this).find('a').addClass("subhover"); //On hover over, add class "subhover"
			$(this).find('div.tab_right').addClass("tron"); //On hover over, add class "subhover"
        }, function(){  //On Hover Out  
            $(this).find('a').removeClass("subhover"); //On hover out, remove class "subhover"
			$(this).find('div.tab_right').removeClass("tron"); //On hover over, add class "subhover"
    });  
	
	$("#slider").easySlider({
		auto: true,
		continuous: true,
		pause: 6000
	});

	
	// to fix ie7 layering issue
	var zIndexNumber = 1000;
	$('div').each(function() {
		$(this).css('zIndex', zIndexNumber);
		zIndexNumber -= 10;
	});
	
	// a few get out of order
	$('#cboxOverlay').css('zIndex', 500);
	$('.subnav').css('zIndex', 1500);
	$('#cboxClose, #cboxNext, #cboxPrevious, #cboxLoadingGraphic').css('zIndex', 1501);


		   
});
