/**
 * @package tsVideo_Single_externalAd
 * @author Tony Simbine
 * @Version 20101213.02.TS09, updated 2011.11.27 15:42
 * Copyright (c) 2009-2011 and developed by Tony Simbine <ejantos (at) yahoo.com>
 * Copyright (c) 2009-2011 OMS Online Marketing Service GmbH & Co. KG
 * @link http://www.oms.eu/
**/
var tsVideoPlayer,tsContent,tsTabBar,tsVvideoList,tsVideoIDs,tsIsSPlayer;var collapsedID='bc_ad_728x90';var tsResultName='Suchergebnisse';var tsResultPlay=false;var tsProperty=Object();var tsResultSelect=0;var bc_player,bc_experience,bc_advertising;function onTemplateLoaded(brightcoveID){bc_player=brightcove.getExperience(brightcoveID);bc_experience=bc_player.getModule(APIModules.EXPERIENCE);tsIsSPlayer=/^(?:s_|.*_s_)/i.test(bc_experience.getPlayerName());if(!tsIsSPlayer)
bc_experience.addEventListener(BCExperienceEvent.CONTENT_LOAD,tsOnContentLoad);tsVideoPlayer=bc_player.getModule(APIModules.VIDEO_PLAYER);if(tsVideoIDs!=null&&tsVideoIDs.length>0&&tsIsSPlayer!=true){if(tsResultSelect>=tsVideoIDs.length)tsResultSelect=0;bc_experience.addEventListener(BCExperienceEvent.TEMPLATE_READY,tsOnTemplateReady);tsContent=bc_player.getModule(APIModules.CONTENT);tsContent.addEventListener(BCContentEvent.MEDIA_COLLECTION_LOAD,tsOnMediaCollectionLoad);}
bc_advertising=bc_player.getModule(APIModules.ADVERTISING);if(bc_advertising){bc_advertising.enableExternalAds(true);bc_advertising.tsIsSPlayer=tsIsSPlayer;bc_advertising.addEventListener(BCAdvertisingEvent.EXTERNAL_AD,tsOnExternalAd);}
if(tsIsSPlayer){var tsSocial=bc_player.getModule(APIModules.SOCIAL)
if(typeof(window.opener)!='undefined')
tsSocial.setLink(window.parent.location.href);else
tsSocial.setLink(window.location.href);}
if(typeof tsvcoms=='function')tsvcoms(brightcoveID);}
function tsOnTemplateReady(e){bc_experience.removeEventListener(BCExperienceEvent.TEMPLATE_READY,tsOnTemplateReady);tsTabBar=bc_experience.getElementByID('playlistTabs');tsVideoList=bc_experience.getElementByID('videoList');tsContent.getMediaInGroupAsynch(tsVideoIDs);}
function tsOnMediaCollectionLoad(e){if(e.mediaCollection==null){}else if(tsTabBar&&tsVideoList){tsContent.removeEventListener(BCContentEvent.MEDIA_COLLECTION_LOAD,tsOnMediaCollectionLoad);var tsPlaylist={displayName:tsResultName,mediaIds:tsVideoIDs,referenceId:'ts-search-oms',mediaCount:tsVideoIDs.length};var tsLineup=tsContent.createRuntimeMediaCollection(tsPlaylist,'playlist');tsTabBar.insertTabAt(tsLineup,0);tsTabBar.setSelectedIndex(0);var tsOK=false;if(tsResultPlay)
tsOK=tsVideoList.setSelectedIndex(tsResultSelect);else
tsOK=tsVideoPlayer.cueVideo(tsVideoIDs[tsResultSelect],'id');if(!tsOK)
tsVideoPlayer.loadVideo(list.getSelectedData());}}
function tsOnContentLoad(){bc_advertising.enableExternalAds(true);}
function tsOnExternalAd(pAdString,callback){new ExternalAd(pAdString,{});}
function ExternalAd(pXML,pOptions){var showAd=true;this.buildAd=function(pXML){try{if(pXML.ad.indexOf('<a ')!==-1){showAd=false;bc_advertising.resumeAfterExternalAd();return;}
if(window.ActiveXObject){var adXML=new ActiveXObject('Microsoft.XMLDOM');adXML.async=false;adXML.loadXML(pXML.ad);}else if(window.XMLHttpRequest){var adXML=(new DOMParser()).parseFromString(pXML.ad,'text/xml');}
var ad=new Object();ad.type='videoAd';var currentNode=adXML.firstChild;var nodeItems=currentNode.childNodes.length;adXML=null;ad.duration=(currentNode.getAttribute('duration')!=='')?Number(currentNode.getAttribute('duration')):15;if(currentNode.getAttribute('trackStartURLs')!=='')ad.trackStartURLs=currentNode.getAttribute('trackStartURLs').split(',');if(currentNode.getAttribute('trackMidURLs')!=='')ad.trackMidURLs=currentNode.getAttribute('trackMidURLs').split(',');if(currentNode.getAttribute('trackEndURLs')!=='')ad.trackEndURLs=currentNode.getAttribute('trackEndURLs').split(',');if(currentNode.getAttribute('trackPointURLs')&&(currentNode.getAttribute('trackPointURLs')!==''))ad.trackPointURLs=currentNode.getAttribute('trackPointURLs').split(',');ad.trackPointTime=(currentNode.getAttribute('trackPointTime')&&(currentNode.getAttribute('trackPointTime')!==''))?Number(currentNode.getAttribute('trackPointTime')):0;if(currentNode.getAttribute('trackFirstQuartileURLs')&&currentNode.getAttribute('trackFirstQuartileURLs')!=='')
ad.trackFirstQuartileURLs=currentNode.getAttribute('trackFirstQuartileURLs').split(',');if(currentNode.getAttribute('trackThirdQuartileURLs')&&currentNode.getAttribute('trackThirdQuartileURLs')!=='')
ad.trackThirdQuartileURLs=currentNode.getAttribute('trackThirdQuartileURLs').split(',');if(currentNode.getAttribute('trackFullscreenURLs')&&currentNode.getAttribute('trackFullscreenURLs')!=='')
ad.trackFullscreenURLs=currentNode.getAttribute('trackFullscreenURLs').split(',');if(currentNode.getAttribute('trackExitFullscreenURLs')&&currentNode.getAttribute('trackExitFullscreenURLs')!=='')
ad.trackExitFullscreenURLs=currentNode.getAttribute('trackExitFullscreenURLs').split(',');if(currentNode.getAttribute('trackPauseURLs')&&currentNode.getAttribute('trackPauseURLs')!=='')
ad.trackPauseURLs=currentNode.getAttribute('trackPauseURLs').split(',');if(currentNode.getAttribute('trackResumeURLs')&&currentNode.getAttribute('trackResumeURLs')!=='')
ad.trackResumeURLs=currentNode.getAttribute('trackResumeURLs').split(',');if(currentNode.getAttribute('trackMuteURLs')&&currentNode.getAttribute('trackMuteURLs')!=='')
ad.trackMuteURLs=currentNode.getAttribute('trackMuteURLs').split(',');if(currentNode.getAttribute('trackUnmuteURLs')&&currentNode.getAttribute('trackUnmuteURLs')!=='')
ad.trackUnmuteURLs=currentNode.getAttribute('trackUnmuteURLs').split(',');var isOverlay=false;currentNode=currentNode.firstChild;for(var i=0;i<nodeItems;i++){if(currentNode.nodeName=='videoURL'&&currentNode.firstChild)ad.videoURL=currentNode.firstChild.nodeValue;if(currentNode.nodeName=='videoClickURL'&&currentNode.firstChild)ad.videoClickURL=currentNode.firstChild.nodeValue;if(currentNode.nodeName=='overlayURL'&&currentNode.firstChild){isOverlay=true;ad.type='overlay';ad.overlayURL=currentNode.firstChild.nodeValue;}
if(currentNode.nodeName=='overlayClickURL'&&currentNode.firstChild)ad.overlayClickURL=currentNode.firstChild.nodeValue;currentNode=currentNode.nextSibling;}
if(!ad.videoURL&&!ad.overlayURL)showAd=false;return ad;}catch(e){bc_advertising.resumeAfterExternalAd();showAd=false;return null;}}
var ad=this.buildAd(pXML);if(showAd)bc_advertising.showAd(ad);else bc_advertising.resumeAfterExternalAd();}
