//(c) 2008  wpntv.com 
//All rights reserved.

var SwitchBar = Class.create();
SwitchBar.prototype = {
	normalLink : false,
	browserLink : false,
	liveLink : false,
	enabledString : "",
	customColors : false,
	colorCode : "",
	initialize : function ( params ) {
		//init
		if (params == "all") {
			this.normalLink = true;
			this.liveLink = true;
			this.browserLink = true;
			this.enabledString = this.enabledString + "normal";			
			this.enabledString = this.enabledString + "browser";			
			this.enabledString = this.enabledString + "live";			
		}
		if (params.indexOf("normal") != -1) {
			this.normalLink = true;
			this.enabledString = this.enabledString + "normal";
		}
		if (params.indexOf("browser") != -1) {
			this.browserLink = true;
			this.enabledString = this.enabledString + "browser";
		}
		if (params.indexOf("live") != -1 ) {
			this.liveLink = true;
			this.enabledString = this.enabledString + "live";
		} 
	},
	setColor : function ( colorCode ) {
		this.customColors = true;
		this.colorCode = colorCode;
	},
	renderDefault : function ( type ) {
		this.renderSpecial( type , "" );
	},
	renderSpecial : function ( type, cssColorTag ) {
		output = "";
		if (this.browserLink) output = output + '<a href="/browser/"><div class="browserLink'+(type=="browser"?'Over':'')+'"></div></a>';			
		if (this.normalLink) output = output + '<a href="/"><div class="basicLink'+(type=="normal"?'Over':'')+'"></div></a>'; 	
		if (this.liveLink) output = output + '<a href="/live/"><div class="liveLink'+(type=="live"?'Over':'')+'"></div></a>';
 	    $("switch_bar").update(output);		
	},
	renderFlashHome : function() {
		enabledBtns = this.enabledString;	
		//swfobject.embedSWF("/common/util/switchbar/SwitchBar.swf", "switchbar_flash", "143", "34", "9.0.0", /*expressInstallLink=*/false, /*flashVars=*/{defaultIcon:"normal", enabledIcons:"browser,normal,live" }, /*flashParams=*/{allowScriptAccess:"always",quality:"high",allowFullScreen:"true",swLiveConnect:"true", seamlesstabbing:"true", wmode:"transparent"}, /*other object attribtues=*/{base:"/",name:"switchbar_flash", id:"switchbar_flash"});				
//		$("switchbar_flash").update('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="143" height="34" id="SwitchBar" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="allowFullScreen" value="false" /><param name="wmode" value="transparent" /><param name="movie" value="SwitchBar.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />	<embed src="http://webkast.tv/common/util/switchbar/SwitchBar.swf" quality="high" width="143" height="34" name="SwitchBar" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
		if (this.customColors == true) {
			$("switchbar_flash").update('<EMBED src="/common/util/switchbar/SwitchBar.swf?selected=normal&enabled='+enabledBtns+'&customColor='+this.colorCode+'" WIDTH="143" HEIGHT="34" loop="false" ALIGN="" quality=high wmode=transparent bgcolor=#FFFFFF TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>');
		} else {
			$("switchbar_flash").update('<EMBED src="/common/util/switchbar/SwitchBar.swf?selected=normal&enabled='+enabledBtns+'" WIDTH="143" HEIGHT="34" loop="false" ALIGN="" quality=high wmode=transparent bgcolor=#FFFFFF TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>');
		}
	},
	renderFlashBrowser : function() {
		enabledBtns = this.enabledString;
		colorCode = this.colorCode;
		if (this.customColors == true) {
			swfobject.embedSWF("/common/util/switchbar/SwitchBar.swf", "switchbar_flash", "143", "34", "9.0.0", /*expressInstallLink=*/false, /*flashVars=*/{selected:"browser", enabled:enabledBtns, customColor:colorCode }, /*flashParams=*/{allowScriptAccess:"always",quality:"high",allowFullScreen:"true",swLiveConnect:"true", seamlesstabbing:"true", wmode:"transparent"}, /*other object attribtues=*/{base:"/",name:"switchbar_flash", id:"switchbar_flash"});		
		} else {
			swfobject.embedSWF("/common/util/switchbar/SwitchBar.swf", "switchbar_flash", "143", "34", "9.0.0", /*expressInstallLink=*/false, /*flashVars=*/{selected:"browser", enabled:enabledBtns }, /*flashParams=*/{allowScriptAccess:"always",quality:"high",allowFullScreen:"true",swLiveConnect:"true", seamlesstabbing:"true", wmode:"transparent"}, /*other object attribtues=*/{base:"/",name:"switchbar_flash", id:"switchbar_flash"});					
		}
	},
	renderFlashLive : function() {
		enabledBtns = this.enabledString;		
		colorCode = this.colorCode;	
		if (this.customColors == true) {
			swfobject.embedSWF("/common/util/switchbar/SwitchBar.swf", "flashPlaceholderForEmbed", "143", "34", "9.0.0", /*expressInstallLink=*/false, /*flashVars=*/{selected:"live", enabled:enabledBtns, customColor:colorCode }, /*flashParams=*/{allowScriptAccess:"always",quality:"high",allowFullScreen:"true",swLiveConnect:"true", seamlesstabbing:"true", wmode:"transparent"}, /*other object attribtues=*/{base:"/",name:"flashPlaceholder", id:"flashPlaceholder"});
		} else {
			swfobject.embedSWF("/common/util/switchbar/SwitchBar.swf", "flashPlaceholderForEmbed", "143", "34", "9.0.0", /*expressInstallLink=*/false, /*flashVars=*/{selected:"live", enabled:enabledBtns }, /*flashParams=*/{allowScriptAccess:"always",quality:"high",allowFullScreen:"true",swLiveConnect:"true", seamlesstabbing:"true", wmode:"transparent"}, /*other object attribtues=*/{base:"/",name:"flashPlaceholder", id:"flashPlaceholder"});			
		}
	}
};

