/**
* TE
**/
/**
 *
 * OMS Widget : Homepage
 * Version: 2009.03.25.01.TS06
 * Bugfixes by Tony Simbine <t.simbine (at) oms.eu>
 *
**/
if(typeof bc_id != 'array') {
 var bc_id = new Array();
}

function OZ_getRequest(pCount) {  
  if(window.XMLHttpRequest) {
   this.httpRequest = new XMLHttpRequest();
   if(this.httpRequest.overrideMimeType) {
    this.httpRequest.overrideMimeType('text/xml');
   }
  } else if(window.ActiveXObject) {
   try {
    this.httpRequest = new ActiveXObject('Msxml2.XMLHTTP');
   }
   catch (e) {
    try {
     this.httpRequest = new ActiveXObject('Microsoft.XMLHTTP');
    }
   catch (e) {}
   }
  }
  
  if(!this.httpRequest) {
   return false;
  }
  
  var thispointer = this;
  
  this.httpRequest.onreadystatechange = function() {
   thispointer.handler();
  };
 
  this.httpRequest.open('GET', this.xmlUrl, true);
  this.httpRequest.send('');
 }

function OZ_auto(pCount) {
  var code = document.createElement('script');
  code.setAttribute('src', 'http://api.brightcove.com/services/library?command=find_playlist_by_id&playlist_id=' + (pCount == 1 ? this.playlistId1 : this.playlistId2) + '&token=' + this.token + '&callback=bc_id[' + this.id + '].autoReturn');
  code.setAttribute('charset', 'UTF-8');
  code.setAttribute('type', 'text/javascript');
  document.getElementsByTagName('head')[0].appendChild(code);
 }
 
 
function OZ_bc_get_js(){
  var code;
   code = document.createElement("script");
   code.setAttribute('src', 'http://admin.brightcove.com/js/BrightcoveExperiences.js');
   code.setAttribute('charset', 'UTF-8');
   code.setAttribute('type', 'text/javascript');
   document.getElementsByTagName('head')[0].appendChild(code);
   code = document.createElement("script");
   code.setAttribute('src', 'http://admin.brightcove.com/js/APIModules_all.js');
   code.setAttribute('charset', 'UTF-8');
   code.setAttribute('type', 'text/javascript');
   document.getElementsByTagName('head')[0].appendChild(code); 
}

function OZ_bc_get_css(dir){
 var code;
  code = document.createElement("link");
  code.setAttribute('href', dir + '/brightcove.css');
  code.setAttribute('rel', 'stylesheet');
  code.setAttribute('type', 'text/css');
  document.getElementsByTagName('head')[0].appendChild(code);
}
  
function bc_widget_homepage(arg) {
 bc_status = 1;
 var id = bc_id.length;
 bc_id.push(new bc_make_widget_homepage(arg, id));
 bc_id[id].generate();
 bc_id[id].layout();
 bc_id[id].retrieve(1);
}
function bc_make_widget_homepage(arg, id) {
 this.id = id;
 this.postfix = arg.postfix || '';
 this.token = arg.token || (this.id > 0? bc_id[0].token: 'myReadToken.');
 this.url = arg.url || (this.id > 0? bc_id[this.id - 1].url: '/videocenter-Url');
 this.dir = arg.dir || 'bcw_homepage';
 this.width = arg.width || 500;
 this.playerId1 = (!arg.playerIds || arg.playerIds[0] == 0) ? null : arg.playerIds[0];
 this.playerId2 = (!arg.playerIds || arg.playerIds[1] == 0) ? null : arg.playerIds[1];
 this.playlistId1 = (!arg.playlistIds || arg.playlistIds[0] == 0) ? null : arg.playlistIds[0];
 this.playlistId2 = (!arg.playlistIds || arg.playlistIds[1] == 0) ? null : arg.playlistIds[1];
 this.xmlUrl = arg.xml || false;
 this.xml = '';
 this.httpRequest = null;
 this.referName = 'homepage';
 this.sliding = false;
 this.page = 0;
 this.currentTab = 1;
 this.scriptCount = 1;
 this.videoCount1 = null;
 this.videoCount2 = null;
 this.pageCount1 = null;
 this.pageCount2 = null;
 this.test = null;
 this.ie = (document.all) ? true : false;
 this.TStab = new Array(null, null);
 if (arg.TsTabs) {
  if (arg.TsTabs[0] != null && arg.TsTabs[0].length > 1)
   this.TStab[0] = arg.TsTabs[0];
  if (arg.TsTabs[1] != null && arg.TsTabs[1].length > 1)
   this.TStab[1] = arg.TsTabs[1];
 }
 this.TSlink = new Array(null, null);
 this.TStarget = this.TStargets = null;
 this.maximum = 15;
 this.tsCol = 3;
 if (arg.TSopt) {
  if (arg.TSopt['target'] && arg.TSopt['target'].length > 2) {
   this.TStarget = ' target="' + arg.TSopt.target + '"';
   this.TStargets = arg.TSopt.target;
  }
  if (arg.TSopt['maximum'] && arg.TSopt['maximum'] > 0)
   this.maximum = arg.TSopt['maximum'];
  if (arg.TSopt['tsCol'] && arg.TSopt['tsCol'] > 1)
   this.tsCol = arg.TSopt['tsCol'];
 }
 this.url += ((this.url.indexOf('?') > -1)? '&': '?');
 
 this.generate = function() {
  var code;
  if (this.id < 1) {
   OZ_bc_get_js();
  }
  OZ_bc_get_css(this.dir + this.postfix);
    
  document.write('<style type="text/css">');
  
  if(this.ie) {
   document.write('div.bc_widget_homepage' + this.postfix + ' div.bc_outer' + this.postfix + ' div.bc_inner' + this.postfix + ' div.bc_video' + this.postfix + ' div.bc_thumb' + this.postfix + ' div.bc_overlay' + this.postfix + ' { background-image: none; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + this.dir + this.postfix + '/bc_overlay.png",sizingMethod="scale"); }');
   document.write('div.bc_widget_homepage'+ this.postfix + ' div.bc_header'+ this.postfix + ' { height: 31px; overflow: hidden; }');
   document.write('div.bc_widget_homepage'+ this.postfix + ' div.bc_pagination'+ this.postfix + ' ul li { width: 16px; }');
   document.write('div.bc_widget_homepage'+ this.postfix + ' img.bc_arrow_right'+ this.postfix + ' { margin-left: -2px; }');
   document.write('div.bc_widget_homepage'+ this.postfix + ' div.bc_header'+ this.postfix + ' div.bc_link'+ this.postfix + ' { margin-right: 8px; }');
   document.write('div.bc_widget_homepage'+ this.postfix + ' div.bc_outer'+ this.postfix + ' div.bc_inner'+ this.postfix + ' div.bc_video'+ this.postfix + ' div.bc_thumb'+ this.postfix + ' { width: 128px; height: 98px; }');
  } else {
   document.write('div.bc_widget_homepage' + this.postfix + ' div.bc_outer' + this.postfix + ' div.bc_inner' + this.postfix + ' div.bc_video' + this.postfix + ' div.bc_thumb' + this.postfix + ' div.bc_overlay' + this.postfix + ' { background: transparent url("' + this.dir + this.postfix + '/bc_overlay.png"); }');
  }
  
  document.write('</style>');
  document.write('<div id="' + this.id + 'BCWH_widget" class="bc_widget_homepage' + this.postfix + '">');
  document.write('<div id="' + this.id + 'BCWH_header" class="bc_header' + this.postfix + '"><div id="' + this.id + 'BCWH_tab1" class="bc_tab_left' + this.postfix + ' bc_tab_active' + this.postfix + '" onclick="bc_id[' + this.id + '].view(1)"></div><div id="' + this.id + 'BCWH_tab2" class="bc_tab_right' + this.postfix + '" onclick="bc_id[' + this.id + '].view(2)"></div><div class="bc_link' + this.postfix + '"><a href="' + this.url + 'refer=' + this.referName + '" id="' + this.id + 'BC_TS_All"' + (this.TStarget? this.TStarget: '') + '>Alle Videos &raquo;</a></div></div>');
  document.write('<div class="bc_pagination' + this.postfix + '"><ul id="' + this.id + 'BCWH_paginationList"></ul></div>');
  document.write('<img src="' + this.dir + this.postfix + '/arrow_left.png" id="' + this.id + 'BCWH_arrowLeft" class="bc_arrow_left' + this.postfix + ' bc_arrow_disabled' + this.postfix + '" onclick="bc_id[' + this.id + '].slide(0)" onmouseover="bc_id[' + this.id + '].arrowHover(0);" onmouseout="bc_id[' + this.id + '].arrowOff(0);" alt="Pfeil nach links"/><img src="' + this.dir + this.postfix + '/arrow_right.png" id="' + this.id + 'BCWH_arrowRight" class="bc_arrow_right' + this.postfix + ' bc_arrow_disabled' + this.postfix + '" onclick="bc_id[' + this.id + '].slide(1)" onmouseover="bc_id[' + this.id + '].arrowHover(1);" onmouseout="bc_id[' + this.id + '].arrowOff(1);" alt="Pfeil nach rechts" />');
  document.write('<div id="' + this.id + 'BCWH_outer1" class="bc_outer' + this.postfix + '"><div id="' + this.id + 'BCWH_inner1" class="bc_inner' + this.postfix + '"></div></div>');
  document.write('<div id="' + this.id + 'BCWH_outer2" class="bc_outer' + this.postfix + '" style="display: none;"><div id="' + this.id + 'BCWH_inner2" class="bc_inner' + this.postfix + '"></div></div>');
  document.write('</div>');
 };
 
 this.retrieve = function(pCount) {
  if(pCount == 1) {
   if(this.playlistId1) {
    this.auto(1);
   } else {
    this.manual(1);
   }
  } else {
   if(this.playlistId2) {
    this.auto(2);
   } else {
    this.manual(2);
   }
  }
 }
 
 this.auto = OZ_auto;
 this.manual = OZ_getRequest;
 
 this.autoReturn = function(pData) {  
  document.getElementById(this.id + 'BCWH_tab' + this.scriptCount).innerHTML = this.TStab[this.scriptCount - 1] || pData.name;
  var videos = pData['videos'];
  var maximum = this.maximum;
  var tsCol = this.tsCol;
  
  if(videos.length < maximum) {
   maximum = videos.length;
  }
  
  if(this.scriptCount == 1) {
   this.videoCount1 = videos.length;
   this.pageCount1 = Math.ceil(maximum / tsCol);
   var playerId = this.playerId1;
   var lineupId = this.playlistId1;
   
   for(var i = 0; i < this.pageCount1; i++) {
    var code = document.createElement('li');
    
    if(i == 0) {
     code.className = 'selected' + this.postfix;
    }
    
    document.getElementById(this.id + 'BCWH_paginationList').appendChild(code);
   }
  } else {
   this.videoCount2 = videos.length;
   this.pageCount2 = Math.ceil(maximum / tsCol);
   var playerId = this.playerId2;
   var lineupId = this.playlistId2;
  }
  
  for(var i = 0; i < maximum; i++) {
   var minutes = Math.floor((videos[i]['length'] / 1000) / 60);
   var seconds = Math.round((((videos[i]['length'] / 1000) % 60) * 60) / 60);
   
   if(seconds < 10) {
    seconds = '0' + seconds;
   }
   
   var timeString = minutes + ':' + seconds;
   
   var date = new Date();
   date.setTime(videos[i]['publishedDate']);
   var dateString = date.getDate() + '.' + (date.getMonth() + 1) + '.' + date.getFullYear();
   
   if(videos[i]['thumbnailURL']) {
    var image = '<img src="' + videos[i]['thumbnailURL'] + '" width="120" height="90" />';
   } else {
    var image = '';
   }
   
   var code = document.createElement('div');
   code.className = 'bc_video' + this.postfix;
   code.innerHTML = '<div class="bc_thumb' + this.postfix + '" onmouseover="bc_id[' + this.id + '].over(this,1)" onmouseout="bc_id[' + this.id + '].over(this,0)" onclick="window.location=\'' + this.url + 'bcpid=' + playerId + '&bclid=' + lineupId + '&bctid=' + videos[i].id + '&refer=' + this.referName + '\'">' + image + '<div class="bc_overlay' + this.postfix + '" style="visibility: hidden;"></div></div><div class="title' + this.postfix + '">' + videos[i]['name'] + '</div><div class="time' + this.postfix + '">' + timeString + ' | ' + dateString + '</div>';
   document.getElementById(this.id + 'BCWH_inner' + this.scriptCount).appendChild(code);
  }
  this.TSlink[this.scriptCount - 1] = this.url + 'refer=' + this.referName;
  if (playerId && lineupId)
   this.TSlink[this.scriptCount - 1] += '&bcpid=' + playerId + '&bclid=' + lineupId;
  if (this.scriptCount == 1)
   document.getElementById(this.id + 'BC_TS_All').href = this.TSlink[this.scriptCount - 1];
  
  if(this.scriptCount == 1) {
   this.arrows();
   this.scriptCount++;
   this.retrieve(2);
  } else {
   this.layout();
  }
 }
 
 this.over = function(pEl, pState) {
  if(pState == 1) {
   pEl.childNodes[1].style.visibility = 'visible';
   pEl.className = 'bc_thumb bc_thumb_over';
  } else {
   pEl.childNodes[1].style.visibility = 'hidden';
   pEl.className = 'bc_thumb';
  }
 }
 
 
 
 this.handler = function() {
  var tabs, tab, videos;
  var videoIds = '';
  
  if(this.httpRequest.readyState == 4) {
   if(this.httpRequest.status == 200) {
    this.xml = this.httpRequest.responseXML;
    tabs = this.xml.getElementsByTagName('lineup');
    
    for(var i = 0; i < tabs.length; i++) {
     var tabId = tabs[i].getAttribute('tab');
     
     if(tabId == this.scriptCount) {
      tab = tabs[i];
     }
    }
    
    document.getElementById(this.id + 'BCWH_tab' + this.scriptCount).innerHTML = this.TStab[this.scriptCount - 1] || tab.getAttribute('name');
    videos = tab.getElementsByTagName('video');
    
    for(var i = 0; i < videos.length; i++) {
     var video = videos[i];
     var title = video.getElementsByTagName('title_id')[0].childNodes[0].nodeValue;
     
     videoIds += title;
     
     if(i + 1 < videos.length) {
      videoIds += ',';
     }
    }
    
    var code = document.createElement('script');
    code.setAttribute('src', 'http://api.brightcove.com/services/library?command=find_videos_by_ids&token=' + this.token + '&video_ids=' + videoIds + '&fields=id,name,thumbnailURL,length,publishedDate&callback=bc_id[' + this.id + '].manualReturn');
    code.setAttribute('charset', 'UTF-8');
    code.setAttribute('type', 'text/javascript');
    document.getElementsByTagName('head')[0].appendChild(code);
   }
  }
 }
 
 this.manualReturn = function(pData) {
  var videos = pData['items'];
  var maximum = this.maximum;
  var tsCol = this.tsCol;
  var tab;
  var tabs = this.xml.getElementsByTagName('lineup');
  
  for(var q = 0; q < tabs.length; q++) {
   var tabId = tabs[q].getAttribute('tab');
   
   if(tabId == this.scriptCount) {
    tab = tabs[q];
   }
  }
  var videosXml = tab.getElementsByTagName('video');
  for (var i = 0; i < videos.length; i++) {
   if (videos[i] == null) {
    videos.splice(i, 1);
    var removednode = videosXml[i];
    removednode.parentNode.removeChild(removednode);
    i--;
   }
   if (i >= maximum)
    break;
  }
  
  if(videos.length < maximum) {
   maximum = videos.length;
  }
  
  if(this.scriptCount == 1) {
   this.videoCount1 = videos.length;
   this.pageCount1 = Math.ceil(maximum / tsCol);
   
   for(var i = 0; i < this.pageCount1; i++) {
    var code = document.createElement('li');
    
    if(i == 0) {
     code.className = 'selected' + this.postfix;
    }
    
    document.getElementById(this.id + 'BCWH_paginationList').appendChild(code);
   }
  } else {
   this.videoCount2 = videos.length;
   this.pageCount2 = Math.ceil(maximum / tsCol);
  }
  
  var _playerId, __playerId, _playlistId, __playlistId;
  for(var i = 0; i < maximum; i++) {
    var minutes = Math.floor((videos[i]['length'] / 1000) / 60);
    var seconds = Math.round((((videos[i]['length'] / 1000) % 60) * 60) / 60);
    
    if(seconds < 10) {
     seconds = '0' + seconds;
    }
    
    var timeString = minutes + ':' + seconds;
    
    var date = new Date();
    date.setTime(videos[i]['publishedDate']);
    var dateString = date.getDate() + '.' + (date.getMonth() + 1) + '.' + date.getFullYear();
    
    if(videos[i]['thumbnailURL']) {
     var image = '<img src="' + videos[i]['thumbnailURL'] + '" width="120" height="90" />';
    } else {
     var image = '';
    }
 
    var lineupId = videosXml[i].getElementsByTagName('lineup_id')[0].childNodes[0].nodeValue;
    var playerId = videosXml[i].getElementsByTagName('player_id')[0].childNodes[0].nodeValue;
    if (i == 0) {
     _playerId = playerId;
     __playerId = _playerId;
     _playlistId = lineupId;
     __playlistId = _playlistId;
    }
    if (_playerId != playerId && __playerId == _playerId)
     __playerId = playerId;
    if (_playlistId != lineupId && __playlistId == _playlistId)
     __playlistId = lineupId;
 
    var code = document.createElement('div');
    code.className = 'bc_video' + this.postfix;
    code.innerHTML = '<div class="bc_thumb' + this.postfix + '" onmouseover="bc_id[' + this.id + '].over(this,1)" onmouseout="bc_id[' + this.id + '].over(this,0)"  onclick="window.location=\'' + this.url + 'bcpid=' + playerId + '&bclid=' + lineupId + '&bctid=' + videos[i].id + '&refer=' + this.referName + '\'">' + image + '<div class="bc_overlay' + this.postfix + '" style="visibility: hidden;"></div></div><div class="title' + this.postfix + '">' + videos[i]['name'] + '</div><div class="time' + this.postfix + '">' + timeString + ' | ' + dateString + '</div>';
    document.getElementById(this.id + 'BCWH_inner' + this.scriptCount).appendChild(code);
  }
  this.TSlink[this.scriptCount - 1] = this.url + 'refer=' + this.referName;
  if (_playerId && _playlistId && __playerId == _playerId && __playlistId == _playlistId)
   this.TSlink[this.scriptCount - 1] += '&bcpid=' + _playerId + '&bclid=' + __playlistId;
  if(this.scriptCount == 1) {
   document.getElementById(this.id + 'BC_TS_All').href = this.TSlink[this.scriptCount - 1];
   this.arrows();
   this.scriptCount++;
   this.retrieve(2);
  } else {
   this.layout();
  }
 }
 
 this.view = function(pId) {
  if(pId == 1) {
   var active = 'bc_tab_left' + this.postfix;
   var inactive = 'bc_tab_right' + this.postfix;
   var pageCount = this.pageCount1;
  } else {
   var active = 'bc_tab_right' + this.postfix;
   var inactive = 'bc_tab_left' + this.postfix;
   var pageCount = this.pageCount2;
  }
  
  document.getElementById(this.id + 'BCWH_paginationList').innerHTML = '';
  document.getElementById(this.id + 'BCWH_outer' + this.currentTab).style.display = 'none';
  document.getElementById(this.id + 'BCWH_inner' + this.currentTab).style.left = '0px';
  document.getElementById(this.id + 'BCWH_tab' + this.currentTab).className = inactive;
  document.getElementById(this.id + 'BC_TS_All').href = this.TSlink[pId - 1];
  
  this.currentTab = pId;
  this.page = 0;
  this.arrows();
  
  for(var i = 0; i < pageCount; i++) {
   var code = document.createElement('li');
   
   if(i == 0) {
    code.className = 'selected' + this.postfix;
   }
   document.getElementById(this.id + 'BCWH_paginationList').appendChild(code);
  }
  
  var offset = document.getElementById(this.id + 'BCWH_paginationList').offsetWidth;
  var pEl = document.getElementById(this.id + 'BCWH_paginationList').parentNode;
  pEl.style.left = (this.width / 2) - (offset / 2) + 2 + 'px';
    
  document.getElementById(this.id + 'BCWH_outer' + this.currentTab).style.display = 'block';
  document.getElementById(this.id + 'BCWH_inner' + this.currentTab).style.left = '0px';
  document.getElementById(this.id + 'BCWH_tab' + this.currentTab).className = active + ' bc_tab_active' + this.postfix;
 }
 
 this.arrows = function() {
  var pageCount = (this.currentTab == 1 ? this.pageCount1 : this.pageCount2);
  document.getElementById(this.id + 'BCWH_arrowLeft').className = 'bc_arrow_left' + this.postfix + (this.page > 0 ? '' : ' bc_arrow_disabled' + this.postfix);
  document.getElementById(this.id + 'BCWH_arrowRight').className = 'bc_arrow_right' + this.postfix + (this.page + 1 < pageCount ? '' : ' bc_arrow_disabled' + this.postfix);
 }
 
 this.arrowHover = function(pSide) {
  var arrow;
  
  if(pSide == 0) {
   arrow = document.getElementById(this.id + 'BCWH_arrowLeft');
   arrow.src = this.dir + this.postfix + '/arrow_left_hover.png';
  } else {
   arrow = document.getElementById(this.id + 'BCWH_arrowRight');
   arrow.src = this.dir + this.postfix + '/arrow_right_hover.png';
  }
 }
 
 this.arrowOff = function(pSide) {
  var arrow;
  
  if(pSide == 0) {
   arrow = document.getElementById(this.id + 'BCWH_arrowLeft');
   arrow.src = this.dir + this.postfix + '/arrow_left.png';
  } else {
   arrow = document.getElementById(this.id + 'BCWH_arrowRight');
   arrow.src = this.dir + this.postfix + '/arrow_right.png';
  }
 }
 
 this.layout = function() {
  var delta = 227;
  if(this.ie) {
   document.getElementById(this.id + 'BCWH_widget').style.width = (this.width + 1) + 'px';
   document.getElementById(this.id + 'BCWH_header').style.width = (this.width - 2) + 'px';
   document.getElementById(this.id + 'BCWH_outer1').style.left = ((this.width / 2) - delta - 1) + 'px';
   document.getElementById(this.id + 'BCWH_outer2').style.left = ((this.width / 2) - delta - 1) + 'px';
   document.getElementById(this.id + 'BCWH_arrowRight').style.left = (this.width - 21) + 'px';
   document.getElementById(this.id + 'BCWH_arrowLeft').style.left = '4px';
  } else {
   document.getElementById(this.id + 'BCWH_widget').style.width = (this.width - 2) + 'px';
   document.getElementById(this.id + 'BCWH_header').style.width = (this.width - 2) + 'px';
   document.getElementById(this.id + 'BCWH_outer1').style.left = ((this.width / 2) - delta) + 'px';
   document.getElementById(this.id + 'BCWH_outer2').style.left = ((this.width / 2) - delta) + 'px';
   document.getElementById(this.id + 'BCWH_arrowRight').style.left = (this.width - 26) + 'px';
  }
  
  var offset = document.getElementById(this.id + 'BCWH_paginationList').offsetWidth;
  var pEl = document.getElementById(this.id + 'BCWH_paginationList').parentNode;
  pEl.style.left = (this.width / 2) - (offset / 2) + 2 + 'px';
 }
 this.getNum = function(pNum) {
  if(pNum) {
   if(pNum.indexOf('px') > -1) {
    return parseInt(pNum.substring(0, pNum.indexOf('px')));
   } else {
    return parseInt(pNum);
   }
  } else {
   return 0;
  }
 }
 
 this.slide = function(pDir) {
  if(!this.sliding) {
   if(this.currentTab == 1) {
    var pageCount = this.pageCount1;
    var el = document.getElementById(this.id + 'BCWH_inner1');
   } else {
    var pageCount = this.pageCount2;
    var el = document.getElementById(this.id + 'BCWH_inner2');
   }
   var distance = -453;
   if (this.ie)
    distance -= 6;
   if(pDir == 0) {
    if(this.page > 0) {
     this.page--;
     this.sliding = true;
     this.prepSlide(el, (this.page * distance));
    }
   } else {
    if(this.page + 1 < pageCount) {
     this.page++;
     this.sliding = true;
     this.prepSlide(el, (this.page * distance));
    }
   }
   
   this.arrows();
  }
 }
 this.prepSlide = function(pEl, pEnd) {
  var moveStart = this.getNum(pEl.style['left']);
  var amountToMove = pEnd - moveStart;
  var timeStart = new Date().getTime();
  var timeEnd = timeStart + 1000;
  
  this.doSlide(this.id, pEl, 'left', amountToMove, moveStart, 1000, timeEnd);
 }
 
 this.doSlide = function(id, pEl, pType, pDistance, pStart, pTimeTotal, pTimeEnd) {
  var currentTime = new Date().getTime();
  var timeRemaining = Math.max(0, pTimeEnd - currentTime);
  var currentMove = parseInt(pDistance - (Math.pow(timeRemaining, 3) / Math.pow(pTimeTotal, 3)) * pDistance);
  pEl.style[pType] = (pStart + currentMove) + 'px';
  
  if(timeRemaining > 0) {
    setTimeout(function () { bc_id[id].doSlide(id, pEl, pType, pDistance, pStart, pTimeTotal, pTimeEnd); }, 10);
  } else {
   var parent = document.getElementById(this.id + 'BCWH_paginationList');
   var children = parent.childNodes;
   
   for(var i = 0; i < children.length; i++) {
    children[i].className = (i != this.page ? '' : 'selected' + this.postfix);
   }
   
   this.sliding = false;
  } 
 }
}
/**
 *
 * OMS Widget : Right Box A
 * Version: 2009.03.26.02.TS05
 * Bugfixes by Tony Simbine <t.simbine (at) oms.eu>
 *
**/

function bc_widget_rightboxa(arg) {
 var id = bc_id.length;
 bc_id.push(new bc_make_widget_rightboxa(arg, id));
 bc_id[id].generate();
 bc_id[id].retrieve();
}
function bc_make_widget_rightboxa(arg, id) {
 this.id = id;
 this.postfix = arg.postfix || '';
 this.token = arg.token || (this.id > 0? bc_id[0].token: 'myReadToken.');
 this.url = arg.url || (this.id > 0? bc_id[this.id - 1].url: '/videocenter-Url');
 this.dir = arg.dir || 'bcw_rightboxa';
 this.playerId = (!arg.playerIds) ? null : arg.playerIds[0];
 this.playlistId1 = (!arg.playlistIds) ? null : arg.playlistIds[0];
 this.width = arg.width || 170;
 this.xmlUrl = arg.xml || false;
 this.xml = '';
 this.httpRequest = null;
 this.videoCount = null;
 this.page = 0;
 this.sliding = false;
 this.referName = 'rightboxa';
 this.ie = (document.all) ? true: false;
 this.TStab = new Array(null);
 if (arg.TsTabs) {
  if (arg.TsTabs[0] != null && arg.TsTabs[0].length > 1)
   this.TStab[0] = arg.TsTabs[0];
 }
 this.TStarget = null;
 this.maximum = 11;
 if (arg.TSopt) {
  if (arg.TSopt['target'] && arg.TSopt['target'].length > 2) {
   this.TStarget = ' target="' + arg.TSopt.target + '"';
   this.TStargets = arg.TSopt.target;
  }
  if (arg.TSopt['maximum'] && arg.TSopt['maximum'] > 0)
   this.maximum = arg.TSopt['maximum'];
 }
 this.url += ((this.url.indexOf('?') > -1)? '&': '?');
 
 this.generate = function() {
  var code;
  if (this.id < 1) {
   OZ_bc_get_js();
  }
  OZ_bc_get_css(this.dir + this.postfix);;
  
  if(this.ie) {
   document.write('<style type="text/css">');
   document.write('div.bc_widget_rba' + this.postfix + ' div.bc_title' + this.postfix + ' { height: 23px; }');
   document.write('div.bc_widget_rba' + this.postfix + ' div.bc_mainVideo_title' + this.postfix + ' { height: 48px; }');
   document.write('div.bc_widget_rba' + this.postfix + ' div.bc_mainVideo_thumb' + this.postfix + ' div.bc_overlay' + this.postfix + ' { background: none; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + this.dir + '/inactive_overlay_large.png",sizingMethod="image"); }');
   document.write('div.bc_widget_rba' + this.postfix + ' div.bc_mainVideo_thumb' + this.postfix + ' div.bc_mainHover' + this.postfix + ' { background: none; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + this.dir + '/overlay_large.png",sizingMethod="image"); }');
   document.write('div.bc_widget_rba' + this.postfix + ' div.bc_arrow_left' + this.postfix + ' { top: 29px; }');
   document.write('div.bc_widget_rba' + this.postfix + ' div.bc_arrow_right' + this.postfix + ' { top: 9px; }');
   document.write('div.bc_widget_rba' + this.postfix + ' div.bc_outer' + this.postfix + ' div.bc_inner' + this.postfix + ' div.bc_video' + this.postfix + ' div.bc_thumb' + this.postfix + ' { width: 84px; height: 64px; }');
   document.write('div.bc_widget_rba' + this.postfix + ' div.bc_outer' + this.postfix + ' div.bc_inner' + this.postfix + ' div.bc_video' + this.postfix + ' div.bc_thumb' + this.postfix + ' div.bc_smallHover' + this.postfix + ' { background: none; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + this.dir + '/overlay_small.png",sizingMethod="scale"); }');
   document.write('div.bc_widget_rba' + this.postfix + ' div.bc_outer' + this.postfix + ' div.bc_inner' + this.postfix + ' div.bc_video' + this.postfix + ' div.bc_video_title' + this.postfix + ' { height: 40px; }');
   document.write('</style>');
  }
  document.write('<div id="' + this.id + 'BCWRA_widget" class="bc_widget_rba' + this.postfix + '">');
  document.write('<div class="bc_title' + this.postfix + '" id="' + this.id + 'BCWRA_title"></div>');
  document.write('<div id="' + this.id + 'BCWRA_thumb" class="bc_mainVideo_thumb' + this.postfix + '" onmouseover="bc_id[' + this.id + '].mainHover(1)" onmouseout="bc_id[' + this.id + '].mainHover(0)"><img id="' + this.id + 'BCWRA_mainSrc" class="bc_src' + this.postfix + '" /><div class="bc_overlay' + this.postfix + '" id="' + this.id + 'BCWRA_mainOverlay"></div></div><div class="bc_mainVideo_title' + this.postfix + '" id="' + this.id + 'BCWRA_mainTitle"></div>');
  document.write('<div id="' + this.id + 'BCWRA_arrowLeft" class="bc_arrow_left' + this.postfix + '" onclick="bc_id[' + this.id + '].slide(0)"><img src="' + this.dir + this.postfix + '/arrow_left.png" onmouseover="bc_id[' + this.id + '].arrowOver(this,0)" onmouseout="bc_id[' + this.id + '].arrowOff(this,0)" alt="Pfeil nach links" /></div><div id="' + this.id + 'BCWRA_arrowRight" class="bc_arrow_right' + this.postfix + '" onclick="bc_id[' + this.id + '].slide(1)"><img src="' + this.dir + this.postfix + '/arrow_right.png" onmouseover="bc_id[' + this.id + '].arrowOver(this,1)" onmouseout="bc_id[' + this.id + '].arrowOff(this,1)" alt="Pfeil nach links" /></div><div class="bc_outer' + this.postfix + '" id="' + this.id + 'BCWRA_outer"><div class="bc_inner' + this.postfix + '" id="' + this.id + 'BCWRA_inner">');
  document.write('</div></div>');
  document.write('<div class="bc_footer' + this.postfix + '"><a href="' + this.url + 'refer=' + this.referName + '" id="' + this.id + 'BC_TS_All"' + (this.TStarget? this.TStarget: '') + '>Alle Videos &raquo;</a></div>');
  document.write('</div>');
 }
 
 this.retrieve = function() {
  if(this.xmlUrl) {
   this.manual();
  } else {
   this.auto(1);
  }
 }
 
 this.auto = OZ_auto;
 this.manual = OZ_getRequest;
 
 this.autoReturn = function(pData) {
  document.getElementById(this.id + 'BCWRA_title').innerHTML = '<a href="' + this.url +  'bcpid=' + this.playerId + '&bclid=' + this.playlistId1 + '&refer=' + this.referName + '"' + (this.TStarget? this.TStarget: '') + '>' + (this.TStab[0] || pData.name) + '</a>';
  var el = document.getElementById(this.id + 'BCWRA_inner');
  var videos = pData['videos'];
  var maximum = this.maximum;
  
  if(videos.length < maximum) {
   maximum = videos.length;
  }
  
  this.videoCount = maximum - 1;
  
  document.getElementById(this.id + 'BCWRA_mainSrc').setAttribute('src', videos[0]['videoStillURL']);
  document.getElementById(this.id + 'BCWRA_mainTitle').innerHTML = videos[0]['name'];
  
  var a = this.url;
  var b = this.playerId;
  var c = this.playlistId1;
  var d = this.referName;
  
  document.getElementById(this.id + 'BCWRA_thumb').onclick = function() {
   window.location = a + 'bcpid=' + b + '&bclid=' + c + '&bctid=' + videos[0].id + '&refer=' + d;
  }
  
  for(var i = 1; i < maximum; i++) {
   var code = document.createElement('div');
   code.className = 'bc_video' + this.postfix;
   code.innerHTML = '<div class="bc_thumb' + this.postfix + '" onclick="window.location=\'' + this.url + 'bcpid=' + this.playerId + '&bclid=' + this.playlistId1 + '&bctid=' + videos[i].id + '&refer=' + this.referName + '\';" onmouseover="bc_id[' + this.id + '].smallHover(' + i + ',1)" onmouseout="bc_id[' + this.id + '].smallHover(' + i + ',0)"><img class="bc_src' + this.postfix + '" src="' + videos[i]['thumbnailURL'] + '" /><div class="bc_overlay' + this.postfix + '" id="' + this.id + 'BCWRA_smallOverlay' + i + '"></div></div><div class="bc_video_title' + this.postfix + '">' + videos[i]['name'] + '</div>';
   
   el.appendChild(code);
  }
  if (this.playerId && this.playlistId1)
   document.getElementById(this.id + 'BC_TS_All').href = this.url + 'bcpid=' + this.playerId + '&bclid=' + this.playlistId1 + '&refer=' + this.referName;
  
  this.count();
  this.position();
  this.arrows();
 }
 
 
 this.handler = function() {
  var tabs, tab, videos;
  var videoIds = '';
  
  if(this.httpRequest.readyState == 4) {
   if(this.httpRequest.status == 200) {
    this.xml = this.httpRequest.responseXML;
    tabs = this.xml.getElementsByTagName('lineup');
    tab = tabs[0];
    document.getElementById(this.id + 'BCWRA_title').innerHTML = '<a href="' + this.url + '"' + (this.TStarget? this.TStarget: '') + '>' + (this.TStab[0] || tab.getAttribute('name')) + '</a>';
    videos = tab.getElementsByTagName('video');
    
    for(var i = 0; i < videos.length; i++) {
     var video = videos[i];
     var title = video.getElementsByTagName('title_id')[0].childNodes[0].nodeValue;
     
     videoIds += title;
     
     if(i + 1 < videos.length) {
      videoIds += ',';
     }
    }
    
    var code = document.createElement('script');
    code.setAttribute('src', 'http://api.brightcove.com/services/library?command=find_videos_by_ids&token=' + this.token + '&video_ids=' + videoIds + '&callback=bc_id[' + this.id + '].manualReturn');
    code.setAttribute('charset', 'UTF-8');
    code.setAttribute('type', 'text/javascript');
    document.getElementsByTagName('head')[0].appendChild(code);
   }
  }
 }
 this.manualReturn = function(pData) {
  var el = document.getElementById(this.id + 'BCWRA_inner');
  var videos = pData['items'];
  var maximum = this.maximum;
  var tabs = this.xml.getElementsByTagName('lineup');
  var tab = tabs[0];
  var xml_videos = tab.getElementsByTagName('video');
  
  for (var i = 0; i < videos.length; i++) {
   if (videos[i] == null) {
    videos.splice(i, 1);
    var removednode = xml_videos[i];
    removednode.parentNode.removeChild(removednode);
    i--;
   }
   if (i >= maximum)
    break;
  }
  
  if(videos.length < maximum) {
   maximum = videos.length;
  }
  
  this.videoCount = maximum - 1;
  
  document.getElementById(this.id + 'BCWRA_mainSrc').setAttribute('src', videos[0]['videoStillURL']);
  document.getElementById(this.id + 'BCWRA_mainTitle').innerHTML = videos[0]['name'];
  
  var a = this.url;
  var b = xml_videos[0].getElementsByTagName('player_id')[0].childNodes[0].nodeValue;
  var c = xml_videos[0].getElementsByTagName('lineup_id')[0].childNodes[0].nodeValue;
  var d = this.referName;
  
  document.getElementById(this.id + 'BCWRA_thumb').onclick = function() {
   window.location = a + 'bcpid=' + b + '&bclid=' + c + '&bctid=' + videos[0].id + '&refer=' + d;
  }
  
  var _playerId, __playerId, _playlistId, __playlistId;
  _playerId = b;
  __playerId = _playerId;
  _playlistId = c;
  __playlistId = _playlistId;
  for(var i = 1; i < maximum; i++) {
   var playerId = xml_videos[i].getElementsByTagName('player_id')[0].childNodes[0].nodeValue;
   var playlistId = xml_videos[i].getElementsByTagName('lineup_id')[0].childNodes[0].nodeValue;
   if (_playerId != playerId && __playerId == _playerId)
    __playerId = playerId;
   if (_playlistId != playlistId && __playlistId == _playlistId)
    __playlistId = playlistId;
   
   var code = document.createElement('div');
   code.className = 'bc_video' + this.postfix;
   code.innerHTML = '<div class="bc_thumb' + this.postfix + '" onclick="window.location=\'' + this.url + 'bcpid=' + playerId + '&bclid=' + playlistId + '&bctid=' + videos[i].id + '&refer=' + this.referName + '\';" onmouseover="bc_id[' + this.id + '].smallHover(' + i + ',1)" onmouseout="bc_id[' + this.id + '].smallHover(' + i + ',0)"><img class="bc_src' + this.postfix + '" src="' + videos[i]['thumbnailURL'] + '" /><div class="bc_overlay' + this.postfix + '" id="' + this.id + 'BCWRA_smallOverlay' + i + '"></div></div><div class="bc_video_title' + this.postfix + '">' + videos[i]['name'] + '</div>';
   
   el.appendChild(code);
  }
  if (_playerId && _playlistId && __playerId == _playerId && __playlistId == _playlistId)
   document.getElementById(this.id + 'BC_TS_All').href = this.url + 'bcpid=' + _playerId + '&bclid=' + __playlistId + '&refer=' + this.referName;
  
  this.count();
  this.position();
  this.arrows();
 }
 this.count = function() {
  var outer = document.getElementById(this.id + 'BCWRA_outer');
  
  if(this.width < 208) {
   outer.style.left = (((this.width - 20) / 2) - 43) + 'px';
   outer.style.width = 84 + 'px';
  } else if(this.width < 300) {
   this.videoCount = this.videoCount - 1;
   outer.style.left = (((this.width - 20) / 2) - 90) + 'px';
   outer.style.width = 178 + 'px';
  } else {
   this.videoCount = this.videoCount - 2;
   outer.style.left = (((this.width - 20) / 2) - 136) + 'px';
   outer.style.width = 272 + 'px';
  }
 }
 
 this.position = function() {
  var widget = document.getElementById(this.id + 'BCWRA_widget');
  var title = document.getElementById(this.id + 'BCWRA_title');
  var thumb = document.getElementById(this.id + 'BCWRA_thumb');
  var image = document.getElementById(this.id + 'BCWRA_mainSrc');
  var overlay = document.getElementById(this.id + 'BCWRA_mainOverlay');
  var mainTitle = document.getElementById(this.id + 'BCWRA_mainTitle');
  var arrowRight = document.getElementById(this.id + 'BCWRA_arrowRight');
  var height = this.width * 0.75;
  
  widget.style.width = (this.width - 22) + 'px';
  height = (this.width - 20) * 0.75;
  image.style.height = (height - 2) + 'px';
  image.style.top = '1px';
  image.style.left = '1px';
  overlay.style.width = (this.width - 22) + 'px';
  overlay.style.height = height + 'px';
  arrowRight.style.left = ((this.width - 20) - 19) + 'px';
  if(this.ie) {
   title.style.width = (this.width - 21) + 'px';
   overlay.style.left = (((this.width - 24) / 2) - 92) + 'px';
   overlay.style.top = ((height / 2) - 70) + 'px';
   thumb.style.width = (this.width - 21) + 'px';
   thumb.style.height = (height + 2) + 'px';
   image.style.width = (this.width - 25) + 'px';
   mainTitle.style.width = (this.width - 21) + 'px';
  } else {
   title.style.width = (this.width - 28) + 'px';
   thumb.style.width = (this.width - 22) + 'px';
   thumb.style.height = height + 'px';
   image.style.width = (this.width - 24) + 'px';
   mainTitle.style.width = (this.width - 20) + 'px';
  }
 }
 
 this.mainHover = function(pState) {
  var overlay = document.getElementById(this.id + 'BCWRA_mainOverlay');
  
  if(pState == 1) {
   overlay.className = 'bc_overlay' + this.postfix + ' bc_mainHover' + this.postfix;
   document.getElementById(this.id + 'BCWRA_thumb').className = 'bc_mainVideo_thumb bc_mainVideo_thumb_over';
  } else {
   overlay.className = 'bc_overlay' + this.postfix;
   document.getElementById(this.id + 'BCWRA_thumb').className = 'bc_mainVideo_thumb';
  }
 }
 
 this.smallHover = function(pId, pState) {
  var overlay = document.getElementById(this.id + 'BCWRA_smallOverlay' + pId);
  var pEl = overlay.parentNode;
  
  if(pState == 1) {
   overlay.className = 'bc_overlay' + this.postfix + ' bc_smallHover' + this.postfix;
   pEl.className = 'bc_thumb bc_thumb_over';
  } else {
   overlay.className = 'bc_overlay' + this.postfix;
   pEl.className = 'bc_thumb';
  }
 }
 
 this.arrows = function() {
  var arrowLeft = document.getElementById(this.id + 'BCWRA_arrowLeft');
  var arrowRight = document.getElementById(this.id + 'BCWRA_arrowRight');
  
  arrowLeft.className = 'bc_arrow_left' + this.postfix + (this.page < 1 ? ' bc_arrow_disabled' + this.postfix : '');
  arrowRight.className = 'bc_arrow_right' + this.postfix + (this.page + 1 == this.videoCount ? ' bc_arrow_disabled' + this.postfix : '');
 }
 
 this.arrowOver = function(pEl, pSide) {
  if(pSide == 0) {
   pEl.src = this.dir + this.postfix + '/arrow_left_hover.png';
  } else {
   pEl.src = this.dir + this.postfix + '/arrow_right_hover.png';
  }
 }
 
 this.arrowOff = function(pEl, pSide) {
  if(pSide == 0) {
   pEl.src = this.dir + this.postfix + '/arrow_left.png';
  } else {
   pEl.src = this.dir + this.postfix + '/arrow_right.png';
  }
 }
 
 this.slide = function(pDir) {
  if(!this.sliding) {
   el = document.getElementById(this.id + 'BCWRA_inner');
   
   if(pDir == 0) {
    if(this.page > 0) {
     this.page--;
     this.sliding = true;
     this.prepSlide(el, (this.page * -94));
    }
   } else {
    if(this.page + 1 < this.videoCount) {
     this.page++;
     this.sliding = true;
     this.prepSlide(el, (this.page * -94));
    }
   }
   
   this.arrows();
  }
 }
 
 this.getNum = function(pNum) {
  if(pNum) {
   if(pNum.indexOf('px') > -1) {
    return parseInt(pNum.substring(0, pNum.indexOf('px')));
   } else {
    return parseInt(pNum);
   }
  } else {
   return 0;
  }
 }
 this.prepSlide = function(pEl, pEnd) {
  var moveStart = this.getNum(pEl.style['left']);
  var amountToMove = pEnd - moveStart;
  var timeStart = new Date().getTime();
  var timeEnd = timeStart + 500;
  
  this.doSlide(this.id, pEl, 'left', amountToMove, moveStart, 500, timeEnd);
 }
 
 this.doSlide = function(id, pEl, pType, pDistance, pStart, pTimeTotal, pTimeEnd) {
  var currentTime = new Date().getTime();
  var timeRemaining = Math.max(0, pTimeEnd - currentTime);
  var currentMove = parseInt(pDistance - (Math.pow(timeRemaining, 3) / Math.pow(pTimeTotal, 3)) * pDistance);
  pEl.style[pType] = (pStart + currentMove) + 'px';
  
  if(timeRemaining > 0) {
    setTimeout(function () { bc_id[id].doSlide(id, pEl, pType, pDistance, pStart, pTimeTotal, pTimeEnd); }, 10);
  } else {   
   this.sliding = false;
  } 
 }
}

/**
 *
 * OMS Widget : Right Box B  300
 * Version: 2009.03.25.01.TS06
 * Bugfixes by Tony Simbine <t.simbine (at) oms.eu>
 *
**/

function bc_widget_rightboxb(arg) {
 var id = bc_id.length;
 bc_id.push(new bc_make_widget_rightboxb(arg, id));
 bc_id[id].generate();
 bc_id[id].retrieve();
}
function bc_make_widget_rightboxb(arg, id) {
 this.id = id;
 this.postfix = arg.postfix || '';
 this.token = arg.token || (this.id > 0? bc_id[0].token: 'myReadToken.');
 this.url = arg.url || (this.id > 0? bc_id[this.id - 1].url: '/videocenter-Url');
 this.dir = arg.dir || 'bcw_rightboxb';
 this.playerId = (!arg.playerIds) ? null : arg.playerIds[0];
 this.playlistId1 = (!arg.playlistIds) ? null : arg.playlistIds[0];
 this.xmlUrl = arg.xml || false;
 this.xml = '';
 this.httpRequest = null;
 this.videoCount = null;
 this.page = 0;
 this.sliding = false;
 this.referName = 'rightboxb';
 this.ie = (document.all) ? true: false;
 this.TStab = new Array(null);
 if (arg.TsTabs) {
  if (arg.TsTabs[0] != null && arg.TsTabs[0].length > 1)
   this.TStab[0] = arg.TsTabs[0];
 }
 this.TStarget = null;
 this.maximum = 10;
 if (arg.TSopt) {
  if (arg.TSopt['target'] && arg.TSopt['target'].length > 2) {
   this.TStarget = ' target="' + arg.TSopt.target + '"';
   this.TStargets = arg.TSopt.target;
  }
  if (arg.TSopt['maximum'] && arg.TSopt['maximum'] > 0)
   this.maximum = arg.TSopt['maximum'];
 }
 this.url += ((this.url.indexOf('?') > -1)? '&': '?');
 
 this.generate = function() {
  var code;
  if (this.id < 1) {
   OZ_bc_get_js();
  }
  OZ_bc_get_css(this.dir + this.postfix);
  
  if(this.ie) {
   document.write('<style type="text/css">');
   document.write('div.bc_widget_rightboxb'+ this.postfix + ' { width: 301px; }');
   document.write('div.bc_widget_rightboxb'+ this.postfix + ' div.bc_container_one'+ this.postfix + ' div.bc_video'+ this.postfix + ' div.bc_meta'+ this.postfix + ' div.bc_data'+ this.postfix + ' { width: 194px; }');
   document.write('div.bc_widget_rightboxb'+ this.postfix + ' div.bc_container_one'+ this.postfix + ' div.bc_video'+ this.postfix + ' div.bc_meta'+ this.postfix + ' div.bc_data'+ this.postfix + ' img { margin: 2px 5px 0 0; }');
   document.write('div.bc_widget_rightboxb'+ this.postfix + ' div.bc_footer'+ this.postfix + ' { padding-bottom: 8px; }');
   document.write('div.bc_widget_rightboxb'+ this.postfix + ' div.bc_container_two'+ this.postfix + ' { width: 298px; }');
   document.write('div.bc_widget_rightboxb'+ this.postfix + ' div.bc_container_two'+ this.postfix + ' div.bc_inner'+ this.postfix + ' div.bc_video'+ this.postfix + ' div.bc_title'+ this.postfix + ' { width: 240px; }');
   document.write('div.bc_widget_rightboxb'+ this.postfix + ' div.bc_header'+ this.postfix + ' img.bc_tab_left'+ this.postfix + ' { left: 225px; }');
   document.write('div.bc_widget_rightboxb'+ this.postfix + ' div.bc_header'+ this.postfix + ' img.bc_tab_right'+ this.postfix + ' { left: 258px; }');
   document.write('div.bc_widget_rightboxb'+ this.postfix + ' div.bc_container_two'+ this.postfix + ' div.bc_arrow_left'+ this.postfix + ' { background: none; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + this.dir + this.postfix + '/bc_arrow_left.png",sizingMethod="scale"); }');
   document.write('div.bc_widget_rightboxb'+ this.postfix + ' div.bc_container_two'+ this.postfix + ' div.bc_arrow_right'+ this.postfix + ' { background: none; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + this.dir + this.postfix + '/bc_arrow_right.png",sizingMethod="scale"); }');
   document.write('</style>');
  }
  document.write('<div class="bc_widget_rightboxb' + this.postfix + '"><div class="bc_header' + this.postfix + '">');
  document.write('<div class="bc_title' + this.postfix + '" id="' + this.id + 'BCWRB_title"></div><img src="' + this.dir + this.postfix + '/tab_1_active.png" id="' + this.id + 'BCWRB_tab1" class="bc_tab_left' + this.postfix + '" onclick="bc_id[' + this.id + '].view(1)" /><img src="' + this.dir + this.postfix + '/tab_2_inactive.png" id="' + this.id + 'BCWRB_tab2" class="bc_tab_right' + this.postfix + '" onclick="bc_id[' + this.id + '].view(2)" /></div>');
  document.write('<div class="bc_container_one' + this.postfix + '" id="' + this.id + 'BCWRB_containerOne"></div>');
  document.write('<div class="bc_container_two' + this.postfix + '" id="' + this.id + 'BCWRB_containerTwo" style="display: none;"><div class="bc_arrow_left' + this.postfix + '" id="' + this.id + 'BCWRB_arrowLeft" style="display: none;" onclick="bc_id[' + this.id + '].slide(0)"></div><div class="bc_arrow_right' + this.postfix + '" id="' + this.id + 'BCWRB_arrowRight" onclick="bc_id[' + this.id + '].slide(1)"></div><div id="' + this.id + 'BCWRB_inner" class="bc_inner' + this.postfix + '"></div></div>');
  document.write('<div class="bc_footer' + this.postfix + '"><a href="' + this.url + 'refer=' + this.referName + '" id="' + this.id + 'BC_TS_All"' + (this.TStarget? this.TStarget: '') + '>Alle Videos &raquo;</a></div>');
  document.write('</div>');
 }
 
 this.retrieve = function() {
  if(this.xmlUrl) {
   this.manual();
  } else {
   this.auto(1);
  }
 }
 
 this.auto = OZ_auto;
 this.manual = OZ_getRequest;
 
 this.autoReturn = function(pData) {
  document.getElementById(this.id + 'BCWRB_title').innerHTML = this.TStab[0] || pData.name;
  var videos = pData['videos'];
  var maximum = this.maximum;
  
  if(videos.length < maximum) {
   maximum = videos.length;
  }
  
  this.videoCount = maximum;
  
  for(var i = 0; i < maximum; i++) {
   var minutes = Math.floor((videos[i]['length'] / 1000) / 60);
   var seconds = Math.round((((videos[i]['length'] / 1000) % 60) * 60) / 60);
   
   if(seconds < 10) {
    seconds = '0' + seconds;
   }
   
   var timeString = minutes + ':' + seconds;
   
   if(videos[i]['thumbnailURL']) {
    var image1 = '<img src="' + videos[i]['thumbnailURL'] + '" width="80" height="60" />';
    var image2 = '<img src="' + videos[i]['videoStillURL'] + '" width="240" height="180" />';
   } else {
    var image1 = '';
    var image2 = '';
   }
   
   var code = document.createElement('div');
   if(i == 0) {
    code.className = 'bc_video' + this.postfix + ' bc_video_over' + this.postfix;
   } else {
    code.className = 'bc_video' + this.postfix;
   }
   
   code.innerHTML = '<div class="bc_left' + this.postfix + '" onmouseover="bc_id[' + this.id + '].show(' + i + ')"><span>' + (i + 1) + '</span> ' + videos[i]['name'] + '</div><div class="bc_right' + this.postfix + '">' + timeString + '</div><div class="bc_meta' + this.postfix + '"><a href="' + this.url + 'bcpid=' + this.playerId + '&bclid=' + this.playlistId1 + '&bctid=' + videos[i].id + '&refer=' + this.referName + '"' + (this.TStarget? this.TStarget: '') + '>' + image1 + '</a><div class="bc_data' + this.postfix + '"><div class="bc_desc' + this.postfix + '">' + videos[i]['shortDescription'] + '</div><a href="' + this.url + 'bcpid=' + this.playerId + '&bclid=' + this.playlistId1 + '&bctid=' + videos[i].id + '&refer=' + this.referName + '"' + (this.TStarget? this.TStarget: '') + '><img src="' + this.dir + this.postfix + '/bc_arrow.png" alt="Pfeil" /></a><div class="bc_link' + this.postfix + '"><a href="' + this.url + 'bcpid=' + this.playerId + '&bclid=' + this.playlistId1 + '&bctid=' + videos[i].id + '&refer=' + this.referName + '"' + (this.TStarget? this.TStarget: '') + '>Abspielen</a></div></div></div></div>';
   
   if(i == 0) {
    code.style.height = (this.ie ? 95 : 78)+'px';
   } else {
    code.style.height = '10px';
   }
   document.getElementById(this.id + 'BCWRB_containerOne').appendChild(code);
   
   var code = document.createElement('div');
   code.className = 'bc_video' + this.postfix;
   code.innerHTML = '<a href="' + this.url + 'bcpid=' + this.playerId + '&bclid=' + this.playlistId1 + '&bctid=' + videos[i].id + '&refer=' + this.referName + '"' + (this.TStarget? this.TStarget: '') + '>' + image2 + '</a><div class="bc_title' + this.postfix + '">' + videos[i]['name'] + '<div class="bc_time' + this.postfix + '">' + timeString + '</div></div>';
   document.getElementById(this.id + 'BCWRB_inner').appendChild(code);
  }
  if (this.playerId && this.playlistId1)
   document.getElementById(this.id + 'BC_TS_All').href = this.url + 'bcpid=' + this.playerId + '&bclid=' + this.playlistId1 + '&refer=' + this.referName;
 }
 
 
 
 this.handler = function() {
  var tabs, tab, videos;
  var videoIds = '';
  
  if(this.httpRequest.readyState == 4) {
   if(this.httpRequest.status == 200) {
    this.xml = this.httpRequest.responseXML;
    tabs = this.xml.getElementsByTagName('lineup');
    tab = tabs[0];
    document.getElementById(this.id + 'BCWRB_title').innerHTML = this.TStab[0] || tab.getAttribute('name');
    videos = tab.getElementsByTagName('video');
    
    for(var i = 0; i < videos.length; i++) {
     var video = videos[i];
     var title = video.getElementsByTagName('title_id')[0].childNodes[0].nodeValue;
     
     videoIds += title;
     
     if(i + 1 < videos.length) {
      videoIds += ',';
     }
    }
    
    var code = document.createElement('script');
    code.setAttribute('src', 'http://api.brightcove.com/services/library?command=find_videos_by_ids&token=' + this.token + '&video_ids=' + videoIds + '&callback=bc_id[' + this.id + '].manualReturn');
    code.setAttribute('charset', 'UTF-8');
    code.setAttribute('type', 'text/javascript');
    document.getElementsByTagName('head')[0].appendChild(code);
   }
  }
 }
 this.manualReturn = function(pData) {
  var videos = pData['items'];
  var maximum = this.maximum;
  var tabs = this.xml.getElementsByTagName('lineup');
  var tab = tabs[0];
  var xml_videos = tab.getElementsByTagName('video');
  
  for (var i = 0; i < videos.length; i++) {
   if (videos[i] == null) {
    videos.splice(i, 1);
    var removednode = xml_videos[i];
    removednode.parentNode.removeChild(removednode);
    i--;
   }
   if (i >= maximum)
    break;
  }
  
  if(videos.length < maximum) {
   maximum = videos.length;
  }
  
  this.videoCount = maximum;
  var _playerId, __playerId, _playlistId, __playlistId;
  for(var i = 0; i < maximum; i++) {
   var playerId = xml_videos[i].getElementsByTagName('player_id')[0].childNodes[0].nodeValue;
   var playlistId = xml_videos[i].getElementsByTagName('lineup_id')[0].childNodes[0].nodeValue;
   if (i == 0) {
    _playerId = playerId;
    __playerId = _playerId;
    _playlistId = playlistId;
    __playlistId = _playlistId;
   }
   if (_playerId != playerId && __playerId == _playerId)
    __playerId = playerId;
   if (_playlistId != playlistId && __playlistId == _playlistId)
    __playlistId = playlistId;
   
   var minutes = Math.floor((videos[i]['length'] / 1000) / 60);
   var seconds = Math.round((((videos[i]['length'] / 1000) % 60) * 60) / 60);
   
   if(seconds < 10) {
    seconds = '0' + seconds;
   }
   
   var timeString = minutes + ':' + seconds;
   
   if(videos[i]['thumbnailURL']) {
    var image1 = '<img src="' + videos[i]['thumbnailURL'] + '" width="80" height="60" />';
    var image2 = '<img src="' + videos[i]['videoStillURL'] + '" width="240" height="180" />';
   } else {
    var image1 = '';
    var image2 = '';
   }
   
   var code = document.createElement('div');
   
   if(i == 0) {
    code.className = 'bc_video' + this.postfix + ' bc_video_over' + this.postfix;
   } else {
    code.className = 'bc_video' + this.postfix;
   }
   
   code.innerHTML = '<div class="bc_left' + this.postfix + '" onmouseover="bc_id[' + this.id + '].show(' + i + ')"><span>' + (i + 1) + '</span> ' + videos[i]['name'] + '</div><div class="bc_right' + this.postfix + '">' + timeString + '</div><div class="bc_meta' + this.postfix + '"><a href="' + this.url + 'bcpid=' + playerId + '&bclid=' + playlistId + '&bctid=' + videos[i].id + '&refer=' + this.referName + '"' + (this.TStarget? this.TStarget: '') + '>' + image1 + '</a><div class="bc_data' + this.postfix + '"><div class="bc_desc' + this.postfix + '">' + videos[i]['shortDescription'] + '</div><a href="' + this.url + 'bcpid=' + playerId + '&bclid=' + playlistId + '&bctid=' + videos[i].id + '&refer=' + this.referName + '"' + (this.TStarget? this.TStarget: '') + '><img src="' + this.dir + this.postfix + '/bc_arrow.png" alt="Pfeil" /></a><div class="bc_link' + this.postfix + '"><a href="' + this.url + 'bcpid=' + playerId + '&bclid=' + playlistId + '&bctid=' + videos[i].id + '&refer=' + this.referName + '"' + (this.TStarget? this.TStarget: '') + '>Abspielen</a></div></div></div></div>';
   
   if(i == 0) {
    code.style.height = (this.ie ? 95 : 78)+'px';
   } else {
    code.style.height = '10px';
   }
   document.getElementById(this.id + 'BCWRB_containerOne').appendChild(code);
   
   var code = document.createElement('div');
   code.className = 'bc_video' + this.postfix;
   code.innerHTML = '<a href="' + this.url + 'bcpid=' + playerId + '&bclid=' + playlistId + '&bctid=' + videos[i].id + '&refer=' + this.referName + '"' + (this.TStarget? this.TStarget: '') + '>' + image2 + '</a><div class="bc_title' + this.postfix + '">' + videos[i]['name'] + '<div class="bc_time' + this.postfix + '">' + timeString + '</div></div>';
   document.getElementById(this.id + 'BCWRB_inner').appendChild(code);
  }
  if (_playerId && _playlistId && __playerId == _playerId && __playlistId == _playlistId)
   document.getElementById(this.id + 'BC_TS_All').href = this.url + 'bcpid=' + _playerId + '&bclid=' + __playlistId + '&refer=' + this.referName;
 }
 this.show = function(pCount) {
  var children = document.getElementById(this.id + 'BCWRB_containerOne').childNodes;
  
  for(var i = 0; i < children.length; i++) {
   if(i == pCount) {
    children[i].style.height = (this.ie ? 95 : 78)+'px';
    children[i].className = 'bc_video' + this.postfix + ' bc_video_over' + this.postfix;
   } else {
    children[i].style.height = '10px';
    children[i].className = 'bc_video' + this.postfix;
   }
  }
 }
 
 this.view = function(pId) {
  if(pId == 1) {
   document.getElementById(this.id + 'BCWRB_containerOne').style.display = 'block';
   document.getElementById(this.id + 'BCWRB_containerTwo').style.display = 'none';
   document.getElementById(this.id + 'BCWRB_tab1').setAttribute('src', this.dir + this.postfix + '/tab_1_active.png');
   document.getElementById(this.id + 'BCWRB_tab2').setAttribute('src', this.dir + this.postfix + '/tab_2_inactive.png');
  } else {
   document.getElementById(this.id + 'BCWRB_containerOne').style.display = 'none';
   document.getElementById(this.id + 'BCWRB_containerTwo').style.display = 'block';
   document.getElementById(this.id + 'BCWRB_tab1').setAttribute('src', this.dir + this.postfix + '/tab_1_inactive.png');
   document.getElementById(this.id + 'BCWRB_tab2').setAttribute('src', this.dir + this.postfix + '/tab_2_active.png');
  }
 }
 
 this.slide = function(pDir) {
  if(!this.sliding) {
   el = document.getElementById(this.id + 'BCWRB_inner');
   var delta = -300;
   if (this.ie)
    delta += 2;
   if(pDir == 0) {
    if(this.page > 0) {
     this.page--;
     this.sliding = true;
     this.prepSlide(el, (this.page * delta));
    }
   } else {
    if(this.page + 1 < this.videoCount) {
     this.page++;
     this.sliding = true;
     this.prepSlide(el, (this.page * delta));
    }
   }
   
   this.arrows();
  }
 }
 
 this.arrows = function() {
  document.getElementById(this.id + 'BCWRB_arrowLeft').style.display = (this.page > 0 ? 'block' : 'none');
  document.getElementById(this.id + 'BCWRB_arrowRight').style.display = (this.page + 1 < this.videoCount ? 'block' : 'none');
 }
 
 this.getNum = function(pNum) {
  if(pNum) {
   if(pNum.indexOf('px') > -1) {
    return parseInt(pNum.substring(0, pNum.indexOf('px')));
   } else {
    return parseInt(pNum);
   }
  } else {
   return 0;
  }
 }
 this.prepSlide = function(pEl, pEnd) {
  var moveStart = this.getNum(pEl.style['left']);
  var amountToMove = pEnd - moveStart;
  var timeStart = new Date().getTime();
  var timeEnd = timeStart + 1000;
  
  this.doSlide(this.id, pEl, 'left', amountToMove, moveStart, 1000, timeEnd);
 }
 
 this.doSlide = function(id, pEl, pType, pDistance, pStart, pTimeTotal, pTimeEnd) {
  var currentTime = new Date().getTime();
  var timeRemaining = Math.max(0, pTimeEnd - currentTime);
  var currentMove = parseInt(pDistance - (Math.pow(timeRemaining, 3) / Math.pow(pTimeTotal, 3)) * pDistance);
  pEl.style[pType] = (pStart + currentMove) + 'px';
  
  if(timeRemaining > 0) {
    setTimeout(function () { bc_id[id].doSlide(id, pEl, pType, pDistance, pStart, pTimeTotal, pTimeEnd); }, 10);
  } else {   
   this.sliding = false;
  } 
 }
}




/**
 *
 * OMS Widget : Single Widget
 * Version: 2009.05.06.01.TS06
 * Bugfixes by Tony Simbine <t.simbine (at) oms.eu>
 *
**/
if (typeof now == 'undefined') var now = new Date();
if(typeof bc_experience == 'undefined') { var bc_experience = new Object(); }
if(typeof bc_player == 'undefined') { var bc_player = new Object(); }
if(typeof bc_social == 'undefined') { var bc_social = new Object(); }
if(typeof bc_content == 'undefined') { var bc_content = new Object(); }
if(typeof bc_playerOpened == 'undefined') { var bc_playerOpened = new Array(); }
var bc_firstWidget = true;
if(typeof bc_id != 'array') {
        var bc_id = new Array();
}
function onTemplateLoaded(pExperienceId) {
        bc_experience[pExperienceId] = brightcove.getExperience(pExperienceId);
        bc_player[pExperienceId] = bc_experience[pExperienceId].getModule(APIModules.VIDEO_PLAYER);
        bc_social[pExperienceId] = bc_experience[pExperienceId].getModule(APIModules.SOCIAL);
        bc_content[pExperienceId] = bc_experience[pExperienceId].getModule(APIModules.CONTENT);
}
function bc_widget_single(arg) {
        var id = bc_id.length;
        bc_id.push(new bc_make_widget_single(arg, id));
        bc_id[id].generate();
        bc_id[id].retrieve();
        bc_id[id].listen(id);
}


function createXMLHttpRequest() {
   try { return new XMLHttpRequest(); } catch(e) {}
   try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
   try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}
   return null;
}



function bc_widget_scripts() {
        var now = new Date();
        var milli = now.getTime();
        var script = document.createElement('script');
        script.type = 'text/javascript';
        script.setAttribute('charset', 'UTF-8');
        script.src = 'http://admin.brightcove.com/js/APIModules_all.js?' + milli;
        document.getElementsByTagName('head')[0].appendChild(script);
        var script1 = document.createElement('script');
        script1.type = 'text/javascript';
        script1.setAttribute('charset', 'UTF-8');
        script1.src = 'http://admin.brightcove.com/js/BrightcoveExperiences.js?' + milli;
        document.getElementsByTagName('head')[0].appendChild(script1);
}



function bc_make_widget_single(arg, id) {
        this.id = id;
        this.postfix = arg.postfix || '';
        this.token = arg.token || (this.id > 0? bc_id[0].token: 'myReadToken.');
        this.dir = arg.dir || 'bcw_single';
        this.videoId = (!arg.videoIds) ? null : arg.videoIds[0];
        this.playerId = (!arg.playerIds) ? null : arg.playerIds[0];
        this.width = arg.width || 300;
        this.height = null;
        this.viewed = false;
        this.ff = false;
        this.saf = false;
        this.ie = false;
        this.ie7 = false
        this.ie6 = false;
        this.first = (bc_firstWidget) ? true : false;
        this.referName = 'singlewidget';
        this.TSshow = (!arg.TSshow) ? true : arg.TSshow;
        this.TSurl = this.TSsytyle = this.TSurlText = null;
        if (arg.TSopt)  {
                if (arg.TSopt['target'] && arg.TSopt['target'].length > 2)      {
                        this.TStarget = ' target="' + arg.TSopt.target + '"';
                        this.TStargets = arg.TSopt.target;
                }
                if (arg.TSopt['style'] && arg.TSopt['style'].length > 1)
                        this.TSsytyle = arg.TSopt['style'];
                if (arg.TSopt['url'] && arg.TSopt['url'].length > 1)
                        this.TSurl = arg.TSopt['url'];
                if (arg.TSopt['urltext'] && arg.TSopt['urltext'].length > 1)
                        this.TSurlText = arg.TSopt['urltext'];
        }
        this.generate = function() {
                var browser = this.detect()[1];
                var version = this.detect()[2];
                if(browser == 'firefox') {
                        this.ff = true;
                } else if(browser == 'safari') {
                        this.saf = true;
                } else if(browser == 'explorer') {
                        this.ie = true;
                        if(version < 7) {
                                this.ie6 = true;
                        } else if(version < 8) {
                                this.ie7 = true;
                        }
                }
                var code = document.createElement("link");
                code.setAttribute('href', this.dir + this.postfix + '/brightcove.css');
                code.setAttribute('rel', 'stylesheet');
                code.setAttribute('type', 'text/css');
                document.getElementsByTagName('head')[0].appendChild(code);
                bc_firstWidget = false;
                if(this.ie) {
                        document.write('<style type="text/css">');
                        document.write('div.bc_widget_single' + this.postfix + ' div.bc_overlay_off' + this.postfix + ' { background: none; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + this.dir + this.postfix + '/bc_playOverlay_Off.png", sizingMethod="image"); }');
                        document.write('div.bc_widget_single' + this.postfix + ' div.bc_overlay_on' + this.postfix + ' { background: none; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + this.dir + this.postfix + '/bc_playOverlay_On.png", sizingMethod="image"); }');
                        document.write('div.bc_widget_single' + this.postfix + ' div.bc_metaOverlay' + this.postfix + ' { background: none; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + this.dir + this.postfix + '/bc_metaOverlay.png", sizingMethod="scale"); }');
                        if(this.ie6) {
                                document.write('div.bc_widget_single_overlay' + this.postfix + ' { background: #000; filter:alpha(opacity=90); position: absolute; }');
                        }
                        if (this.ie) {
                                document.write('div.bc_widget_single_overlay' + this.postfix + ' { position: absolute; top:0px; }');
                        }
                        document.write('</style>');
                }
                document.write('<div id="' + this.id + 'BCWS_widget" class="bc_widget_single' + this.postfix + '" onmouseout="bc_id[' + this.id + '].overlaySwitch(0);" onmouseover="bc_id[' + this.id + '].overlaySwitch(1);"></div>');
        }

        this.playerCheck = function() {
                brightcove.createExperiences([], this.id + 'BCWS_experience');
                // NEW Safari
                if(this.saf) {
                        if(!bc_playerOpened[this.id]) {
                                brightcove.createExperiences([], this.id + 'BCWS_experience');
                                bc_playerOpened[this.id] = true;
                        }
                }
        }
        this.retrieve = function() {
                var code = document.createElement('script');
                var now = new Date();
                var milli = now.getTime();
                code.setAttribute('src', 'http://api.brightcove.com/services/library?' + milli + '=&command=find_video_by_id&video_id=' + this.videoId + '&token=' + this.token + '&fields=name,id,shortDescription,videoStillURL,length&callback=bc_id[' + this.id + '].autoReturn');
                code.setAttribute('charset', 'UTF-8');
                code.setAttribute('type', 'text/javascript');
                document.getElementsByTagName('head')[0].appendChild(code);
        }
        this.autoReturn = function(pData) {
                if (! pData)
                        return(true);
                var pMin = Math.floor((pData.length / 1000) / 60);
                var pSec = Math.round((((pData.length / 1000) % 60) * 60) / 60);
                var now = new Date();
                var milli = now.getTime();
                if(pSec < 10) {
                        pSec = '0' + pSec;
                }
                var code = '<img src="' + pData.videoStillURL + '" class="bc_still' + this.postfix + '" onclick="bc_id[' + this.id + '].openBox();" id="' + this.id + 'BCWS_image" />';
                code += '<div id="' + this.id + 'BCWS_overlayOn" onclick="bc_id[' + this.id + '].openBox();" class="bc_overlay_on' + this.postfix + '" style="display: none;"></div>';
                code += '<div id="' + this.id + 'BCWS_overlayOff" class="bc_overlay_off' + this.postfix + '"></div>';
                code += '<div id="' + this.id + 'BCWS_metaOverlay" onclick="bc_id[' + this.id + '].openBox();" class="bc_metaOverlay' + this.postfix + '">' + pData.name + ' <span>(' + pMin + ':' + pSec + ')</span></div>';
                code += '<div id="' + this.id + 'BCWS_overlay" class="bc_widget_single_overlay' + this.postfix + '" onclick="bc_id[' + this.id + '].closeBox();" style="display:none;">';
                code += '<div id="' + this.id + 'BCWS_box" class="bc_widget_single_lightbox' + this.postfix + '" onclick="event.cancelBubble = true; return false;">';
                code += '<div class="bc_close' + this.postfix + '"><a href="#" onclick="bc_id[' + this.id + '].closeBox();return false;">Schlie&szlig;en</a></div>';
                code += '<iframe name="' + this.id + 'BCWS_experience" frameBorder="0" id="' + this.id + 'BCWS_experience" src="' + this.dir + this.postfix + '/bcw_single_blank.html" width="486" height="425"></iframe>';
                code += '<div class="bc_metaLightbox' + this.postfix + '">';
                code += '<div class="bc_title' + this.postfix + '">' + pData.name + '</div>';
                code += '<div class="bc_desc' + this.postfix + '">' + pData.shortDescription + '</div>';
                if (this.TSurl)
                code += '<div class="bc_ts_link' + this.postfix + '" style="' + (this.TSsytyle || 'text-align: right;line-height:14px;padding:0 3px;') + '"><a href="#" onclick="bc_id[' + this.id + '].closeBox();return(window.location.href=\'' + this.TSurl + '\');">' + (this.TSurlText || 'Alle Videos') + '</a></div>';
                code += '</div></div></div>';
                document.getElementById(this.id + 'BCWS_widget').innerHTML = code;
                this.setSize();
                (document.getElementById('bc_single_dummy') || document.body).appendChild(document.getElementById(this.id + 'BCWS_overlay'));
                this.tsAutoCheck();
        }
        this.setSize = function() {
                this.height = this.width * 0.75;
                document.getElementById(this.id + 'BCWS_widget').style.height = this.height + 'px';
                document.getElementById(this.id + 'BCWS_overlayOn').style.top = ((this.height / 2) - 45) + 'px';
                document.getElementById(this.id + 'BCWS_overlayOn').style.left = ((this.width / 2) - 60) + 'px';
                document.getElementById(this.id + 'BCWS_overlayOff').style.top = ((this.height / 2) - 45) + 'px';
                document.getElementById(this.id + 'BCWS_overlayOff').style.left = ((this.width / 2) - 60) + 'px';

                if(this.ie) {
                        document.getElementById(this.id + 'BCWS_widget').style.width = this.width + 'px';
                        document.getElementById(this.id + 'BCWS_image').style.width = (this.width - 5) + 'px';
                        document.getElementById(this.id + 'BCWS_image').style.height = (this.height - 6) + 'px';
                        document.getElementById(this.id + 'BCWS_metaOverlay').style.width = (this.width - 5) + 'px';
                        document.getElementById(this.id + 'BCWS_metaOverlay').style.bottom = '-1px';
                } else {
                        document.getElementById(this.id + 'BCWS_widget').style.width = (this.width - 6) + 'px';
                        document.getElementById(this.id + 'BCWS_image').style.width = (this.width - 6) + 'px';
                        document.getElementById(this.id + 'BCWS_image').style.height = this.height + 'px';
                        document.getElementById(this.id + 'BCWS_metaOverlay').style.width = (this.width - 16) + 'px';
                }
        }
        this.listen = function(pId) {
                var prevScroll = window.onscroll;
                var prevResize = window.onresize;
                window.onscroll = function() {
                        if(typeof prevScroll == 'function') {
                                prevScroll();
                        }
                        bc_id[pId].position();
                };
                window.onresize = function() {
                        if(typeof prevResize == 'function') {
                                prevResize();
                        }
                        bc_id[pId].position();
                };
        }
        this.overlaySwitch = function(pState) {
                if(pState == 1) {
                        document.getElementById(this.id + 'BCWS_overlayOn').style.display = 'block';
                        document.getElementById(this.id + 'BCWS_overlayOff').style.display = 'none';
                        document.getElementById(this.id + 'BCWS_widget').className = 'bc_widget_single' + this.postfix + ' bc_widget_single_over' + this.postfix;
                } else {
                        document.getElementById(this.id + 'BCWS_overlayOn').style.display = 'none';
                        document.getElementById(this.id + 'BCWS_overlayOff').style.display = 'block';
                        document.getElementById(this.id + 'BCWS_widget').className = 'bc_widget_single' + this.postfix;
                }
        }
        this.openBox = function() {
                var overlay = document.getElementById(this.id + 'BCWS_overlay');
                var box = document.getElementById(this.id + 'BCWS_box');
                var embed = document.getElementById(this.id + 'BCWS_experience');
                this.flashDisplay(true);
                overlay.style.display = 'block';
                box.style.display = 'block';
                embed.style.width = '486px';
                embed.style.height = '425px';
                this.position();
                var milli = now.getTime();
                window.frames[this.id + 'BCWS_experience'].location = this.dir + this.postfix + '/bcw_single_player.html?id=' + this.id + '&videoId=' + this.videoId + '&playerId=' + this.playerId + '&refer=' + this.referName + '&timestamp='+ milli + '&doply=' + (this.doply? 'true': 'false');
        }
        this.closeBox = function() {
                var overlay = document.getElementById(this.id + 'BCWS_overlay');
                var box = document.getElementById(this.id + 'BCWS_box');
                var iFrame = window.frames[this.id + 'BCWS_experience'];
                iFrame.bc_player.pause();
                iFrame.bc_player.stop();
                overlay.style.display = 'none';
                box.style.display = 'none';
                this.flashDisplay(false);
        }
        this.position = function() {
                var widget = document.getElementById(this.id + 'BCWS_widget');
                var overlay = document.getElementById(this.id + 'BCWS_overlay');
                var box = document.getElementById(this.id + 'BCWS_box');
                var embed = document.getElementById(this.id + 'BCWS_experience');
                var size = this.dimensions();
                try {
                        overlay.style.top = (size[2] - 3) + 'px';
                        overlay.style.left = (size[3] - 3) + 'px';
                        if(embed.offsetHeight > 100) {
                                box.style.top = ((size[1] / 2) - (box.offsetHeight / 2)) + 'px';
                                box.style.left = ((size[0] / 2) - (box.offsetWidth / 2)) + 'px';
                        } else {
                                box.style.top = (((size[1] / 2) - (box.offsetHeight / 2)) - 206) + 'px';
                                box.style.left = ((size[0] / 2) - (box.offsetWidth / 2)) + 'px';
                        }
                        if(this.ie) {
                                overlay.style.width = (size[0] + 13) + 'px';
                                overlay.style.height = (size[1] + 18) + 'px';
                        } else {
                                overlay.style.width = size[0] + 'px';
                                overlay.style.height = size[1] + 'px';
                        }
                } catch(e) {
                        // Elements not yet available
                }
        }
        this.flashDisplay = function(pOff) {
                var setState = 'visible';
                var tsActiveObject = this.id + 'BCWS_experience';
                var tsObject = document.getElementsByTagName('object');
                if(pOff) {
                        setState = 'hidden';
                }
                if(tsObject != null) {
                        var apNum = tsObject.length;
                        for(var i = 0; i < apNum; i++) {
                                tsObject[i].style.visibility = setState;
                        }
                        if(tsActiveObject.length > 0 && pOff) {
                                document.getElementById(tsActiveObject).style.visibility = 'visible';
                        }
                }
        }
        this.dimensions = function() {
                var BC_WINDOW_W = 0, BC_WINDOW_H = 0, BC_SCROLL_H = 0, BC_SCROLL_W = 0;
                if (typeof(window.innerWidth) == 'number') {
                        BC_WINDOW_W = window.innerWidth;
                        BC_WINDOW_H = window.innerHeight;
                        BC_SCROLL_H = window.pageYOffset;
                        BC_SCROLL_W = window.pageXOffset;
                } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
                        BC_WINDOW_W = document.documentElement.clientWidth;
                        BC_WINDOW_H = document.documentElement.clientHeight;
                        BC_SCROLL_H = document.documentElement.scrollTop;
                        BC_SCROLL_W = document.documentElement.scrollLeft;
                } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
                        BC_WINDOW_W = document.body.clientWidth;
                        BC_WINDOW_H = document.body.clientHeight;
                        BC_SCROLL_H = document.body.scrollTop;
                        BC_SCROLL_W = document.body.scrollLeft;
                }
                return [ BC_WINDOW_W, BC_WINDOW_H, BC_SCROLL_H, BC_SCROLL_W ];
        }
        this.detect = function() {
                var t;
                var b = new Array(
                        {string: navigator.userAgent, subString: "Chrome", identity: "Chrome"},
                        {string: navigator.userAgent, subString: "OmniWeb", versionSearch: "OmniWeb/", identity: "OmniWeb"},
                        {string: navigator.vendor, subString: "Apple", identity: "Safari", versionSearch: "version"},
                        {prop: window.opera, identity: "Opera"},
                        {string: navigator.vendor, subString: "iCab", identity: "iCab"},
                        {string: navigator.vendor, subString: "KDE", identity: "Konqueror"},
                        {string: navigator.userAgent, subString: "Firefox", identity: "Firefox"},
                        {string: navigator.vendor, subString: "Camino", identity: "Camino"},
                        {string: navigator.userAgent, subString: "Netscape", identity: "Netscape"},
                        {string: navigator.userAgent, subString: "MSIE", identity: "Explorer", versionSearch: "MSIE"},
                        {string: navigator.userAgent, subString: "Gecko", identity: "Mozilla", versionSearch: "rv"},
                        {string: navigator.userAgent, subString: "Mozilla", identity: "Netscape", versionSearch: "Mozilla"}
                );
                var o = new Array(
                        {string: navigator.platform, subString: "Win", identity: "windows"},
                        {string: navigator.platform, subString: "Mac", identity: "mac"},
                        {string: navigator.platform, subString: "Linux", identity: "linux"}
                );
                var g = function(d) {
                        for(var i = 0; i < d.length; i++) {
                                var s = d[i].string;
                                var p = d[i].prop;
                                t = d[i].versionSearch || d[i].identity;
                                if(s) {
                                        if(s.indexOf(d[i].subString) != -1) {
                                                return d[i].identity;
                                        }
                                } else if(p) {
                                        return d[i].identity;
                                }
                        }
                };
                var h = function(s, t) {
                        var i = s.indexOf(t);
                        if(i == -1) {
                                return;
                        }
                        return parseFloat(s.substring(i + t.length + 1));
                };
                browser = g(b) || "unknown";
                version = h(navigator.userAgent, t) || h(navigator.appVersion, t) || "unknown";
                browser = browser.toLowerCase();
                os = g(o) || "unknown";
                return new Array(os, browser, version);
        }
        this.tsAutoCheck = function() {
                var query = window.location.search.substring(1);
                this.doply = false;
                if (query.indexOf('doply=true') > -1)   {
                        this.doply = true;
                        this.openBox();
                }
        }
}