//videoplayer activation code
function activateVideoPlayer(which) {
	if ($(which).select('.videoURL')[0]) {
		targetVP=$(which).select('.vPlayer')[0];
		var imageURL='';
		if (targetVP.select('img')[0]) {
			imageURL=targetVP.select('img')[0].src;
			$(which).insert({bottom:'<div class="imageURLstored" style="display:none;">'+imageURL+'</div>'});
		} else if ($(which).select('.imageURLstored')[0]) {
			imageURL=$(which).select('.imageURLstored')[0].innerHTML;
		}
		targetVP=targetVP.identify();
		videoURL=$(which).select('.videoURL')[0].innerHTML;
		var so = new SWFObject('/campaign/global/videoplayer/videoplayer.swf', 'vPlayer'+targetVP, '240', '210', '8', '#ffffff');
		so.addVariable('videoURL',videoURL);
		so.addVariable('imageURL',imageURL);
		so.addVariable('videoPlayerCSSID','vPlayer'+targetVP);
		so.addVariable('isExplorer',BrowserDetect.browser=='Explorer');
		so.addVariable('popupVideoRolloverText',$('popupVideoRolloverText').innerHTML);
		so.addVariable('tStr',window.s.pageName);
		so.addParam('allowFullscreen','true');
		so.addParam('wmode','transparent');
		so.addParam('quality','autohigh');
		so.addParam('scale','noscale');
		so.addParam('salign','tl');
		so.write(targetVP);
	}
}
//videoplayer resize callback -- called when player resizes for any reason, should be used to adjust HTML container's height to match
function videoPlayerLayoutCallback(vPlayerCSSID,updatedSpecs) {
	$(vPlayerCSSID).style.height=(updatedSpecs.videoHeight+updatedSpecs.interfaceHeight)+'px';
}
function deactivateAllVideoPlayers() {
	$$('.vPlayer').each(function(e){
		if (!e.select('img')[0]) {
			$(e).update('');
		}
	});
}
//to use this with a tab system, set a variable in the page "postponeVideoActivation=true;" and then at the appropriate time
//call "activateVideo(ID)" where ID is the ID attribute of the videoplayer's ".mediaDiv" <div>
//if "postponeVideoActivation" is not set or set to anything but true, all videoplayers in the page are activated on page load
try {
	if (postponeVideoActivation!=true) {
		activateAllVideoPlayers();
	}
}
catch(err) {
	activateAllVideoPlayers();
}
function activateAllVideoPlayers() {
    Event.observe(window,'load',function(){
        $$('.mediaDiv').each(function(e){
           activateVideoPlayer(e); 
        });
    });
}
