// JavaScript Document
//video


function deletePlayer(theWrapper, thePlaceholder, thePlayerId, theIndustry) { 

		var firecaption = "Fire Department Testimonial: Chief David Kingsbury of the Bourne Fire Department and firefighter Jay Boyne of the West Barnstable Fire Department discuss the uses of PowerFlares and their benefits over old fashioned road flares. The video also includes a PowerFlare getting run over by a fire truck.";
		var policecaption = "Police Testimonial: LT. Steve Xiarhos from the Yarmouth Police department demonstrates the uses and features of the PowerFlare Safety Light. The PowerFlare system was designed by police officers for police officers. ";
		var powerflare_1 = "Solid Light Deployment: The PowerFlare Safety Light emitting light in all directions (can be seen for miles at night). Check out how bright they are at dusk in this video. ";
		var powerflare_2 = "Rotating Light Deployment: The PowerFlare; Safety Light captures attention with multiple flash patterns. The rotation pattern captures eye attention immediately. ";
		var powerflare_3 = "A video demonstration of the basic functions and flash patters of the PowerFlare. The PowerFlare is an environmentally-friendly, durable, and economical alternative to traditional road flares.";
		
		if (theIndustry == "fire") {
			var thecaption = firecaption;
		}
		if (theIndustry == "police") {
			var thecaption = policecaption;
		}
		if (theIndustry == "powerflare_1") {
			var thecaption = powerflare_1;
		}
		if (theIndustry == "powerflare_2") {
			var thecaption = powerflare_2;
		}
		if (theIndustry == "powerflare_3") {
			var thecaption = powerflare_3;
		}
		
		
        swfobject.removeSWF(thePlayerId);
        var tmp=document.getElementById(theWrapper);
		var captionarea = document.getElementById("vidcaption");
		
		if (captionarea) { captionarea.innerHTML = "<div id=\"vidcaption\">" + thecaption + "</div>"; }
        if (tmp) { tmp.innerHTML = "<div id=" + thePlaceholder + "></div>"; }
		}

      function createPlayer(thePlaceholder, thePlayerId, theFile, theStart, thePreview) {
	
		
        var flashvars = {
                file:theFile+"&type=video",
				image:thePreview,
                autostart:theStart
        }
        var params = {
                allowfullscreen:"true", 
                allowscriptaccess:"always"
        }
        var attributes = {
                id:thePlayerId,  
                name:thePlayerId
        }
        swfobject.embedSWF("swf/player-viral.swf", thePlaceholder, "425", "320", "9.0.115", false, flashvars, params, attributes);
}


function initPlayer(theFile, thePreview, theStart, industry) { 
        deletePlayer('wrapper', 'placeholder1', 'player1', industry); 
        createPlayer('placeholder1', 'player1', theFile, theStart, thePreview);
}

function createSidebar(thePlaceholder, thePlayerId, theFile, thePreview) {
	
		
        var flashvars = {
                file:theFile+"&type=video",
				image:thePreview,
                autostart:"false"
        }
        var params = {
                allowfullscreen:"true", 
                allowscriptaccess:"always"
        }
        var attributes = {
                id:thePlayerId,  
                name:thePlayerId
        }
        swfobject.embedSWF("swf/player-viral.swf", thePlaceholder, "250", "200", "9.0.115", false, flashvars, params, attributes);
}

function initSidebar(theFile, thePreview) { 
        createSidebar('deptvideo', 'player2', theFile, thePreview);
}