$(document).ready(function(){
	//don't report errors
	/*
	try {
		*/
		$('#logo img').hover(function () {
			this.src = '/images/logo/bas_production_logo-over.gif';
		}, function () {
			this.src = '/images/logo/bas_production_logo.gif';
		});
		
		$("#slider").easySlider({
			auto: false, 
			continuous: false,
			vertical:false,
			allControls: true,
			/*
			controlsShow: true,
			*/
			prevText: '&lt;',
			nextText: '&gt;',
			speed:800,
			pause:300
		});
		
		$('#slider a').tooltip({ 
			track: true, 
			delay: 0, 
			showURL: false,
			fade: 250 
		});
		
		/*
		//from color to grayscale - option 1
		$('#slider img').hover(
			function(){
				this.src = 'lib-grayscaleimage.php?src=' + this.src;
			}, 
			function(){
				this.src = this.src;
			}
		);
		*/
		
		//from grayscale to color - option 2
		var counter = 0;
			
		$('#slider img').each(function() {
			if (counter++ != 0) {
				this.src = '/v2/lib-grayscaleimage.php?src=' + this.src;
			}
		});
		
		$('#slider img:first').addClass("visited");
		
		$('#slider img').click(
			function() {
				var split_array = this.src.split("src=");
				if (split_array.length == 2) {
					this.src = split_array[1];
				}
				$(this).addClass("visited");
			}
		);
		
		
		$('#slider img').hover(
			function() {
				var split_array = this.src.split("src=");
				if (split_array.length == 2) {
					this.src = split_array[1];
				}
			}, 
			function(){
				if ($(this).hasClass("visited")) {
				} else {
					this.src = '/v2/lib-grayscaleimage.php?src=' + this.src;
				}
			}
		);
	/*
	} catch (e) {
		
	}
	*/
});

function neoChooseMovie(id, language, subcontent) {
	var postURL = "/v2/quicktime-player.php?post_id=" + id + "&chosen_language=" + language + "&subcontent=" + subcontent + "&operating_system=" + $.client.os;
	$.get(postURL, function(postdata) {
		//append the data to content
		$('#movie-holder').html(postdata);
	}).complete(function() { refreshMovieHeight(); });
}

function neoChoosePhoto(filename) {
	/*
	var path_to_images = '../files/photos/locations/';
	$('#photo-holder').html('<img src="' + path_to_images + filename + '">');
	*/
	
	var path_to_images = '/files/photos/locations/';
	
	$("#photo-holder").hide();
	$("#content-preloader").show();
	
	$('<img />')
		.attr('src', path_to_images + filename)
		.load(function(){
			$('#photo-holder').html( $(this) );
			$("#photo-holder").fadeIn(300);
			$("#content-preloader").hide();
	});		
}
