//////////// MAIN PLAYER SCRIPTS ///////////

// define videos (large scale id; petatv/embed id (sans _high))
videoList = new Array(
	'Stolen_for_fashion_peta2_022509_640_high,whose_skin_are_you_in-peta-peta2_lrg_high&i=stolen-for-fashion-640-high', 'Stolen_for_fashion_peta2_022509_std',
	'whose_skin_are_you_in-peta-peta2_lrg_high', 'whose_skin_are_you_in-peta2',
	'tim_gunn_fashion_victims_peta2_lrg_high', 'tim_gunn_fashion_victims_peta2'
);

// play function
videoLoaded = false;
function playVideo(vId) {
	// reset video links
	aEls = document.getElementById('videoListContent').getElementsByTagName('A');
	for(i=0;i<aEls.length;i++) {
		aEl = aEls[i];
		// highlight the selected video thumbnail
		aEl.className = (vId==i) ? 'selected' : '';		
	}
	// identify video information
	playerLink = videoList[(vId*2)];
	embedLink = videoList[(vId*2)+1];
	// load large player
	videoSource = 'http://www.petatv.com/swf/video.swf?v='+playerLink+((videoLoaded)?'&ap=1':'');
	iframeEl = document.getElementById('video_iframe');
	iframeEl.src = videoSource;

	// customise embed link text for first video
	embedLinkText = ((vId*1)) ? '' : "&quot;Stolen for Fashion&quot;&amp;mdash;Learn More at peta2.com.";

	// set video option links
	document.getElementById('vid_options_link').href = "http://www.petatv.com/tvpopup/Prefs.asp?video="+embedLink;
	document.getElementById('vid_download_link').href = "http://www.petatv.com/downloads/"+embedLink+".zip";
	document.getElementById('vid_embed_link').href = "javascript:showEmbedCode('"+embedLink+"','"+embedLinkText+"');void(0);";
	videoLoaded = true;
}

// pop up dynamic embed code window for main player
function showEmbedCode(v,t) {
	if (!t) t = 'Learn more at peta2.com.';
	window.open('embed.aspx?vid='+v+'&t='+escape(t), '_blank', 'width=300,height=140,scrollbars=yes,resize=yes,status=yes');
}




