$(document).ready(function() {	
	if ($('#s3slider').length > 0){
		$('#s3slider').s3Slider({
	      timeOut: 2500
	   	});
	}
	//$(document).pngFix();
	
	//photo slideshow
/*	$('#photos').galleryView({
			panel_width: 770,
			panel_height: 350,
			overlay_height: 60,
			overlay_position: 'top',
			overlay_opacity: 0.5,
			transition_speed: 1500,
			transition_interval: 5000,
			nav_theme: 'light',
			//border: '1px solid #AF2A2F',
			pause_on_hover: true,
		});*/
	
		//for search results hover effects
	if ($('.tour').length > 0) {
		$('.tour').mouseover(function() {
				$(this).children(".h2Grey").addClass('h2Hover');//MUST use dom tree to find this node otherwise all elements changes
				$(this).children(".tourPic").addClass('tourPicHover');
		}).mouseout(function() {
				$(this).children(".h2Grey").removeClass('h2Hover');
				$(this).children(".tourPic").removeClass('tourPicHover');
		});
	}
	
	
	
	//When page loads...
	$(".tabPanel").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tabPanel:first").show(); //Show first tab content

	//On Click Event
	$("ul.tabs li").click(function() {

		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tabPanel").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).show(); //Fade in the active ID content
		return false;
	});
	
	$(".leftTabPanel").hide(); //Hide all content
	$("ul.leftTab li:first").addClass("active").show(); //Activate first tab
	$(".leftTabPanel:first").show(); //Show first tab content

	//On Click Event
	$("ul.leftTab li").click(function() {
		$("ul.leftTab li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".leftTabPanel").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});
	
	
	//for pop window 
	if ($("#dialog").length > 0) {
		$("#dialog").dialog({
				bgiframe: true,
				//height: 140,
				modal: true,
				autoOpen: false,
				buttons: {
					Close: function() {
						$(this).dialog('close');
					}
				}
	        });
			$(".popup").click(function(){
	        	$("#dialog").dialog('open');
		});
	}
	
		//for pop window 
	if ($("#appForm").length > 0) {
		$("#appForm").dialog({
				bgiframe: true,
				//height: 140,
				modal: true,
				autoOpen: false,
				buttons: {
					Close: function() {
						$(this).dialog('close');
					}
				}
	        });
			$(".appForm").click(function(){
	        	$("#dialog").dialog('open');
		});
	}
});



var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-12054606-2']);
_gaq.push(['_trackPageview']);

(function() {
	var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();