
// JSON decoder:
function decodeJSON(JSONstr){
	eval("var obj = "+JSONstr);
	return obj;
}		



/* function to get the initiatieven and place them on homepage inside layer*/
function saveCard(){

	var tmpUrl = "ajax/cardActions.php";
	
	if ($F('Toevoeging') == 'Toev') { 
		toevoeging = '' 
	} else {
		toevoeging = $F('Toevoeging') 
	}
/*
	alert("!");
	alert($F('Naam'));
	alert($('Naam').value);
*/ 


	var tmpParameters = "?action=savecard&hashid="+$F('hashid')+"&kaartid="+$F('kaartid')+"&naam="+escape($F('Naam'))+"&straatnaam="+escape($F('Straatnaam'))+"&huisnummer="+$F('Nr')+"&toevoeging="+escape(toevoeging)+"&postcode="+$F('Postcode')+"&plaats="+escape($F('Plaats'))+"&vdatum_dd="+$F('dd')+"&vdatum_mm="+$F('mm')+"&vdatum_jjjj="+$F('jjjj');
	var req = new Ajax.Request(
			tmpUrl,
				{
					method: "get",
					parameters: tmpParameters,
					asynchronous: "true",
					onComplete: callMovie
				}
	);
	
			
		
}


function callMovie(transport) {
	if (gJumpURL != '') {
		document.location.href=gJumpURL;
	}
					if ($F('kaartid') == 4 || $F('kaartid') == 5) {
						$('uploader').show(); 
					} else {
						$('uploader').hide(); 
					}
					/* fill in the HashId in the hidden hashId field & the fileupload field, afterwords do the file upload*/
					if (!$F('hashid')) { 
						$('hashid').value = transport.responseText;
						window.frames['uploadframe'].$('hashid').value = transport.responseText;
						}
					swfObjectPlayer = new SWFObject("verhuisbericht.swf", "fundaverhuisplayer", "600", "365", "9", "#ffffff");
					swfObjectPlayer.useExpressInstall('expressinstall.swf');
					swfObjectPlayer.addParam("scale", "noScale");
					swfObjectPlayer.addParam("wmode", "transparent");
					swfObjectPlayer.addParam("allowFullScreen", "true");
					swfObjectPlayer.addVariable("play", "true");
					swfObjectPlayer.addVariable("id", transport.responseText);
					swfObjectPlayer.write('player');
	setActByIndex($F('kaartid'));
					

}
		
var previewRules = {
	'#previewstep1' : function(el) {
			el.onclick = function() {
					saveCard();
					return false;
				}
			}
	}
	
Behaviour.register(previewRules);