//---> all scripts written by Ulli Stemmeler/all scripts by: Ulli@Stemmeler.net
if(location.toString().indexOf("Script=0")>-1) { loc=location.toString(); loc=loc.replace("Script=0","Script=1"); location.replace(loc); }
onerror=fehlermeldung;

var myself=basename(location.toString()), myname=self.name.toString(), mypath=location.toString(); 

var Lang=(location.toString().indexOf("Lang=de")>0) ? "de":"en";
if(myname=="TamborContent") { onload=mystartup; }

var ns4 = (document.layers) ? true:false
var op=(navigator.userAgent.toLowerCase().match("opera")) ? true:false
var ie = (document.all && !op) ? true:false
var ns6=(navigator.userAgent.toLowerCase().match("netscape6")) ? true:false
var ns7=(navigator.userAgent.toLowerCase().indexOf("netscape/7")>0) ? true:false
var moz=((navigator.userAgent.toLowerCase().match("mozilla"))&&(navigator.userAgent.toLowerCase().match("gecko"))&&(!ns6)&&(!ns7)) ? true:false
var icab=(navigator.userAgent.toLowerCase().match("icab")) ? true:false
var modernbrowser=(document.getElementById) ? true:false
var ie4=(!modernbrowser && ie) ? true:false;
var gurkenbrowser=ns4 ? true:false
var netscapefamily=(ns4 || ns6 || ns7 || moz) ? true:false
var modernnetscape=(ns6 || ns7 || moz) ? true:false
var notgurkenbrowser=(modernbrowser || ie4) ? true:false
var is_mac=(navigator.platform.toLowerCase().match("mac")) ? true:false
var is_win=(navigator.platform.toLowerCase().match("win")) ? true:false
var is_win_ie=((ie) && (navigator.platform.toLowerCase().match("win"))) ? true:false
var is_mac_ie=((ie) && (navigator.platform.toLowerCase().match("mac"))) ? true:false
var knowsComplete=(ie || (is_win && op)) ? true:false

var separator="\n"; 
if(is_mac_ie) { separator="\r"; }
if(is_win_ie) { separator="\r\n"; }

if (ns4) {
var Breite_vor_resize = self.innerWidth;
var Hoehe_vor_resize  = self.innerHeight;
self.focus();
}

var mousex=0,mousey=0;
var windefstat="Tambor";
window.defaultStatus=windefstat; 
var imgzoom=10;
getUserLanguage();
// if(mypath.indexOf("service")<0) frame_safe();

function frame_safe() {
  if(self==top && !is_top()) { 
   CN=get_GetVar("CN",location); Lang=get_GetVar("Lang",location); 
   if(Lang) ML="Lang="+Lang+"?"; else ML="Lang="+getUserLanguage()+"?"; 
   if(CN) mys=CN; else mys=myself; mys=mys.replace(".php","").replace(".html","").replace(".htm","");
   root=""; if(mys.indexOf("-prg")>0 || mys.indexOf("show_veranstaltung")>0) { mys="Programme:"+mys; root="../"; }
   top.location.replace(root+"index.php?"+ML+"Script=1&TK="+mys); 
  }
}

function is_top() {
 return (myself.indexOf("index")>0 || myself.indexOf("start")>0 || myself.indexOf("showpressrelease")>0) ? false:true;
}

function getUserLanguage() {
 var ML="en";
 if(navigator.language) ML=navigator.language;
 else if(navigator.userLanguage) ML=navigator.userLanguage;
 if(ML.indexOf("de")>-1) return "de";
 else return "en";
}

function fehlermeldung() {
  return false;
}

function mystartup() {
 if(top.frames.TamborHead) {
   if(top.frames.TamborHead.CurrPath) {
     MyTitle=TitleHL.replace("Tambor ","").replace("Tambor ","").replace("Tambor ","");
     MyTitle=uc_words(MyTitle);
     top.frames.TamborHead.CurrPath(MyTitle,location.toString());
   }
   else window.setTimeout("mystartup()",1000);
 }
 else window.setTimeout("mystartup()",1000);
}

function check_plugin(MType,AXControl) {
var check=0;
if(is_win_ie) { var iecheck=is_plugin(AXControl); if(iecheck) check=1; }
else if(is_mac_ie && ie4) { alert("Ihr Browser ist leider volllkommen veraltet!\nYour Browser is too old!"); return 0; }
else if (navigator.mimeTypes[MType]) {  if(navigator.mimeTypes[MType].enabledPlugin!=null) { check=1; } } 
return check;
}

function init_plugin_check() {
if(is_win_ie) dr("<script language=\"VBScript\">\n\nfunction is_plugin(AXObj)\n On Error Resume Next\n  is_plugin=(IsObject(CreateObject(AXObj)))\nend function\n</script>\n\n");
else dr("<script type=\"text/javascript\">\nfunction is_plugin(AXObj) {\nreturn false;\n}\n</script>\n\n");
}

function zurueckgehen() {
 if(opener) { opener.focus(); window.close(); }
 else { history.back(); }
}

function validEMail(adr) {
var check=/[a-zA-Z0-9_]+@[a-zA-Z0-9_-]+\.[a-zA-Z0-9_]+/;
if(adr.toLowerCase().match("ä|ö|ü|ß| ")) return false;
return check.test(adr);
}

function validHomepage(adr) {
var check=/[a-zA-Z0-9-]+\.[a-zA-Z0-9]+/;
if(adr.toLowerCase().match("ä|ö|ü|ß| ")) return false;
if(adr.match("www")) { check=/[www]+\.[a-zA-Z0-9-]+\.[a-zA-Z0-9]+/; return check.test(adr); }
return check.test(adr);
}

function basename(file) { 
  file=file.toString(); file=file.split("?"); file=file[0];
  if(file.match("/")) file=file.split("/"); 
  else if(file.match(/\\/)) file=file.split("\\"); 
  else if(file.match(":")) file=file.split(":"); 
  file=file[(file.length-1)]; 
  return file; 
}

function dirname(file) { 
  var nf=new Array(); file=file.toString().split("/");
  for(i=0;i<(file.length-1);i++) { nf[i]=file[i] }
  nf=nf.join("/"); return nf;
}

function get_parms(file) { return file.search.replace("?","&");  }

function get_GetVar(VarName,file) {
  var ln=file.toString(); var found="";
  if(ln.match(VarName+"=")) { found=ln.split(VarName+"="); found=found[1]; }
  if(found.match("&")) { found=found.split("&"); found=found[0]; }
  return found;
}

function fn(o,txt) { 
  if(!gurkenbrowser) o.title=txt; 
  window.status=txt; 
  return true 
}

function dr(txt) { document.writeln(txt); }

function no_translation_button() {
  top.frames.TamborHead.get_obj("ChangeLang").style.visibility="hidden"; 
  onunload=translation_button;
}

function translation_button() {
  top.frames.TamborHead.get_obj("ChangeLang").style.visibility="visible";
}

function fotocopyright() {
  alert("Photo: Uschi Weiner"); return false;
}

function ausdrucken(Lang) {
 var Txt=new Array();
 if(self.print) { 
   Txt["de"]="Möchten Sie diese Seite  ausdrucken?"; Txt["en"]="Would you like to print this page?"; 
   if(confirm(Txt[Lang])) { self.print(); } 
 }
else { 
  Txt["de"]="Leider ist Ihr Browser nicht fähig, die Seite auf diesem Wege zu auszudrucken.\nBenutzen Sie bitte die Druckfunktion des Browsers."; 
  Txt["en"]="Unfortunately your browser is not able to print out the page this way. Please use the print function of the browser."; 
  alert(Txt[Lang]);
 }
}

function nada() { ; }

function init_mousepos() { 
        document.onmousemove = mouseMove
        if (netscapefamily|op) document.captureEvents(Event.MOUSEMOVE)
}

function mouseMove(e) {
  if(netscapefamily) { mousex=e.pageX; mousey=e.pageY }
  if(ie) { mousex=event.x+document.body.scrollLeft;  mousey=event.y+document.body.scrollTop; }
  if(op) { mousex=event.clientX; mousey=event.clientY; }
}

function zoomen(img) {
    imgzoom=10; if(img.zoomstat) imgzoom=img.zoomstat;
    limit=20; if(img.height<200) limit=50;
    if (event.wheelDelta >= 120) {  imgzoom--; }
    else if (event.wheelDelta <= -120) { imgzoom++; }
    if(imgzoom>limit) imgzoom=limit;
    if(imgzoom<4) imgzoom=4;
    img.zoomstat=imgzoom; window.status="Zoomfaktor: "+imgzoom+ "0%"
    img.style.zoom = imgzoom+"0%"; 
    if(self==top) { 
      if((((img.width/100)*(imgzoom*10))>img.width) || (((img.height/100)*(imgzoom*10))>img.height)) {
        fenster_groesse((img.width/100)*(imgzoom*10)+16,(img.height/100)*(imgzoom*10)+24);
      }
    }
}

function fenster_groesse(br,ho) {
 if (is_win_ie) resizeTo(br+12,ho+32); 
 else if(is_mac_ie) resizeTo(br+30,ho+30);
 else if(op) resizeTo(br+12,ho+31);
 else { window.innerWidth=br; window.innerHeight=ho; }
}

function show_pic(url,Breite,Hoehe) {
  if(url.match("thumb-")) { url=url.replace("thumb-",""); }
  window.open("showpic.php?url="+url,"Tambor_Image","left=0,top=0,width="+Breite+",height="+Hoehe+",resizable=yes");
  return false;
}

function bildwechsel(bild,neuesbild) {
if(is_win_ie) {
  bild.filters.blendTrans.Apply();
  bild.src=neuesbild.src;
  bild.filters.blendTrans.Play();
}
  else { bild.src=neuesbild.src; }
}

function xborder() {
  var xfactor=800;
  if (netscapefamily) xfactor=window.innerWidth;
  if (op) xfactor=window.innerWidth-20;
  if (ie) xfactor=document.body.offsetWidth;
  return xfactor
}
 
function yborder() {
  var yfactor=600;
  if (netscapefamily) yfactor=window.innerHeight;
  if (op) yfactor=window.innerHeight-20;
  if (ie) yfactor=document.body.offsetHeight;
  return yfactor
}

function get_obj(nombre) { 
if(modernbrowser) { 
  var erg=document.getElementById(nombre); if(!erg) erg=document.getElementsByName(nombre)[0]
  return erg;  
}
if(ie4) { for(i=0;i<window.document.all.length;i++) {  var obj=window.document.all[i]; if(obj.name==nombre) { return obj; } } }
if(ns4 || document.layers) { for(i=0;i<window.document.layers.length;i++) { var obj=window.document.layers[i]; if(obj.name==nombre){ return obj; } 
    else { for(j=0;j<window.document.layers[i].layers.length; j++) { var obj=window.document.layers[i].layers[j]; 
    if(obj.name==nombre) { return obj; } } } }
}
return false;
}

function blurren(o) {
 if(notgurkenbrowser) o.blur();
}

function ape(name,val,zeichen) {
// ape= add parm escaped, zeichen= ? oder &
return zeichen+name+"="+escape(val);
}

function trim(IPS,Zeichen) {
  if(typeof IPS != "string") { return IPS; }
  if(IPS.indexOf(Zeichen)==-1) { return IPS; }
  var RetVal=IPS, ch=RetVal.substring(0,Zeichen.length);
  while(ch==Zeichen) { RetVal = RetVal.substring(Zeichen.length,RetVal.length); ch=RetVal.substring(0,Zeichen.length); }
  ch=RetVal.substring(RetVal.length-Zeichen.length,RetVal.length);
  while(ch==Zeichen) { RetVal=RetVal.substring(0,RetVal.length-Zeichen.length); ch=RetVal.substring(RetVal.length-Zeichen.length,RetVal.length); }
  if(Zeichen==" ") { while(RetVal.indexOf(Zeichen+Zeichen)!=-1) {  RetVal=RetVal.replace(Zeichen+Zeichen,Zeichen);  } }
  return RetVal; 
} 

function replace_it(txt,was,wodurch) {
 if(txt) { while(txt.indexOf(was)>-1) txt=txt.replace(was,wodurch); }
 return txt;
}

function uc_words(text) {
  if(text) {
    text=replace_it(text,"_"," ");
    if(text.indexOf("-")>-1) { text=text.split("-");  for(i=0;i<text.length;i++) { text[i]=first_letter_up(text[i]); }  text=text.join("-"); }
    text=text.split(" ");  for(i=0;i<text.length;i++) { text[i]=first_letter_up(text[i]); } text=text.join(" "); 
    // kurze Worte ganz gross wäre: if(text[i].length<4) { text[i]=text[i].toUpperCase(); } 
  }
  return text;
}

function first_letter_up(Txt) { 
 if(Txt) { var Br=Txt.split(""); Br[0]=Br[0].toUpperCase(); Txt=Br.join(""); }
 return Txt;
}

