$(function() {
	$('#partnerpassform').submit(function() {

		// validate and process form
		// first hide any error messages
		var pass = $("input#passwd").val();
		 
		// phpscript.php aufrufen über POST aufrufen
		// entspricht: phpscript.php?a=callDoAnything&b=[Inhalt von iofield]
		result = $.ajax({
		    type: 'POST',
		    async: false,   // WICHTIG!
		    url: 'encrypt.php',
		    data: ({
		        a: "encrypt",
		        b: pass
		    })
		}).responseText;
		
		if(result) {
			passfile = result + ".php";
			// 
		}
		else {
			$('#message').append("<p>Bitte ein Passwort eingeben.</p>");			
		}
		
		var jxhr = $.ajax({ url: passfile })
		    .success(function(XMLmediaArray) { 
		    	$('#message').html("<div id='message'></div>")
	        .append("<p>Datei gefunden, wird aufbereitet für die Anzeige</p>")
					.hide()
        	.fadeIn(1500);
        	
		    	$('#partnerpass').attr('src', passfile);

		   	})
		    .error(function() { 
	        $('#message').html("<div id='message'></div>")
	        .append("<p>Das eingegebene Passwort ist nicht korrekt.</p>")
					.hide()
        	.fadeIn(1500);

		    });			

    return false;
	});
});



