// ------------------------------------------------------------------------------
// Der nachfolgende JavaScript-Code ist 
// (c) 2000 copyright activate communication systems
// Jegliches Kopieren untersagt!!
// info@activate.de http://www.activate.de
// ------------------------------------------------------------------------------

var PIDPraefix = "PID=";    // muss mit Variablennamen im Cookie übereinstimmen!
var PIDMinLength = 6;           
var PIDMaxLength = 10;          
var PIDReplaceText = "0"    
var AcceptLongerPID = false 
var AcceptFreeFormat = true 




var PID = "";




function getPosition(anyString,expression)
{
  return(anyString.search(expression));
};




function PIDinURL(position)
{
  return((position - PIDPraefix.length > -1) ? true : false);
};




function PIDTooLong(URL,position)
{
  var c = getChar(URL,position + PIDMaxLength);
  if((c != '') && (c != '&') && (position - PIDMaxLength) > -1) 
  {
    return(true)
  }
  else
  {
    return(false);
  };
};  




function ToPID(c)
{
  if(AcceptFreeFormat)
  {
    if((PID.length + 1 <= PIDMaxLength) && (c != '') && (c != '&'))
    {
        return(true);
    }
    else
    {
        return(false);
    };
  } 
  else
  {
      var r = false;    
      if(PID.length + 1 <= 2)
        {
          r = true; 
        }
        else
        {
        if(PID.length + 1 == 3)
        {
            r = ((c < '0' || c > '9') && c != '-') ? false : true;
        }
        else
        {   
            if(PID.length + 1 <= PIDMaxLength)
            {
                r = (c < '0' || c > '9') ? false : true;
            };
        };
      };
    };  
  return(r);
};




function getSlice(anyString,position,length)
{
  return(anyString.slice(position,position + length));
};




function getChar(anyString,position)
{
  return getSlice(anyString,position,1);    
};  




function getCookieValue (offset) 
{
    var endstr = document.cookie.indexOf (';', offset);
    endstr = (endstr > -1) ? endstr : document.cookie.length;
    return(unescape(document.cookie.substring(offset, endstr)));
}




function getCookie(argument) 
{
    var i = 0;
    var clen = document.cookie.length;
    do 
    {
      var j = i + argument.length;
      if (document.cookie.substring(i, j) == argument)
      {
        return(getCookieValue(j));
      };
        i = document.cookie.indexOf(' ', i) + 1;
    }
    while ((i < clen) && (i != 0));
    return(PIDReplaceText);
};




function getPID(URL)
{
  if(PID == "")
  {
    var position = getPosition(URL,PIDPraefix) + PIDPraefix.length;
    var PIDEnd = false;
    if((PIDinURL(position)) && ((PIDTooLong(URL,position) == false) || (PIDTooLong(URL,position) && AcceptLongerPID)))
    {
      while((PID.length <= PIDMaxLength) && (PIDEnd == false))
      {
        c = getChar(URL,position + PID.length);
        ToPID(c) ? PID = PID + c : PIDEnd = true;
      };
      if(PID.length < PIDMinLength)
      {
        PID = getCookie(PIDPraefix);        
      };
      return(PID);
    }
    else
    {
      PID = getCookie(PIDPraefix);      
    };
  }
  else
  {
    return(0)
  };    
};  




function popUp(URL,x,y)
{
   mcNerv = window.open(URL,"xbroker","dependent=yes,locationbar=no,menubar=no,resizable=yes,status=no,toolbar=no,width=" + x + ",height=" + y);
}


function BestMinute(URL,x,y)
{
   mcNerv = window.open(URL,"bestminute","scrollbars=yes,toolbar=no,location=no,status=no,menubar=no,resizable=yes,width=" + x + ",height=" + y);
}


function getWebhits()  /* webhits REF-Code */
{
  if ((document.referrer.length > 0) && (document.images) && (document.referrer.toLowerCase().indexOf('ignore') < 0))
  {
    refstat = new Image(1,1);
    refstat.src = "http://www.webhits.de/cgi/refstat?df=38946&ref="+escape(document.referrer);
  }
};  /*Ende webhits REF- Code */



function getWebhitsNEU(WebHitsID)  /* webhits REF-Code  neu mit Webhits-ID*/
{
  if ((document.referrer.length > 0) && (document.images) && (document.referrer.toLowerCase().indexOf('ignore') < 0))
  {
    refstat = new Image(1,1);
    refstat.src = "http://www.webhits.de/cgi/refstat?df="+WebHitsID+"&ref="+escape(document.referrer);
  }
};  /*Ende webhits REF- Code */



defaultStatus=" ";


