$(document).ready(function(){


 $('#tour').hide();


$('#tourInfo').hide();



var myPlayer = VideoJS.setup("videoOne");



// HOME PAGE 

// Start Specials 


$("#foo2").carouFredSel({
items  	 : 1,
	prev : "#foo2_prev",
	next : "#foo2_next"
});








// Start Menu link
$('#transister').jqFancyTransitions({ 

effect: 'wave', // wave, zipper, curtain
width: 464, // width of panel
height: 290, // height of panel
strips: 20, // number of strips
delay: 5000, // delay between images in ms
stripDelay: 50, // delay beetwen strips in ms
titleOpacity: 0.7, // opacity of title
titleSpeed: 1000, // speed of title appereance in ms
position: 'alternate', // top, bottom, alternate, curtain
direction: 'fountainAlternate', // left, right, alternate, random, fountain, fountainAlternate
navigation: false, // prev and next navigation buttons
links:false // show images as links

});


// Start Events

// Start Menu link
$('#trasister').jqFancyTransitions({ 

effect: 'zipper', // wave, zipper, curtain
width: 464, // width of panel
height: 258, // height of panel
strips: 20, // number of strips
delay: 5000, // delay between images in ms
stripDelay: 50, // delay beetwen strips in ms
titleOpacity: 0.7, // opacity of title
titleSpeed: 1000, // speed of title appereance in ms
position: 'alternate', // top, bottom, alternate, curtain
direction: 'fountainAlternate', // left, right, alternate, random, fountain, fountainAlternate
navigation: false, // prev and next navigation buttons
links:false // show images as links

});

























// Set up pan viewer 



$('ul#foo1 li:first').addClass("live");

$('ul#foo1 li').each(function(){


   $("img", this).fadeTo("fast", 0.55);
   
   
   
   // mouse over





	$(this).mouseover(function(){

if ($(this).hasClass('live')) {


} else {
$("img", this).fadeTo("fast", 1);

} // End If live 
	
      
    }).mouseout(function(){
    
  
if ($(this).hasClass('live')) {


} else {
 $("img", this).fadeTo("fast", 0.55);

} // End If live 
     
    });
    
    
    $(this).click(function(){
    
   
    
    if ($(this).hasClass('video')) {

	// If ist a video
	
	if ($('#tourInfo').hasClass('opmnedd')) {
	
	$('#tourInfo').html("").fadeOut().removeClass('opmnedd');
	
	} else {
	
	$('#tourInfo').removeClass('opmnedd').hide();
	
	}
	
	$('.live').removeClass('live').fadeTo("fast", 0.55);
	
	$('.liveOn').fadeOut().removeClass('liveOn');
	
	
	
	} else {
	
	// If its a panno
			
	if ($('#tourInfo').hasClass('opmnedd')) {
	
		$('#tourInfo').html("").fadeOut().removeClass('opmnedd');
	
	} else {
	
	$('#tourInfo').removeClass('opmnedd').hide();
	
	}
	
	var theId = $(this).attr("id");
	
	  
	
	$('.live').removeClass('live').fadeTo("fast", 0.55);
	
	$(this).addClass("live");
	
	$('#tour').fadeIn().addClass('liveOn');
	
	$('#tour img').fadeOut();
	
	
	
	
	
	
	$('#tour').load(jpUrl+'/ajax_load_panno/', { queryStrings: ""+theId+"" }, function(){
	
	$('#theContents').hide();
	
	$("img.pano").panorama({
                 viewport_width: 720,
                 speed: 10000,
                 direction: 'left',
                 control_display: 'yes',
                 mode_360: false,
                 loop_180: true
         });


	
	
	$("a.moreinfo").click(function(){
	
	var moreInfo = $('#theContents').html();
	
	$('#tourInfo').fadeIn().html(""+moreInfo+"").addClass('opmnedd');
	
	
	
	
	return false;
	
	});
	
	
	
	
	});
	
	
	}
    



	}); // End CLick








// Get link 




});// End Each

// Arm the first li and give it a live class

$('ul#foo1 li:first img').fadeTo("fast", 1);







// Thumbs naver 





  var scroll_prev = false,
	scroll_next = false;

$("#foo1").carouFredSel({
	auto 		: false,
	width		: 690,
	scroll 		: {
		items 		: 1,
		duration	: 400,
		easing		: "linear",
		mousewheel		: true,
		
	},
	
	items		: {
		start		: 0
	
	},
	
	
	prev : { 
		onAfter : function() {
			if (scroll_prev) setTimeout(function() { 
			
			
			$("#foo1").trigger("prev"); 
			
			
	
			
			}, 10);
			
		

			
			
		}
	},
	next : { 
		onAfter : function() {
			if (scroll_next) setTimeout(function() { 
			
			$("#foo1").trigger("next");
	
			
			}, 10);
	
		}
	}
});



$("#foo1_prev").hover(
	function() { 
		scroll_prev = true;
		$("#foo1").trigger("prev"); 
	},
	function() { 
		scroll_prev = false;
	}
).click(function() {
	return false;
});



$("#foo1_next").hover(
	function() { 
		scroll_next = true;
		$("#foo1").trigger("next"); 
	},
	function() {
		scroll_next = false;
	}
).click(function() {
	return false;
});
  

// Start Panno test


//Start Gallery


  var scroll_prev4 = false,
	scroll_next4 = false;

$("#foo4").carouFredSel({
	auto 		: false,
	width		: 690,
	scroll 		: {
		items 		: 1,
		duration	: 400,
		easing		: "linear",
		mousewheel		: true,
		
	},
	
	items		: {
		start		: 0
	
	},
	
	
	prev : { 
		onAfter : function() {
			if (scroll_prev4) setTimeout(function() { 
			
			
			$("#foo4").trigger("prev"); 
			
			
	
			
			}, 10);
			
		

			
			
		}
	},
	next : { 
		onAfter : function() {
			if (scroll_next4) setTimeout(function() { 
			
			$("#foo4").trigger("next");
	
			
			}, 10);
	
		}
	}
});



$("#foo4_prev").hover(
	function() { 
		scroll_prev4 = true;
		$("#foo4").trigger("prev"); 
	},
	function() { 
		scroll_prev4 = false;
	}
).click(function() {
	return false;
});



$("#foo4_next").hover(
	function() { 
		scroll_next4 = true;
		$("#foo4").trigger("next"); 
	},
	function() {
		scroll_next4 = false;
	}
).click(function() {
	return false;
});
  


});// End ready
