// JavaScript Document
var toScroll=new Array()
var ie=document.all
var dom=document.getElementById
var firstNews_obj;
var secondNews_obj;

function newsScroll(name){
  var c=this; c.name=name; c.mc=0; c.i=2;
  return this;
}

newsScroll.prototype.addItem = function(text,link,font,fontSize,fontStyle){
  var c = this;
  if (link !=''){
    if (font != '')
      toScroll[c.mc]="<a href='"+link+"'><font face='"+font+"' size='"+fontSize+"' Class='"+fontStyle+"'>"+text+"</font></a>";
    else
      toScroll[c.mc]="<a href='"+link+"'><font Class='"+fontStyle+"'>"+text+"</font></a>";
  }
  else { 
    if (font != '')
      toScroll[c.mc]="<font face='"+font+"' size='"+fontSize+"' Class='"+fontStyle+"'>"+text+"</font>";
    else
      toScroll[c.mc]="<font Class='"+fontStyle+"'>"+text+"</font>";
  }
  c.mc++;
}

newsScroll.prototype.construct = function(){
  var c = this; theWidth = c.scrollerwidth; theHeight=c.scrollerheight; thebgColor = c.scrollerbgcolor; theBackground =c.scrollerbackground; theDelay=c.scrollerdelay;
  scroll_obj=eval(c.name);        
  if (ie||dom){
    document.writeln('<div id="main2" style="position:relative;width:'+theWidth+';height:'+theHeight+';overflow:hidden;background-color:'+thebgColor+' ;background-image:url('+theBackground+')">')
    document.writeln('<div style="position:absolute;width:'+theWidth+';height:'+theHeight+';clip:rect(0 '+theWidth+' '+theHeight+' 0);left:0;top:0">')
    document.writeln('<div id="firstNews" style="position:absolute;width:'+theWidth+';left:0;top:1">')
    document.write(toScroll[0])
    document.writeln('</div>')
    document.writeln('<div id="secondNews" style="position:absolute;width:'+theWidth+';left:0;top:0;visibility:hidden">')
    document.write(toScroll[dyndetermine=(toScroll.length==1)? 0 : 1])
    document.writeln('</div>')
    document.writeln('</div>')
    document.writeln('</div>')
  }
}

newsScroll.prototype.move = function(whichdiv){
  var c = this; theDelay = c.scrollerdelay; theHeight = c.scrollerheight; 
  scroll_obj=eval(c.name);
  tdiv=eval(whichdiv)

  if (parseInt(tdiv.style.top)>0&&parseInt(tdiv.style.top)<=5){
    tdiv.style.top=0+"px"
    setTimeout("scroll_obj.move(tdiv)",theDelay)
    setTimeout("scroll_obj.move2(secondNews_obj)",theDelay)
    //document.write('Got Milk?')
  return
  }
  if (parseInt(tdiv.style.top)>=tdiv.offsetHeight*-1){
    tdiv.style.top=parseInt(tdiv.style.top)-5+"px"
    setTimeout("scroll_obj.move(tdiv)",50)
  }
  else {
    tdiv.style.top=parseInt(theHeight)+"px"
    tdiv.innerHTML=toScroll[c.i]
    if (c.i==toScroll.length-1)
      c.i=0
    else
      c.i++
  }
}

newsScroll.prototype.move2 = function(whichdiv){
  var c = this; theDelay = c.scrollerdelay; theHeight= c.scrollerheight;
  scroll_obj=eval(c.name);
  tdiv2=eval(whichdiv)

  if (parseInt(tdiv2.style.top)>0&&parseInt(tdiv2.style.top)<=5){
    tdiv2.style.top=0+"px"
    setTimeout("scroll_obj.move2(tdiv2)",theDelay)
    setTimeout("scroll_obj.move(firstNews_obj)",theDelay)
    return
  }
  if (parseInt(tdiv2.style.top)>=tdiv2.offsetHeight*-1){
    tdiv2.style.top=parseInt(tdiv2.style.top)-5+"px"
    setTimeout("scroll_obj.move2(secondNews_obj)",50)
  }
  else {
    tdiv2.style.top=parseInt(theHeight)+"px"
    tdiv2.innerHTML=toScroll[c.i]
    if (c.i==toScroll.length-1)
      c.i=0
    else
      c.i++
  }
}

newsScroll.prototype.startScroll = function(){
  var c = this;
  scroll_obj=eval(c.name);        
  
  if (toScroll.length >2)
    c.i = 2;
  else
    c.i = 0;
  
  firstNews_obj=ie? firstNews : document.getElementById("firstNews")
  secondNews_obj=ie? secondNews : document.getElementById("secondNews")
  setTimeout("scroll_obj.move(firstNews_obj)",c.scrollerDelay);
  secondNews_obj.style.top=theHeight;
  secondNews_obj.style.visibility='visible'
}
// replaces special characters with HTML entities
SpawEditor.prototype.convertToEntities = function(src_string)
{
  var result = src_string;
  
  var entities = {
    // Latin-1
    "¡":"&iexcl;",
    "¢":"&cent;",
    "£":"&pound;",
    "¤":"&curren;",
    "¥":"&yen;",
    "¦":"&brvbar;",
    "§":"&sect;",
    "¨":"&uml;",
    "©":"&copy;",
    "ª":"&ordf;",
    "«":"&laquo;",
    "¬":"&not;",
    "­":"&shy;",
    "®":"&reg;",
    "¯":"&macr;",
    "°":"&deg;",
    "±":"&plusmn;",
    "²":"&sup2;",
    "³":"&sup3;",
    "´":"&acute;",
    "µ":"&micro;",
    "¶":"&para;",
    "·":"&middot;",
    "¸":"&cedil;",
    "¹":"&sup1;",
    "º":"&ordm;",
    "»":"&raquo;",
    "¼":"&frac14;",
    "½":"&frac12;",
    "¾":"&frac34;",
    "¿":"&iquest;",
    "À":"&Agrave;",
    "Á":"&Aacute;",
    "Â":"&Acirc;",
    "Ã":"&Atilde;",
    "Ä":"&Auml;",
    "Å":"&Aring;",
    "Æ":"&AElig;",
    "Ç":"&Ccedil;",
    "È":"&Egrave;",
    "É":"&Eacute;",
    "Ê":"&Ecirc;",
    "Ë":"&Euml;",
    "Ì":"&Igrave;",
    "Í":"&Iacute;",
    "Î":"&Icirc;",
    "Ï":"&Iuml;",
    "Ð":"&ETH;",
    "Ñ":"&Ntilde;",
    "Ò":"&Ograve;",
    "Ó":"&Oacute;",
    "Ô":"&Ocirc;",
    "Õ":"&Otilde;",
    "Ö":"&Ouml;",
    "×":"&times;",
    "Ø":"&Oslash;",
    "Ù":"&Ugrave;",
    "Ú":"&Uacute;",
    "Û":"&Ucirc;",
    "Ü":"&Uuml;",
    "Ý":"&Yacute;",
    "Þ":"&THORN;",
    "ß":"&szlig;",
    "à":"&agrave;",
    "á":"&aacute;",
    "â":"&acirc;",
    "ã":"&atilde;",
    "ä":"&auml;",
    "å":"&aring;",
    "æ":"&aelig;",
    "ç":"&ccedil;",
    "è":"&egrave;",
    "é":"&eacute;",
    "ê":"&ecirc;",
    "ë":"&euml;",
    "ì":"&igrave;",
    "í":"&iacute;",
    "î":"&icirc;",
    "ï":"&iuml;",
    "ð":"&eth;",
    "ñ":"&ntilde;",
    "ò":"&ograve;",
    "ó":"&oacute;",
    "ô":"&ocirc;",
    "õ":"&otilde;",
    "ö":"&ouml;",
    "÷":"&divide;",
    "ø":"&oslash;",
    "ù":"&ugrave;",
    "ú":"&uacute;",
    "û":"&ucirc;",
    "ü":"&uuml;",
    "ý":"&yacute;",
    "þ":"&thorn;",
    "ÿ":"&yuml;",
    // symbols and greek
    "ƒ":"&fnof;",
    "Α":"&Alpha;",
    "Β":"&Beta;",
    "γ":"&Gamma;",
    "Δ":"&Delta;",
    "Ε":"&Epsilon;",
    "Ζ":"&Zeta;",
    "Η":"&Eta;",
    "Θ":"&Theta;",
    "Ι":"&Iota;",
    "Κ":"&Kappa;",
    "Λ":"&Lambda;",
    "Μ":"&Mu;",
    "Ν":"&Nu;",
    "Ξ":"&Xi;",
    "Ο":"&Omicron;",
    "Π":"&Pi;",
    "Ρ":"&Rho;",
    "Σ":"&Sigma;",
    "Τ":"&Tau;",
    "Υ":"&Upsilon;",
    "Φ":"&Phi;",
    "Χ":"&Chi;",
    "Ψ":"&Psi;",
    "Ω":"&Omega;",
    "α":"&alpha;",
    "β":"&beta;",
    "γ":"&gamma;",
    "δ":"&delta;",
    "ε":"&epsilon;",
    "ζ":"&zeta;",
    "η":"&eta;",
    "θ":"&theta;",
    "ι":"&iota;",
    "κ":"&kappa;",
    "λ":"&lambda;",
    "μ":"&mu;",
    "ν":"&nu;",
    "ξ":"&xi;",
    "ο":"&omicron;",
    "π":"&pi;",
    "ρ":"&rho;",
    "ς":"&sigmaf;",
    "σ":"&sigma;",
    "τ":"&tau;",
    "υ":"&upsilon;",
    "φ":"&phi;",
    "χ":"&chi;",
    "ψ":"&psi;",
    "ω":"&omega;",
    "•":"&bull;",
    "…":"&hellip;",
    "′":"&prime;",
    "″":"&Prime;",
    "‾":"&oline;",
    "⁄":"&frasl;",
    "℘":"&weierp;",
    "ℑ":"&image;",
    "ℜ":"&real;",
    "™":"&trade;",
    "ℵ":"&alefsym;",
    "←":"&larr;",
    "↑":"&uarr;",
    "→":"&rarr;",
    "↓":"&darr;",
    "↔":"&harr;",
    "↵":"&crarr;",
    "⇐":"&lArr;",
    "⇑":"&uArr;",
    "⇒":"&rArr;",
    "⇔":"&hArr;",
    "∀":"&forall;",
    "∂":"&part;",
    "∃":"&exist;",
    "∅":"&empty;",
    "∇":"&nabla;",
    "∈":"&isin;",
    "∉":"&notin;",
    "∋":"&ni;",
    "∏":"&prod;",
    "∑":"&sum;",
    "−":"&minus;",
    "∗":"&lowast;",
    "√":"&radic;",
    "∝":"&prop;",
    "∞":"&infin;",
    "∧":"&and;",
    "∨":"&or;",
    "∩":"&cap;",
    "∪":"&cup;",
    "∫":"&int;",
    "≅":"&cong;",
    "≈":"&asymp;",
    "≠":"&ne;",
    "≡":"&equiv;",
    "≤":"&le;",
    "≥":"&ge;",
    "⊂":"&sub;",
    "⊃":"&sup;",
    "⊄":"&nsub;",
    "⊆":"&sube;",
    "⊇":"&supe;",
    "⊕":"&oplus;",
    "⊗":"&otimes;",
    "⊥":"&perp;",
    "⋅":"&sdot;",
    "⌈":"&lceil;",
    "⌉":"&rceil;",
    "⌊":"&lfloor;",
    "⌋":"&rfloor;",
    "〈":"&lang;",
    "〉":"&rang;",
    "◊":"&loz;",
    "♠":"&spades;",
    "♣":"&clubs;",
    "♥":"&hearts;",
    "♦":"&diams;",
    // special chars
    "Œ":"&OElig;",
    "œ":"&oelig;",
    "Š":"&Scaron;",
    "š":"&scaron;",
    "Ÿ":"&Yuml;",
    "ˆ":"&circ;",
    "˜":"&tilde;",
    " ":"&ensp;",
    " ":"&emsp;",
    " ":"&thinsp;",
    "‌":"&zwnj;",
    "‍":"&zwj;",
    "‎":"&lrm;",
    "‏":"&rlm;",
    "–":"&ndash;",
    "—":"&mdash;",
    "‘":"&lsquo;",
    "’":"&rsquo;",
    "‚":"&sbquo;",
    "„":"&bdquo;",
    "†":"&dagger;",
    "‡":"&Dagger;",
    "‰":"&permil;",
    "‹":"&lsaquo;",
    "›":"&rsaquo;",
    "€":"&euro;",
    "“":"&ldquo;",
    "”":"&rdquo;"
  }
  var entities_str = "¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿƒΑΒγΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρςστυφχψω•…′″‾⁄℘ℑℜ™ℵ←↑→↓↔↵⇐⇑⇒⇔∀∂∃∅∇∈∉∋∏∑−∗√∝∞∧∨∩∪∫≅≈≠≡≤≥⊂⊃⊄⊆⊇⊕⊗⊥⋅⌈⌉⌊⌋〈〉◊♠♣♥♦ŒœŠšŸˆ˜   ‌‍‎‏–—‘’‚“”„†‡‰‹›€";

  var rgx = new RegExp("[" + entities_str + "]", "gm");
  
  var matches = result.match(rgx);
  if (matches != null)
  {
    var processed = new Array();
    
    for (var i=0; i<matches.length; i++)
    {
      if (processed[matches[i]] == null && entities[matches[i]] != null && entities[matches[i]] != undefined)
      {
        // register that the symbol was processed
        processed[matches[i]] = entities[matches[i]];
        var replace_rgx = new RegExp(matches[i],"gm");
        result = result.replace(replace_rgx, entities[matches[i]]);
      }
    }    
  }
  
  return result;   
}
function checkform(form)
{
	re1 = /^[0-9]{4}$/;
<!-- GSTEBUCH -->
	if(form.gbname.value==""){alert("Bitte tragen Sie den Name ein.");form.gbname.focus();return false;}
	else if(form.kommentar.value==""){alert("Bitte tragen Sie einen Kommentar ein.");form.kommentar.focus();return false;}
	else if(form.antispam.value==""){alert("Bitte tragen Sie den Spamschutz ein.");form.antispam.focus();return false;}
	else if((form.antispam.value!="")&&(form.antispam.value.search(re1)<0)){alert("Bitte geben Sie den Spamschutz vierstellig ein.");form.antispam.focus();return false;}
<!-- NEWSLETTER -->
return true;
}
function checkformnl(form)
{
	re1 = /^.+@.+\..+$/;
	re2 = /^[0-9]{4}$/;
<!-- NEWSLETTER -->
	if(form.email.value==''){alert("Bitte tragen Sie eine e-Mail Adresse ein.");form.email.focus();return false;}
	else if((form.email.value!="")&&(form.email.value.search(re1)<0)){alert("Die e-Mail Adresse ist nicht korrekt.");form.email.focus();return false;}
	else if(form.antispam.value==""){alert("Bitte tragen Sie den Spamschutz ein.");form.antispam.focus();return false;}
	else if((form.antispam.value!="")&&(form.antispam.value.search(re2)<0)){alert("Bitte geben Sie den Spamschutz vierstellig ein.");form.antispam.focus();return false;}
	return true;
}
