function Is(){
  this.agent = navigator.userAgent.toLowerCase();
  this.major = parseInt(navigator.appVersion);
  // DOM Support
  if(document.addEventListener && document.removeEventListener){this.dom2events = true;}
  if(document.getElementById){this.dom1getbyid = true;}
  // Opera
  this.opera = this.agent.indexOf('opera') != -1;
  if(this.opera){
    this.opera5 = (this.agent.indexOf('opera 5') != -1 || this.agent.indexOf('opera/5') != -1);
    this.opera6 = (this.agent.indexOf('opera 6') != -1 || this.agent.indexOf('opera/6') != -1);
    return;
  }

  // MSIE
  this.ie = this.agent.indexOf('msie') != -1;
  if (this.ie) {
    this.ie3 = this.major < 4;
    this.ie4 = (this.major == 4 && this.agent.indexOf('msie 5') == -1 && this.agent.indexOf('msie 6') == -1);
    this.ie4up = this.major >= 4;
    this.ie5 = (this.major == 4 && this.agent.indexOf('msie 5.0') != -1);
    this.ie5up = !this.ie3 && !this.ie4;
    this.ie6 = (this.major == 4 && this.agent.indexOf('msie 6.0') != -1);
    this.ie7 = (this.major == 4 && this.agent.indexOf('msie 7.0') != -1);
    return;
  }

  // Gecko, NN4+, and NS6
  this.gecko = this.agent.indexOf('gecko') != -1;
  this.nav = (this.agent.indexOf('mozilla') != -1 && this.agent.indexOf('spoofer') == -1 && this.agent.indexOf('compatible') == -1);
  if (this.nav) {
    this.nav4  = this.major == 4;
    this.nav4up= this.major >= 4;
    this.nav5= this.major >= 5;
  }
}
     
function show(_event,_cell){
  is = new Is(); 
  if(is.ie5 || is.ie5up || is.ie6 || is.nav5 || is.opera6 || is.ie7){
    var c = document.getElementById(_cell);
    var d = document.getElementById('popup');
  
    if(_event == ''){
      d.style.display = 'none';
      c.setAttribute('name',c.getAttribute('className'));
      c.setAttribute('className','overme');
    }else{
      d.innerHTML = '<div id=\"popupinfo\"><div class=\"popuphead\">Event</div><div class=\"popupinfotext\">' + _event + '</div></div>';
      c.setAttribute('name',c.getAttribute('className'));
      c.setAttribute('className','overme');
      d.style.left = xpos + 10 + 'px';
      d.style.top = ypos + 10 + 'px';
      d.style.display = 'block';
    }
  }
}

function hide(_cell){
  is = new Is(); 
  if(is.ie5 || is.ie5up || is.ie6 || is.nav5 || is.opera6 || is.ie7){
    var c = document.getElementById(_cell);
    c.setAttribute('className',c.getAttribute('name'));
    document.getElementById('popup').style.display = 'none';
  }    
}

function adddate(day,month,year){
  document.forms[0].elements['eventdate'].value = year + '-' + month + '-' + day;
}

function check_input(_formname){
  var d = document.forms[_formname];
  for(a=0;a<d.elements.length;a++){
    if((d.elements[a].type == 'text' || d.elements[a].type == 'textarea')  && d.elements[a].value == ''){
      if(document.forms[_formname].elements[5].type.indexOf('select') != -1 && document.forms[_formname].elements[5].options[document.forms[_formname].elements[5].options.selectedIndex].value == '' && document.forms[_formname].elements['eventplace'].value == ''){
        alert('Ups. Da fehlt ja noch was.\nBitte f&uuml;llen Sie das Feld noch aus')
        d.elements[a].focus();
        return false;      
      }else{
        if(document.forms[_formname].elements['s_eventplace'].options[document.forms[_formname].elements['s_eventplace'].options.selectedIndex].value != '' && document.forms[_formname].elements['eventplace'].value == ''){  
          return true;
        }else{          
          alert('Ups. Da fehlt ja noch was.\nBitte f&uuml;llen Sie das Feld noch aus!');
          d.elements[a].focus();
          return false;
        }          
      }        
    }      
  }
}

function check_user(_formname){
  var d = document.forms[_formname];
  for(a=0;a<d.elements.length;a++){
    if(d.elements[a].type == 'text' || d.elements[a].type == 'password'){
      if(d.elements[a].value == ''){
        alert('Ups. Da fehlt noch was.\nBitte f&uuml;llen Sie das Feld noch aus');
        d.elements[a].focus();
        return false;
      }
    }
    
    if(d.elements[a].type == 'password' && d.elements[a].value != ''){
      if(d.elements['pass'].value != d.elements['pass_repeat'].value){
        alert('Die Passworteingabe ist leider falsch.\nBitte achten Sie auf Gro&szlig;- und Kleinschreibung');
        d.elements['pass'].value = '',
        d.elements['pass_repeat'].value = '',
        d.elements['pass'].focus();
        return false;
      }
    }    
  }
}

function check_userupdate(_formname){
  var d = document.forms[_formname];
  for(a=0;a<d.elements.length;a++){
    if(d.elements[a].type == 'text'){
      if(d.elements[a].value == ''){
        alert('Ups. Da fehlt noch was.\nBitte f&uuml;llen Sie das Feld noch aus');
        d.elements[a].focus();
        return false;
      }
    }

    if(d.elements['pass'].value != d.elements['pass_repeat'].value){
      alert('Die Passworteingabe ist leider falsch.\nBitte achten Sie auf Gro&szlig;- und Kleinschreibung');
      d.elements['pass'].value = '',
      d.elements['pass_repeat'].value = '',
      d.elements['pass'].focus();
      return false;
    }
  }        
}

function getInfo(id){
 win = window.open('reminder.php?id=' + id,'reminder','width=300,height=150,left=10,top=10');
}

function wopen(link,wi,he) {
      wincom = window.open(link ,"fenster","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width="+wi+",height="+he);
      wincom.focus() ;
}

function openJigsaw(jUrl) {
	var jWin = open("spiele/jigsaw.html?"+jUrl,"jWin","width=462,height=420,status=yes,scrollbars=no,scrolling=no,toolbar=no,menubar=no,location=no,resizable=no");
}

function openBubbles() {
	var jWin = open("spiele/bubbles/bubbles.php","jWin","width=550,height=380,status=no,scrollbars=yes,scrolling=yes,toolbar=no,menubar=no,location=no,resizable=no");
}

function openSame() {
	var jWin = open("spiele/wsame/index.php","jWin","width=550,height=390,status=no,scrollbars=yes,scrolling=yes,toolbar=no,menubar=no,location=no,resizable=no");
}

  function spielen(was)
   {
    win=window.open ("spiele/" + was + ".htm","spiel","width=790px,height=545px,location=0,directories=0,menubar=0,scrollbars=0,dependent=1,resizable=0,toolbar=0,alwaysraised=1,hotkeys=0,menubar=0,status=0,titlebar=0");
    (screen.width<=800 && screen.height<=600) ? win.moveTo(0,0) : win.moveTo(((screen.width-790)/2),((screen.height-570)/2));
    win.focus();
   }

function openChathilfe() {
	var jWin = open("chathilfe.php","jWin","width=550,height=390,status=no,scrollbars=yes,scrolling=yes,toolbar=no,menubar=no,location=no,resizable=no");
}

function openChatident() {
	var jWin = open("chatident.php","jWin","width=550,height=390,status=no,scrollbars=yes,scrolling=yes,toolbar=no,menubar=no,location=no,resizable=no");
}

function pruefen() {
var name = document.forms[0].name.value;
var mail = document.forms[0].mail.value;
var betreff = document.forms[0].betreff.value;
var text = document.forms[0].text.value;

if(name == "") {
alert("Bitte geben Sie Ihren Namen ein!");
document.forms[0].name.focus();return false;
}
if(mail == "") {
alert("Bitte geben Sie Ihre E-Mail-Adresse ein!");
document.forms[0].mail.focus();return false;
}
if(document.forms[0].mail.value.indexOf('@') == -1) {
alert("E-Mail ohne @?");
document.forms[0].mail.focus();return false;
}
if(betreff == "") {
alert("Bitte geben Sie Ihren Betreff ein!");
document.forms[0].betreff.focus();return false;
}
if(text == "") {
alert("Bitte geben Sie Ihren Text ein!");
document.forms[0].text.focus();return false;
}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

  window.defaultStatus = "GAY magdeburg - Schwule Seiten an der Elbe";

