// JavaScript Document

// Formular anzeigen
function openForm() {
	blackCloud();
	
	var content	= 'laden...';
	
	$('alertBoxContent').innerHTML = content;
	
	var url = 'wettbewerbFormular.php';
	var pars = 'site=site&sID=';
		
	var myAjax = new Ajax.Request(
			url, 
			{
				method: 'get', 
				parameters: pars, 
				onComplete: function(o) {
						$('alertBoxContent').innerHTML = o.responseText;
					}
	
	
	});
}

// Formular senden
function submitSpecial() {
	var url = 'check.php?key=send';
	
	var myAjax = new Ajax.Request(
	url, 
	{
		method: 'post', 
		postBody: $('gutschein').serialize(), 
		onComplete: function(o) {
			$('gutscheinContent').innerHTML = o.responseText;
		}
	});
}

// Mailadresse checken
function checkInput(what) {
	var url = 'check.php';
	var pars = 'key=' + what + '&value=' + $F(what);
		
	var myAjax = new Ajax.Request(
			url, 
			{
				method: 'get', 
				parameters: pars, 
				onComplete: function(o) {
						var output = o.responseText.split("###");
						
						if (output[0] == 0) {
							$('check' + what).show();
							$('check' + what).innerHTML = output[1];
							$('Input').disabled	= true;
						}
						else {
							$('check' + what).hide();
							$('Input').disabled	= false;
						}
					}
	
	
	});
}

// Schwarzen Vorhang einblenden
function blackCloud() {
	new Effect.Appear($('blackCloud'), { duration: 0.1, from: 0, to: 0.5 });
	new Effect.Appear($('alertBox'), { duration: 0.1, from: 0, to: 1 });
}
// Schwarzen Vorhang ausblenden
function closeBlackCloud() {
	new Effect.Fade($('blackCloud'), { duration: 0.1, from: 0.5, to: 0 });
	new Effect.Fade($('alertBox'), { duration: 0.1, from: 1, to: 0 });
	$('alertBox').empty();
}


function pompup(link) //news window
	{
	if (self.screen) { 
    sw = screen.width
    sh = screen.height
    w = 550 //breite
    h = 600 //hoehe
    cx = (.5*sw) - (w*.5)
    cy = (.5*sh) - (h*.5)
    var  dimentions_and_such = 'width='+w+','+'height='+h+',' + 'screenX=' +cx+','+'screenY='+cy+','+'left='+cx+','+'top='+cy
    }
	Pop=window.open(link,"gutschein",dimentions_and_such);
	}


