if(top!=self) if(location) top.location.replace(self.location.href); else top.document.location.replace(self.document.location.href);
function send(id,captchanr) {
  document.getElementById('statusmeldung').className = "loading";
  document.getElementById('statusmeldung').innerHTML = "<img src='/bilder/loading.gif' alt='Bitte warten' style='vertical-align:middle' /> Bitte warten ...";
  if(document.getElementById('sendAsTopic')) xajax_sendContactMail(encodeURIComponent(document.getElementById('mailvon').value), encodeURIComponent(document.getElementById('mailmailaddy').value), encodeURIComponent(document.getElementById('mailtext').value), id, ((document.getElementById('captcha'))?encodeURIComponent(document.getElementById('captcha').value):''), captchanr, document.getElementById('sendAsTopic').checked, document.getElementById('sendAsMail').checked, ((document.getElementById('kopie'))?document.getElementById('kopie').checked:false), ((document.getElementById('saveContactData'))?document.getElementById('saveContactData').checked:false) );
  else xajax_sendContactMail(encodeURIComponent(document.getElementById('mailvon').value), encodeURIComponent(document.getElementById('mailmailaddy').value), encodeURIComponent(document.getElementById('mailtext').value), id, ((document.getElementById('captcha'))?encodeURIComponent(document.getElementById('captcha').value):''), captchanr, false, true, ((document.getElementById('kopie'))?document.getElementById('kopie').checked:false), ((document.getElementById('saveContactData'))?document.getElementById('saveContactData').checked:false) );
}

function recommend(id) {
  pop=window.open('','','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,fullscreen=0,width=400,height=400,top=0,left=0'); 
  pop.resizeTo(420,460); 
  pop.moveTo(screen.availWidth / 2 - 210,screen.availHeight / 2 - 230); 
  pop.location='http://www.suchebiete.com/empfehlen.php?ID='+id; 
}

function markContactForm() {
  document.getElementById('kontakt').style.background='#CEFED0';
  document.getElementById('kontakt').style.border='dashed 2px #039108';
  document.getElementById('kontakt').style.padding='4px';
}

/*
function vote(id,punkte) {
  xajax_bewerten(id,punkte);
}*/

function handleFormCheck(response,id) {
  var fehler = "";
  var span = document.getElementById(id).nextSibling;
  span.innerHTML = "";
  if(response!="ok") {
    if(response=="leer") {
      fehler = "Bitte geben Sie eine E-Mail-Adresse ein, damit der Anbieter Ihnen antworten kann.";
    }
    if(response=="syntaxFehler" || response=="dnsFehler") {
      fehler = "Sie haben sich bei Ihrer E-Mail-Adresse verschrieben. Überprüfen Sie sie bitte nochmal.";
    }
    if(response.indexOf("550~")>-1) {
      fehler = "In den vergangenen 7 Tagen wurde eine unserer E-Mails an diese Adresse abgewiesen. Entweder weil die E-Mail-Adresse nicht existiert oder weil das Postfach voll war. Bitte überprüfen Sie sie nochmal genau. Hier die Meldung Ihres Mail-Anbieters:<br />"+response.substr(4);
    }
    
    var pic = document.createElement("IMG");
    pic.src = "/bilder/fehler.gif";
    pic.onmouseover = function() { tip_it(1,"Fehler",fehler); };
    pic.onmouseout = function() { tip_it(0, "", "") };
    span.appendChild(pic);
    ele.className = "fehlerInput";
  } else {
    ele.className = "formstext";
  }
}

function loadMoreResults(type,id,start) {
  if(type=='local') {
    document.getElementById('moreLocal').innerHTML += "<div style='position:absolute;top:0;left:0;background:#fff;filter:alpha(opacity=70);-moz-opacity:0.7;-khtml-opacity: 0.7;opacity: 0.7;width:100%;height:100px;'><img src='/bilder/loading.gif' alt='Weitere Anzeigen werden geladen' title='Weitere Anzeigen werden geladen' style='display:block;margin:30px auto;' width='32' height='32' /></div>";
    xajax_moreLocalResults(id,start);
  } else if(type=='user') {
    document.getElementById('moreFromUser').innerHTML += "<div style='position:absolute;top:0;left:0;background:#fff;filter:alpha(opacity=70);-moz-opacity:0.7;-khtml-opacity: 0.7;opacity: 0.7;width:100%;height:100px;'><img src='/bilder/loading.gif' alt='Weitere Anzeigen werden geladen' title='Weitere Anzeigen werden geladen' style='display:block;margin:30px auto;' width='32' height='32' /></div>";
    xajax_moreUserResults(id,start);
  } else if(type=='kat') {
    document.getElementById('moreKat').innerHTML += "<div style='position:absolute;top:0;left:0;background:#fff;filter:alpha(opacity=70);-moz-opacity:0.7;-khtml-opacity: 0.7;opacity: 0.7;width:100%;height:100px;'><img src='/bilder/loading.gif' alt='Weitere Anzeigen werden geladen' title='Weitere Anzeigen werden geladen' style='display:block;margin:30px auto;' width='32' height='32' /></div>";
    xajax_moreKatResults(id,start);
  } else if(type=='geoLocation') {
    document.getElementById('moreGeoLocation').innerHTML += "<div style='position:absolute;top:0;left:0;background:#fff;filter:alpha(opacity=70);-moz-opacity:0.7;-khtml-opacity: 0.7;opacity: 0.7;width:100%;height:100px;'><img src='/bilder/loading.gif' alt='Weitere Anzeigen werden geladen' title='Weitere Anzeigen werden geladen' style='display:block;margin:30px auto;' width='32' height='32' /></div>";
    xajax_moreGeoLocation(id,start);
  }
}

function playSound(surl,id) {
  var code = "<embed src='"+surl+"' id='captcha_sound_file' hidden=true autostart=true loop=false width=0 height=0 />";
  if(navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') === -1 && navigator.userAgent.indexOf("Win") > 0){
    if(navigator.plugins && $A(navigator.plugins).detect(function(p){ return p.name.indexOf('QuickTime') != -1 }))
      code = '<object id="captcha_sound_file" width="0" height="0" type="audio/wav" data="'+surl+'" />';
    else
      return true;
  }
	document.getElementById(id).innerHTML=code;
  return false;
}

function switchTab(tab,id) {
  if(tab==curTab) return;
  if(document.getElementById(curTab)) document.getElementById(curTab).style.display = "none";
  if(document.getElementById(tab)) {
    if(tab=="moreGeoLocation" && document.getElementById(tab).innerHTML=='') loadMoreResults('geoLocation',id,0);
    document.getElementById(tab).style.display = "block";
  }
  
  if(document.getElementById(tab)) {
    document.getElementById('tab'+tab).className = "moreActive";
  }
  
  if(document.getElementById(curTab)) {
    document.getElementById('tab'+curTab).className = "";
  }
  curTab = tab;
}

function showVersand(label) {
  document.getElementById('versand').innerHTML = '<iframe id="versandrechner" src="http://www.versandtarif.de/toolbox/versandkostenrechner_180x180.aspx?partnerID=suchebiete&promoArtikel='+label+'&showTab=1" width="180" height="180" scrolling="no" frameborder="0"></iframe>';
}

if(document.getElementById('moreFromUser')) {
  var curTab = 'moreFromUser';
  document.getElementById('tab'+curTab).className = "moreActive";
  if(document.getElementById('moreLocal')) document.getElementById('moreLocal').style.display = 'none';
  if(document.getElementById('moreKat')) document.getElementById('moreKat').style.display = 'none';
  if(document.getElementById('moreGeoLocation')) document.getElementById('moreGeoLocation').style.display = 'none';
} else if(document.getElementById('moreLocal')) {
  var curTab = 'moreLocal';
  document.getElementById('tab'+curTab).className = "moreActive";
  if(document.getElementById('moreKat')) document.getElementById('moreKat').style.display = 'none';
  if(document.getElementById('moreGeoLocation')) document.getElementById('moreGeoLocation').style.display = 'none';
} else if(document.getElementById('moreKat')) {
  var curTab = 'moreKat';
  document.getElementById('tab'+curTab).className = "moreActive";
  if(document.getElementById('moreGeoLocation')) document.getElementById('moreGeoLocation').style.display = 'none';
} else var curTab = '';
