


var formOpen = false; var h = 0; var seth = 76;
var av = true;

var world;
var curLink;
var name;


function FileBrowser(cw) { 

	rcolsize(384); hoehe();
	document.getElementById('rcontent').innerHTML = "";
	
	var inhalt ='<div style="position:relative; padding:13px;">';
	inhalt +='File Upload for scene: '+cw+'<br><br>';
	inhalt +='This is the upload page for your home folder.<br><br>';
	inhalt +='The following media formats can be used:<br>JPG, PNG, OGV (video), OGG (audio) and UNITY3D (3d model).<br><br>';
	inhalt +='Upload limit per file is 5Mb.<br><br><br>';
	inhalt +='<form name="uploadFb" enctype="multipart/form-data" method="POST" target="hiddenFrame" action="_system/setup/filebrowser.php">';
	inhalt +='<input type="hidden" name="linkFb" value="'+cw+'">';	
	inhalt +='<input name="uploadMediaFb" type="file" onChange="LoadingText();this.form.submit()"></form>';
	inhalt +='<br><span id="resultFb"></span>';
	inhalt +='<br><br><a href="javascript:closeText();">Close >></a>';
	
	document.getElementById('rcontent').innerHTML = inhalt;	
	
	/*
	inhalt +='<form id="getFiles" method="POST" target="hiddenFrame" action="_system/setup/getfiles.php">';
	inhalt +='<input type="hidden" name="sendCw" value="'+cw+'">';
	inhalt +='</form>';	
	inhalt +='<span id="resultFiles"></span>';
	inhalt +='</div>';		  
	document.getElementById('rcontent').innerHTML = inhalt;	
	document.forms.getFiles.submit();
	*/
	
	/*
	document.getElementById('rbottom').innerHTML = "";
	var cBottom ='<form name="uploadFb" enctype="multipart/form-data" method="POST" target="hiddenFrame" action="_system/setup/filebrowser.php">';
	cBottom +='<input type="hidden" name="linkFb" value="'+cw+'">';	
	cBottom +='<span id="resultFb">Content Upload: </span>';
	cBottom +='<input name="uploadMediaFb" type="file" onChange="this.form.submit()">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</form>';
	document.getElementById('rbottom').innerHTML = cBottom;
	*/
	
	
	
}
function LoadingText() { document.getElementById('resultFb').innerHTML = 'Uploading...'; }

function SendUrl() {
	GetUnity().SendMessage("objects", "LoadFiles", ""); 
}

function SearchImages(cw, x) { 

	rcolsize(384); hoehe();
	document.getElementById('rcontent').innerHTML = "";
	var scr = x+1;	
	var inhalt ='<div style="position:relative; padding:13px;">';
	inhalt +='Current Scene: '+cw+' &nbsp;&nbsp;&nbsp;&nbsp; Selected: MediaObject'+scr+'<br><br>';
	inhalt +='<a href="javascript:FileBrowser(\''+cw+'\',\''+x+'\');">Private Images</a> | <a href="javascript:;">Public Images</a> | Search Images<br><br>';
	
	inhalt +='<span id="imgSearchControl" class="search-control"></span>';
	inhalt +='<span class="clear"></span>';
    inhalt +='<span id="imageContainer"></span>';
	
	inhalt +='</div>';		  
	document.getElementById('rcontent').innerHTML = inhalt;
	
	StartSearch();
	
}

/*************************************************/
/* OpenLink */
/*************************************************/
function OpenLink(link) { 
	window.open(link);
}


/*************************************************/
/* CMS: SetWorldName */
/*************************************************/
function SetWorldName(w) {
	world = w;
}


/*************************************************/
/* CMS: updateThumb */
/*************************************************/
function updateThumb() {
	var t = parseInt( Math.random() * 10000);
	var b = new Image(); 
	b.src = curLink+"?"+t; 
	document.curTh.src = b.src;
}



/*************************************************/
/* CMS: updateMedia */
/*************************************************/
function updateMedia() { 
	GetUnity().SendMessage(name, "LoadMedia", ""); 		 		
}



/****************************************************************/
/* CMS: getMedia */
/* Unity tells if there is a video or a picture on the screen */
/****************************************************************/
function getMedia(obj) { 
	
	var nameAndType = obj.split('&');
	name = nameAndType[0];
	var type = nameAndType[1];
	
	var file = ".jpg"
	if (type == "video") file = ".ogv";
	
	curLink = "_worlds/" + world + "/cms/" + name + file;
	
	var t = parseInt( Math.random() * 10000);
	
 	rcolsize(325); 
 	hoehe();	
 	
	var inhalt = '<table border="0" cellspacing="0" cellpadding="0">';
	inhalt+='<tr><td style="width:10px;" valign="top"><a href="javascript:closeText();"><img src="_system/setup/layout/rcol_pfeil2.jpg"></a></td>';
	inhalt+='<td valign="top" style="padding:5px;"><br><br>';
	inhalt+='<form name="upload" enctype="multipart/form-data" method="POST" target="hiddenFrame" action="_system/setup/upload.php">';
	inhalt+='<input type="hidden" name="curLink" value="'+curLink+'">';
	inhalt+='<br><br><strong>"'+ world.toUpperCase() + '"</strong><br>';		
	inhalt+='<br><strong>Administration f&uuml;r Flaeche: <br><br><i>'+name+file+'</i></strong>';
	inhalt+='<br><a href="'+curLink+'?'+t+'" target="_blank"><img name="curTh" ';
	
	if (file == ".jpg") {
		inhalt+= 'src="'+"_worlds/" + world + "/cms/" + name + '.jpg?'+t+'" width="100"></a>';
	}
	else {
		inhalt+= 'src="'+"_worlds/" + world + "/cms/video_thumb.jpg?"+t+'" width="100"></a>';
	}
	inhalt+='<br><br><br><strong>Upload Bild oder Video</strong>';
	inhalt+='<br>M&ouml;gliche Dateitypen: jpg, ogv';
	inhalt+='<br>Maximale Dateigr&ouml;sse: 5 MB';
	inhalt+='<br><br><input name="uploadMedia" type="file" onChange="this.form.submit()">';
	inhalt+='<br><div id="result"><br><br><br></div>';	
	inhalt+='<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:help();">Hilfe</a>';
	inhalt+='&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:closeText();">Schliessen</a>';
	inhalt+='<br><br><hr></form>';	
	
	inhalt+='</td><td style="width:10px;">&nbsp;</td></tr>';	  
	inhalt+='</table>';
	
	document.getElementById('rcontent').innerHTML = inhalt;
}



/****************************************************************/
/* CMS: openInfo */
/* stilwerk bag */
/****************************************************************/
function openInfo(obj) { 
	
	curLink = "_worlds/stilwerk/cms/tasche.jpg";
	
 	rcolsize(320); 
 	hoehe();	
 	
	var inhalt = '<table border="0" cellspacing="0" cellpadding="0">';
	inhalt+='<tr><td style="width:10px;" valign="top"><a href="javascript:closeText();"><img src="_system/setup/layout/rcol_pfeil2.jpg"></a></td>';
	inhalt+='<td valign="top" style="padding:1px;"><br><br>';
	inhalt+='<strong>&nbsp;&nbsp;&nbsp;&nbsp;'+ 'STILWERK HAMBURG' + '</strong><br><br><br>';	
		
	inhalt+='<br><strong>&nbsp;&nbsp;&nbsp;&nbsp;Tasche Weekender<br><br></strong>';
	inhalt+='<i>&nbsp;&nbsp;&nbsp;&nbsp;Design: Ralph von Gemert<br><br></i>';
	
	inhalt+='<a href="'+curLink+'" target="_blank"><img src="'+curLink+'" name="curTh"></a>';
	
	inhalt+='<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:help();">Hilfe</a>';
	inhalt+='&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:closeText();">Schliessen</a>';
	inhalt+='<br><br>';	
	
	inhalt+='</td><td style="width:10px;">&nbsp;</td></tr>';	  
	inhalt+='</table>';
	
	document.getElementById('rcontent').innerHTML = inhalt;
}



function hoehe() {
  if (self.innerHeight) { h = self.innerHeight-seth; }
  else if (document.documentElement && document.documentElement.clientHeight) { h = document.documentElement.clientHeight-seth; }
  else if (document.body) { h = document.body.clientHeight-seth; }  
  document.getElementById('rcontent').style.height = h+"px";  
}
function rcolsize(n) {
    document.getElementById('rcol').style.width = n+'px';	
}
function closeText() {
	formOpen = false;
	document.getElementById('rcontent').innerHTML = "";
	document.getElementById('rcontent').style.height = 0+"px";
    rcolsize(0);		
}
function FormOpen() {
	if (formOpen) { formOpen = false; closeText(); }
	else { formOpen = true; contact(); }
}

function doload() {
    //if (formOpen) contact();
		hoehe();
}

function contact() { 
	rcolsize(400); hoehe();
	document.getElementById('rcontent').innerHTML = "";
	
	var inhalt ='<div style="position:relative; padding:13px;"><br>'; 
 
	inhalt+='<form name="contact" method="POST" target="hiddenFrame" action="_system/setup/contact.php">';
	inhalt+='<strong>VIP-Anfrage:</strong>';
	
	inhalt+='<br><br><br>Angaben zur Person: &nbsp;&nbsp;(* notwendige Angaben)<br>';
	inhalt+='<table width="370" style="height:125px;" border="0" cellspacing="0" cellpadding="0">';          
    inhalt+='<tr><td width="130">Unternehmen:</td><td><input name="company" type="text" size="20"></td></tr>';
    inhalt+='<tr><td>Name*:</td><td><input name="surname" type="text" size="20"></td></tr>';
	inhalt+='<tr><td>Vorname*:</td><td><input name="firstname" type="text" size="20"></td></tr>';
	inhalt+='<tr><td>E-Mail*:</td><td><input name="email" type="text" size="20"></td></tr>';
	inhalt+='<tr><td>Telefon:</td><td><input name="telefon" type="telefon" size="20"></td></tr>';
    inhalt+='</table>';	
	
	inhalt+='<br><br>Interesse an folgenden Bereichen im VIP-Club West:<br>';
	inhalt+='<table width="370" style="height:67px;" border="0" cellspacing="0" cellpadding="0">';          
    inhalt+='<tr><td width="312"><input name="vip1" type="checkbox" value="vip1"> VIP-Logen West</td></tr>';
	inhalt+='<tr><td><input name="vip2" type="checkbox" value="vip2"> Business-Class West (Restaurant)</td></tr>';
	inhalt+='<tr><td><input name="vip3" type="checkbox" value="vip3"> Premium Lounge VIP West</td></tr>';
    inhalt+='</table><br>';
	inhalt+='Download: <a href="_system/setup/vip-bereiche.pdf" target="_blank">&Uuml;bersicht VIP-Bereiche</a>';	
	
	inhalt+='<br><br>Bemerkungen:<br>'; 
	inhalt+='<textarea name="comments" cols="30" rows="5"></textarea><br><br><br>';	
	inhalt+='<input type="submit" value="Senden"><br><br>';
	inhalt+='<div id="contactResult"></div>';
	inhalt+='</form>';
	inhalt+='</div>';
		  
	document.getElementById('rcontent').innerHTML = inhalt;
}

function Avchat(name) { 	
	var inhalt = '';
	if (av == false) { 
		av = true;		    	
		document.getElementById("bottom").style.height = 0+'px';
		document.getElementById("bottom").innerHTML = '';
		seth=76;
		hoehe();
	}
	else { 
		av = false;
		document.getElementById("bottom").style.height = 200+'px';
		inhalt = '<embed src="_system/SmartVideoConference.swf?name='+name+'" quality="high" bgcolor="#869ca7"';
        inhalt+= 'width="100%" height="200" name="SmartVideoConference" align="middle"';
        inhalt+= 'play="true" loop="false" quality="high" allowScriptAccess="sameDomain"';
        inhalt+= 'type="application/x-shockwave-flash" ';
        inhalt+= 'pluginspage="http://www.adobe.com/go/getflashplayer">';
     	inhalt+= '</embed>';		
		
		document.getElementById("bottom").innerHTML = inhalt;
		seth=276;
		hoehe();		
	}			 		
}