var videoDirectory = "http://www.cricketeurope4.net/CRICKETEUROPE/DATABASE/VIDEOZONE/";
var audioDirectory = "http://www.cricketeurope4.net/CRICKETEUROPE/DATABASE/AUDIOZONE/";

// WMF Movie Display **********************************

var playerWindow;

var styleRules = "<style>";
styleRules += ".mediaAnnotationBox{margin:10px;padding:5px;background-color:#FFFFFF;font-size:10px;font-weight:bold;color:#000000;text-align:center;}";
styleRules += ".mediaLinkBox{margin-left:75px;margin-right:75px;padding:2px;background-color:#FFCC00;font-size:10px;font-weight:bold;color:#000000;text-align:center;}";
styleRules += ".mediaLinkBox:hover{background-color:#FFFFFF;color:#000000;}";
styleRules += ".mediaLink {color: #000000; font-weight:bold; text-decoration:none;}";
styleRules += "</style>";



function OpenVideoPlayer(videoURL, width, height, videoDescription, countryID, country) {

  if ((playerWindow) && (!playerWindow.closed)) {
   playerWindow.close();
  }

windowHeight = height + 176;

attString = "width=" + width + ",height=" + windowHeight + ",top=50,left=0,resizable=0,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0,personalbar=0"
playerWindow = window.open('','VideoPlayer',attString);
playerWindow.focus(); 

var html = "<html><head><title>CricketEurope videoZone</title>";
html += styleRules + "</head>";
html += "<body bgcolor='#005432' topmargin='0' leftmargin='0' marginwidth='0' marginheight='0'>";
html += "<table width='320' cellpadding='0' cellspacing='0' border = '0' bgcolor='#005432'>";
html += "<tr><td align='center'>";
html += "<img src='http://www.cricketeurope4.net/MEDIA/CRICKETEUROPE/MEDIAZONES/videoZonegreen.gif' width='320' height='81' border='0'>";
html += "</td></tr>";

html += "<tr><td align='center'>";
html += "<object width='" + width + "' height='" + height + "' type='video/x-ms-wmv' data='" + videoURL + "\'>";
html += "<param name='src' value='" +  videoURL + "'>";
html += "<param name='autoStart' value='true'>";
html += "<embed type='video/x-ms-wmv' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/' src='" +  videoURL + "' width='" + width + "' height='" + height + "' showdisplay='false' autostart='true' showstatusbar='true'>";
html += "</object>";
html += "</td></tr>";

html += "<tr><td align='center' valign = 'middle' height = '60'><div>";
html += "<div class = 'mediaAnnotationBox'>" + videoDescription + "</div>";
html += "</td></tr>";

hrefURL        = videoDirectory + countryID + ".shtml";
clickHandler   = "opener.location.href = \"" + videoDirectory + countryID + ".shtml\"; window.close()";

html += "<tr><td align='center' valign = 'middle' height = '30'><div>";
html += "<div class = 'mediaLinkBox'>" + "<a class = 'mediaLink' href = '" + hrefURL + "' onClick = '" + clickHandler + "'>" + "View more " + country + " videos" + "</a></div>";

html += "</td></tr></table>";
html += "</body></html>";

playerWindow.document.write(html);
playerWindow.document.close();
}

function LoadVideoPlayer(videoURL, width, height, videoDescription) {

var html = "";
html += "<table width='320' cellpadding='0' cellspacing='0' border = '0' bgcolor='#005432'>";
html += "<tr><td align='center'>";
html += "<img src='http://www.cricketeurope4.net/MEDIA/CRICKETEUROPE/MEDIAZONES/videoZonegreen.gif' width='320' height='81' border='0'>";
html += "</td></tr>";

html += "<tr><td align='center'>";
html += "<object width='" + width + "' height='" + height + "' type='video/x-ms-wmv' data='" + videoURL + "\'>";
html += "<param name='src' value='" +  videoURL + "'>";
html += "<param name='autoStart' value='true'>";
html += "<embed type='video/x-ms-wmv' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/' src='" +  videoURL + "' width='" + width + "' height='" + height + "' showdisplay='false' autostart='true' showstatusbar='true'>";
html += "</object>";
html += "</td></tr>";

html += "<tr><td align='center' valign = 'middle' height = '60'><div>";
html += "<div class = 'mediaAnnotationBox'>" + videoDescription + "</div>";
html += "</td></tr></table>";

document.getElementById("mediaPlayer").innerHTML = html;
}

// Yahoo video display **********************************

function OpenYahooPlayer(yahooURL, videoDescription, width, height, id, vid, turl1, turl2, countryID, country) {

  if ((playerWindow) && (!playerWindow.closed)) {
   playerWindow.close();
  }
    
  windowHeight = height + 176;
  
  attString = "width=" + width + ",height=" + windowHeight + ",top=50,left=0,resizable=0,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0,personalbar=0"
  playerWindow = window.open('','YahooPlayer',attString);
  playerWindow.focus(); 
  
  var html = "<html><head><title>CricketEurope videoZone</title>";
  html += styleRules + "</head>";
  html += "<body bgcolor='#005432' topmargin='0' leftmargin='0' marginwidth='0' marginheight='0'>";
  html += "<table width='320' cellpadding='0' cellspacing='0' border = '0' bgcolor='#005432'>";
  html += "<tr><td align='center'>";
  html += "<img src='http://www.cricketeurope4.net/MEDIA/CRICKETEUROPE/MEDIAZONES/videoZonegreen.gif' width='320' height='81' border='0'>";
  html += "</td></tr>";
  
  html += "<tr><td align='center'>";
  html += "<object width='" + width + "' height='" + height + "'>";
  html += "<param name='movie' value='" + yahooURL + "' />";
  html += "<param name='allowFullScreen' value='false' />";
  html += "<param name='AllowScriptAccess' VALUE='always' />";
  html += "<param name='bgcolor' value='#000000' />";
  html += "<param name='flashVars' value='id=" + id + "&vid=" + vid + "&lang=en-us&intl=us&thumbUrl=http%3A//l.yimg.com/a/p/i/bcst/videosearch/" + turl1 + "/" + turl2 + ".jpeg&embed=1' />";
  html += "<embed src='" + yahooURL + "' type='application/x-shockwave-flash' width='" + width + "' height='" + height + "' allowFullScreen='false' AllowScriptAccess='always' bgcolor='#000000' flashVars='id=" + id + "&vid=" + vid + "&lang=en-us&intl=us&thumbUrl=http%3A//l.yimg.com/a/p/i/bcst/videosearch/" + turl1 + "/" + turl2 + ".jpeg&embed=1' />";
  html += "</embed>";
  html += "</object>";
  html += "</td></tr>";

  html += "<tr><td align='center' valign = 'middle' height = '60'><div>";
  html += "<div class = 'mediaAnnotationBox'>" + videoDescription + "</div>";
  html += "</td></tr>";

  hrefURL        = videoDirectory + countryID + ".shtml";
  clickHandler   = "opener.location.href = \"" + videoDirectory + countryID + ".shtml\"; window.close()";

  html += "<tr><td align='center' valign = 'middle' height = '30'><div>";
  html += "<div class = 'mediaLinkBox'>" + "<a class = 'mediaLink' href = '" + hrefURL + "' onClick = '" + clickHandler + "'>" + "View more " + country + " videos" + "</a></div>";

  html += "</td></tr></table>";
  html += "</body></html>";

  playerWindow.document.write(html);
  playerWindow.document.close();
}


function LoadYahooPlayer(yahooURL, videoDescription, width, height, id, vid, turl1, turl2) {

  var html = "";
  html += "<table width='320' cellpadding='0' cellspacing='0' border = '0' bgcolor='#005432'>";
  html += "<tr><td align='center'>";
  html += "<img src='http://www.cricketeurope4.net/MEDIA/CRICKETEUROPE/MEDIAZONES/videoZonegreen.gif' width='320' height='81' border='0'>";
  html += "</td></tr>";

  html += "<tr><td align='center'>";
  html += "<object width='" + width + "' height='" + height + "'>";
  html += "<param name='movie' value='" + yahooURL + "' />";
  html += "<param name='allowFullScreen' value='false' />";
  html += "<param name='AllowScriptAccess' VALUE='always' />";
  html += "<param name='bgcolor' value='#000000' />";
  html += "<param name='flashVars' value='id=" + id + "&vid=" + vid + "&lang=en-us&intl=us&thumbUrl=http%3A//l.yimg.com/a/p/i/bcst/videosearch/" + turl1 + "/" + turl2 + ".jpeg&embed=1' />";
  html += "<embed src='" + yahooURL + "' type='application/x-shockwave-flash' width='" + width + "' height='" + height + "' allowFullScreen='false' AllowScriptAccess='always' bgcolor='#000000' flashVars='id=" + id + "&vid=" + vid + "&lang=en-us&intl=us&thumbUrl=http%3A//l.yimg.com/a/p/i/bcst/videosearch/" + turl1 + "/" + turl2 + ".jpeg&embed=1' />";
  html += "</embed>";
  html += "</object>";
  html += "</td></tr>";

  html += "<tr><td align='center' valign = 'middle' height = '60'><div>";
  html += "<div class = 'mediaAnnotationBox'>" + videoDescription + "</div>";
  html += "</td></tr></table>";

  document.getElementById("mediaPlayer").innerHTML = html;
}

// YouTube video display **********************************


function OpenYoutubePlayer(youtubeURL, videoDescription, width, height, countryID, country) {
  if ((playerWindow) && (!playerWindow.closed)) {
   playerWindow.close();
  }
    
  windowHeight = height + 176;
  
  attString = "width=" + width + ",height=" + windowHeight + ",top=50,left=0,resizable=0,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0,personalbar=0"
  playerWindow = window.open('','YouTubePlayer',attString);
  playerWindow.focus(); 
  
  var html = "<html><head><title>CricketEurope videoZone</title>";
  html += styleRules + "</head>";
  html += "<body bgcolor='#005432' topmargin='0' leftmargin='0' marginwidth='0' marginheight='0'>";
  html += "<table width='320' cellpadding='0' cellspacing='0' border = '0' bgcolor='#005432'>";
  html += "<tr><td align='center'>";
  html += "<img src='http://www.cricketeurope4.net/MEDIA/CRICKETEUROPE/MEDIAZONES/videoZonegreen.gif' width='320' height='81' border='0'>";
  html += "</td></tr>";
  
  html += "<tr><td align='center'>";
  html += "<object width='" + width + "' height='" + height + "'>";
  html += "<param name='movie' value='" + youtubeURL + "' />";
  html += "<param name='allowFullScreen' value='true' />";
  html += "<param name='AllowScriptAccess' VALUE='always' />";
  html += "<embed src='" + youtubeURL + "' type='application/x-shockwave-flash' width='" + width + "' height='" + height + "' allowFullScreen='false' AllowScriptAccess='always' />";
  html += "</embed>";
  html += "</object>";
  html += "</td></tr>";

  html += "<tr><td align='center' valign = 'middle' height = '60'><div>";
  html += "<div class = 'mediaAnnotationBox'>" + videoDescription + "</div>";
  html += "</td></tr>";

  hrefURL        = videoDirectory + countryID + ".shtml";
  clickHandler   = "opener.location.href = \"" + videoDirectory + countryID + ".shtml\"; window.close()";

  html += "<tr><td align='center' valign = 'middle' height = '30'><div>";
  html += "<div class = 'mediaLinkBox'>" + "<a class = 'mediaLink' href = '" + hrefURL + "' onClick = '" + clickHandler + "'>" + "View more " + country + " videos" + "</a></div>";

  html += "</td></tr></table>";
  html += "</body></html>";

  playerWindow.document.write(html);
  playerWindow.document.close();
}

function LoadYoutubePlayer(youtubeURL, videoDescription, width, height) {
  var html = "";
  html += "<table width='320' cellpadding='0' cellspacing='0' border = '0' bgcolor='#005432'>";
  html += "<tr><td align='center'>";
  html += "<img src='http://www.cricketeurope4.net/MEDIA/CRICKETEUROPE/MEDIAZONES/videoZonegreen.gif' width='320' height='81' border='0'>";
  html += "</td></tr>";
  
  html += "<tr><td align='center'>";
  html += "<object width='" + width + "' height='" + height + "'>";
  html += "<param name='movie' value='" + youtubeURL + "' />";
  html += "<param name='allowFullScreen' value='true' />";
  html += "<param name='AllowScriptAccess' VALUE='always' />";
  html += "<embed src='" + youtubeURL + "' type='application/x-shockwave-flash' width='" + width + "' height='" + height + "' allowFullScreen='false' AllowScriptAccess='always' />";
  html += "</embed>";
  html += "</object>";
  html += "</td></tr>";

  html += "<tr><td align='center' valign = 'middle' height = '60'><div>";
  html += "<div class = 'mediaAnnotationBox'>" + videoDescription + "</div>";
  html += "</td></tr></table>";
  html += "</body></html>";

  document.getElementById("mediaPlayer").innerHTML = html;
}


// MyPhotoAlbum video display **********************************

function OpenMPAPlayer(mpaURL, videoDescription, width, height, turl1, turl2, countryID, country) {

  if ((playerWindow) && (!playerWindow.closed)) {
   playerWindow.close();
  }
    
  windowHeight = height + 176;
  
  attString = "width=" + width + ",height=" + windowHeight + ",top=50,left=0,resizable=0,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0,personalbar=0"
  playerWindow = window.open('','MPAPlayer',attString);
  playerWindow.focus(); 
  
  var html = "<html><head><title>CricketEurope videoZone</title>";
  html += styleRules + "</head>";
  html += "<body bgcolor='#005432' topmargin='0' leftmargin='0' marginwidth='0' marginheight='0'>";
  html += "<table width='320' cellpadding='0' cellspacing='0' border = '0' bgcolor='#005432'>";
  html += "<tr><td align='center'>";
  html += "<img src='http://www.cricketeurope4.net/MEDIA/CRICKETEUROPE/MEDIAZONES/videoZonegreen.gif' width='320' height='81' border='0'>";
  html += "</td></tr>";
  
  html += "<tr><td align='center'>";
  html += "<object width='" + width + "' height='" + height + "'>";
  html += "<param value='" + mpaURL + "' />";
  html += "<param name='allowfullscreen' value='true'>";
  html += "<param name='flashVars' value='" + "config=http://cricketeurope.myphotoalbum.com/inc/share/flashvideoxml.php?flvFile=http://rawimages.myphotoalbum.com/c/cr/cri/cric/crick/cricketeurope/albums" + turl1 + "/" + turl2 + "' />";
  html += "<embed src='" + mpaURL + "' type='application/x-shockwave-flash' width='" + width + "' height='" + height + "' allowFullScreen='true' AllowScriptAccess='always' bgcolor='#000000' flashVars='config=http://cricketeurope.myphotoalbum.com/inc/share/flashvideoxml.php?flvFile=http://rawimages.myphotoalbum.com/c/cr/cri/cric/crick/cricketeurope/albums/" + turl1 + "/" + turl2 + "' />";
  html += "</embed>";
  html += "</object>";
  html += "</td></tr>";

  html += "<tr><td align='center' valign = 'middle' height = '60'><div>";
  html += "<div class = 'mediaAnnotationBox'>" + videoDescription + "</div>";
  html += "</td></tr>";

  hrefURL        = videoDirectory + countryID + ".shtml";
  clickHandler   = "opener.location.href = \"" + videoDirectory + countryID + ".shtml\"; window.close()";
  
  html += "<tr><td align='center' valign = 'middle' height = '30'><div>";
  html += "<div class = 'mediaLinkBox'>" + "<a class = 'mediaLink' href = '" + hrefURL + "' onClick = '" + clickHandler + "'>" + "View more " + country + " videos" + "</a></div>";

  html += "</td></tr></table>";
  html += "</body></html>";

  playerWindow.document.write(html);
  playerWindow.document.close();
}

function LoadMPAPlayer(mpaURL, videoDescription, width, height, turl1, turl2, countryID) {
  var html = "";
  html += "<table width='320' cellpadding='0' cellspacing='0' border = '0' bgcolor='#005432'>";
  html += "<tr><td align='center'>";
  html += "<img src='http://www.cricketeurope4.net/MEDIA/CRICKETEUROPE/MEDIAZONES/videoZonegreen.gif' width='320' height='81' border='0'>";
  html += "</td></tr>";
  
  html += "<tr><td align='center'>";
  html += "<object width='" + width + "' height='" + height + "'>";
  html += "<param value='" + mpaURL + "' />";
  html += "<param name='allowfullscreen' value='true'>";
  html += "<param name='flashVars' value='" + "config=http://cricketeurope.myphotoalbum.com/inc/share/flashvideoxml.php?flvFile=http://rawimages.myphotoalbum.com/c/cr/cri/cric/crick/cricketeurope/albums" + turl1 + "/" + turl2 + "' />";
  html += "<embed src='" + mpaURL + "' type='application/x-shockwave-flash' width='" + width + "' height='" + height + "' allowFullScreen='true' AllowScriptAccess='always' bgcolor='#000000' flashVars='config=http://cricketeurope.myphotoalbum.com/inc/share/flashvideoxml.php?flvFile=http://rawimages.myphotoalbum.com/c/cr/cri/cric/crick/cricketeurope/albums/" + turl1 + "/" + turl2 + "' />";
  html += "</embed>";
  html += "</object>";
  html += "</td></tr>";

  html += "<tr><td align='center' valign = 'middle' height = '60'><div>";
  html += "<div class = 'mediaAnnotationBox'>" + videoDescription + "</div>";
  html += "</td></tr></table>";
  html += "</body></html>";

  document.getElementById("mediaPlayer").innerHTML = html;
}


// Audio Display **********************************


function OpenAudioPlayer(audioURL, audioDescription, countryID, country) {

  if ((playerWindow) && (!playerWindow.closed)) {
   playerWindow.close();
  }

  playerWindow =   window.open('','CricketEurope audioZone','width=340,height=236,top=50,left=0,resizable=0,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0,personalbar=0');
  playerWindow.focus(); 

  var html = "<html><head><title>CricketEurope videoZone</title>";
  html += styleRules + "</head>";
  html += "<body bgcolor='#005432' topmargin='0' leftmargin='0' marginwidth='0' marginheight='0'>";
  html += "<table width='340' cellpadding='0' cellspacing='0' border = '0' bgcolor='#005432'>";
  html += "<tr><td align='center'>";
  html += "<img src='http://www.cricketeurope4.net/MEDIA/CRICKETEUROPE/MEDIAZONES/audioZonegreen.gif' width='320' height='81' border='0'>";
  html += "</td></tr>";

  html += "<tr><td align='center'>";
  html += "<object width='320' height='45' type='application/x-oleobject' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,902' classid='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95' standby='Loading Windows Media Player components...' id='MediaPlayer1'>";
  html += "<param name='FileName' value='" +  audioURL + "'>";
  html += "<param name='animationatStart' value='true'>";
  html += "<param name='transparentatStart' value='true'>";
  html += "<param name='autoStart' value='true'>";
  html += "<param name='ShowDisplay' value='false'>";
  html += "<param name='showControls' value='true'>";
  html += "<embed type='application/x-mplayer2' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/' src='" +  audioURL + "' width='320' height='40' showdisplay='false' autostart='true' showstatusbar='true'>";
  html += "</object>";
  html += "</td></tr>";

  html += "<tr><td align='center' valign = 'middle' height = '60'><div>";
  html += "<div class = 'mediaAnnotationBox'>" + audioDescription + "</div>";
  html += "</td></tr>";

  hrefURL        = audioDirectory + countryID + ".shtml";
  clickHandler   = "opener.location.href = \"" + audioDirectory + countryID + ".shtml\"; window.close()";

  html += "<tr><td align='center' valign = 'middle' height = '40'><div>";
  html += "<div class = 'mediaLinkBox'>" + "<a class = 'mediaLink' href = '" + hrefURL + "' onClick = '" + clickHandler + "'>" + "Listen to more " + country + " audio clips" + "</a></div>";


  html += "</td></tr></table>";
  html += "</body></html>";

  playerWindow.document.write(html);
  playerWindow.document.close();
}

function LoadAudioPlayer(audioURL, audioDescription) {

  var html = "";
  html += "<table width='320' cellpadding='0' cellspacing='0' border = '0' bgcolor='#005432' style = 'border: 1px solid #005432'>";
  html += "<tr><td align='center'>";
  html += "<img src='http://www.cricketeurope4.net/MEDIA/CRICKETEUROPE/MEDIAZONES/audioZonegreen.gif' width='320' height='81' border='0'>";
  html += "</td></tr>";

  html += "<tr><td align='center'>";
  html += "<object width='320' height='45' type='application/x-oleobject' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,902' classid='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95' standby='Loading Windows Media Player components...' id='MediaPlayer1'>";
  html += "<param name='FileName' value='" +  audioURL + "'>";
  html += "<param name='animationatStart' value='true'>";
  html += "<param name='transparentatStart' value='true'>";
  html += "<param name='autoStart' value='true'>";
  html += "<param name='ShowDisplay' value='false'>";
  html += "<param name='showControls' value='true'>";
  html += "<embed type='application/x-mplayer2' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/' src='" +  audioURL + "' width='320' height='40' showdisplay='false' autostart='true' showstatusbar='true'>";
  html += "</object>";
  html += "</td></tr>";

  html += "<tr><td align='center' valign = 'middle' height = '60'><div>";
  html += "<div class = 'mediaAnnotationBox'>" + audioDescription + "</div>";
  html += "</td></tr></table>";

  document.getElementById("mediaPlayer").innerHTML = html;
}

// Slideshow display **********************************

var SS_speed = 6000; //milliseconds
var SS_photoInfo = new Array;
var SS_photoDirectory;
var SS_next = 0;

function showNextSlide() {
  SS_next = SS_next + 1;
  if (SS_next == SS_photoInfo.length) SS_next = 0;
  imageHTML = "<img src='" + SS_photoDirectory + SS_photoInfo[SS_next][0] + ".jpg'" + " border = '0'>";
  document.getElementById("SS_imageArea").innerHTML = imageHTML;
  document.getElementById("SS_imageCaption").innerHTML = SS_photoInfo[SS_next][1];
  setTimeout('showNextSlide()', SS_speed);
}

function runSlideShow(slideshowTitle) {
  var preLoad = new Array();
  for (i = 0; i < SS_photoInfo.length; i++) {
    preLoad[i] = new Image();
    preLoad[i].src = SS_photoDirectory + SS_photoInfo[i][0] + ".jpg";
  }
  document.write ('<div class = "columnheader">' + slideshowTitle + '</div>');
  document.write ('<div id = "SS_imageArea" class = "sidebarframe" style = "padding:0px;">');
  document.write ('<img src="' + SS_photoDirectory + SS_photoInfo[0][0] + '.jpg" border = "0" />');
  document.write ('</div>');
  document.write ('<div id = "SS_imageCaption" class = "sidebarfooter">' + SS_photoInfo[0][1] + '</div>');
  setTimeout('showNextSlide()', SS_speed);
}

