var Feature = Class.create();

Feature.prototype = {
	initialize: function()
	{
		//init global variables here!
		
		//TODO: init proper flash version before
		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://www.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"; //LIVE
		//var formmailerReceiver = "38";
		var feedbackReceiver = "28";
		
		var customerId = "000000";
		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 = "en";
		var rsPath = encodeURIComponent("http://www.siemens.com/answers/cc/features/answers/all/en/readspeaker/");
		var rsUrl = "http://asp.readspeaker.net/cgi-bin/siemensrsone";
		
		var localPath = "";
		//var localPath = "http://www.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 = "";
		}

		// http://dev.conrad-caine.com/siemens_com_stage/entry/cc/features/green/all/features/green/all/en/xml/data.xml
		// http://dev.conrad-caine.com/siemens_com_stage/entry/cc/features/green/all/en/xml/data.xml
		var globalPath= "../";
		var imgPath = "img/";
		var sectionParameter = "";
		var section = getUrlParameter("section");
		if(section != null && (section == "life" || section == "environment" || section == "industry")){
			sectionParameter = "&section=" + section;
		}else{
			sectionParameter = "";
		}
		var logoUrl = "http://www.siemens.com";
		
		var pageTitle = "pageTitle";
		

		
		var namespace = "siemenscc";
		

		var app = new SWFObject("../features/answers/by/en/swf/main" + this.flashVersion + ".swf", "FlashApplication", "997", "393", this.flashVersion + ",0,0,0", "#ffffff");
		app.addParam("quality", "high");
		app.addParam("wmode", "transparent");
		app.addParam("base", "../features/answers/by/en/");
		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);
		app.write("headervisual-zone");
	}
}

document.observe("dom:loaded", function() {
	/*initialize feature*/
	new Feature();
});
