jQuery(document).ready(function(){ 
		
	function fensterbreiteermitteln(){	
	if (window.innerWidth) {
  return window.innerWidth-4;
 } else if (document.body && document.body.offsetWidth) {
  return document.body.offsetWidth+5;
	}
	}
	
	//window.onresize = fensterbreiteermitteln();
	//window.onresize = jQuery('.not_registered_overlay').css("margin-left",fensterbreiteermitteln()-450+"px");
	//jQuery('.not_registered_overlay').
																	
 function not_registered_overlay(mode){
  if(jQuery('.not_registered_overlay').css('display')!='none' && mode!='over'){
   jQuery('.not_registered_overlay').fadeOut('normal');
  }else{
   jQuery('.not_registered_overlay').css("background-image","none");
			jQuery('.not_registered_overlay').css("margin-left",fensterbreiteermitteln()-450+"px");
   jQuery('.not_registered_overlay').animate({height: 'show',opacity:'1.00'}, 'slow', function(){
    jQuery('.not_registered_overlay').css("background-color","#203b36");
   });
  }
 }

 jQuery('.close_overlay').click(function(){
  jQuery('.not_registered_overlay').fadeOut('normal');
 });

   //jQuery.timer(36000, function (timer) {
    //not_registered_overlay('over');
    //timer.stop();
    //timer.reset(36000);
   //});
 
 not_registered_overlay('over');
 
});

jQuery(document).ready(function() {
																																																														
																																
jQuery(document).everyTime(1000, function(i) {
		  test();
		});
	
function test(){
	if((jQuery('#kuenstlernameResult').html()!="")||(jQuery('#gebResult').html()!="")||(jQuery('#emailResult').html()!="")||(jQuery('#passwortResult').html()!="")||(jQuery('#passwortwdhResult').html()!="")||(jQuery('#agbResult').html()!="")){
  if(jQuery('#senden1').html()!="<a class=\"a_cont\" style=\"font-weight:bold;\" href=\"#\">Profil anlegen</a>"){
   jQuery('#senden1').html("<a class=\"a_cont\" style=\"font-weight:bold;\" href=\"#\">Profil anlegen</a>");
		 jQuery('#senden2').html("<a href=\"#\"><img width=\"14\" src=\"/pics/submit.png\" border=\"0\" alt=\"Submit\" /></a>");
		}
 }
	else{
		if(jQuery('#senden1').html()!="<a class=\"a_cont\" style=\"font-weight:bold;\" href=\"javascript:window.document.registrierung.submit();\">Profil anlegen</a>"){
		 jQuery('#senden1').html("<a class=\"a_cont\" style=\"font-weight:bold;\" href=\"javascript:window.document.registrierung.submit();\">Profil anlegen</a>");
		 jQuery('#senden2').html("<a href=\"javascript:window.document.registrierung.submit();\"><img width=\"14\" src=\"/pics/submit.png\" border=\"0\" alt=\"Submit\" /></a>");
	 }
	}
}

																																																															
 jQuery('#email').blur(function(){
  jQuery.post("formcheck/check_email.php", {
   email: jQuery('#email').val()
  }, function(response){
   setTimeout("finishAjax('emailResult', '"+escape(response)+"')", 400);
  });
  return false;
 });
 
 /*jQuery('#vorname').blur(function(){
  jQuery.post("formcheck/check_vorname.php", {
   vorname: jQuery('#vorname').val()
  }, function(response){
   setTimeout("finishAjax('vornameResult', '"+escape(response)+"')", 400);
  });
  return false;
 });*/
 	
 /*jQuery('#nachname').blur(function(){
  jQuery.post("formcheck/check_nachname.php", {
   nachname: jQuery('#nachname').val()
  }, function(response){
   setTimeout("finishAjax('nachnameResult', '"+escape(response)+"')", 400);
  });
  return false;
 });*/
  
 jQuery('#kuenstlername').blur(function(){
  jQuery.post("formcheck/check_kuenstlername.php", {
   kuenstlername: jQuery('#kuenstlername').val()
  }, function(response){
   setTimeout("finishAjax('kuenstlernameResult', '"+escape(response)+"')", 400);
  });
  return false;
 });
 	
 jQuery('#passwort').blur(function(){
  jQuery.post("formcheck/check_passwort.php", {
   passwort: jQuery('#passwort').val()
  }, function(response){
   setTimeout("finishAjax('passwortResult', '"+escape(response)+"')", 400);
  });
  return false;
 });
 	
 jQuery('#passwortwdh').blur(function(){
  jQuery.post("formcheck/check_passwortwdh.php", { 
   passwortwdh: jQuery('#passwortwdh').val()
  }, function(response){
   setTimeout("finishAjax('passwortwdhResult', '"+escape(response)+"')", 400);
  });
  return false;
 });
  
 jQuery('#gebtag').blur(function(){
  jQuery.post("formcheck/check_gebtag.php", { 
   gebtag: jQuery('#gebtag').val()
  }, function(response){
   setTimeout("finishAjax('gebResult', '"+escape(response)+"')", 400);
  });
  return false;
 });
  
 jQuery('#gebmonat').blur(function(){
  jQuery.post("formcheck/check_gebmonat.php", { 
   gebmonat: jQuery('#gebmonat').val()
  }, function(response){
   setTimeout("finishAjax('gebResult', '"+escape(response)+"')", 400);
  });
  return false;
 });
  
 jQuery('#gebjahr').blur(function(){
  jQuery.post("formcheck/check_gebjahr.php", { 
   gebjahr: jQuery('#gebjahr').val()
  }, function(response){
   setTimeout("finishAjax('gebResult', '"+escape(response)+"')", 400);
  });
  return false;
 });
  
 jQuery('#plz').blur(function(){
  jQuery.post("formcheck/check_plz.php", {
   plz: jQuery('#plz').val()
  }, function(response){
   setTimeout("finishAjax('ortResult', '"+escape(response)+"')", 400);
  });
  return false;
 });
 
 jQuery('#ort').blur(function(){
  jQuery.post("formcheck/check_ort.php", {
   ort: jQuery('#ort').val()
  }, function(response){
   setTimeout("finishAjax('plzortResult', '"+escape(response)+"')", 400);
  });
  return false;
 });
	
	function agbChecked() {
      var n = jQuery("#agb:checked").length;
      //jQuery("#nachname").val(n + (n <= 1 ? " is" : " are") + " checked!");
	  if(n>0){
	  jQuery("#agbResult").html("");
	  }
	  else{
		jQuery("#agbResult").html("<img src=\"/pics/error_delete.png\" alt=\"AGB und Datenschutz NOK\" title=\"Sie m&uuml;ssen die AGBs und die Datenschutzerkl&auml;rung akzeptieren\" height=\"16\" width=\"16\" border=\"0\" />");
	  }
    }
    jQuery("#agb:checkbox").click(agbChecked);
	
});

function finishAjax(id, response) {
  jQuery('#'+id).html(unescape(response));
  jQuery('#'+id).fadeIn();
} 
