var Feature = Class.create();

Feature.prototype = {
	initialize: function()
	{
		this._featureId = "FlashApplication";
		
		var version;
		var fVersion = deconcept.SWFObjectUtil.getPlayerVersion()["major"];
		if(fVersion >= 8){			//special resources for flash 8 available
			version = 8;
		}
		else if(fVersion >= 7){		//special resources for flash 7 available
			version = 7;
		}
		else{
			version = 0;			//not supported flash version -> show non-flash/non-javascript version
		}

		if(version != 0){
			this.flashVersion = version;
			this.initFeature();
		}
	},
	initFeature: function()
	{
		var startPage = getUrlParameter("page");
		if(startPage != null && startPage != ""){
			startPage = "&startPage=" + startPage;
		}else{
			startPage = "";
		}
		var startSite = getUrlParameter("site");
		if(startSite != null && startSite != ""){
			startSite = "&startSite=" + startSite;
		}else{
			startSite = "";
		}
		
		var isFirefox = navigator.appName == "Netscape" ? true : false;
		
		var closeButtonUrl = "http://www.siemens.com";
		var moreButtonUrl = "http://w1.siemens.com/press/en/events/press-briefing.php"; 
		var letterParameters = "";
		
		if (startPage == "letter") {
			swfUrl = "feature/swf/letter.swf";
			
			letterParameters = "&closeButtonUrl=" + closeButtonUrl + "&moreButtonUrl=" + moreButtonUrl;
		}
		
		var formmailerURL = "../../../../../framework/pub/script/formmailer.php";
		var formmailerReceiver = "28";
		var feedbackReceiver = "28";
		
		var customerId = "notusedanymore";
		var komdat_download_bestell = "";  //if "" =random in flash
		var komdat_optin_bestell = "";     //if "" =random in flash
		var komdat_mailopen_bestell = "";  //if "" =random in flash
		var komdat_linkrot_bestell = "";   //if "" =random in flash
		var komdat_subscribe_bestell = "";   //if "" =random in flash
		
		var komdat_download_op1 = "26";    //if "" = 26 in flash
		var komdat_optin_op1 = "14";        //if "" = 5 in flash
		var komdat_mailopen_op1 = "13";    //if "" = 13 in flash
		var komdat_linkrot_op1 = "6";	   //if "" = 6 in flash
		var komdat_subscribe_op1 = "5";    //if "" = 5 in flash		

		var komdat_download_worth = "1";   //if "" = 0 in flash
		var komdat_optin_worth = "1";      //if "" = 0 in flash
		var komdat_mailopen_worth = "1";   //if "" = 0 in flash
		var komdat_linkrot_worth = "1";    //if "" = 0 in flash
		var komdat_subscribe_worth = "1";  //if "" = 0 in flash
		
		var rsCustomer = "1003388";
		var rsLang = "us";
		var swfLang = "sk";
		var rsPath = encodeURIComponent("http://w1.siemens.com/answers/cc/features/answers/cc/en/readspeaker/");
		var rsUrl = "http://asp.readspeaker.net/cgi-bin/siemensrsone";
		
		var localPath = "";
		//var localPath = "http://w1.siemens.com/features/answers/en/";
		var flvPath = "../flv/" + this.flashVersion + "/";
		if(typeof FEATURE_SHOWINTRO != "undefined"){
		//global variable; set in html file
			var introVideo = "spot_all.flv";
			var introThumb = "video_all_start.jpg";
		}else{
			var introVideo = "";
			var introThumb = "";
		}
		

		var globalPath= "";
		var imgPath = "img/";
		var sectionParameter = "";
		var section = getUrlParameter("section");
		if(section != null && (section == "index" || section == "eclipse" || section == "first" || section =="second" || section == "third" || section == "fourth" || section == "fifth" || section == "sixth")){
			sectionParameter = "&section=" + section;
		}else{
			sectionParameter = "";
		}
		var logoUrl = "http://www.siemens.com";
		
		var pageTitle = "pageTitle";
		

		
		var namespace = "siemens";
		
		var app = new SWFObject("../features/answers/cee/sr/swf/main" + this.flashVersion + ".swf", this._featureId, "997", "393", this.flashVersion + ",0,0,0", "#ffffff");
		app.addParam("quality", "high");
		app.addParam("wmode", "transparent");
		app.addParam("base", "../features/answers/cee/sr/");
		app.addParam("menu", "false");
		app.addParam("swliveconnect", "true");
		app.addParam("allowScriptAccess", "always");
		app.addParam("FlashVars", "pageTitle=" + pageTitle + "&namespace=" + namespace + "&s_account=" + s_account + "&isFirefox=" + isFirefox + "&feedbackReceiver=" + feedbackReceiver + "&komdat_subscribe_bestell=" + komdat_subscribe_bestell + "&komdat_subscribe_op1=" + komdat_subscribe_op1 + "&komdat_subscribe_worth=" + komdat_subscribe_worth + "&komdat_linkrot_op1=" + komdat_linkrot_op1 + "&komdat_mailopen_op1=" + komdat_mailopen_op1 + "&komdat_optin_op1=" + komdat_optin_op1 + "&komdat_download_op1=" + komdat_download_op1 + "&komdat_download_bestell=" + komdat_download_bestell + "&komdat_optin_bestell=" + komdat_optin_bestell + "&komdat_mailopen_bestell=" + komdat_mailopen_bestell + "&komdat_linkrot_bestell=" + komdat_linkrot_bestell + "&komdat_download_worth=" + komdat_download_worth + "&komdat_optin_worth=" + komdat_optin_worth + "&komdat_mailopen_worth=" + komdat_mailopen_worth + "&komdat_linkrot_worth=" + komdat_linkrot_worth + "&customerId=" + customerId + "&formmailerURL=" + formmailerURL + "&formmailerReceiver=" + formmailerReceiver + "&version=" + this.flashVersion + "&introVideo=" + introVideo + "&introThumb=" + introThumb + "&language=" + swfLang + "&rsCustomer=" + rsCustomer + "&rsPath=" + rsPath + "&rsLang=" + rsLang + "&rsUrl=" + rsUrl + "&localPath=" + localPath + "&globalPath=" + globalPath + "&startPage=" + startPage + "&startSite=" + startSite + "&logoUrl=" + logoUrl + "&imgPath=" + imgPath + "&flvPath=" + flvPath + letterParameters + sectionParameter + "&featureName=" + FEATURE_NAME);
		app.write("headervisual-zone");
	},
	stopVideo: function() { 
		var _flashObj = $(this._featureId); 
	    if(_flashObj) _flashObj.SetVariable('stopVideo','true');
	},
	looseFocus: function() {
		$(this._featureId).blur();
	},
	getFeatureId: function() {
		return this._featureId;
	}
}

var featureFlash;
document.observe("dom:loaded", function() {
	/*initialize feature*/
	featureFlash = new Feature();
});