  function showLoading(){
	  	var loading = $("#loading");
		loading
			.css({visibility:"visible"})
			.css({opacity:"1"})
			.css({display:"block"})
		;
	}
		//hide loading bar
	function hideLoading(){
			var loading = $("#loading");
		loading.fadeOut("slow");
	}
   function showContent(page){
	var loading = $("#loading");
	var content = $("#content");
	showLoading();
		content.hide();
				content.load(page, hideLoading);
				content.fadeIn("slow");


   window.scrollTo(0, 0);
   document.getElementById("content").scrollTop = 0;
  }

function meinlader(loadmysite)
{
    var content = $("#content");
    content.slideUp();
    var sidebar = $("#sidebar");
    sidebar.slideUp();
    var loading = $("#loading");
    loading
    .css(
    {visibility:"visible"})
    .css(
    {opacity:"1"})
    .css(
    {display:"block"})
    switch(loadmysite)
    {
      case "home":
        content.load("home.php", hideLoader);
	    sidebar.load("homes.html", function()
        {hideLoader();
            content.slideDown();
            sidebar.slideDown();
		        });
        break;
        case "portrait0":
        content.load("portrait0.html", hideLoader);
        sidebar.load("portraits0.html", function()
        {hideLoader();
            content.slideDown();
            sidebar.slideDown();
        });
		break;
				        case "portrait1":
        content.load("portrait1.html", hideLoader);
        sidebar.load("portraits1.html", function()
        {hideLoader();
            content.slideDown();
            sidebar.slideDown();
        });
        break;
        case "homeoeoladen":
        content.load("homeoeo.php #section_homeoeo", hideLoader);
        sidebar.load("homeoeos1.html", function()
        {hideLoader();
            content.slideDown();
            sidebar.slideDown();
        });
        break;
        case "hangebot":
        content.load("homeoeo.php #section_hangebot", hideLoader);
        sidebar.load("homeoeos.html", function()
        {hideLoader();
            content.slideDown();
            sidebar.slideDown();
        });
        break;
        case "infos1":
        content.load("homeoeo.php #section_infos1", hideLoader);
        sidebar.load("homeoeos.html", function()
        {hideLoader();
            content.slideDown();
            sidebar.slideDown();
        });
        break;
		        case "infos11":
        content.load("homeoeo.php #section_infos11", hideLoader);
        sidebar.load("homeoeos.html", function()
        {hideLoader();
            content.slideDown();
            sidebar.slideDown();
        });
        break;
        case "infos2":
        content.load("homeoeo.php #section_infos2", hideLoader);
        sidebar.load("homeoeostier.html", function()
        {hideLoader();
            content.slideDown();
            sidebar.slideDown();
        });
        break;
        case "infos3":
        content.load("homeoeo.php #section_infos3", hideLoader);
        sidebar.load("homeoeos.html", function()
        {hideLoader();
            content.slideDown();
            sidebar.slideDown();
        });
        break;
        case "infos31":
        content.load("homeoeo.php #section_infos31", hideLoader);
        sidebar.load("homeoeos.html", function()
        {hideLoader();
            content.slideDown();
            sidebar.slideDown();
        });
        break;
        case "infos32":
        content.load("homeoeo.php #section_infos32", hideLoader);
        sidebar.load("homeoeos.html", function()
        {hideLoader();
            content.slideDown();
            sidebar.slideDown();
        });
        break;
        case "hpreisliste":
        content.load("homeoeo.php #section_hpreisliste", hideLoader);
        sidebar.load("homeoeos.html", function()
        {hideLoader();
            content.slideDown();
            sidebar.slideDown();
        });
        break;
		      case "hpreisliste1":
        content.load("homeoeo.php #section_hpreisliste1", hideLoader);
        sidebar.load("homeoeos.html", function()
        {hideLoader();
            content.slideDown();
            sidebar.slideDown();
        });
        break;
        case "honline":
        content.load("homeoeo.php #section_honline", hideLoader);
        sidebar.load("homeoeos.html", function()
        {hideLoader();
            content.slideDown();
            sidebar.slideDown();
        });
        break;
        case "hfragebogen":
        content.load("homeoeo.php #section_fragebogen", hideLoader);
        sidebar.load("msg.html", function()
        {
		hideLoader();
            content.slideDown();
            sidebar.slideDown();
			$("#vornameError").hide(); 
$("#nameError").hide();
$("#emailError").hide();
$("#messageError").hide();
$("#codeError").hide();
$("#websiteError").hide();
			
        });
        break;
        case "massagetheras":
        content.load("massagethera.html #section_massagethera", hideLoader);
        sidebar.load("massagetheras1.html", function()
        {hideLoader();
            content.slideDown();
            sidebar.slideDown();
        });
        break;
        case "dornhock":
        content.load("massagethera.html #section_dornhock", function()
        {
            sidebar.load("massagetheras.html", function()
            {hideLoader();
                content.slideDown();
                sidebar.slideDown();
            });
		        });
        break;
        case "breuss":
        content.load("massagethera.html #section_breuss", function()
        {
            sidebar.load("massagetheras.html", function()
            {hideLoader();
                content.slideDown();
                sidebar.slideDown();
            });
        });
        break;
		 case "dornhock1":
        content.load("massagethera.html #section_dornhock1", function()
        {
            sidebar.load("massagetheras.html", function()
            {hideLoader();
                content.slideDown();
                sidebar.slideDown();
            });
		        });
        break;
        case "breuss1":
        content.load("massagethera.html #section_breuss1", function()
        {
            sidebar.load("massagetheras.html", function()
            {hideLoader();
                content.slideDown();
                sidebar.slideDown();
            });
        });
        break;
        case "klmassagen":
        content.load("massagethera.html #section_klmassagen", function()
        {
            sidebar.load("massagetheras.html", function()
            {hideLoader();
                content.slideDown();
                sidebar.slideDown();
            });
        });
        break;
        case "spezmassagen":
        content.load("massagethera.html #section_spezmassagen", function()
        {
            sidebar.load("massagetheras.html", function()
            {hideLoader();
                content.slideDown();
                sidebar.slideDown();
            });
        });
        break;
		case "fussreflex":
        content.load("massagethera.html #section_fussreflex", function()
        {
            sidebar.load("massagetheras.html", function()
            {hideLoader();
                content.slideDown();
                sidebar.slideDown();
            });
        });
        break;
        case "mpreisliste":
        content.load("massagethera.html #section_mpreisliste", function()
        {
		sidebar.load("massagetheras.html", function()
		{hideLoader();
            content.slideDown();
            sidebar.slideDown();
        });
		});
        break;
		        case "mpreisliste1":
        content.load("massagethera.html #section_mpreisliste1", function()
        {
		sidebar.load("massagetheras.html", function()
		{hideLoader();
            content.slideDown();
            sidebar.slideDown();
        });
		});
        break;
        case "mfragebogen":
        content.load("massagethera.html #section_fragebogen", hideLoader);
        sidebar.load("msg.html", function()
        {
		hideLoader();
            content.slideDown();
            sidebar.slideDown();
			$("#vornameError").hide(); 
$("#nameError").hide();
$("#emailError").hide();
$("#messageError").hide();
$("#codeError").hide();
$("#websiteError").hide();
			
        });
        break;
		case "ernaerung":
        content.load("ernaerung.php #section_ernaerung", hideLoader);
        sidebar.load("ernaerungs.html", function()
        {hideLoader();
            content.slideDown();
            sidebar.slideDown();
        });
        break;
						case "coaching":
        content.load("ernaerung.php #section_coaching", hideLoader);
        sidebar.load("ernaerungs.html", function()
        {hideLoader();
            content.slideDown();
            sidebar.slideDown();
        });
        break;
				case "entlastung":
        content.load("ernaerung.php #section_entlastung", hideLoader);
        sidebar.load("ernaerungs.html", function()
        {hideLoader();
            content.slideDown();
            sidebar.slideDown();
        });
        break;
				case "ernpreis":
        content.load("ernaerung.php #section_ernpreis", hideLoader);
        sidebar.load("ernaerungs.html", function()
        {hideLoader();
            content.slideDown();
            sidebar.slideDown();
        });
        break;
        case "lageplan":
        content.load("kontakt.html #section_lageplan", hideLoader);
        sidebar.load("kontaktmap.html", function()
        {hideLoader();
            content.slideDown();
            sidebar.slideDown();
        });
        break;
        case "kontakts":
        content.load("kontakt.html #section_kontakt", hideLoader);
        sidebar.load("kontakts.html", function()
        {hideLoader();
            content.slideDown();
            sidebar.slideDown();
        });
        break;
		
		case "erfahrungsbericht":
      content.load("include/gb/gb.php?seite=1", hideLoader);
	 /*  content.load("include/gb/eintrag.php", hideLoader);*/
        sidebar.load("homes.html", function()
        {hideLoader();
            content.slideDown();
            sidebar.slideDown();
        });
        break;
		case "gb":
      content.load("include/gb/gb.php?seite=1", hideLoader);

        sidebar.load("homes.html", function()
        {hideLoader();
            content.slideDown();
            sidebar.slideDown();
        });
        break;
		case "kfragebogen":
        content.load("include/kontakt/kontakt.php", hideLoader);
        sidebar.load("kontakts.html", function()
        {
		hideLoader();
            content.slideDown();
            sidebar.slideDown();
			$("#vornameError").hide(); 
$("#nameError").hide();
$("#emailError").hide();
$("#messageError").hide();
$("#codeError").hide();
$("#websiteError").hide();
			
        });
        break;
		case "sendmessage":
			var code = $("input#code").val();
			var vorname = $("input#vorname").val();
			var name = $("input#name").val();
    		var strasse = $("input#strasse").val();
			var plz = $("input#plz").val();
			var ort = $("input#ort").val();
			var email = $("input#email").val();
			var website = $("input#website").val();
			var message = $("textarea#message").val();
			var feedback = $("input#feedback").val();
	      if ($("#anrede:checked").val() == "Herr") {
  
      var anrede ="Herr";
        } else {
			 var anrede ="Frau";
			}


			var dataString = 'anrede='+ anrede + '&code='+ code + '&vorname='+ vorname + '&name=' + name + '&strasse=' + strasse + '&plz=' + plz + '&ort=' + ort + '&email=' + email + '&website=' + website + '&message=' + message + '&feedback=' + feedback;  
$.ajax({  
type: "POST",  
   url: "sendemail.php",  
   data: dataString,  
    success: function(check) {  
	if (check == "ok") { 
		content.load("danke.html", function()
        {hideLoader();});
        sidebar.load("dankes.html", function()
        {hideLoader();
            content.slideDown();
            sidebar.slideDown();
        });
		}
		if (check == "illegal") { 
		content.load("sorry.html", function()
        {hideLoader();});
        sidebar.load("sorrys.html", function()
        {hideLoader();
            content.slideDown();
            sidebar.slideDown();
        });
		}
		
      }  
        });
        break;
        default:
        content.load("http://o-d-l.ch/", hideLoader);
        sidebar.load("homes.html", function()
        {hideLoader();
            content.slideDown();
            sidebar.slideDown();
        });
        break;
    }
}
var url = 'captcheck.php?code=';
var captchaOK = 2;  // 2 - not yet checked, 1 - correct, 0 - failed
function getHTTPObject()
        {
        try {
        req = new XMLHttpRequest();
          } catch (err1)
          {
          try {
          req = new ActiveXObject("Msxml12.XMLHTTP");
          } catch (err2)
          {
          try {
            req = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (err3)
            {
	req = false;
            }
          }
	}
        return req;
	}
	var http = getHTTPObject();
	     function handleHttpResponse() {
        if (http.readyState == 4) {
            captchaOK = http.responseText;
            if(captchaOK != 1) {
              $("#codeError").html('<span class="error">Der Sicherheits Code ist falsch.</span>');
              $("#input#code").focus();
				 $("#codeError").show(); 
              return false;
              }
			meinlader('sendmessage');
           }
        }

        function checkcode(thecode) {
	    http.open("GET", url + escape(thecode), true);
		http.send(null);
		http.onreadystatechange = handleHttpResponse;
    
		}
		
function checkform()
{ 
$("#vornameError").hide(); 
$("#nameError").hide();
$("#emailError").hide();
$("#messageError").hide();
$("#codeError").hide();
$("#websiteError").hide();
	var vorname = $("input#vorname").val();
		 if (vorname == "") {  
		 $("#vornameError").html('<span class="error">Das Vornamens Feld ist leer.</span>');
         $("#input#vorname").focus();  
		 $("#vornameError").show(); 
 return false; 
}
		var name = $("input#name").val();
		 if (name == "") {  
		 $("#nameError").html('<span class="error">Das Namens Feld ist leer.</span>');
         $("#input#name").focus();  
		 $("#nameError").show(); 
 return false; 
}	

		var emailReg = /^([\w]+)(.[\w]+)*@([\w]+)(.[\w]{2,3}){1,2}$/;
		var email = $("input#email").val();
		 if (email == "") {  
		 $("#emailError").html('<span class="error">Das Email Feld ist leer.</span>');
		          $("#input#email").focus();  
		 $("#emailError").show(); 
 return false;
		 } else if(!emailReg.test(email)) {	
			$("#emailError").html('<span class="error">Email Adresse Ung&uuml;ltig. bsp hans@muster.ch</span>');
			
		 
         $("#input#email").focus();  
		 $("#emailError").show(); 
 return false; 
}	
var httpReg = /^(http:\/\/www.|https:\/\/www.|ftp:\/\/www.|www.){1}([\w]+)(.[\w]+){1,2}$/;
		var website = $("input#website").val();
		 if (website == "") {  
			 $("input#website").attr("value", "http://"); 
		          $("#input#website").focus();  
 		 } else 
		 if (website > "http://") { 
		 if(!httpReg.test(website)) {	
			$("#websiteError").html('<span class="error">Webseite Adresse Ung&uuml;ltig, bsp (http://www.odl.ch) sonst m&uuml;ssen Sie (http://) stehen lassen.</span>');
			
		 
         $("#input#website").focus();  
		 $("#websiteError").show(); 
 return false; 
}	
}
		var message = $("textarea#message").val();
		 if (message == "") {  
		 $("#messageError").html('<span class="error">Das Nachrichten Feld ist leer.</span>');
         $("#textarea#message").focus();  
		 $("#messageError").show(); 
 return false; 
}
				 if (message.length > 768) {  
		 $("#messageError").html('<span class="error">Ihre Nachrichten ist '+message.length+' Zeichen lang Sie darf h&ouml;chstens 768 sein.</span>');
         $("#textarea#message").focus();  
		 $("#messageError").show(); 
 return false; 
}
				
		 if (message > "") { 
		var Woerter = message.split(" ");
var worte=/\barschloch\b|\barsch\b|\bpimel\b|\bschwanz\b|\futz\b|\bmuschi\b|\bporno\b|\bsex\b|\bsexfilm\b|\bkinderporno\b|\bkinder porno\b|\bfuck\b|\bkinder sex\b/g;
message1=message.toLowerCase();
Ergebnis = message1.match(worte);
if (Ergebnis)
 { 
  for (var i = 0; i < Ergebnis.length; ++i)
   {
$("#messageError").html('<span class="error">Bitte &auml;nder Sie das Wort&nbsp;' +Ergebnis[i]+ '&nbsp;in der Nachricht</span>');
$("#textarea#message").focus();  
$("#messageError").show(); 
}
 return false; 
}else{ 
$("#input#code").focus(); 
}
}	
	var name = $("input#code").val();
		 if (name == "") {  
		 $("#codeError").html('<span class="error">Das Sicherheits Code Feld ist leer.</span>');
         $("#input#code").focus();  
		 $("#codeError").show(); 
 return false; 
}	
		
checkcode(name);
return false;
};			


function hideLoader()
{
var loading = $("#loading");
loading.fadeTo(1000,0,function()
	{
    if($("div#.gallery").length)
    	{	
		$("a#single_image1").fancybox();
		$("a#single_image2").fancybox();
		$("a#single_image3").fancybox();
		$("a#single_image4").fancybox();
		$("a#single_image5").fancybox();
		/*	$("a").fancybox(); 
	
    	$.getScript("js/jquery.easing.1.3.js", function()
    		{
			$.getScript("js/jquery.easing.1.3.js");
			$.getScript("js/jquery.fancybox-1.2.1.pack.js");
			$("a").fancybox();
			alert ();
			    	});*/
	
		}
	
					 
    });

	
};

