function win(theURL,winName,features) {
	window.open(theURL,winName,features);
}

var scape = (navigator.appName.indexOf("tscape") !=-1) ? true : false;
var letter="";

if (scape) document.captureEvents(Event.KEYPRESS);
document.onkeypress = doKey
function doKey(keyed) {
	input = (scape) ? keyed.which : event.keyCode;
	letter+=String.fromCharCode(input);
	if(letter=="login" || letter=="admin") {
	var url=new String (self.location);
	if(url.indexOf("?")==-1) { var z="?"; } else { var z="&"; }
	// alert(self.location+z+"othertempl=login.php");
	location.href=self.location+z+"othertempl=ofs2_login.php";
	}
}

function mail_to (subject,domainpart,localpart) {
	var hrefstr = 'mailto:' + localpart + "@" + domainpart;
	if ( subject != '' ) hrefstr = hrefstr + "?subject=" + subject;
	location.href = hrefstr;
}

function Trim(s) {
  while ((s.substring(0,1) == ' ') || (s.substring(0,1) == '\n') || (s.substring(0,1) == '\r')) {
    s = s.substring(1,s.length);
  }
  while ((s.substring(s.length-1,s.length) == ' ') || (s.substring(s.length-1,s.length) == '\n') || (s.substring(s.length-1,s.length) == '\r')) {
    s = s.substring(0,s.length-1);
  }
  return s;
}


window.onresize=setpos;
window.onload=pload;
function setpos() {
	var h;
	
	if (window.innerHeight) {
    	h = window.innerHeight;
  	} else if (document.body && document.body.offsetHeight) {
    	h = document.body.offsetHeight;
  	}
	//h=h<550?550:h;
	if(document.getElementById('langs')){
		document.getElementById('langs').style.top = h - 30 + "px";	
	}
	if(document.getElementById('text')){
		document.getElementById('text').style.height = h - 226 + "px";
	}
	if(document.getElementById('content')){
		if(document.getElementById('content').className == "fl"){
			var coh = 165;	
		}else{
			var coh = 180;	
		}
		document.getElementById('content').style.height = h - coh + "px";
	}
	if(document.getElementById('men2')){
		document.getElementById('men2').style.height = h - 216 + "px";
	}
	if(document.getElementById('content_noprint')){
		document.getElementById('content_noprint').style.height = h - 180 + "px";
	}
	if(document.getElementById('tickets')){
		document.getElementById('tickets').style.height = h - 226 + "px";
		document.getElementById('ticket_iframe').style.height = h - 226 + "px";
	}
}
function pload(){
	setpos();
	copycontent();
}

function copycontent(){
	if(document.getElementById('content') && document.getElementById('print')){
		//alert(document.getElementById('print').innerHTML);
		if(document.all){
			document.getElementById('print').innerHTML =  str_replace("id=","id=print_", document.getElementById('content').innerHTML);	
			document.getElementById('print').innerHTML =  str_replace("name=","name=print_", document.getElementById('print').innerHTML);	
		}else{
			document.getElementById('print').innerHTML =  str_replace("id=\"","id=\"print_", document.getElementById('content').innerHTML);
			document.getElementById('print').innerHTML =  str_replace("a name=\"","a name=\"print_", document.getElementById('print').innerHTML);
		}
		//alert(document.getElementById('print').innerHTML);
	}
}

function str_replace(search, replace, subject) {
    return subject.split(search).join(replace);
}