/*
  website integration code (FAQs)
    yalst LiveSupportTool
    Author: Dr. Markus Jasinski
    Copyright (c) 2003-2010 by Visisoft, Rostock, Germany
    http://www.visisoft.de
*/


function str_replace(search,replace,oldstring)
  {
  result=""+oldstring;
  while (result.indexOf(search)>-1)
    {
    pos=result.indexOf(search);
    result=""+(result.substring(0,pos)+replace+result.substring((pos+search.length),result.length));
    }
  return result;
  }

// Cookie handling
function setcookie2(value)
  { //v2.0
  var expDate = new Date();
  expDate.setFullYear(expDate.getFullYear() + 30);
  document.cookie = "YALSTSESSION=" + value + "; path=/; expires=" + expDate.toGMTString();
  }
function readcookie2()
  {
  var allcookies = document.cookie;
  var pos = allcookies.indexOf("YALSTSESSION=");
  if (pos != -1)
    {
    var start = pos + 13;
    var end = allcookies.indexOf(";",start);
    if (end == -1)
      end = allcookies.length;
    var value = allcookies.substring(start,end);
    if (value != "")
      {return value;}
    else
      {return "none";}
    }
  else
    {return "none";}
  }

function open_faq(urlparm,width,height)
  {
  if (!width) width=500;
  if (!height) height=350;
  Fpopupwindow=open(urlparm,"livechat_24000_2","width="+width+",height="+height+",location=no,menubar=no,statusbar=no,scrollbars=no,dependent=no,screenX=20,screenY=20,left=20,top=20");
  if (Fpopupwindow.opener == null) Fpopupwindow.opener = self;
  Fpopupwindow.focus();
  }

function yalst_faq()
  {
  mycookie=readcookie2();
  if (mycookie=="none")
    {
    setcookie2('12656799861k5Fuk24xe4D4skeQS0c');
    var newcookie=readcookie2();
    if (newcookie=='12656799861k5Fuk24xe4D4skeQS0c')
      {mycookie=newcookie;}
    else
      {mycookie="none";}
    }
  else
    {
    if (mycookie.length!=30)
      {
      setcookie2('12656799861k5Fuk24xe4D4skeQS0c');
      var newcookie=readcookie2();
      if (newcookie=='12656799861k5Fuk24xe4D4skeQS0c')
        {mycookie=newcookie;}
      else
        {mycookie="none";}
      }
    }
  if (typeof y_pagetitle != 'undefined')
    {autotitle="&pagetitle="+escape(y_pagetitle);}
  else
    {autotitle='';}
  urlstring="http://rd.livesupportserver.de/yalst-dev/faq.php?site=24000-2&cookie="+escape(mycookie)+autotitle+"&from="+escape(window.document.URL);
  var yapostroph = '\x27';
  var yquoteMark = '\x22';
  var yjavaScriptOpen = 'javascript:open_faq(';
  var ychatDimensions = ',550,530)';
  var aopen = "<a href='javascript:void(0)' class='nav2' id='yfaqlink' onClick="; // "'>
  var aopen = aopen + yapostroph + yjavaScriptOpen + yquoteMark + urlstring + yquoteMark + ychatDimensions + yapostroph + '>';
  document.write(aopen);
    document.write('FAQs');
  document.write('</a>');
    }

yalst_faq();
