/* FCT: (X) Set basic parameters
*/
function PB_Default_F()
{
	PB_PARAMS["base"] 			= "http://preview.panobyte.de/PANOCITY/"; // URL to the folder of this file
//	PB_PARAMS["base"] 			= "http://localhost/PanoCity/";
	PB_PARAMS["flash_minimum"] 	= 8; // Set to "9" if russian panoramic image player should be minimum for usage
	PB_PARAMS["flash_maximum"] 	= 8; // Set to "9" if russian panoramic image player should be minimum for usage
	PB_PARAMS["revision"] 		= "R15";
	PB_PARAMS["width"]			= screen.width - 20;
	PB_PARAMS["height"]			= screen.height - 100;
	PB_PARAMS["category"]		= 0;
	PB_PARAMS["motif"]			= 0;
	PB_PARAMS["bgcolor"]		= "000000";
	PB_PARAMS["cmaster"]		= "cc0033";
	PB_PARAMS["moderation"]		= "off";
	PB_PARAMS["language"]		= "ge";
	PB_PARAMS["ie"] 			= navigator.appName.indexOf("Microsoft") != -1;
	PB_PARAMS["gui"] 			= "shown";
	PB_PARAMS["flash_current"] 	= 7;
	PB_PARAMS["debug"] 			= false;
	PB_PARAMS["plugins"]		= "DEVAL,QUICKTIME,FLASH"; // JAVA on new server: DEVAL,QUICKTIME,,FLASH
	PB_PARAMS["ptviewer"]		= "false";
}

/* ACT: (X) Set basic variables
*/
var PB_PARAMS = new Object();

var PB_ERROR_OB;
var PB_ERROR_EL = "PB_ERROR_OB";

var PB_PLAYER_C_OB;
var PB_PLAYER_OB;
var PB_PLAYER_EL = "PB_PLAYER_OB";

var PB_CONTROLLER_HEIGHTS = [20, 110];
var PB_CONTROLLER_OB;
var PB_CONTROLLER_EL = "PB_CONTROLLER_OB";

var PB_QUERY = "";

var PB_PAN = 0;
var PB_TIMER = null;

var PB_HEIGHT = 110;

// ======================================================================

/* ACT: (X) SWFObject v1.5
*/
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;

// ======================================================================

/* FCT: (X) Capture error 
*/
function L2D_Error_F(msg, line, url)
{
// <![CDATA[

 	var hr = window.location.href;		// url
  	var qs = window.location.search;	// query string
	
 	var st = PB_PARAMS["base"]+PB_PARAMS["revision"]+".php?command=Send_Report";
   	st += "&message="+escape(msg);
   	st += "&line="+escape(line);
 	st += "&url="+escape(url);
    st += "&appcode="+escape(navigator.appCodeName);	// Browser codename
    st += "&application="+escape(navigator.appName);	// Browser name
    st += "&version="+escape(navigator.appVersion);		// OS and browser version
    st += "&user="+escape(navigator.userAgent);			// HTTP header
  
	PB_ERROR_OB.innerHTML = "<img src='"+st+"' height=0 width=0>";
  	return true;
	
// ]]>
}

// ======================================================================

/* FCT: (X) Check for supported plugins
*/
function PB_Check_Plugins_F()
{
	var s_A = (PB_PARAMS["plugins"]+",FLASH").split(",");
	var r_A = [];
	var a_A = [];

	var agt = navigator.userAgent.toLowerCase();
	var ie  = (agt.indexOf("msie") != -1);
	var ns  = (navigator.appName.indexOf("Netscape") != -1);
	var win = ((agt.indexOf("win")!=-1) || (agt.indexOf("32bit")!=-1));
	var mac = (agt.indexOf("mac")!=-1);

	if (ie && win)
	{
		a_A = 	detectIE("DevalVRXCtrl.DevalVRXCtrl.1","DEVAL")+
				detectIE("QuickTimeCheckObject.QuickTimeCheck.1","QUICKTIME")+
				detectIE("ShockwaveFlash.ShockwaveFlash.1","FLASH");
	}
	
	if (ns || !win)
	{
		nse = ""; for (var i=0;i<navigator.mimeTypes.length;i++) nse += navigator.mimeTypes[i].type.toLowerCase();

		a_A = 	detectNS("application/x-devalvrx","DEVAL")+ 
				detectNS("video/quicktime","QUICKTIME")+ 
				detectNS("application/x-shockwave-flash","FLASH");
	}

	function detectIE(ClassID,name) { result = false; document.write('<SCRIPT LANGUAGE=VBScript>\n on error resume next \n result = IsObject(CreateObject("' + ClassID + '"))</SCR'+'IPT>\n'); if (result) return name+','; else return ''; }
	function detectNS(ClassID,name) { n = ""; if (nse.indexOf(ClassID) != -1) if (navigator.mimeTypes[ClassID].enabledPlugin != null) n = name+","; return n; }

	a_A += navigator.javaEnabled() ? "JAVA," : "";
	
	a_A = (a_A.length > 0) ? a_A.substring(0,a_A.length-1) : a_A;
	
	for(var i=0; i<s_A.length; i++) { var c = s_A[i]; if (a_A.indexOf(c) != -1) r_A[r_A.length] = c; }

//	alert("\nPLUGIN_AVAIL: "+a_A+"\nPLUGINS: "+s_A+"\nPLUGIN_LIST: "+r_A.join(","));

	return r_A;
}

// ======================================================================

/* FCT: (X) (Re)load player content
*/
function PB_Load_F(file_i, type_i, size_i, pan_i, fov_i, tilt_i, flash_current)
{
	/* ACT: Parse arguments
	*/
	if (!PB_Legal_F(file_i)) { PB_Error_F("PB_Load_F: no file given"); return; }
	
	PB_PARAMS["flash_current"] = parseInt(flash_current);
	
	var pan  	= PB_Legal_F(pan_i)  	? parseFloat(pan_i)  	: 0.0;
	var fov  	= PB_Legal_F(fov_i)  	? parseFloat(fov_i)  	: 60.0;
	var tilt 	= PB_Legal_F(tilt_i) 	? parseFloat(tilt_i)	: 0.0;

	PB_Unload_F(); // Unload current content
	
	switch(PB_PARAMS["plugin_list"][PB_PARAMS["plugin_index"]])
	{
		case "DEVAL":
		
			PB_FILE = file_i+type_i+size_i+".mov";
	
			fov = 45.0/fov;
			
			var autoplay = 3.0;
			var autoplayspeed = 2.0;
			
			var st = "<object id='PB_PLAYER_C' height='100%' width='100%' ";
			st +="classid='clsid:5D2CF9D0-113A-476B-986F-288B54571614' codeBase='http://www.devalvr.com/instalacion/plugin/devalocx.cab#version=0,4,9,6'>";
			st +="<param name='File' Value='"+PB_FILE+"'>";
			st +="<param name='filter' value='1'>";
			st +="<param name='bgcolor' value='"+PB_PARAMS["bgcolor"]+"'>";
			st +="<param name='progressbar' value='0'>";
			st +="<param name='toolsbar' value='0'>";
			st +="<param name='zoom' value='"+fov+"'>";
			st +="<param name='rotationx' value='"+tilt+"'>";
			st +="<param name='autoplay' value='"+autoplay+"'>";
			st +="<param name='autoplayspeed' value='"+autoplayspeed+"'>";
			st +="<param name='rotationy' value='"+pan+"'>";
			st +="<param name='resize' value='0'>";
			
			st +="<embed name='PB_PLAYER_C' width='100%' height='100%' type='application/x-devalVRX' ";
			st +="src='"+PB_FILE+"' ";
			st +="pluginspace='http://www.devalvr.com/instalacion/plugin/install.html' ";
			st +="filter='1' ";
			st +="toolsbar='0' ";
			st +="bgcolor='"+PB_PARAMS["bgcolor"]+"' ";
			st +="zoom='"+fov+"' ";
			st +="rotationx='"+tilt+"' ";
			st +="rotationy='"+pan+"' ";
			st +="autoplay='"+autoplay+"' ";
			st +="autoplayspeed='"+autoplayspeed+"' ";
			st +="progressbar='0' ";
			st +="resize='0' ";
			st +="></embed>";
			
			st +="</object>";
			
			PB_PLAYER_OB.innerHTML = st;
			
			if (!PB_PARAMS["ie"]) PB_PLAYER_C_OB = document.PB_PLAYER_C;
			else PB_PLAYER_C_OB = document.getElementById("PB_PLAYER_C");
			
			break;
		
		case "QUICKTIME":
		
			PB_FILE = file_i+type_i+size_i+".mov";
			
			var st = "<object id='PB_PLAYER_C' height='100%' width='100%' type='video/quicktime' ";
			st +="classid='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B' codebase='http://www.apple.com/qtactivex/qtplugin.cab'>";
			st +="<param name='name' value='PB_PLAYER_C'>";
			st +="<param name='src' value='"+PB_FILE+"'>";
			st +="<param name='enablejavascript' value='true'>";
			st +="<param name='correction' value='full'>";
			st +="<param name='kioskmode' value='true'>";
			st +="<param name='scale' value='tofit'>";
			st +="<param name='controller' value='false'>";
			st +="<param name='saveembedtags' value=true'>";
			st +="<param name='fov' value='"+fov+"'>";
			st +="<param name='tilt' value='"+tilt+"'>";
			st +="<param name='pan' value='"+pan+"'>";
		
			st +="<embed name='PB_PLAYER_C' height='100%' width='100%' type='video/quicktime' ";
			st +="src='"+PB_FILE+"' ";
			st +="pluginspace='http://appldnld.m7z.net/qtinstall.info.apple.com/pthalo/us/win/QuickTimeFullInstaller.exe' ";
			st +="controller='false' ";
			st +="saveembedtags='true' ";
			st +="scale='tofit' ";
			st +="correction='full' ";
			st +="enablejavascript='true' ";
			st +="kioskmode='true' ";
			st +="fov='"+fov+"' ";
			st +="tilt='"+tilt+"' ";
			st +="pan='"+pan+"' ";
			st +="></embed>";
			
			st +="</object>";
			
			PB_PLAYER_OB.innerHTML = st;
			
			if (!PB_PARAMS["ie"]) PB_PLAYER_C_OB = document.PB_PLAYER_C;
			else PB_PLAYER_C_OB = document.getElementById("PB_PLAYER_C");
			
			PB_Autospin_F(true);
			break;

		case "JAVA":
			
			if (PB_PARAMS["ptviewer"] != "true")
			{
				/* IMMERVISION PURE PLAYER 
				*/
				PB_FILE = file_i+"9"+size_i+".xml";

				var st = "<applet id='PB_PLAYER_C' height='100%' width='"+PB_PARAMS["width"]+"' archive='PurePlayer.jar' code='PurePlayer'>";
				st +="<param name='panorama' value='"+PB_FILE+"'>";
//				st +="<param name='bgcolor' value='0x00000000'>"; 
				st +="<param name='hidegui' value='true'>"; 
				st +="<param name='imgLoadFeedback' value='false'>"; 
				st +="<param name='singlepanorama' value='true'>"; 
//				st +="<param name='quality' value='100'>";
				st +="<param name='optimizememory' value='true'>";
				st +="<param name='antialiasing' value='everytime'>";
				st +="</applet>";
			}
			else
			{
				/* PTVIEWER
				*/
				PB_FILE = file_i+type_i+size_i+".ptvref";

				fov = 90;
			
				var st = "<applet id='PB_PLAYER_C' height='100%' width='"+PB_PARAMS["width"]+"' archive='ptviewer.jar' code='ptviewer.class'>";
				st +="<param name='file' value='"+PB_FILE+"'>";
				st +="<param name='showToolbar' value='false'>"; 
				st +="<param name='fov' value='"+fov+"'>";
				st +="<param name='tilt' value='"+tilt+"'>";
				st +="<param name='pan' value='"+pan+"'>";
				st +="<param name='cache' value='false'>";
				st +="<param name='antialiasing' value='true'>";
//				st +="<param name='quality' value='bi'>";
				st +="</applet>";
			}

			PB_PLAYER_OB.innerHTML = st;
			
			if (!PB_PARAMS["ie"]) PB_PLAYER_C_OB = document.PB_PLAYER_C;
			else PB_PLAYER_C_OB = document.getElementById("PB_PLAYER_C");
					
			break;

		case "FLASH":
		
			/* Wrap on for FLASH 8 panoramic image player
			*/		
// X		if ((PB_PARAMS["flash_current"] == 8) || (PB_PARAMS["flash_maximum"] < 9))
// X		{
				PB_FILE = file_i+"1"+size_i+".swf";

				var d = new SWFObject(PB_PARAMS["base"]+PB_PARAMS["revision"]+"_FC.swf", "PB_PLAYER_C", "100%", "100%", "8", "#000000", false, "low");
			
				d.addParam("menu", 					"false");
//				d.addParam("wmode", 				"opaque");
				d.addParam("allowscriptaccess", 	"always");
				d.addParam("base",					PB_PARAMS["base"]);
				d.addVariable("language", 			PB_PARAMS["language"]);
				
				d.addVariable("parameters", 		PB_FILE+"|"+PB_PARAMS["width"]+"|"+(PB_PARAMS["height"]-PB_HEIGHT)+"|"+pan*1000+"|"+tilt*1000+"|"+fov*1000);
				d.write(PB_PLAYER_EL);
// X		}
			
			/* FLASH 9 panoramic image player
	 		*/
/* X		if ((PB_PARAMS["flash_current"]) >= 9 && (PB_PARAMS["flash_maximum"] >= 9))
			{
				PB_FILE = file_i+"4"+size_i+".swf?xml_file="+file_i+"4"+size_i+".xml&panoName="+file_i+"4"+size_i;

				var d = new SWFObject(PB_FILE, "PB_PLAYER_C", "100%", "100%", "9", "#000000", false, "high");
			
				d.addParam("menu", 					"false");
				d.addParam("wmode", 				"opaque");
				d.addParam("allowscriptaccess", 	"always");				
				d.write(PB_PLAYER_EL);
			}
X */
			if (!PB_PARAMS["ie"]) PB_PLAYER_C_OB = document.PB_PLAYER_C;
			else PB_PLAYER_C_OB = document.getElementById("PB_PLAYER_C");
			
			break;
	}
	
//	alert(PB_PARAMS["plugin_list"][PB_PARAMS["plugin_index"]]+" / "+PB_FILE);
}

// ======================================================================

/* FCT: (X) Adapt window size to dimensions [x, y]
*/
function PB_Resize_F(x_i, y_i)
{
	/* Parse arguments
	*/
	if (!PB_Legal_F(x_i)) { PB_Error_F("PB_Resize_F: no x value given"); return; }
	if (!PB_Legal_F(y_i)) { PB_Error_F("PB_Resize_F: no y value given"); return; }

	var x = Math.floor(parseFloat(x_i));
	var y = Math.floor(parseFloat(y_i));
		
	var ix, iy, ox, oy, nx, ny;
	
	if (x > 800) {
		window.moveTo(0,0);
		window.resizeTo(window.screen.availWidth, window.screen.availHeight);
		window.focus();
	}	
	else {
		if (self.innerHeight) // handle all browsers except IE
		{
			ix = self.innerWidth;
			iy = self.innerHeight;
			ox = self.outerWidth;
			oy = self.outerHeight;
		
			nx = x+(ox-ix);
			ny = y+(oy-iy);
		}
		else if (document.body && document.body.offsetHeight) // IE needs workaround with double resize
		{
			ix = document.body.clientWidth;
			iy = document.body.clientHeight;
	
			window.resizeTo(x,y); // intermediate resize
		
			nx = x+(x-document.body.clientWidth);
			ny = y+(y-document.body.clientHeight);
		}
		
		window.moveTo((screen.width-nx)/2,(screen.height-ny)/2);
		window.resizeTo(nx,ny);
		window.focus();
	}
}

// ======================================================================

/* FCT: (X) Extract JS query string parameters (coded like v1=c1;v2=c2;...)
*/
function PB_Parse_Query_F(query)
{
	if (!query) return;
	
	PB_QUERY = query;
	
	var pairs_A = query.split(/[;&]/);
	var kv;
	var v;
	
	for (var i=0; i<pairs_A.length; i++) {
		kv = pairs_A[i].split('='); if (!kv || kv.length!=2) continue;
		v = unescape(kv[1]).replace(/\+/g,' ');
		if (PB_Legal_F(v)) PB_PARAMS[unescape(kv[0])] = v;
		
//		alert(unescape(kv[0])+" = "+v);
	}
}

// ======================================================================

/* FCT: (X) Open application as widget in popup
*/
function PB_Popup_F(query_string_i)
{
	/* Determine popup of application
	*/
	switch(PB_PARAMS["mode"]) {

		case "widget":	var url 	= PB_PARAMS["base"]+PB_PARAMS["revision"]+".html?"+PB_QUERY+"&"+query_string_i+"&mode=intern";
						var params 	= "toolbar=0,titlebar=no,hotkeys=no,location=no,directories=0,menubar=0,scrollbars=0,status=0,resizable=0";

						var PB_POPUP = window.open(url, "PB_POPUP", params);
						
						break;

		case "intern":	var url 	= PB_PARAMS["base"]+PB_PARAMS["revision"]+".html?"+query_string_i;
		
						window.location = url;
						
						break;
		
		case "inline":	PB_Clear_F();
 
 						var url 	= PB_PARAMS["base"]+PB_PARAMS["revision"]+".html?"+query_string_i;
						var params 	= "toolbar=0,titlebar=no,hotkeys=no,location=no,directories=0,menubar=0,scrollbars=0,status=0,resizable=0";

						var PB_POPUP = window.open(url, "PB_POPUP", params);
						
						break;
	}
}

// ======================================================================

/* FCT: (E) Set info message in player div due to popup
*/
function PB_Clear_F()
{
	PB_Autospin_F(false);

	var st = "<table bgcolor='#000000' style='padding:0px; border-style:none; margin:0px; width:100%; height:100%;'>";
	st +="<tr valign='middle'>";
	st +="<td align='center'>";
	st +="<font color='#eeeeee' face='Arial, Helvetica, sans-serif' size='1'>";
	
	switch(PB_PARAMS["language"])
	{
		case "en":
			st +="<b>This player region was deactivated when you opened the full-screen mode.";
			st +="<br>";
			st +="Please select a new motif to reactivate the presentation.</b>";
			break;
	
		case "ge":
		default:
			st +="<b>Der Player-Bereich wurde durch Anwahl des Full-Screen Modus deaktiviert.";
			st +="<br>";
			st +="Bitte wählen Sie ein neues Motiv, um die Darstellung zu reaktivieren.</b>";
			break;	
	}
	
	st +="</font>";
	st +="</td>";
	st +="</tr>";
	st +="</table>";

	PB_PLAYER_OB.innerHTML = st; // QUICKTIME will not be hidden
}

// ======================================================================

/* FCT: (X) Unload player content
*/
function PB_Unload_F()
{
	PB_PLAYER_OB.innerHTML = "";
	clearTimeout(PB_TIMER);
}

// ======================================================================

/* FCT: (X) Return true if 'v' is not trivial
*/
function PB_Legal_F(v)
{
	return (v!="" && typeof(v)!="undefined" && v!="null");	
}

// ======================================================================

/* FCT: (X) Display message in debug mode
*/
function PB_Message_F(m)
{
	if (PB_PARAMS["debug"]) alert("MSG: "+m);
}


// ======================================================================

/* FCT: (X) HTML embedding of player and controller
*/
function PB_Insert_F()
{
	/* ACT: Parse arguments
	*/
	if (!PB_Legal_F(PB_PARAMS["project"])) { PB_Error_F("PB_embed_F: no project given"); return; }
	
	/* ACT: Set appropriate controller height 'hc'
	*/
	
//	var hc = PB_CONTROLLER_HEIGHTS[1];
//	var hp = PB_PARAMS["height"] - hc;

	if (PB_PARAMS["width"] > 800)
	{
		if (self.innerHeight)
		{
			PB_PARAMS["height"] = self.innerHeight;
			PB_PARAMS["width"] = self.innerWidth;
		}
		else if (document.body && document.body.offsetHeight) // IE needs workaround
		{
			PB_PARAMS["height"] = document.body.clientHeight;
			PB_PARAMS["width"] = document.body.clientWidth;
		}
	}
	
	if (PB_PARAMS["gui"] == "hidden") PB_HEIGHT = 0.1;
	
	/* ACT: Initialize ERROR div
	*/
	var st = "<div id='"+PB_ERROR_EL+"' style='visibility:hidden; clear:both; float:none; height:0; line-height: 0; font-size: 0.1px; position:relative; border:0px; padding:0px; left:0; top:0; width:0; margin-left:0; margin-top:0;'>";
	st +="</div>";
	document.write(st);

	PB_ERROR_OB = document.getElementById(PB_ERROR_EL);

	/* ACT: Initialize PLAYER div
	*/
	var st = "<div id='"+PB_PLAYER_EL+"' style='position:relative; border:0px; padding:0px; left:0; top:0; width:"+(PB_PARAMS["width"])+"px; height:"+(PB_PARAMS["height"]-PB_HEIGHT)+"px; margin-left:0; margin-top:0;'>";
	st +="<table bgcolor='#000000' style='padding:0px; border-style:none; margin:0px; width:100%; height:100%;'>";
    st +="<tr valign='middle'>";
    st +="<td align='center'>";
	st +="&nbsp;";
	st +="</td>";  
    st +="</tr>";
  	st +="</table></div>";
	document.write(st);
	
	PB_PLAYER_OB = document.getElementById(PB_PLAYER_EL);

	/* ACT: Initialize CONTROLLER div
	*/
	var st = "<div id='"+PB_CONTROLLER_EL+"' style='position:relative; border:0px; padding:0px; left:0; top:0; width:"+(PB_PARAMS["width"])+"px; height:"+PB_HEIGHT+"px; margin-left:0; margin-top:0;'>";
	st +="<table bgcolor='#000000' style='padding:0px; border-style:none; margin:0px; width:100%; height:100%;'>";
    st +="<tr valign='middle'>";
    st +="<td align='center'>";
	st +="<font color='#eeeeee' face='Arial, Helvetica, sans-serif' size='1'>";
			
	switch(PB_PARAMS["language"])
	{
		case "en":
			st +="<b>This 360° panoramic image gallery uses features of ADOBEs FLASH <sup><font size='1'>&reg;</font></sup> V"+PB_PARAMS["flash_minimum"]+".<br>";
			st +="Unfortunately your system indicates no or an older version of the plugin.<br>";
			st +="Please restart this page after your ";
			st +="<a href='http://www.macromedia.com/go/getflashplayer' target='_blank' style='text-decoration:none'><font color='#cc3300'>UPDATE</font></a></b>";
			break;
				
		case "ge":
		default:
			st +="<b>Diese 360° Pr&auml;sentation nutzt Features von ADOBEs FLASH <sup><font size='1'>&reg;</font></sup> V"+PB_PARAMS["flash_minimum"]+".<br>";
			st +="Leider ist auf Ihrem System keine oder eine ältere Version des Plugins installiert.<br>";
			st +="Starten Sie diese Seite nach Ihrem ";
			st +="<a href='http://www.macromedia.com/go/getflashplayer' target='_blank' style='text-decoration:none'><font color='#cc3300'>UPDATE</font></a> ";
			st +="bitte erneut.</b>";
			break;	
	}
			
	st +="</font>";
	st +="</td>";  
    st +="</tr>";
  	st +="</table>";
	st +="</div>";
	document.write(st);
	
	PB_CONTROLLER_OB = document.getElementById(PB_CONTROLLER_EL);
	
	/* ACT: Insert FLASH controller
	*/
	var d = new SWFObject(PB_PARAMS["base"]+PB_PARAMS["revision"]+".swf", "L2D_CONTROLLER", "100%", "100%", PB_PARAMS["flash_minimum"], "#000000", false, "high");	

	d.addParam("menu", 				"false");
 	d.addParam("wmode",				"opaque");
	d.addParam("allowscriptaccess", "always");
	d.addParam("base",				PB_PARAMS["base"]);

	d.addVariable("base",			PB_PARAMS["base"]);
	d.addVariable("plugins", 		PB_PARAMS["plugins"]);
	d.addVariable("plugin_list", 	PB_PARAMS["plugin_list"].join("|"));
	d.addVariable("plugin_index", 	PB_PARAMS["plugin_index"]);
	d.addVariable("project", 		PB_PARAMS["project"]);
	d.addVariable("category", 		PB_PARAMS["category"]);
	d.addVariable("motif", 			PB_PARAMS["motif"]);
	d.addVariable("cmaster", 		PB_PARAMS["cmaster"]);	
	d.addVariable("moderation", 	PB_PARAMS["moderation"]);
	d.addVariable("language", 		PB_PARAMS["language"]);
	
	d.addVariable("ewidth", 		PB_PARAMS["width"]);
	d.addVariable("eheight", 		PB_PARAMS["height"]);
	d.addVariable("ptviewer", 		PB_PARAMS["ptviewer"]);
	
	d.write(PB_CONTROLLER_EL);
}

// ======================================================================

/* FCT: (X) Initialize application
*/
function PB_Init_F()
{
	/* Set default parameters
	*/
	PB_Default_F();
	
	/* Set error handler
	*/
	if (!PB_PARAMS["debug"]) window.onerror = L2D_Error_F;

	/* Parse potential query string of JS
	*/
	var scripts_A = document.getElementsByTagName('script');
	
	PB_Parse_Query_F(scripts_A[scripts_A.length-1].src.replace(/^[^\?]+\??/,''));

	/* Parse query string of url in addition if mode is 'intern' 
	*/
	if (PB_PARAMS["mode"] == "intern") PB_Parse_Query_F(location.href.split("?")[1]);
	
	/* Check for player choices (by matching the specified and available priority list)
	*/
	PB_PARAMS["plugin_list"]	= PB_Check_Plugins_F();
	PB_PARAMS["plugin_index"]	= 0;
	
	/* Determine usage mode of application
	*/
	switch(PB_PARAMS["mode"]) {

		case "widget":	break;

		case "intern":	/* Open application as widget
						*/
 						PB_Resize_F(PB_PARAMS["width"], PB_PARAMS["height"]); // Resize window

						// go on with inline
		
		case "inline":	/* Override auto plugin selection
						*/
						if (PB_PARAMS["plugin_selection"])
						{
							var c = PB_PARAMS["plugin_selection"].toUpperCase();

							for(var i=0; i<PB_PARAMS["plugin_list"].length; i++)
							{
								if (PB_PARAMS["plugin_list"][i] == c) { PB_PARAMS["plugin_index"] = i; break; }
							}
						}

						/* Insert application
						*/
						PB_Insert_F();
						break;
	}
}

// ======================================================================

/* FCT: (X) Initialize panning (currently for QUICKTIME)
*/
function PB_Autospin_F(start)
{
    if (start) {
		var st = "uninitialized";
		
		switch(PB_PARAMS["plugin_list"][PB_PARAMS["plugin_index"]])
		{
			case "QUICKTIME":
			default:			// Check should be made against "function", but IE reports "unknown" only
								if (typeof PB_PLAYER_C_OB.GetPluginStatus != "undefined")
									st = PB_PLAYER_C_OB.GetPluginStatus().toUpperCase();	
								break;
		}

		if (st != "COMPLETE") { PB_TIMER = setTimeout("PB_Autospin_F("+start+")", 3000); return; }	
		PB_PAN = PB_PLAYER_C_OB.GetPanAngle();	
		PB_Autorotate_F();
	}
	else clearTimeout(PB_TIMER);
}

// ======================================================================

/* FCT: (X) Maintain panning (currently for QUICKTIME)
*/
function PB_Autorotate_F()
{
	var p = 0;
	
 	switch(PB_PARAMS["plugin_list"][PB_PARAMS["plugin_index"]])
	{
		case "QUICKTIME":
		default:			p = PB_PLAYER_C_OB.GetPanAngle(); break;
	}
	
    var d = PB_PAN-p; if (d == Number.NaN) return; d = Math.abs(d);
	
	if (d>=1 && d<=359) { PB_TIMER = setTimeout("PB_Autospin_F(true)", 3000); return; }
	
	PB_PAN -= 0.05; while (PB_PAN<0) PB_PAN += 360;
		 
	switch(PB_PARAMS["plugin_list"][PB_PARAMS["plugin_index"]])
	{
		case "QUICKTIME":
		default:			PB_PLAYER_C_OB.SetPanAngle(PB_PAN); break;
	}

	PB_TIMER = setTimeout("PB_Autorotate_F()", 40);
}

// ======================================================================

/* FCT: (X) Initialization
*/

PB_Init_F();