//TV Station Properties
var WPNTVStation = new Class.create();
WPNTVStation.prototype = {
	initialize: function( settingsObj ) {
		//defaults+overrides
		this.stationName = "webkast";
		if (!Object.isUndefined(settingsObj["stationName"])) {
			this.stationName=settingsObj["stationName"];
		}
		this.autoPlay=false;
		if (!Object.isUndefined(settingsObj["autoplay"])) {
			this.autoPlay=settingsObj["autoplay"];
		}
		this.maintainAspect=false;
		if (!Object.isUndefined(settingsObj["maintainAspect"])) {
			this.maintainAspect=settingsObj["maintainAspect"];
		}
		this.uacct="";
		if (!Object.isUndefined(settingsObj["uacct"])) {
			this.uacct=settingsObj["uacct"];
		}	
		this.homeLink="";
		//$("home").update('<a href="http://www.kzs-zveza.si/kzs/"><img src="http://www.slobasket.tv/home_link.png" border="0"/></a>');
		if (!Object.isUndefined(settingsObj["homeLink"])) {
			this.homeLink = settingsObj["homeLink"];
			if ($("home_link") != null) {
				$("home_link").update(this.homeLink);
			}
		}	
		//this.uploadVisible=false;
		if (!Object.isUndefined(settingsObj["uploadVisible"])) {
			//this.uploadVisible=settingsObj["uploadVisible"];
			if (settingsObj["uploadVisible"] == true) {
				Try.these(function(){
					$("uploadBoxSignedIn").setStyle({
						display: "inline"
					});
					$("uploadBoxNotSignedIn").setStyle({
						display: "inline"
					});
				});
			}
		}	
		this.liveStreamEnabled=false;
		if (!Object.isUndefined(settingsObj["liveStreamEnabled"])) {
				this.liveStreamEnabled = settingsObj["liveStreamEnabled"];				
		}
		this.liveStreams = [];
		if (!Object.isUndefined(settingsObj["liveStreams"])) {
				this.liveStreams = settingsObj["liveStreams"];				
		}
		this.randomShowOnStartup=true;
		if (!Object.isUndefined(settingsObj["randomShowOnStartup"])) {
				this.randomShowOnStartup = settingsObj["randomShowOnStartup"];				
		}
		this.modules = [];
		if (!Object.isUndefined(settingsObj["modules"])) {
				this.modules = settingsObj["modules"];				
		}
		
		this.startupModule = '';
		if (!Object.isUndefined(settingsObj["startupModule"])) {
				this.startupModule = settingsObj["startupModule"];				
		}
		
		this.showActualSection = false;
		if (!Object.isUndefined(settingsObj["showActualSection"])) {
				this.showActualSection = settingsObj["showActualSection"];				
		}
		
		this.switchbarIcons="";
		if (!Object.isUndefined(settingsObj["switchbarIcons"])) {
				this.switchbarIcons = settingsObj["switchbarIcons"];				
		}	
		
		this.switchbarCustomColor="";
		this.switchbarHasCustomColor = false;
		if (!Object.isUndefined(settingsObj["switchbarCustomColor"])) {
				this.switchbarHasCustomColor = true;
				this.switchbarCustomColor = settingsObj["switchbarCustomColor"];				
		}		
		
		this.hasIntro=false;
		if (!Object.isUndefined(settingsObj["hasIntro"])) {
				this.hasIntro = settingsObj["hasIntro"];				
		}
		
		this.maxTVVideoSectionChars=12;
		if (!Object.isUndefined(settingsObj["maxTVVideoSectionChars"])) {
				this.maxTVVideoSectionChars = settingsObj["maxTVVideoSectionChars"];				
		}	
		

 		this.adCode = "reklama";
		this.defaultCover="wpntvcover.png";
		this.customUrl = "http://"+this.stationName+".tv";		
		
		this.queryParams = null;
		if (window.location.href.indexOf('?') != -1 && window.location.href.indexOf('=') != -1 ) {
			query = window.location.href.substring( window.location.href.lastIndexOf('/') );
			this.queryParams = query.toQueryParams();
		}
		
		this.customLinkName = "Link";
		if (!Object.isUndefined(settingsObj["customLinkName"])) {
				this.customLinkName = settingsObj["customLinkName"];				
		}
		
		this.customLinkUrl = "";
		if (!Object.isUndefined(settingsObj["customLinkUrl"])) {
				this.customLinkUrl = settingsObj["customLinkUrl"];				
		}	
		
	//	this.setupPageItems();
	//	document.fire("wpntv:initialized",{});
	},
	report: function() {
		
	},
	getName : function() {
		return this.stationName;
	},
	getAddress : function() {
		return this.customUrl;
	}, 
	getLocation : function() {
		return window.location;
	},
	getDefaultShowCover : function() {
		return this.defaultCover;
	},
	getAutoPlay : function() {
		return this.autoPlay;
	},
	getMaintainAspect : function() {
		return this.maintainAspect;
	},
	getUACCT : function() {
		return this.uacct;
	},
	getLiveStreamEnabled : function() {
		return this.liveStreamEnabled;
	},
	getLiveStreams : function() {
		return this.liveStreams;
	},
	getRandomShowOnStartup : function() {
		return this.randomShowOnStartup;
	},
	localizationLoaded : function( localizationObj ) {
	//	this.localizationObj = localizationObj;
		document.fire("wpntv:initialized",{});
	},
	setupPageItems : function() {
		$("info_show_title").update("Trenutno na sporedu");
		$("napis").update("Spletna televizija "+this.getName()+".TV");
	},
	getQueryParams : function() {
		return this.queryParams;
	},
	getModules : function() {
		return this.modules;
	},
	getStartupModule : function() {
		return this.startupModule;
	},
	getLocalization : function() {
		return this.localizationObj;
	},
	getShowActualSection : function() {
		return this.showActualSection;
	},
	getSwitchbarIcons : function() {
		return this.switchbarIcons;
	},
	getSwitchbarCustomColor : function() {
		return this.switchbarCustomColor;
	},
	getSwitchbarHasCustomColor : function () {
		return this.switchbarHasCustomColor;
	},
	isIntroEnabled : function() {
		return this.hasIntro;
	},
	getMaxTVVideoSectionChars : function() {
		return this.maxTVVideoSectionChars;
	},
	getCustomLinkName : function() {
		return this.customLinkName;
	},
	getCustomLinkUrl : function() {
		return this.customLinkUrl;
	}
};

if (typeof TVStationSettings != 'undefined') {
	var tvStation = new WPNTVStation( TVStationSettings);	
}
