$(document).ready(function(){

	//Ajax
	//Set ajax to not cache
	$.ajaxSetup ({
		cache: false,
		type: "POST"
	});

	var ajax_load = "<img src='http://174.137.136.68/images/ajax-loader.gif' alt='loading...' />";

	//Meerkat
	splash({
		showMeerkatOnLoad: 'true',
		dontShow: '.enter_site',
		dontShowExpire: 0,
		animation: 'fade',
		animationSpeed: 6000,
		meerkatPosition: 'bottom',
		background: '#000',
		height: '100%'
	});
	
  	meerkat({
	  	dontShow: '.close_newsletter',
	  	dontShowExpire: 3,
	  	animation: 'fade',
	  	animationSpeed: 750,
	  	meerkatPosition: 'bottom',
	  	background: '#101010 url(../images/bg/matrix.png) repeat',
	  	height: '180px',
	showMeerkatOnLoad: 'false'
	});
	
	//Slideshow
	if ($("ul#latest_releases_slideshow").length) {
		$('ul#latest_releases_slideshow').cycle({
			fx: 'fade',
			random: 1 
		});
	};
	
	// Login
	$('.loginBox').css({ opacity: '0.0', display: 'none' });

	$('#madcap,.opensesame').click(function() {
		$("#loginBox").animate({marginTop: "0"}, 'fast' );
		$("input.mainLogin").focus();
		return false;
	});

	$("#closeLogin").click(function(){
		$("#loginBox").animate({marginTop: "-55px"}, 'fast');
		return false;
	});

	// Lazy Load
	$("body:not(#home,#movies,#israel_tour,#tour) img").lazyload({
		effect : "fadeIn"
	}); 

	//Searchbox: Display default text in search input 
	$("#search-input")
	.val('Search scenes, movies, models')
	.css("color", "#ccc")
	.focus(function(){
		$(this).css("color", "black");
		if ($(this).val() == 'Search scenes, movies, models') {
			$(this).val("");
		}
	})
	.blur(function(){
		$(this).css("color", "#ccc");
		if ($(this).val() == "") {
			$(this).val('Search scenes, movies, models');
		}
	});
	
	//Homepage Lists: Sliding Boxes
	$('.boxgrid.caption').hover(function(){
		$(".cover", this).stop().animate({top:'110px'},{queue:false,duration:360});
		
		}, function() {
		$(".cover", this).stop().animate({top:'190px'},{queue:false,duration:360});
	});

	//Show hide Scene Description
	$('#view_descrip').click(function () {
		$(this.hash).slideToggle(1000);
		return false;
	});
	
	//My Favorites Ajax Submit
	$("a.add-to-favorites").click(function() {
		$("div#favorite-added").html(ajax_load).load(this.href, null, function(responseText) {
		$("#favorite-added").html(responseText)})
		return false;
	});

	//jQuery Colorbox
	$("a[rel='example1']").colorbox();
	
	//jQuery scrollable
	$("div.scrollable").scrollable({
		size: 3
	}).navigator();
	$("a.newsletter-signup[rel]").overlay({ 
	   // some expose tweaks suitable for modal dialogs 
	   expose: { 
	       color: '#333', 
	       loadSpeed: 400, 
	       opacity: 0.9 
	   },
	   closeOnClick: false 
	});

});
//End Document Ready
