$(document).ready(function() {
  $(".references").hide();
  $("#commentsinput").hide();
  $("#commspam").hide();
  $("#commclick").show();
  $("#commclick").click(function() {
    $("#commentsblock").slideUp("slow", function(){
    $("#commentsinput").slideDown("slow");
    });
    $("#commspam").val($("#nospam").val()/2);
  });
  $("#formclick").click(function() {
    $("#commentsinput").slideUp("slow", function(){
    $("#commentsblock").slideDown("slow");
    });
  });
  $("#commentsinput .comminput").each(function() {
    $(this).attr("rel",$(this).val());
    $(this).focus(function(){
      $(this).css("background","#ffffff").css("color","#000000");
      if($(this).val()==$(this).attr("rel")) {
        $(this).val("");
        $(this).css('color','#000000');
      }
    });
    $(this).blur(function(){
      if($(this).val()=="") {
        $(this).val($(this).attr("rel"));
        $(this).css('color','#323B5D');
      }
    });
  });
  $("#aktuelllink").click(function(){
    $(this).blur();
    if(document.cookie.search('slider=down')<0) {
      document.cookie='slider=down;path=/';$("#aktuellblock").slideDown("slow");
    } else {
      document.cookie='slider=up;path=/';$("#aktuellblock").slideUp("slow");
    }
  });


  if (!document.cookie) {
    document.cookie = "";
  }
  if(document.cookie.search('slider=')<0)
    setTimeout(function() { document.cookie='slider=down;path=/';$("#aktuellblock").slideDown("slow"); }, 2000);
  else if(document.cookie.search('slider=down')>=0) {
    document.cookie='slider=down;path=/';$("#aktuellblock").show();
  }
  // hreplace();

});
function checkit() {
  error="";
  if($("#commname").val()=="" || $("#commname").val()==$("#commname").attr("rel")) {
    error="error";$("#commname").css("background","#3C0C13").css("color","#ffffff");}
  if($("#commemail").val()=="" || $("#commemail").val()==$("#commemail").attr("rel")) {
    error="error";$("#commemail").css("background","#3C0C13").css("color","#ffffff");}
  s=$("#commemail").val();
  if(!(s.search('@') >= 1 && s.lastIndexOf('.') > s.search('@'))){
    error="error";$("#commemail").css("background","#3C0C13").css("color","#ffffff");}
  if($("#commcomm").val()=="" || $("#commcomm").val()==$("#commcomm").attr("rel")) {
    error="error";$("#commcomm").css("background","#3C0C13").css("color","#ffffff");}
  if(error=="error") return false;
  else return true;
}
function hreplace() {
  $("span.titel").each(function() {
    cls=$(this).get(0).tagName.toLowerCase();
    if($(this).children().text()!="") {
      str=escape($(this).children().text());
      title=$(this).children().attr("title");
      $(this).children().html('<img src="/themes/website/headline/?t='+str+'" alt="" border="0" />');
      $(this).replaceWith($(this).html());
    } else {
      str=escape($(this).text());
      $(this).replaceWith('<div class="h3block"><img src="/themes/website/headline/?t='+str+'" alt="" border="0" /></div>');
    }
	});
	$("a[href^=http]").each(function() {
		this.target="_blank";
	});
}

