function VideoArticlePreview() {

	var hasImagePreviewContainer = false;
	var arrVideos = new Array(1);
	
	this.add = function(videoURL,videoTextContent,videoTime,videoLang,videoMore,bannerAdImage,bannerAdLink,bottomLinkText,bottomLink) {
		var objArticleVideo = new Object();
		var arrIndex = arrVideos.length;
		objArticleVideo.videoURL = videoURL;
		objArticleVideo.videoTime = videoTime;
		objArticleVideo.videoLang = videoLang;
		objArticleVideo.videoMore = videoMore;
		objArticleVideo.videoTextContent = videoTextContent;
		objArticleVideo.bannerAdImage = bannerAdImage;
		objArticleVideo.bannerAdLink = bannerAdLink;	
		objArticleVideo.bottomLinkText = bottomLinkText;
		objArticleVideo.bottomLink = bottomLink;				
		arrVideos[arrIndex] = objArticleVideo;
		return arrIndex;
	}
	
	this.previewArticleVideo = function(videoID) { 

		var currVideo = arrVideos[parseInt(videoID)];
		if (!hasImagePreviewContainer) {
			$("body").prepend("<div class=\"templateWrapper\"><div id=\"videoArticlePreview\"><div id=\"videoArticle\" class=\"removeMarginTop\"><div class=\"blank\"></div></div><div id=\"videoContent\" class=\"removeMarginTop\"><div class=\"blank\"></div></div></div></div>")
			$("#videoArticlePreview").css("padding",'0px');
			$("#videoArticle").css("float",'left');
			$("#videoContent").css("float",'right');
			$("#videoContent").css("padding",'0px');
			$("#videoContent").css("margin",'0px');
			$("#videoArticle").css("width",'450px');
			$("#videoContent").css("width",'285px');

			hasImagePreviewContainer = true;
		}
		//$("#imageLoading").show();
		if ( $("#videoArticlePreview").modal( { position:[124,], onClose: function (dialog) { $.modal.close(); } } ) ) 
		{
			$("#simplemodal-container").hide();
			$("#simplemodal-container").fadeIn();
		}

// set the window size
	var win_width = 740;
	//var win_height = 520;
	//alert(currVideo.videoTextContent);
	
	$("#videoArticlePreview").css("width",win_width);
	//$("#videoArticlePreview").css("height",win_height);
	
	$.modal.setPosition();	
	
	if (currVideo.videoLang == 'en')
	{
		videoLangImg = 'en';
		}
	else
	{
		videoLangImg = 'es';
		}
	
	//create the content for the inner window
	var this_content = "<div>";
	this_content += "<iframe width='450' height='300' frameborder='0' scrolling='no' allowtransparency='true' ";
	this_content += "src='" + currVideo.videoURL + "&notemplate=&isAjaxRequest=";
	this_content += "'></iframe>";
	this_content += "<div id='videoArticleBottom' class='addPadding' style='padding-left:5px;'>"+currVideo.videoTime+"</div><br/>";
	this_content += "<div id='videoArticleBottomMore'>"+currVideo.videoMore+" >>> <a href='http://www.iadb.org/news/videos.cfm?lang="+currVideo.videoLang+"&WT.cg_n=HVMICREN"+currVideo.videoLang+"&WT.cg_s=BIDTV'><img src='/homepage/images/IDB-TV_"+videoLangImg+"_active.gif' name='/homepage/images/IDB-TV_"+videoLangImg+"_up.gif' align='absmiddle' border='0' class='homeVideoIDBTVButton' id='homeVideoIDBTVButton'  alt='More Videos'/><a> ";
	this_content += " <a href='http://www.iadb.org/youtube/index.cfm?WT.cg_n=HVMICREN"+currVideo.videoLang+"&WT.cg_s=BIDYOUTUBE'><img src='/homepage/images/IDB-Youtube_"+videoLangImg+"_active.gif' name='/homepage/images/IDB-Youtube_"+videoLangImg+"_up.gif' align='absmiddle' border='0' class='homeVideoIDBYouTubeButton' id='homeVideoIDBYouTubeButton' alt='IDB Youtube'/></a></div><br/></div>";
	if (currVideo.bannerAdLink != '')
	this_content += "<div class='addPadding' style='padding-left:5px;'><a href='"+currVideo.bannerAdLink+"'><img src='"+currVideo.bannerAdImage+"' border='0'/></a></div><br/>";	
	
	if (currVideo.bottomLink != '')
	this_content += "<hr><div class='addPadding' style='padding-top:10px;padding-left:15px;font-size:1.3em;'><a href='"+currVideo.bottomLink+"'>"+currVideo.bottomLinkText+"</a></div><br/>";
	
	$("#videoArticlePreview #videoArticle").html(this_content);
	$("#videoArticlePreview #videoContent").html(currVideo.videoTextContent);
	
		$(function() {
			$('#homeVideoIDBTVButton').hover(
			function() {
				var currentImg = $(this).attr('src');
				$(this).attr('src', $(this).attr('name'));
				$(this).attr('name', currentImg);
			}, 
			function() {
				var currentImg = $(this).attr('src');
				$(this).attr('src', $(this).attr('name'));
				$(this).attr('name', currentImg);
			});
		});
	
		$(function() {
			$('#homeVideoIDBYouTubeButton').hover(
			function() {
				var currentImg = $(this).attr('src');
				$(this).attr('src', $(this).attr('name'));
				$(this).attr('name', currentImg);
			}, 
			function() {
				var currentImg = $(this).attr('src');
				$(this).attr('src', $(this).attr('name'));
				$(this).attr('name', currentImg);
			});
		});


}

}


