var MoviePlayer = new Object();
var movieArray = new Array();

MoviePlayer.Movie = function(movieName, movieStreamURL, movieDownloadURL, sizeWidth, sizeHeight, thumbnailImage)
{
	this.movieName = movieName;
	this.movieStreamURL = movieStreamURL;
	this.movieDownloadURL = movieDownloadURL;
	this.sizeWidth = sizeWidth;
	this.sizeHeight = sizeHeight;
	this.thumbnailImage = thumbnailImage;
}

MoviePlayer.ListMovies = function(name)
{
	var writeOut = "";
	var imageURL = "http://glarp.atk.com/images/movie_player_thumbs/";
	
	try{
		writeOut += "<table width=\"170\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
	
		if(movieArray[name].length > 0)
		{
			for(var i=0; i < movieArray[name].length; i++){
				writeOut += "<tr>\n";
				writeOut += "<td><a href=\"javascript:MoviePlayer.PlayMovie('"+ name +"',"+ i +");void (0)\"><img src=\"" + imageURL + movieArray[name][i].thumbnailImage + "\" class=\"videoThumbnails\" alt=\""+ movieArray[name][i].movieName +"\" width=\"85\" border=\"0\"></a></td>";
				writeOut += "<td><p class=\"smallVideoInfo\"><a class=\"smallVideoInfoLink\" href=\"javascript:MoviePlayer.PlayMovie('"+ name +"',"+ i +");void (0)\">"+ movieArray[name][i].movieName +"<br></a></p></td>";
				writeOut += "</tr>\n";
			}
		}else{
			writeOut += "<tr>\n";
				writeOut += "<td><p class=\"smallVideoInfo\"><br><br>There are no Videos at this time.</p></td>";
			writeOut += "</tr>\n";
		}
		
		writeOut += "</table>\n";	
	}
	catch(e){
	}
	document.getElementById("content").innerHTML = writeOut;
	Scroller.init();
}


MoviePlayer.PlayMovie = function(name, id)
{
	MoviePlayer.CreateMovieControl(movieArray[name][id],name,id,true);
}


MoviePlayer.PlayStartUpMovie = function(name, id)
{
	MoviePlayer.CreateMovieControl(movieArray[name][id],name,id,true);
}


MoviePlayer.CreateMovieControl = function(arrayobj, name, id, autostart)
{
	var movieControl = "";

	try{
	
		movieControl += "<OBJECT id=\'WMVMoviePlayer\' name=\"WMVMoviePlayer\" width=\"280\" height=\"252\" classid=\'CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95\' codebase=\'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701\' standby=\'\' type=\'application/x-oleobject\'>";

		if(autostart){
			movieControl += "<param name=\'autoStart\' value=\"true\">";
		}else{
			movieControl += "<param name=\'autoStart\' value=\"false\">";
		}		
		
		movieControl += "<param name=\'fileName\' value=\'"+ arrayobj.movieStreamURL +"\'>";
		movieControl += "<param name=\'animationatStart\' value=\'true\'>";
		movieControl += "<param name=\'transparentatStart\' value=\'true\'>";
		
		movieControl += "<param name=\'showControls\' value=\"true\">";
		movieControl += "<param name=\'loop\' value=\"false\">";
		movieControl += "<EMBED type=\'application/x-mplayer2\' pluginspage=\'http://microsoft.com/windows/mediaplayer/en/download/\' id=\'WMVMoviePlayer\' name=\'WMVMoviePlayer\' autostart=\""+(autostart?"true":"false")+"\" displaysize=\'4\' autosize=\'-1\' bgcolor=\'darkblue\' showcontrols=\'true\' showtracker=\'-1\' showdisplay=\'0\' showstatusbar=\'-1\' videoborder3d=\'-1\' width=\"280\" height=\"252\" src=\""+ arrayobj.movieStreamURL +"\" designtimesp=\'5311\' loop=\"false\">";
		movieControl += "</EMBED>";
		movieControl += "</OBJECT>";
	
		movieControl += "<p class=\"loadedVideoTitle\">";
		movieControl += arrayobj.movieName + "<br />";
		//movieControl += "<a href=\"javascript:MoviePlayer.PlayMovie('"+ name +"',"+ id +");void (0)\">Streaming</a>  \// ";
		movieControl += "<a href=\"http://glarp.atk.com/videos/" + arrayobj.movieDownloadURL + "\">Download as Windows Media</a>";
		movieControl += "</p>";
	}
	catch(e){
	}

	var obj = document.getElementById("mediaplayer");  
	obj.innerHTML = movieControl;
	movieControl = "";
}


MoviePlayer.Init = function()
{
	document.getElementById("scrollbar").style.display = 'none';
	document.getElementById("scrollUp").style.display = 'none';
	document.getElementById("scrollDn").style.display = 'none';
	
	MoviePlayer.ListMovies('Outers');
	MoviePlayer.PlayStartUpMovie('Outers',0);

}


movieArray["Outers"] = new Array(
	new MoviePlayer.Movie("Outers Products, How to Video","http://wst2.atk.com/anokastream/OutersGuncare/2007/OutersProductDemo_272x208.wmv","OutersGuncare/2007/download.aspx?movie=OutersProductDemo_272x208.wmv",272,208,"OutersProductDemo.jpg"),
	new MoviePlayer.Movie("Outers, Specialty kits Ad","http://wst2.atk.com/anokastream/OutersGuncare/2007/Outers_272x208.wmv","OutersGuncare/2007/download.aspx?movie=Outers_272x208.wmv",272,208,"Outers2007.jpg")
);

window.onload = function() { MoviePlayer.Init(); }
