// JavaScript Document
function launchvodcast(playlistPath, startIndex, relatedFolder){
  var section;
  if(typeof startIndex =='undefined' || isNaN(startIndex) == 'true' || startIndex == '' || startIndex <= 1) startIndex = 1;
  if (playlistPath.split('/')[4].toLowerCase() == 'media' && playlistPath.split('/')[5].toLowerCase() == 'popup') {
    launchMediaPopup(playlistPath, '2');
  } else {
    section = playlistPath.split('/')[3];
    if (typeof relatedFolder !='undefined') {
        section = relatedFolder;
    } else if (isNaN(startIndex) == 'true') {
        section = startIndex;
    }
    launchMediaPopup('http://fun.omy.sg/common/media/popup/?type=video&section=' + section + '&playlistPath=' + encodeURIComponent(playlistPath) + '&startIndex=' + startIndex, '1');
  }
}
 
function launchpodcast(playlistPath, startIndex, relatedFolder){
  var section;
  if(typeof startIndex =='undefined' || isNaN(startIndex) == 'true' || startIndex == '' || startIndex <= 1) startIndex = 1;
  if (playlistPath.split('/')[4].toLowerCase() == 'media' && playlistPath.split('/')[5].toLowerCase() == 'popup') {
    launchMediaPopup(playlistPath, '2');
  } else {
    section = playlistPath.split('/')[3];
    if (typeof relatedFolder !='undefined') {
        section = relatedFolder;
    } else if (isNaN(startIndex) == 'true') {
        section = startIndex;
    }    
    launchMediaPopup('http://fun.omy.sg/common/media/popup/?type=audio&section=' + section + '&playlistPath=' + encodeURIComponent(playlistPath) + '&startIndex=' + startIndex, '1');
  }
}

function launchgallery(playlistPath, startIndex, relatedFolder){
  var section;
  if(typeof startIndex =='undefined' || isNaN(startIndex) == 'true' || startIndex == '' || startIndex <= 1) startIndex = 1;
  if (playlistPath.split('/')[4].toLowerCase() == 'media' && playlistPath.split('/')[5].toLowerCase() == 'popup') {
    launchMediaPopup(playlistPath, '2');
  } else {
    section = playlistPath.split('/')[3];
    if (typeof relatedFolder !='undefined') {
        section = relatedFolder;
    } else if (isNaN(startIndex) == 'true') {
        section = startIndex;
    }    
    launchMediaPopup('http://fun.omy.sg/common/media/popup/?type=image&section=' + section + '&playlistPath=' + encodeURIComponent(playlistPath) + '&startIndex=' + startIndex, '1');
  }
}

function launchMediaPopup(URL, type) {
  var id = 'omy_media_popup';
  if (type == '2') {
      eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=1080,height=775,left = 135,top = 92.5');");
  } else {
      eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=1080,height=775,left = 135,top = 92.5');");
  }
}

