/* Copyright Scientec Internet Applications + Media GmbH - www.scientec.de */

var zeit = new Date();

basket = [];
basketverkauf = [];
basketurl = [];

kundendaten = [];
var newsession = 1;
var baskethtml = "";
var basketemail = "";
var basketart = "";
var minibaskethtml = "";
var minibaskethtmlanz = "";
var kunde = "";
var anrede = "";
var telefonzahl = "";
var gebotszahl = "";
var verkaufszahl = "";
var gebotswert = "";
var paymenttext = "";
var cookiesession = "";
var catordersend = "";
var wcont = window.name.split("-!-");
var kundeok = "";
var archivok = "";
var displaymod = 0;
var userid = "";
var login = "";
var fotostat = "";
if (wcont[1])
{
  kundeok = "1";
}
if (wcont[2])
{
  archivok = "1";
}
if (!artliste)
{
  var artliste = "";
}

if (top==self)
{
//  cookiesession = getCookie("session");
//  if (window.name.indexOf("PHILIPP") == -1 && cookiesession.indexOf("PHILIPP") == -1 && top==self)
  if (window.name.indexOf("PHILIPP") == -1 && top==self)
  {
    var now = new Date();
    setsession();
//    var time = new Date(now.getTime() + 1000*60*60*6);
//    document.cookie = "session="+sessionid+"; expires="+time.toGMTString()+";";
  }
  else
  {
//    if(cookiesession.indexOf("PHILIPP") != -1)
//    {
//      var now = new Date();
//      var time = new Date(now.getTime() + 30*60*1000);
//      document.cookie = "session="+cookiesession+"; expires="+time.toGMTString()+"; path=/";
//    }
//    if (window.name.indexOf("PHILIPP") == -1)
//    {
//      var sessionid = cookiesession;
//      window.name = sessionid;
//    }
//    else
//    {
    var sessionid = wcont[0];
//    }
    newsession = "";
  }
}

function setsession ()
{
  var params = "Name=PHILIPP&time="+now.getTime();
  var jsHttp = false;

/*@cc_on @if (@_win32 && @_jscript_version >= 5) if (!window.XMLHttpRequest) function XMLHttpRequest() { return new ActiveXObject('Microsoft.XMLHTTP')}@end @*/

  if (typeof XMLHttpRequest != 'undefined'){jsHttp = new XMLHttpRequest()}
  if (jsHttp)
  {
    jsHttp.open('POST', '/cgi-bin/shop/setsession.pl',true);
    jsHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    jsHttp.setRequestHeader("Content-length", params.length);
    jsHttp.setRequestHeader("Connection", "close");
    jsHttp.onreadystatechange = function ()
    {
      if (jsHttp.readyState == 4)
      {
        eval(jsHttp.responseText);
        sessionid = "PHILIPP"+sessionid;
        window.name = sessionid;
      }
    }
    jsHttp.send(params);
  }
}

function getCookie(name)
{
  var c=document.cookie+";";
  start=c.indexOf(name)+name.length+1;
  stop=c.indexOf(";",start);
  keks=c.substring(start,stop);
  return keks
}

function init()
{
  readsession();
  SPRACHE=$("html")[0].lang;
  searchStringHighlight();
  if (SPRACHE == "en")
  {
    document.body.innerHTML += '<div id="popup">\n  <div class="abdeckung"></div>\n  <div id="popup-titel">\n    <div id="popup-titel-text"></div>\n    <div id="popup-titel-nav"><a href="#" onclick="popup(\'off\')">To the shop</a></div>\n  </div>\n  <div id="popup-inhalt"><iframe src="/onTEAM/layout/leer.html" frameborder="0" id="popup-iframe"></iframe></div>\n  <div id="popup-hintergrund" onclick="popup(\'off\')"></div>\n </div>';
  }
  else
  {
    document.body.innerHTML += '<div id="popup">\n  <div class="abdeckung"></div>\n  <div id="popup-titel">\n    <div id="popup-titel-text"></div>\n    <div id="popup-titel-nav"><a href="#" onclick="popup(\'off\')">Zum Shop</a></div>\n  </div>\n  <div id="popup-inhalt"><iframe src="/onTEAM/layout/leer.html" frameborder="0" id="popup-iframe"></iframe></div>\n  <div id="popup-hintergrund" onclick="popup(\'off\')"></div>\n </div>';
  }
  Suchfeld();
  Mailto();
  Fotos();


  if(document.getElementsByTagName("html")[0].lang == "en")
  {
    mwst0 = "Article is subject to the differential taxation";
    mwst7 = "Price including 7 % VAT";
    mwst19 = "Price including 19 % VAT";
    mwst = ", excl. shipment";
  }
  else
  {
    mwst0 = "Artikel unterliegt der Differenzbesteuerung";
    mwst7 = "Preis inkl. 7 % Mehrwertsteuer";
    mwst19 = "Preis inkl. 19 % Mehrwertsteuer";
    mwst = ", exkl. Versandkosten";
  }
  var mwstDiv = $('.mwst');
  for (var i = 0; i < mwstDiv.length; i++)
  {
    if(mwstDiv[i].innerHTML == "7")
    {
      mwstDiv[i].innerHTML = mwst7;
    }
    else if(mwstDiv[i].innerHTML == "19")
    {
      mwstDiv[i].innerHTML = mwst19;
    }
    else
    {
      mwstDiv[i].innerHTML = mwst0;
    }
    mwstDiv[i].innerHTML += mwst;
    mwstDiv[i].style.display = "block";
  }
}



function readsession (mini)
{
  zeit = new Date();
  if (newsession)
  {
    document.getElementById('miniwarenkorb').innerHTML = '';
    document.getElementById('miniwarenkorb').style.display = "none";
    document.getElementById('login').style.display = 'block';
  }
  else
  {
    var jsHttp = false;

/*@cc_on @if (@_win32 && @_jscript_version >= 5) if (!window.XMLHttpRequest) function XMLHttpRequest() { return new ActiveXObject('Microsoft.XMLHTTP')}@end @*/

    if (typeof XMLHttpRequest != 'undefined'){jsHttp = new XMLHttpRequest()}
    if (jsHttp)
    {
      jsHttp.open('GET', '/sessions/'+sessionid+'.js?'+zeit.getTime()+mini, true);
      jsHttp.onreadystatechange = function ()
      {
       if (jsHttp.readyState == 4)
        {
          if(jsHttp.status == 200)
//          if(jsHttp.responseText.indexOf("kunde")!=-1)
          {
            basket = [];
            telefon = [];
            basketverkauf = [];
            gebotszahl = 0;
            verkaufszahl = 0;
            gebotswert = 0;
            eval(jsHttp.responseText);
            if (!mini)
            {
              for (var artikel in basketverkauf)
              {
                if (basketverkauf[artikel] > 0)
                {
                  verkaufszahl++;
                }
                if (document.getElementById('bbox'+artikel))
                {
                  if (basketverkauf[artikel] > 0)
                  {
                    document.getElementById('abox'+artikel).style.display='none';
                    document.getElementById('bbox'+artikel).style.display='inline';
                    document.getElementById('bbox'+artikel).checked = true;
                  }
                  else
                  {
                    basket[artikel] = '';
                  }
                }
              }
            }
            if (document.getElementById('basket'))
            {
              document.getElementById('basket').innerHTML = minibaskethtml;
            }
          }
          if (kunde)
          {
            document.getElementById('login').style.display = 'none';
            document.getElementById('logout').style.display = 'block';
            document.getElementById('anrede').innerHTML = anrede;
            if (window.name.indexOf("-!-") == -1)
            {
              window.name += "-!-1";
            }
            if (archivok)
            {
              window.name += "-!-1";
            }
          }
          else
          {
            document.getElementById('login').style.display = 'block';
          }
          if (document.getElementById('miniwarenkorb'))
          {
            if (verkaufszahl)
            {
              document.getElementById('miniwarenkorb').style.display = "block";
            }
            else
            {
              document.getElementById('miniwarenkorb').style.display = "none";
            }
          }
        }
      }
      jsHttp.send(null);
    }
  }
}

function setarticle (obj,artno,sprache,cval,cbasket,del)
{
  if (obj)
  {
    name1=obj.name;
  }
  if (obj.tagName == "INPUT")
  {
    cval = '';
  }
  zeit = new Date();
  var jsHttp = false;
/*@cc_on @if (@_win32 && @_jscript_version >= 5) if (!window.XMLHttpRequest) function XMLHttpRequest() { return new ActiveXObject('Microsoft.XMLHTTP')}@end @*/

  if (typeof XMLHttpRequest != 'undefined'){jsHttp = new XMLHttpRequest()}
  if (jsHttp)
  {
    jsHttp.open('GET', '/cgi-bin/shop/setarticle.pl?sessionid='+sessionid+'&artno='+artno+'&sprache='+sprache+'&val='+cval+'&del='+del+'&timestamp='+zeit.getTime(), true);
    jsHttp.onreadystatechange = function ()
    {
      if (jsHttp.readyState == 4)
      {
        eval(jsHttp.responseText);
        readsession();
        if (cbasket == "1")
        {
          document.getElementById('popup-inhalt').getElementsByTagName('iframe')[0].src='/cgi-bin/shop/warenkorb.pl?sessionid='+sessionid+'&sprache='+sprache;
        }
      }
    }
    jsHttp.send(null);
  }
}

function userlogin (name,pass,lang,modus)
{
  var params = "Benutzername="+name+"&pass="+pass+"&language="+lang+"&sessionid="+sessionid;
  var jsHttp = false;

/*@cc_on @if (@_win32 && @_jscript_version >= 5) if (!window.XMLHttpRequest) function XMLHttpRequest() { return new ActiveXObject('Microsoft.XMLHTTP')}@end @*/

  if (typeof XMLHttpRequest != 'undefined'){jsHttp = new XMLHttpRequest()}
  if (jsHttp)
  {
if(name == "schroeder@scientec.de")
{
    params = "Benutzername="+name+"&pass="+pass+"&language="+lang+"&session="+sessionid+"&url="+escape('http://www.philipp-militaria.com/cgi-bin/shop/warenkorb.pl?sessionid='+sessionid+'&sprache='+lang);
    document.getElementById('popup-inhalt').getElementsByTagName('iframe')[0].src='https://www.philipp-militaria.com/cgi-bin/login/loginssl.pl?'+params;
}
else
{
    jsHttp.open('POST', '/cgi-bin/login/login.pl', true);
    jsHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    jsHttp.setRequestHeader("Content-length", params.length);
    jsHttp.setRequestHeader("Connection", "close");
    jsHttp.onreadystatechange = function ()
    {
      if (jsHttp.readyState == 4)
      {
        eval(jsHttp.responseText);
        readsession();
        if (kunde && modus == "basket")
        {
          document.getElementById('popup-inhalt').getElementsByTagName('iframe')[0].src='/cgi-bin/shop/warenkorb.pl?sessionid='+sessionid+'&sprache='+lang;
        }
      }
    }
    jsHttp.send(params);
}

  }
}

function userlogout ()
{
  var params = "sessionid="+sessionid;
  var jsHttp = false;

/*@cc_on @if (@_win32 && @_jscript_version >= 5) if (!window.XMLHttpRequest) function XMLHttpRequest() { return new ActiveXObject('Microsoft.XMLHTTP')}@end @*/

  if (typeof XMLHttpRequest != 'undefined'){jsHttp = new XMLHttpRequest()}
  if (jsHttp)
  {
    jsHttp.open('POST', '/cgi-bin/login/logout.pl', true);
    jsHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    jsHttp.setRequestHeader("Content-length", params.length);
    jsHttp.setRequestHeader("Connection", "close");
    jsHttp.onreadystatechange = function ()
    {
      if (jsHttp.readyState == 4)
      {
        window.name=sessionid;
        kundeok = '';
        document.location.reload();
//        document.getElementById('gebote').style.display = 'none';
//        document.getElementById('login').style.display = 'block';
//        document.getElementById('logout').style.display = 'none';
//        document.getElementById('anrede').innerHTML = "";
//        kunde = '';
//        basket = [];
      }
    }
    jsHttp.send(params);
  }
}

function showlogin (sprache)
{
  document.getElementById('popup').style.display='block';
  document.getElementById('popup-inhalt').getElementsByTagName('iframe')[0].src='/cgi-bin/login/login.pl?sessionid='+sessionid+'&lang='+sprache;
}

function zugangok (sprache)
{
  if (!kundeok)
  {
    document.getElementById('popup-inhalt').getElementsByTagName('iframe')[0].src='/onTEAM/layout/leer.html';
    document.getElementById('popup').style.display='none';
    document.location.reload();
  }
}

function register (sprache)
{
  popup("dialog");
  document.getElementById('popup-inhalt').getElementsByTagName('iframe')[0].src='https://www.philipp-militaria.com/subscribe/register_'+sprache+'.htm';
}

function pwvergessen (sprache)
{
  popup("dialog");
  document.getElementById('popup-inhalt').getElementsByTagName('iframe')[0].src='/cgi-bin/login/pw_vergessen.pl?sessionid='+sessionid+'&lang='+sprache;
}

function persdaten (sprache)
{
  popup("dialog");
  document.getElementById('popup-inhalt').getElementsByTagName('iframe')[0].src='/cgi-bin/login/kundendaten.pl?sessionid='+sessionid+'&lang='+sprache;
}

function newsletter (o,sprache)
{
  var send = 1;
  if (sprache=="d"){
    if (send == 1){if (o.email.value == ""){alert("Bitte tragen Sie Ihre Emailadresse ein."); send = 0; o.email.focus()}}
    if (send == 1 && o.email.value!=""){if (o.email.value.indexOf('@')== -1 || o.email.value.indexOf('.')== -1 || o.email.value.length<8 || o.email.value.indexOf('@')==0){alert("Inkorrekte Emailadresse."); send = 0; o.email.focus()}}
  }
  else {
    if (send == 1){if (o.email.value == ""){alert("Please enter your email address."); send = 0; o.email.focus()}}
    if (send == 1 && o.email.value!=""){if (o.email.value.indexOf('@')== -1 || o.email.value.indexOf('.')== -1 || o.email.value.length<8 || o.email.value.indexOf('@')==0){alert("Emailadress not correct."); send = 0; o.email.focus()}}
  }
  if (send)
  {
    document.getElementById('popup').style.display='block';
    document.getElementById('popup-inhalt').getElementsByTagName('iframe')[0].src='/cgi-bin/newsletter/subscribe.pl?sprache='+sprache+'&email='+o.email.value+'&typ=news-subscribe&dic=34';
  }
  return false
}

function katalog (sprache)
{
  document.getElementById('popup').style.display='block';
  document.getElementById('popup-inhalt').getElementsByTagName('iframe')[0].src='/subscribe/ordercat_'+sprache+'.htm';
}

function warenkorb (sprache)
{
  popup("on");
  if (kunde)
  {
    document.getElementById('popup-inhalt').getElementsByTagName('iframe')[0].src='/cgi-bin/shop/warenkorb.pl?sessionid='+sessionid+'&sprache='+sprache+'&timestamp='+zeit.getTime();
  }
  else
  {
    document.getElementById('popup-inhalt').getElementsByTagName('iframe')[0].src='/subscribe/anmeldung_'+sprache+'.htm';
  }
}

function togglenav (id)
{
  if (document.getElementById(id))
  {
    if (document.getElementById(id).style.display == 'none')
    {
      document.getElementById(id).style.display = '';
    }
    else
    {
      document.getElementById(id).style.display = 'none';
    }
  }
}

function hier(){
}
function over(o){
	o.src=o.src.replace(/-0/,'-1');
	if(!o.onmouseout){o.onmouseout=function(){out(this)}}
}
function out(o){
	if(o.className!="hier")o.src=o.src.replace(/-1/,'-0')
}

function showBestellvorgang(){
  document.getElementById("abdeckung").style.display="block"
  document.getElementById("warenkorbcont").style.display="block"
  document.getElementById("bestellungifr").style.visibility="hidden";
  document.getElementById('warenkorb').contentWindow.document.getElementById("inhalt").innerHTML = document.getElementById('artikel').innerHTML;
}
function hideBestellvorgang(){
  document.getElementById("abdeckung").style.display="none"
  document.getElementById("warenkorbcont").style.display="none"
  document.getElementById("bestellungifr").style.visibility="hidden";
}

function displayOrderForm(lang) {
	if (lang == "e")
	{
	  document.getElementById("bestellungifr").src = "/onTEAM/admin/onselect/info/kundeninfoe.htm";
	}
	else
	{
	  document.getElementById("bestellungifr").src = "/onTEAM/admin/onselect/info/kundeninfo.htm";
	}
	document.getElementById("bestellungifr").style.visibility="visible";
}

function setKontaktForm() {
   params=document.location.href.split(/type=|\&box=/);
   if (params[1])
   {
     if (params[2].indexOf("info") != -1)
     {
       document.getElementById(params[1]+"i").checked = true;
     }
     if (params[2].indexOf("angebot") != -1)
     {
       document.getElementById(params[1]+"a").checked = true;
     }
   }
}

function validateForm() {
 var send = 1;
 if (send == 1){if (document.contact.realname.value == ""){alert("Bitte tragen Sie Ihren Namen ein."); send = 0; document.contact.realname.focus();}}
 if (send == 1){if (document.contact.firma.value == ""){alert("Bitte tragen Sie Ihre Firma ein."); send = 0; document.contact.firma.focus();}}
 if (send == 1){if (document.contact.streetno.value == ""){alert("Bitte tragen Sie die Stra�e ein."); send = 0; document.contact.streetno.focus();}}
 if (send == 1){if (document.contact.code.value == ""){alert("Bitte tragen Sie die Postleitzahl ein."); send = 0; document.contact.code.focus();}}
 if (send == 1){if (document.contact.town.value == ""){alert("Bitte tragen Sie die Stadt ein."); send = 0; document.contact.town.focus();}}
 if (send == 1){if (document.contact.email.value == ""){alert("Bitte tragen Sie Ihre Emailadresse ein."); send = 0; document.contact.email.focus();}}
 if (send == 1){if (document.contact.phone.value == ""){alert("Bitte tragen Sie Ihre Telefonnummer ein."); send = 0; document.contact.phone.focus();}}
 if (send==1)
 {
   return true;
 }
 else {return false;}
}

function validateForme() {
 var send = 1;
 if (send == 1){if (document.contact.realname.value == ""){alert("Please enter your name."); send = 0; document.contact.realname.focus();}}
 if (send == 1){if (document.contact.firma.value == ""){alert("Please enter your company."); send = 0; document.contact.firma.focus();}}
 if (send == 1){if (document.contact.streetno.value == ""){alert("Please enter the street."); send = 0; document.contact.firma.focus();}}
 if (send == 1){if (document.contact.code.value == ""){alert("Please enter the zip code."); send = 0; document.contact.code.focus();}}
 if (send == 1){if (document.contact.town.value == ""){alert("Please enter the town."); send = 0; document.contact.town.focus();}}
 if (send == 1){if (document.contact.email.value == ""){alert("Please enter your email address."); send = 0; document.contact.email.focus();}}
 if (send == 1){if (document.contact.phone.value == ""){alert("Please enter your phone number."); send = 0; document.contact.phone.focus();}}
 if (send==1)
 {
   return true;
 }
 else {return false;}
}


function linksMarkieren() {
  for (var i=0; i<document.getElementsByTagName("a").length; i++){
    thisA=document.getElementsByTagName("a")[i];
    thisA.className=(thisA.href==document.location.href)?"hier":"";
  }
}
/*
function abdeckungSchliessen() {
  if (catordersend)
  {
    document.location.reload()
  }
  else
  {
    document.getElementById('popup').style.display='none';
    document.getElementById('popup-inhalt').getElementsByTagName('iframe')[0].src = '/onTEAM/layout/leer.html'
  }
}
*/
function popup(modus)
{
  if(modus=="on" || modus=="dialog")
  {
    document.getElementById("popup-iframe").src="/onTEAM/layout/leer.html";
    document.getElementsByTagName("html")[0].style.overflow = "hidden";
    document.getElementsByTagName("body")[0].style.overflow = "hidden";
    document.getElementById("popup").style.visibility = "visible";
    document.getElementById("popup").style.left = "0";
    if(modus=="on")
    {
      if (SPRACHE == "en")
      {
        document.getElementById("popup-titel-text").innerHTML = "Order transaction";
      }
      else
      {
        document.getElementById("popup-titel-text").innerHTML = "Bestellvorgang";
      }
    }
    else
    {
      document.getElementById("popup-titel-text").innerHTML = "";
    }
  }
  else if(modus=="off")
  {
    if(window.location.href.indexOf("https:") != -1)
    {
      window.location.href = window.location.href.replace("https:","http:").replace(window.location.search,"");
    }
    else
    {
      readsession();
      document.getElementsByTagName("html")[0].style.overflow = "auto";
      document.getElementsByTagName("body")[0].style.overflow = "auto";
      document.getElementById("popup").style.visibility = "hidden";
      document.getElementById("popup").style.left = "-200%";
    }
  }
}




/*Allgemeine Funktionen*/




function highlightWord(node,word) {
  if (node.hasChildNodes){
    var hi_cn;
    for (hi_cn=0;hi_cn<node.childNodes.length;hi_cn++){
      highlightWord(node.childNodes[hi_cn],word);
    }
  }
  if (node.nodeType == 3 && node.parentNode.tagName!="TEXTAREA") {
    tempNodeVal = node.nodeValue.toLowerCase();
    tempWordVal = word.toLowerCase();
    if (tempNodeVal.indexOf(tempWordVal) != -1) {
      pn = node.parentNode;
      if (pn.className != "searchword") {
        nv = node.nodeValue;
        ni = tempNodeVal.indexOf(tempWordVal);
        before = document.createTextNode(nv.substr(0,ni));
        docWordVal = nv.substr(ni,word.length);
        after = document.createTextNode(nv.substr(ni+word.length));
        hiwordtext = document.createTextNode(docWordVal);
        hiword = document.createElement("span");
        hiword.className = "searchword";
        hiword.title = "Suchtreffer";
        hiword.appendChild(hiwordtext);
        pn.insertBefore(before,node);
        pn.insertBefore(hiword,node);
        pn.insertBefore(after,node);
        pn.removeChild(node);
      }
    }
  }
}
function searchStringHighlight() {
  if (!document.createElement || !document.getElementsByTagName || !document.getElementById("M")) return;
  ref = document.referrer;
  if (ref.indexOf('?') == -1 || ref.indexOf('google') == -1) return;// || ref.indexOf('search') == -1
  qs = ref.substr(ref.indexOf('?')+1);
  qsa = qs.split('&');
  for (i=0;i<qsa.length;i++) {
    qsip = qsa[i].split('=');
    if (qsip.length == 1) continue;
    if (qsip[0] == 'q' || qsip[0] == 'as_q') { /* q= for Google, p= for Yahoo*/

      words = unescape(qsip[1].replace(/\+/g,' ')).replace(/\"/g,'').split(/\s+/);
      highlightedWords="";
      for (var w=0;w<words.length;w++) {
        if(words[w].length>3) {
          highlightWord(document.getElementById("M"),words[w]);
          highlightedWords+=words[w]+" ";
        }
      }
    }
  }
  if(highlightedWords!="" && document.getElementById("Suchbegriff").value=="")
  {
    document.getElementById("Suchbegriff").value+=highlightedWords;
    if(document.getElementById("gsearch"))
    {
      searchIFR = document.createElement("iframe");
      searchIFR.id="searchIFR";
      searchIFR.name="searchIFR";
      searchIFR.src="/onTEAM/layout/gsearch.html";
      document.getElementById("gsearch").appendChild(searchIFR);

      searchIFR.onload=function()
      {
        if(document.getElementById("searchIFR").contentWindow.document.getElementById("beding"))
        {
          document.getElementById("searchIFR").contentWindow.document.getElementById("beding").value = highlightedWords;
          if(document.getElementsByTagName("html")[0].lang == "en")
          {
            document.getElementById("searchIFR").contentWindow.document.getElementById("language").value = "e";
          }
          else
          {
            document.getElementById("searchIFR").contentWindow.document.getElementById("language").value = "d";
          }
          document.getElementById("searchIFR").contentWindow.document.getElementById("search").submit();
        }
      }
    }
  }
  /*for (var i=0; i<document.getElementsByTagName("span").length;i++){
    if (document.getElementsByTagName("span")[i].className=="searchword"){
      document.getElementsByTagName("span")[i].scrollIntoView();
      break;
    }
  }*/
}




function Suchfeld()
{
	var VAL = {"de":"Suche","en":"Search"};
	var MIN = 2;

	if(document.location.href.indexOf("suche.pl")!=-1)
	{
		$("#q").val(decodeURI(document.location.search.replace(/\?/,"").split("beding=")[1].split("&")[0]).replace(/\+/," "));
	}
	else
	{
		$("#q").val(VAL[SPRACHE]);
	}

	$("#q").bind({
		focus: function(){ if(this.value==VAL[SPRACHE])this.value="" }
	});
	$("#q").bind({
		blur: function(){ if(this.value=="")this.value=VAL[SPRACHE] }
	});
	$("#search").bind({
		submit: function(){ return ($("#q").val().length>=MIN && $("#q").val()!=VAL[SPRACHE]) }
	});
}

function Mailto()
{
	$('em.em').each(function(){
		var EM = $(this).text().replace(/~at~/,"@");
		$(this).html('<a href="mailto:'+EM+'">'+EM+'</a>');
	});
}

function Fotos()
{
	var zeit = new Date();
	var zeitstempel = zeit.getTime();

	$('img.x').each(function(){
         $(this).attr("src",$(this).attr("name")+"?"+zeitstempel)
	});
}


function openViewer(url)
{
  var onview=window.open(url,'viewer','screenX=30,screenY=30;top=30,left=30,location=no,menubar=no,toolbar=no,scrollbars=no, resizable=yes,status=no');
  onview.focus();
}
