var tour_to_use = 'tour3';
$(document).ready(function(){
	$('a.play_trailer').click(function(action){
		action.preventDefault();
		var trailer_id = $(this).attr('id').replace('link_trailer_id_','');
		if(trailer_id)
		{
			showPlayer(trailer_id);
			var video_identifier = $('#trailer_container_' + trailer_id).attr('yahootrackid');
			name = "RSP TOUR3 PG HOME " + video_identifier;
			YWATracker.setCF(2, name);
			YWATracker.setAction("03");
			YWATracker.submit_action();
		}
	})
});
function showPlayer(trailer_id, force_join)
{
	$('a.play_trailer').show();
	$('div.flash-replaced').each(function(){
		var div_flash_replacement = $(this);
		div_flash_replacement.find('embed').remove();
		var div_flash_replacement_id = div_flash_replacement.attr('id');
		if($('div#'+div_flash_replacement_id).is('flash-replaced'))
		{
			$('div#'+div_flash_replacement_id).removeClass('flash-replaced');
		}

	});
	if(force_join == 1)
	{
		force_join = 1;
	}
	var	showinfo 			= 0;
	var autoplay			= 1;
	var type 				= 'trailer';

	var videooptions_url 	= "http://www.realslutparty.com/tour3/get_scenes/" + trailer_id + "/" + type + "/autoplay-" + autoplay + "/show-info-" + showinfo;
	if(force_join == 1)
	{
		videooptions_url 	= "http://www.realslutparty.com/tour3/get_scenes/" + trailer_id + "/" + type + "/autoplay-" + autoplay + "/show-info-" + showinfo + "?force=1";
	}

	var player 				= $('#trailer_container_' + trailer_id);

	//ie doesn't hide the button so i used javascript
	$('a#link_trailer_id_' + trailer_id).hide();

	player.html("");
	player.flash(
	{
	    src: "http://static.contentabc.com/player/wide_tour_player.swf",
	    'width': 802,
	    'height': 522,
	    wmode: "transparent",
	    align: "middlel",
	    allowfullscreen:true,
	    allowscriptaccess: "always",
	    allownetworkaccess: "always",
	    flashvars: {
	        options: videooptions_url
	    }
	},
	{version:"10.0.22"}
	);
}
function trailer_container_preview_image(trailer_id)
{
	var tmp_image = 'url(http://static.contentabc.com/scenes/' + trailer_id + '/big.jpg)';
	$('div#trailer_container_' + trailer_id).css("background-image",tmp_image);
}

function bookmark_us(url, title){

	if (window.sidebar) // firefox
		window.sidebar.addPanel(title, url, "");
	else if(window.opera && window.print){ // opera
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	}
	else if(document.all)// ie
		window.external.AddFavorite(url, title);
}
function videostart(){

}
function videoFinish(){
	$('div.flash-replaced').each(function(){
		var div_flash_replacement = $(this);
		div_flash_replacement.find('embed').remove();
		var div_flash_replacement_id = div_flash_replacement.attr('id');
		$('div#'+div_flash_replacement_id).removeClass('flash-replaced');
	});
	$('a.play_trailer').show();
}
