//ie :hover fix
$(document).ready(function(){
		$('li.subNav').hover(
			function() { $('ul', this).css('display', 'block'); },
			function() { $('ul', this).css('display', 'none'); });
	});



/**
 * MOST READ TAB CONTROL
 **/
$(document).ready(function() {

	//When page loads...
	$(".tabContent").hide(); //Hide all content
	$("ul.tabs li:nth-child(1)").not($("ul.tabs.noShow")).addClass("selected"); 
	$("ul.tabs li:nth-child(1) a").not($("ul.tabs.noShow")).addClass("selected"); //Activate first tab
	$(".tabContainer .tabContent:nth-child(1)").not($("ul.tabs.noShow")).show(); //Show first tab content next to every tab box

	//overkill
	$("ul.tabs.noShow li:nth-child(1)").removeClass("selected"); 
	$("ul.tabs.noShow li:nth-child(1) a").removeClass("selected"); 
	$(".tabContainer.noShow .tabContent:nth-child(1)").hide(); 


	//On Click Event
	$("ul.tabs li a").click(function() {
        var el = $(this),
            activeTab = el.attr('href');
            noShow = el.closest('ul').hasClass('noShow');

		$(this).closest('ul').find('a').removeClass("selected"); 
		$(this).closest('ul').find('li').removeClass("selected"); 
		
		var activeTab = $(this).attr("href"); //Find the href attribute value to identify the active tab + content
		var noShow = $(this).closest('ul').hasClass('noShow');
		
		if(noShow && $(activeTab).is(":visible")){
			$(this).removeClass("selected"); 
			$(this).parent().removeClass("selected"); 
			$(this).closest('div').siblings('.tabContainer').find('.tabContent').slideUp();
			return false;	
		}
		$(this).addClass("selected"); //Add "active" class to selected tab
		$(this).parent().addClass("selected"); //Add "active" class to selected tab
		$(this).closest('div').siblings('.tabContainer').find('.tabContent').hide(); // hide all sibling divs to tab ul
		
		//if there's an <a> tag with the class 'ajaxLink' in the tab content, it'll follow the first and load it
		if($(activeTab + ' a.ajaxLink').length != 0){
			var htmlLink = $(activeTab + ' a.ajaxLink:first').attr('href');
			$(activeTab).load(htmlLink, function(){
				if(!noShow)
					$(activeTab).fadeIn(); //Fade in the active ID content
				else
					$(activeTab).slideDown();
			});
		//else just show the tab content.
		}else{
			if(!noShow)
				$(activeTab).fadeIn(); //Fade in the active ID content
			else
				$(activeTab).slideDown();
		}
		return false;
	});

});










function disablePopup(){
	$.prettyPhoto.close();
}



$(document).ready(function(){
	
	$("a[rel^='prettyPhoto']").prettyPhoto(
		{
			theme: 'light_rounded'	
		} 
	);
						   
	$("#tour_button").prettyPhoto({
		animation_speed: 'fast', /* fast/slow/normal */
		opacity: 0.80, /* Value between 0 and 1 */
		default_width: 934,
		default_height: 426,
		theme: 'light_rounded', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
		wmode: 'opaque', /* Set the flash wmode attribute */
		keyboard_shortcuts: true, /* Set to false if you open forms inside prettyPhoto */
		flash_markup: '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>'	
	});
});

