function save_click(nr)
{
//alert(nr);	
document.getElementById('is_clicked').value = nr;
}

function ajax_request(divu, url) {

    $('#'+divu).load(url+'&aa='+Math.random(), "",
        function(responseText, textStatus, XMLHttpRequest) {
            if(textStatus == 'error') {
               $('#'+divu).html('<p>There was an error making the AJAX request</p>');
            }
        }
    )};

function returnObj( id )
{
    if (window.document.getElementById)
        var returnVar = window.document.getElementById(id);
    else if (document.all)
        var returnVar = document.all[id];
    else if (document.layers)
        var returnVar = document.layers[id];
    return returnVar;
}
function sherror(obj)
{

var txt = document.getElementById('mail').value;
var handleSuccess = function(o){
			returnObj("mail2").innerHTML=o.responseText;
			
			var ok = document.getElementById("is_ok").value;
			 //alert(ok);
			if (ok != 'Yes') document.getElementById("show_btn").style.display =  'none';
				else document.getElementById("show_btn").style.display =  '';
}
		
		
 
		
		
		
		var handleFailure = function(o){
			if(o.responseText !== undefined){
				alert("Error, please try again!");
			}
		};
		
		var callback =
		{
		  success:handleSuccess,
		  failure:handleFailure,
		  argument:['foo','bar']
		};
		
 
		 var sUrl='./check_mail.php';
		var postData = "txt="+txt;
		var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);
}


function contact_submit()
{
document.getElementById( 'form' ).submit();
}
function showError( field ) {
	//if (document.getElementById( field ) != 'location2') 
	document.getElementById( field ).style.color="#e47100";
	//else document.getElementById( field ).style.background="#FBBF7D";
	
}

function resetError(obj) {
	//document.getElementById('errortd').style.display='none';
	document.getElementById( obj ).style.color="#000000";
	
}

function res()
{
document.getElementById("codeerr").style.display =  'none';
}

function chksubmit() {
	f=document.getElementById( 'form' );
	err=new Array();
	/*
	if (f.name.value.length == 0) {
		showError( "name2" );
		err[err.length]="Name";
	}
	if (f.surname.value.length == 0) {
		showError( "surname2" );
		err[err.length]="Name";
	}
	if (f.street.value.length == 0) {
		showError( "street2" );
		err[err.length]="Name";
	}
	if (f.post.value.length == 0) {
		showError( "post2" );
		err[err.length]="Name";
	}
	if (f.city.value.length == 0) {
		showError( "city2" );
		err[err.length]="Name";
	}
	if (f.phone.value.length == 0) {
		showError( "phone2" );
		err[err.length]="Name";
	}
	if (f.pass.value.length == 0) {
		showError( "pass2" );
		err[err.length]="Name";
	}
	
	
	
	if (f.terms.checked == false) {
		showError( "terms2" );
		err[err.length]="Firma";
	}
	
	
	if (f.codeX.value.length == 0) {
		showError( "code2X" );
		err[err.length]="Name";
	}
	
	
	if (!f.mail.value.match( /^[-\w.]+@([A-z0-9][-A-z0-9]+\.)+[A-z]{2,4}$/ )) {
		showError( "mail2" );
		err[err.length]="Mailadresse";
	}
	 
	*/
	if (err.length==0) {
						//f.submit();
						contact_submit();
		
	}
	
}
function resetE()
{
document.getElementById('errormatch').style.display='none';
}
function foo(textarea,limit){
var val=textarea.value.replace(/\r/g,'').split('\n');
if(val.length>limit){
alert('You can not enter\nmore than '+limit+' lines');
textarea.value=val.slice(0,-1).join('\n')
}
}
      $(document).ready(function() {
						
	// $('form').submit(function() { alert('ioio');  }) ;					
								 
        $("#info").click(function() {
          $('#info_window').AeroWindow({
            WindowTitle:          'Information',
            WindowPositionTop:    'center',
            WindowPositionLeft:   'center',
            WindowWidth:          900,
            WindowHeight:         720,
            WindowAnimationSpeed: 1000,
            WindowAnimation:      'easeInQuad',
            WindowResizable:      false,
            WindowDraggable:      true,
            WindowMinimize:       false,
            WindowMaximize:       false,
            WindowClosable:       true
          });
		 // $('#load_here').load('reg_window.php');
		  $('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
		$('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn(); //Fade in the fade layer 
		
        })				
								 
        $("#reg").click(function() {
          $('#reg_window').AeroWindow({
            WindowTitle:          'Jetzt registrieren',
            WindowPositionTop:    'center',
            WindowPositionLeft:   'center',
            WindowWidth:          314,
            WindowHeight:         585,
            WindowAnimationSpeed: 1000,
            WindowAnimation:      'easeInQuad',
            WindowResizable:      false,
            WindowDraggable:      true,
            WindowMinimize:       false,
            WindowMaximize:       false,
            WindowClosable:       true
          });
		 // $('#load_here').load('reg_window.php');
		  $('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
		$('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn(); //Fade in the fade layer 
		
        })
		 $("#reg0").click(function() {
          $('#reg0_window').AeroWindow({
            WindowTitle:          'Jetzt registrieren',
            WindowPositionTop:    'center',
            WindowPositionLeft:   'center',
            WindowWidth:          314,
            WindowHeight:         585,
            WindowAnimationSpeed: 1000,
            WindowAnimation:      'easeInQuad',
            WindowResizable:      false,
            WindowDraggable:      true,
            WindowMinimize:       false,
            WindowMaximize:       false,
            WindowClosable:       true
          });
		 // $('#load_here').load('reg_window.php');
		  $('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
		$('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn(); //Fade in the fade layer 
		
        }) 
		  
        $('#uberuns').click(function() {
          $('#uber_window').AeroWindow({
            WindowTitle:          'Über uns',
            WindowPositionTop:    'center',
            WindowPositionLeft:   'center',
            WindowWidth:          900,
            WindowHeight:         720,
            WindowAnimationSpeed: 1000,
            WindowAnimation:      'easeInQuad',
            WindowResizable:      false,
            WindowDraggable:      true,
            WindowMinimize:       false,
            WindowMaximize:       false,
            WindowClosable:       true
          });
		  
		  
		  $('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
		$('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn(); //Fade in the fade layer 
        })
		
		$('#grunde').click(function() {
          $('#grunde_window').AeroWindow({
            WindowTitle:          '10 Gründe',
            WindowPositionTop:    'center',
            WindowPositionLeft:   'center',
            WindowWidth:          900,
            WindowHeight:         720,
            WindowAnimationSpeed: 1000,
            WindowAnimation:      'easeInQuad',
            WindowResizable:      false,
            WindowDraggable:      true,
            WindowMinimize:       false,
            WindowMaximize:       false,
            WindowClosable:       true
          });
		 // $('#load_here').load('grunde_window.php');
		  $('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
		$('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn(); //Fade in the fade layer 
        })
		
		$('#fragen').click(function() {
          $('#fragen_window').AeroWindow({
            WindowTitle:          'Häufige Fragen',
            WindowPositionTop:    'center',
            WindowPositionLeft:   'center',
            WindowWidth:          900,
            WindowHeight:         720,
            WindowAnimationSpeed: 1000,
            WindowAnimation:      'easeInQuad',
            WindowResizable:      false,
            WindowDraggable:      true,
            WindowMinimize:       false,
            WindowMaximize:       false,
            WindowClosable:       true
          });
		//  $('#load_here').load('fragen_window.php');
		  $('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
		$('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn(); //Fade in the fade layer 
        })
		$('#agb').click(function() {
          $('#agb_window').AeroWindow({
            WindowTitle:          'AGB',
            WindowPositionTop:    'center',
            WindowPositionLeft:   'center',
            WindowWidth:          900,
            WindowHeight:         720,
            WindowAnimationSpeed: 1000,
            WindowAnimation:      'easeInQuad',
            WindowResizable:      false,
            WindowDraggable:      true,
            WindowMinimize:       false,
            WindowMaximize:       false,
            WindowClosable:       true
          });
		//  $('#load_here').load('agb_window.php');
		  $('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
		$('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn(); //Fade in the fade layer 
        })
		$('#daten').click(function() {
          $('#daten_window').AeroWindow({
            WindowTitle:          'Datenschutz',
            WindowPositionTop:    'center',
            WindowPositionLeft:   'center',
            WindowWidth:          900,
            WindowHeight:         720,
            WindowAnimationSpeed: 1000,
            WindowAnimation:      'easeInQuad',
            WindowResizable:      false,
            WindowDraggable:      true,
            WindowMinimize:       false,
            WindowMaximize:       false,
            WindowClosable:       true
          });
		//  $('#load_here').load('daten_window.php');
		  $('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
		$('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn(); //Fade in the fade layer 
        })
			$('#impr').click(function() {
          $('#impr_window').AeroWindow({
            WindowTitle:          'Impressum',
            WindowPositionTop:    'center',
            WindowPositionLeft:   'center',
            WindowWidth:          900,
            WindowHeight:         720,
            WindowAnimationSpeed: 1000,
            WindowAnimation:      'easeInQuad',
            WindowResizable:      false,
            WindowDraggable:      true,
            WindowMinimize:       false,
            WindowMaximize:       false,
            WindowClosable:       true
          });
		  
		//  $('#load_here').load('impr_window.php');
		  $('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
		$('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn(); //Fade in the fade layer 
        })
			
			
      });
	  
	 
