// globle valuables I know it is dauagues however I need to feed two functions the same data please choose either Viemo or YouTube as your video provider to stop this

var intPageIndexTotal = 4;//holds the total number of videos for page
var intVimeoPageTotal = 1;//holds the Start of Where Vimeo Starts its Video Displays pages
var intPageTotal = 1;//holds the total pages
var intPageIndex = 1;//Counts the total number of videos for page
var htmlDetailVideos = ['<div class="divDetailVideos">'];
  
function detailVideoBody(intIndex,entries,boolYouTube,strVideoExtraID)
{
	var title = "";
	var thumbnailUrl = "";
	var strDuration = "";
	var strOddVideoClass = "divVideoThumb";
	var strVideoTitle = "";//holds the videos title
	var strVideoDesc = "";//holds the videos description
	var strVideoURL = "";//holds the videos URL
	var strClass = "";//holds the class for each site
	var strLinkAction = "";//holds the link onClick action
	
	//checks if the video comse from YouTube or Vimzeo
	if(boolYouTube == true)
	{
		strVideoTitle = entries[intIndex].media$group.media$title.$t;
		title = entries[intIndex].title.$t.substr(0, 20)
		strVideoDesc = entries[intIndex].media$group.media$description.$t;
		strVideoURL = entries[intIndex].media$group.media$content[0].url;
		thumbnailUrl = entries[intIndex].media$group.media$thumbnail[0].url;
		strDuration = Math.floor(entries[intIndex].media$group.yt$duration.seconds / 60) + ":" + (entries[intIndex].media$group.yt$duration.seconds % 60).toFixed().pad(2, "0");
		strLinkAction = 'display_youtube(\'' + strVideoURL + '\',\'' + strVideoTitle.replace(/\'/g, '&rsquo;').replace(/"/g, '&quot;') + '\',\'' + strVideoDesc.replace(/\'/g, '&rsquo;').replace(/"/g, '&quot;').replace(/\r\n/g, '<br/>').replace(/\r/g, ' ').replace(/\n/g, '<br/>') + '\');';
		strClass = " divYouTube";
	}//end of if
	else
	{
		strVideoTitle = entries[intIndex].title;
		title = entries[intIndex].title.substr(0, 20)
		strVideoDesc = entries[intIndex].description;
		strVideoURL = entries[intIndex].url;
		thumbnailUrl = entries[intIndex].thumbnail_small;
		strDuration = Math.floor(entries[intIndex].duration / 60) + ":" + (entries[intIndex].duration % 60).toFixed().pad(2, "0");
		strLinkAction = 'getViemoVideo(\'' + strVideoURL + '\', \'http://vimeo.com/api/oembed.json\', \'switchViemoVideo\',\'' +  strVideoTitle.replace(/\'/g, '&rsquo;').replace(/"/g, '&quot;') + '\',\'' + strVideoDesc.replace(/\'/g, '&rsquo;').replace(/"/g, '&quot;').replace(/\r\n/g, '<br/>').replace(/\r/g, ' ').replace(/\n/g, '<br/>') + '\');'
		strClass = " divViemo";
	}//end of else
	 
  //checks if intPageIndex is greater then intPageIndexTotal and if so then resets intPageIndex and closes the current div with class divPage
  if(intPageIndex > intPageIndexTotal)
  {
	  intPageIndex = 1;
	  intPageTotal++;
	  
	  //checks if there is an odd number and not the first number in order to added in a clear for the two videos
	  //in order not to have the videoes line up
	  if((intIndex%2) && intIndex > 0)
		  htmlDetailVideos.push('<div class="customFooter"></div>');

	  htmlDetailVideos.push('</div><div class="divPage' + strClass + '" id="divPageID' + intPageTotal + '">');
  }//end of if
  
  //checks if it is a video that will on the outside of the page
  if((intIndex%2) && intIndex > 0)
	  strOddVideoClass = "divVideoOddThumb";

  //checks if intIndex is the first item and if so adds the first block it to
  if(intIndex == 0 && intPageIndex == 1)
	  htmlDetailVideos.push('<div class="divPage' + strClass + '" id="divPageID' + intPageTotal + '">');

	htmlDetailVideos.push('<div class="customContent ' + strOddVideoClass + '"> ' + 																																																																																																						'<div class="divBlackVideoThumb" id="divVideoThumb' + strVideoExtraID + intIndex + '"' + 																																																																																																						'onmouseout="if(getDocID(\'objDetailYouTube\').className != getDocID(\'divVideoThumb' + strVideoExtraID + intIndex + '\').id) ' + 																																																																																																						'changeDivImage(\'divVideoThumb' + strVideoExtraID + intIndex + '\',\'url(/CSS/images/videothumbblack.png)\');"  ' + 																																																																																																						'onmouseover="if(getDocID(\'objDetailYouTube\').className != getDocID(\'divVideoThumb' + strVideoExtraID + intIndex + '\').id) ' + 																																																																																																						'changeDivImage(\'divVideoThumb' + strVideoExtraID + intIndex + '\',\'url(/CSS/images/videothumbred.png)\');"> ' + 																																																																																									'<div class="divVideoThumbPicDetails"> ' + 																																																																																																						'<a href="javascript:void(0);" onclick="javascript:' + strLinkAction + '  ' + 																																																																																																						'classToggleLayerDivImg(getDocID(\'video\'),getDocID(\'divVideoThumb' + strVideoExtraID + intIndex + '\'),\'divBlackVideoThumb\',\'div\',\'url(/CSS/images/videothumbred.png)\',\'url(/CSS/images/videothumbblack.png)\'); ' + 																																																																																																						'changeClass(\'objDetailYouTube\',\'divVideoThumb' + strVideoExtraID + intIndex + '\'); ' + 																																																																																																						'getDocID(\'ifFBDetail\').src = \'http://www.facebook.com/plugins/like.php?href=' + encodeURL(strVideoURL) +'&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=35\'; ' + 																																																																																																						'getDocID(\'spanShare\').setAttribute(\'st_url\',\'' + encodeURL(strVideoURL) + '\'); ' + 																																																																																																						'getDocID(\'spanShare\').setAttribute(\'st_title\',\'', strVideoTitle.replace(/\'/g, '&rsquo;').replace(/"/g, '&quot;'), '\');"> ' + 																																																																																																						'<img width="132" src="', thumbnailUrl, '" alt="', strVideoTitle.replace(/\'/g, '&rsquo;').replace(/"/g, '&quot;'), '" /></a> ' + 																																																																																																						'<div class="textgrey videothumbtext">', strDuration, '</div> ' + 																																																																																																						'</div> ' + 																																																																																																						'</div> ' + 																																																																																																						'<label class="textgrey lblVideoTitle">', strVideoTitle, '</label> ' + 																																																																																																						'</div>');

  //checks if there is an odd number and not the first number in order to added in a clear for the two videos
  //in order not to have the videoes line up
  if(intIndex%2 && intIndex > 0)
	  htmlDetailVideos.push('<div class="customFooter"></div>');
  
  intPageIndex++;
}//end of detailVideoBody()

function loadVideo(playerUrl, autoplay) {
	var params = { allowScriptAccess: "always", allowfullscreen: 'true' };
	var atts = { id: "objYouTube" };
  swfobject.embedSWF(
      playerUrl + '&rel=1&border=0&fs=&enablejsapi=1&playerapiid=ytplayer&' + (autoplay?1:0), 'player', '540', '505', '9.0.0', false, false, params,atts);
}//end of loadVideo()

String.prototype.pad = function(l, s) {
    return (l -= this.length) > 0 ? (s = new Array(Math.ceil(l / s.length) + 1).join(s)).substr(0, s.length) + this + s.substr(0, l - s.length) : this;
};

function showDetailVideos(data) 
{
  var feed = data.feed;
  var entries = feed.entry || [];
      
  //goes around for each item in the YouTube item
  for (var intIndex = 0; intIndex < entries.length; intIndex++) 
  {
	  detailVideoBody(intIndex,entries,true,'');
  }//end of for loop

  //this is close the divs and put them onto the page as it has to be here 
  //because the html does not carry back to showDetailVideos()
	
  htmlDetailVideos.push('</div>');
  
  //gets the current total of intPageTotal in order to display Viemo items side by side with YouTube
  //resets the intPageTotal and intPageIndex for the Viemo turn
  intVimeoPageTotal = intPageTotal;
  intPageTotal = 1;
  intPageIndex = 1;

  //adds the YouTube items to the site
  if(document.getElementById('video') != null)
		document.getElementById('video').innerHTML = htmlDetailVideos.join('');
		
  //resets the htmlDetailVideos as this is a different feed to set up
  htmlDetailVideos = ['<div class="divDetailVideo">'];

  //does the viemo videos
  $.getScript('http://vimeo.com/api/v2/OntarioLiberalTV/videos.json?callback=setupViemoGallery');
  
  var oldonload=window.onload;//holds any prevs onload function from the js file
  
  //gets the onload window event checks if there is a function that is already in there
  window.onload=function(){
	  if(typeof(oldonload)=='function')
		  oldonload();

	  //checks if there is a video display first
	  if(entries.length > 0 && getDocID('video') != null && getDocID('videoViemo') != null)
	  {
		  var intEntries = 0;//holds the Entries index in order
		  var strPage = 1;//holds the Page Number
		  var strPlayer = "y";//holds the which player the user wants to use
		  
		  var hash = getUrlVars();//holds the URL variables
		  
		  //checks if the user wants to start a video and if so then puts the URL valiables into the JS valiables
		  if(hash['v'] != null && hash['p'] != null && hash['y'] != null)
		  {
			  intEntries = hash['v'];
			  strPage = hash['p'];
			  strPlayer = hash['y'];
		  }//end of if

		  //checks which Player to use
		  if(strPlayer == 'y')
			  display_youtube(entries[intEntries].media$group.media$content[0].url,entries[intEntries].media$group.media$title.$t.replace(/\'/g, '&rsquo;').replace(/"/g, '&quot;'),entries[intEntries].media$group.media$description.$t.replace(/\'/g, '&rsquo;').replace(/"/g, '&quot;').replace(/\r\n/g, '<br/>').replace(/\r/g, ' ').replace(/\n/g, '<br/>'));
		  
		  //goes around setting each page id from 1 till intPageTotal as the first one is automactlly added
		  for(var intIndex = 1;intIndex <= intVimeoPageTotal;intIndex++)//intPageTotal
		  {
			var strPagingSelection = "";//holds the Paging Selection if the page is the one being used
			var strPagingFirtst = "divPagesNumberContent";//holds the Paging Selection if the page is the one being used
			
		  	//checks if the url valuable is the one being selected
			if(parseInt(strPage) == intIndex)
				strPagingSelection = "aPagingSelection ";
				
			//checks if index is the first index
			if(intIndex == 1)
				strPagingFirtst = "divPagesNumberFirstContent";
			
			getDocID('divPagesNavigation').innerHTML += "<div class=\"customContent " + strPagingFirtst + "\"><a href=\"javascript:void(0);\" onclick=\"javascript: classToggleLayer(getDocID('videoViemo'),getDocID('divPageID" + intIndex + "'),'divPage divViemo','div');classToggleLayer(getDocID('video'),getDocID('divPageID" + intIndex + "'),'divPage divYouTube','div');classToggleLayerChangeClass(getDocID('divPagesNavigation'),getDocID('aPageID" + intIndex + "'),'aPagingSelection aPaging','aPaging','a');\" id=\"aPageID" + intIndex + "\" class=\"" + strPagingSelection + "aPaging\">" + intIndex + "</a></div>";
		  }//end of for loop
		  
		  //displays the Viemo Videos for what ever is in strPage
		  
		  classToggleLayer(getDocID('videoViemo'),getDocID('divPageID' + strPage),'divPage divViemo','div');
	  
		  //checks if this is the video that is being played or the YouTube one
		  if(strPlayer == 'v')
			  classToggleLayerDivImg(getDocID('videoViemo'),getDocID('divVideoThumbViemo' + intEntries),'divBlackVideoThumb','div','url(/CSS/images/videothumbred.png)','url(/CSS/images/videothumbblack.png)');
		  else
			  classToggleLayerDivImg(getDocID('videoViemo'),getDocID('divVideoThumbViemo0'),'divBlackVideoThumb','div','url(/CSS/images/videothumbblack.png)','url(/CSS/images/videothumbblack.png)');
		  
		  //displays the YouTube Videos for what ever is in strPage
		  
		  classToggleLayer(getDocID('video'),getDocID('divPageID' + strPage),'divPage divYouTube','div');
		  
		  //checks if this is the video that is being played or the Viemo one
		  if(strPlayer == 'y')
			  classToggleLayerDivImg(getDocID('video'),getDocID('divVideoThumb' + intEntries),'divBlackVideoThumb','div','url(/CSS/images/videothumbred.png)','url(/CSS/images/videothumbblack.png)');
		  else
			  classToggleLayerDivImg(getDocID('video'),getDocID('divVideoThumb0'),'divBlackVideoThumb','div','url(/CSS/images/videothumbblack.png)','url(/CSS/images/videothumbblack.png)');

		  //does the last part which is page total and clearing out the float: lefts <label>page out of " + intPageTotal + "<label>
		  getDocID('divPagesNavigation').innerHTML += "<div class='customFooter' id='divPagesNumberFooter'></div>";
		  
		  //gets the ifFB
		  getDocID('ifFBDetail').src = "http://www.facebook.com/plugins/like.php?href=" + encodeURL(entries[intEntries].media$group.media$content[0].url) + "&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=35";
	  }//end of if
  }//end of window.onload=function()
}//end of showDetailVideos()

function showMyVideos(data) 
{
	var feed = data.feed;
	var entries = feed.entry || [];
	var html = [''];
	
	//goes around for each item to be display on the Homepage for YouTube
	for (var intIndex = 0; intIndex < entries.length; intIndex++) 
	{
		var entry = entries[intIndex];
		var title = entry.title.$t.substr(0, 20);
		var thumbnailUrl = entries[intIndex].media$group.media$thumbnail[0].url;
		var playerUrl = entries[intIndex].media$group.media$content[0].url;
	  
		var intDuration = Math.floor(entries[intIndex].media$group.yt$duration.seconds / 60) + ":" + (entries[intIndex].media$group.yt$duration.seconds % 60).toFixed().pad(2, "0")

		html.push('<div class="customContent divVideoHomeThumb"><div id="divVideoThumb' + intIndex + '"><div class="divVideoHomeThumbPic"><a href="NewsBlog/OntarioLiberalTV.aspx?v=' + intIndex + '&y=y&p=1"><div class="divVideoHomeThumbPicPlay"><img src="/CSS/images/OL-Video-Play.png" alt="" /></div><img width="215" height="160" src="', thumbnailUrl, '" alt="" /></a></div><div class="customContainer divNewVideoContainer"><div class="customContent divNewVideoContent"><label>', entries[intIndex].media$group.media$title.$t.replace(/\'/g, '&rsquo;').replace(/"/g, '&quot;'), '</label></div><div class="customNavigation divNewVideoNavigation"><label>', intDuration, '</label></div><div class="customFooter divNewVideoFooter"></div></div></div></div>');
	}//end of for loop
	
	html.push('<div class="customFooter"></div>');
	
	if(document.getElementById('videoHome') != null)
	  document.getElementById('videoHome').innerHTML = html.join('');	
}//end of showMyVideos()

function showMyVideosGallery(data) 
{
	var feed = data.feed;
	var entries = feed.entry || [];
	var html = ['<div class="videos">'];
	
	//goes around for each item to be display on the Gallery page for YouTube
	for (var intIndex = 0; intIndex < entries.length; intIndex++) 
	{
		var entry = entries[intIndex];
		var title = entry.title.$t.substr(0, 20);
		var thumbnailUrl = entries[intIndex].media$group.media$thumbnail[0].url;
		var playerUrl = entries[intIndex].media$group.media$content[0].url;
	  
		var intDuration = Math.floor(entries[intIndex].media$group.yt$duration.seconds / 60) + ":" + (entries[intIndex].media$group.yt$duration.seconds % 60).toFixed().pad(2, "0")
	
		 html.push('<div class="divVideoGalleryThumb"><div id="divVideoThumb' + intIndex + '"><div class="divVideoGalleryThumbPic"><a href="javascript:void(0);" onclick="javascript:toggleLayer(\'divVideo\',\'divGrayBG\',\'objYouTube\');displayHiddenYouTube(\'', entries[intIndex].media$group.media$content[0].url, '\');changeImageLightBox(\'\',\'lblYouTubeLightBoxTitle\',\'\',\'', entries[intIndex].media$group.media$title.$t.replace(/\'/g, '&rsquo;').replace(/"/g, '&quot;'), '\',\'\',\'\');"><div class="divVideoGalleryThumbPicPlay"><img src="/CSS/images/OL-Video-Play.png" alt="" /></div><img width="300" src="', thumbnailUrl, '" alt="" /></a></div><div class="customContainer divNewVideoGalleryContainer"><div class="customContent divNewVideoGalleryContent"><label>', entries[intIndex].media$group.media$title.$t.replace(/\'/g, '&rsquo;').replace(/"/g, '&quot;'), '</label></div><div class="customNavigation divNewVideoGalleryNavigation"><label>', intDuration, '</label></div><div class="customFooter divNewVideoGalleryFooter"></div></div></div></div>');
	}//end of for loop
	
	html.push('</div>');
	
	if(document.getElementById('videoGallery') != null)
	  document.getElementById('videoGallery').innerHTML = html.join('');	
}//end of showMyVideosGallery()

function displayHiddenYouTube(new_url)
{	
	//checks if the user is using either IE7 or IE8 as they used a different way of appending a control to another control
	if(navigator.appVersion.indexOf('MSIE 7') != -1 || navigator.appVersion.indexOf('MSIE 8') != -1)
	{
		var tagMedia = getDocID("divYouTubeIE7");//uses a custom div in order for it to work in IE
				
		//checks if there is a object YouTube on the page and if so then remove as a new one is being created
		if (document.getElementById("objYouTube") != null)
			getDocID("objYouTube").parentNode.removeChild(document.getElementById("objYouTube"));
		
		//create a whole new objYouTube as IE7 needs to recreate the whole object tag in order for it to play on screen
		tagMedia.innerHTML = "<object width='630' height='505' id='objYouTube'>" + 
            "<param id='object_url' />" + 
            "<param value='objYouTube' name='flashvars' />" + 
            "<param value='true' name='allowFullScreen' />" + 
            "<param value='always' name='allowscriptaccess' />" + 
            "<embed id='embed_url' src='" + new_url + "&rel=0&autoplay=1' type='application/x-shockwave-flash'  allowscriptaccess='always' allowfullscreen='true' width='630' height='505' flashvars='objYouTube'>></embed>" + 
        "</object>";
	}//end of if
	else
	{
		var tagMedia = getDocID("objYouTube");
		var embedNode = document.createElement('embed');

		embedNode.setAttribute("id","embed_url");
		embedNode.setAttribute("src",new_url + "&rel=0&autoplay=1");
		embedNode.setAttribute("type","application/x-shockwave-flash");
		embedNode.setAttribute("allowscriptaccess","always");
		embedNode.setAttribute("allowfullscreen","true");
		embedNode.setAttribute("width","630");
		embedNode.setAttribute("height","505");
		embedNode.setAttribute("flashvars","objYouTube");
		tagMedia.appendChild(embedNode);
	}//end of else
		
    //$('#shade').css('display', 'block');
	//$('#youtube_player').css('display', 'block');
    //$('#exit_youtube').css('display', 'block');
}//end of displayHiddenYouTubee()
	
function display_youtube(new_url,strTitle,strDecsription)
{
	var tagMedia = getDocID("objYouTube");
			
	$('#object_url').replaceWith('<param id="object_url" name="movie" value="' +new_url+ '&rel=0&autoplay=1" />');
	$('#embedYouTube').replaceWith('<embed id="embedYouTube" src="' +new_url+ '&rel=0&autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="630" height="505" flashvars="objYouTube" />');
	$('#shade').css('display', 'block');
	$('#youtube_player').css('display', 'block');
	$('#exit_youtube').css('display', 'block');
	
	getDocID("lblVideoTitle").innerHTML = strTitle;
	getDocID("lblVideoDesc").innerHTML = strDecsription;
		
	getDocID("divEmbedVideo").style.display = '';
	getDocID("objDetailYouTube").style.display = '';
}//end of display_youtube()
	
function exit_youtube() {
   	$('#object_url').replaceWith('<param id="object_url" />');
   	$('#embedYouTube').replaceWith('<embed id="embedYouTube" />');
   	$('#shade').css('display', 'none');
   	$('#youtube_player').css('display', 'none');
   	$('#exit_youtube').css('display', 'none');		
}//end of exit_youtube()

//Vimeo's Videos

function getViemoVideo(url,oEmbedEndpoint,oEmbedCallback,strTitle,strDecsription) 
{
	$.getScript(oEmbedEndpoint + '?url=' + url + '&width=630&height=505&autoplay=1&callback=' + oEmbedCallback);
		
	getDocID("lblVideoTitle").innerHTML = strTitle;
	getDocID("lblVideoDesc").innerHTML = strDecsription;
	
	getDocID("divEmbedVideo").style.display = 'block';
	getDocID("objDetailYouTube").style.display = 'none';
}//end of getVideo
	
function setupViemoGallery(entries) 
{
	var intEntries = 0;//holds the Entries index in order
	var strPlayer = "y";//holds the which player the user wants to use
		  
	var hash = getUrlVars();//holds the URL variables
	
	//checks if the user wants to start a video and if so then puts the URL valiables into the JS valiables
	if(hash['y'] != null && hash['v'] != null)
	{
		intEntries = hash['v'];
		strPlayer = hash['y'];
	}//end of if
	
	//checks which Player to use for the Viemo it has to be here in order to get the entries from the feed
	if(strPlayer == 'v')
		getViemoVideo(entries[intEntries].url,'http://vimeo.com/api/oembed.json', 'switchViemoVideo',entries[intEntries].title.replace(/\'/g, '&rsquo;').replace(/"/g, '&quot;'),entries[intEntries].description.replace(/\'/g, '&rsquo;').replace(/"/g, '&quot;').replace(/\r\n/g, '<br/>'));
	
	// Add the videos to the gallery
	for (var intViemoIndex = 0; intViemoIndex < entries.length; intViemoIndex++) 
  	{
		detailVideoBody(intViemoIndex,entries,false,'Viemo');
	}//end of for loop

	//this is close the divs and put them onto the page as it has to be here 
	//because the html does not carry back to showDetailVideos()
	
	htmlDetailVideos.push('</div></div>');
	
	if(document.getElementById('videoViemo') != null)
		document.getElementById('videoViemo').innerHTML = htmlDetailVideos.join('');
	
	// Switch to the video when a thumbnail is clicked
	/*$('#thumbs a').click(function(event) {
		event.preventDefault();
		getViemoVideo(this.href, 'http://vimeo.com/api/oembed.json', 'switchViemoVideo');
		return false;
	});	*/
}//end of setupViemoGallery()

function showViemoGallery(entries) 
{
	var html = ['<div class="videos">'];
  
  //goes around for each item to be display on the Homepage for YouTube
  for (var intIndex = 0; intIndex < entries.length; intIndex++) 
  {
	 var strVideoTitle = entries[intIndex].title;
	 var title = entries[intIndex].title.substr(0, 20)
	 var thumbnailUrl = entries[intIndex].thumbnail_small;
	 var strDuration = Math.floor(entries[intIndex].duration / 60) + ":" + (entries[intIndex].duration % 60).toFixed().pad(2, "0");
	  
	 html.push('<div class="customContent divVideoThumb"><div class="divBlackVideothumb" id="divViemoVideoThumb' + intIndex + '" onmouseout="changeDivImage(\'divViemoVideoThumb' + intIndex + '\',\'url(CSS/images/videothumbblack.png)\');" onmouseover="changeDivImage(\'divViemoVideoThumb' + intIndex + '\',\'url(CSS/images/videothumbred.png)\');"><div class="divVideoThumbPicDetails"><a href="NewsBlog/OntarioLiberalTV.aspx?v=' + intIndex + '&y=v&p=1"><img width="134" src="', thumbnailUrl, '" /></a><div class="textgrey videothumbtext">', strDuration, '</div></div></div><label class="textgrey lblVideoTitle">', strVideoTitle, '</label></div>');
	 	 
	//checks if the amount of itemd for display has been reach
	if(intIndex == 3)
		break;
  }//end of for loop
  
  html.push('<div class="customFooter"></div></div>'); 
  
 if(document.getElementById('videoViemo') != null)
	document.getElementById('videoViemo').innerHTML = html.join('');
}//end of showViemoGallery()

function switchViemoVideo(video) 
{
	$('#divEmbedVideo').html(unescape(video.html));
}//end of switchVideo()
