// JavaScript Document
$(document).ready(function()
{
	// Pretty Photo basics
	$("a[rel^='overlay']").prettyPhoto({
		animationSpeed: 'normal', /* fast/slow/normal */
		opacity: 0.80, /* Value between 0 and 1 */
		showTitle: true, /* true/false */
		allowresize: true, /* true/false */
		counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
		theme: 'facebook', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
		hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
		wmode: 'opaque', /* Set the flash wmode attribute */
		autoplay: true, /* Automatically start videos: True/False */
		modal: false /* Automatically start videos: True/False */
	});
	
	
	$('.anythingSlider').anythingSlider({
        easing: "easeInOutExpo",                // Anything other than "linear" or "swing" requires the easing plugin
        autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not
        startStopped: false,            // If autoPlay is on, this can force it to start stopped
        delay: 10000,                    // How long between slide transitions in AutoPlay mode
        animationTime: 600,             // How long the slide transition takes
        hashTags: true,                 // Should links change the hashtag in the URL?
        buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
        pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
        startText: "Start",             // Start text
        stopText: "Stop",               // Stop text
        navigationFormatter: null       // Details at the top of the file on this use (advanced use)
	});
	
	$("#slide-jump").click(function(){
		$('.anythingSlider').anythingSlider(2);
	});
	
	$(".launch-contact").click(function()
	{
		var options = 
		{
			modal : true,
			close: function(ev, ui) { $(this).close(); }
		}
		$("#overlay-content").dialog(options);
		return false;
	});
	
	$("#launch-map").click(function()
	{
		var options = 
		{
			modal : true,
			close: function(ev, ui) { $(this).close(); }
		}
		$("#overlay-map").dialog(options);
		return false;
	});
	
	$("#datepicker").datepicker();
	
	$(".computers > div:last").css("margin", "0 0 15px 0");
	
	
	
	$(".not-clickable .check-list li div").hide();
	$(".not-clickable .check-list li:first div").show().addClass("open");
	$(".not-clickable .check-list a").click(function()
	{	 
		 $(".not-clickable .check-list li div:visible").slideUp("slow").addClass("closed");
		 $(this).siblings("div").slideDown('fast').addClass("open");	
		 return false;
	});
	
	
	$(".post object").wrap("<div class='embed' />");
	$(".post object").prepend("<param name='wmode' value='transparent'>");
	$(".post embed").attr("wmode", "transparent");
	
	$('.post object').attr('width', '676');
	$('.post object').attr('height', '440');
	$('.post embed').attr('width', '676');
	$('.post embed').attr('height', '440');
	
	$('.scroll-to').click(function() 
	{
		var elementClicked = $(this).attr("href");
		var destination = $(elementClicked).offset().top;
		$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination-20}, 1700 );
		return false;
	});
	
	$("#street-link").click(function() 
	{		
		$("#street-view").show(0);
		$("#map-view").hide(0);
		return false;
	});
	
	$("#map-link").click(function() 
	{		
		$("#map-view").show(0);
		$("#street-view").hide(0);
		return false;
	});
});
