$(document).ready(function() {
		$('.boxgrid.slidedown').hover(function() {
			$(".cover", this).stop().animate( {
				top : '150px'
			}, {
				queue : false,
				duration : 200
			});
		}, function() {
			$(".cover", this).stop().animate( {
				top : '115px'
			}, {
				queue : false,
				duration : 200
			});
		});
		
		
		$('.boxgrid.slidedown').hover(function() {
			$(".boxplay", this).stop().animate( {
				top : '00px'
			}, {
				queue : false,
				duration : 200
			});
		}, function() {
			$(".boxplay", this).stop().animate( {
				top : '-50px'
			}, {
				queue : false,
				duration : 200
			});
		});
 
		$('.boxgrid.slidedown_lrg').hover(function() {
			$(".cover", this).stop().animate( {
				top : '220px'
			}, {
				queue : false,
				duration : 200
			});
		}, function() {
			$(".cover", this).stop().animate( {
				top : '170px'
			}, {
				queue : false,
				duration : 200
			});
		});
		
		$('.boxgrid.slidedown_lrg').hover(function() {
			$(".boxplay", this).stop().animate( {
				top : '00px'
			}, {
				queue : false,
				duration : 200
			});
		}, function() {			
			$(".boxplay", this).stop().animate( {
				top : '-50px'
			}, {
				queue : false,
				duration : 200
			});
		});
		
		
		
		
		
		
		$('.boxgrid.slidedown_long').hover(function() {
			$(".cover", this).stop().animate( {
				top : '250px'
			}, {
				queue : false,
				duration : 200
			});
		}, function() {
			$(".cover", this).stop().animate( {
				top : '170px'
			}, {
				queue : false,
				duration : 200
			});
		});
		
		$('.boxgrid.slidedown_long').hover(function() {
			$(".boxplay", this).stop().animate( {
				top : '00px'
			}, {
				queue : false,
				duration : 200
			});
		}, function() {
			$(".boxplay", this).stop().animate( {
				top : '-50px'
			}, {
				queue : false,
				duration : 200
			});
		});

		
		$('#embedButtons a').click(function(){
			var inputid = $(this).attr('id');
			$('#embedButtons input').hide();
			$('#embed'+inputid).show();
		});
		
		// Single functions 
		$('a[rel*=facebox]').facebox(); // Facebok Style box
		

});

function changeFeatured(show_id)
{
	// Change main box to show loading box
	$('#featuredDiv').html("<br /><br /><br /><br /><center><img src='/images/ajax-loader.gif' alt='Please wait...' title='Please wait...' /><br />Please wait...</center>")
	.hide()
	.fadeIn(500);

	$.ajax({
		type: "POST",
		url: "/index.php",
		data: "showFeatured=" + show_id,
		success: function(msg) {
			$('#featuredDiv').html(msg);
		}
	});
}

function changeAd(show_id)
{
	// Change main box to show loading box
	$('#featuredDiv').html("<br /><br /><br /><br /><center><img src='/images/ajax-loader.gif' alt='Please wait...' title='Please wait...' /><br />Please wait...</center>")
	.hide()
	.fadeIn(500);

	$.ajax({
		type: "POST",
		url: "/index.php",
		data: "showFeatured=" + show_id + "&ad=true",
		success: function(msg) {
			$('#featuredDiv').html(msg)
				.fadeIn(500);
		}
	});
}

function changeMovie(movie)
{
	$.facebox({ ajax: '/?process=bookMovie&movie='+movie });
}

function changeMapLocation(place)
{
	// Work out variables
	var x = '';
	var y = '';
	var z = '';
	var div_id = 'map_'+place;
	
	// Set all li's class to ""
	$('#map_latest').removeClass('selected')
	$('#map_johannesburg').removeClass('selected')
	$('#map_capetown').removeClass('selected')
	$('#map_pretoria').removeClass('selected')
	$('#map_durban').removeClass('selected')
	$('#map_all').removeClass('selected')
	
	if(place == 'johannesburg')
	{
		x = '-26.150507';
		y = '28.081055';
		z = 10;
	}
	else if(place == 'capetown')
	{
		x = '-33.94336';
		y = '18.446045';
		z = 10;
	}
	else if(place == 'pretoria')
	{
		x = '-25.730633';
		y = '28.157959';
		z = 10;
	}
	else if(place == 'durban')
	{
		x = '-29.835879';
		y = '31.129761';
		z = 10;
	}
	else if(place == 'all')
	{
		x = 0;
		y = 0;
		z = 2;
	}
	
	// Update menu
	$('#'+div_id).addClass('selected');
	
	// Update Map
	frames['gm-map-1'].GeoMashup.changeLocationOnMap(x,y,z);
}
