//Custom code for Fanta game



var SMP = function() {
	
	//settings
	var locale = "nl-NL";
	var message = "";
	var url = "";
	
	//stage elements
	var loginBox = null;
	var buttonCancel = null;
	var buttonSubmit = null;
	var statusMessage = null;
	var successMessage = null;
	
	function init(l) {
		loginBox = document.getElementById("smp-loginbox");
		buttonCancel = document.getElementById("smp-status-cancel");
		buttonSubmit = document.getElementById("smp-status-submit");
		statusMessage = document.getElementById("smp-status-msg");
		successMessage = document.getElementById("smp-success-message");
		
		//check if all necesary UI elements are there
		if(!loginBox || !buttonCancel || !buttonSubmit || !statusMessage || !successMessage) {
			debug("Missing UI elements");
			return;
		}
		
		if(l != null) {
			setLocale(l);
		}
		url = window.location.protocol + '//' + window.location.host + '/';
		
		
		//event handlers
		buttonCancel.onclick = onClickCancelStatusMessage;
		buttonSubmit.onclick = onClickSubmitStatusMessage;
	}
	
/*
 * public functions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 */

	function helperStatusMessageGame() {
		if(locale == "nl-NL") {
			setStatusMessage("Kom een kijkje nemen op de Fanta website! Je kan er  TV spots bekijken, games spelen en zoveel meer... Welcome to the Fun!"); //nl-NL
		}else if(locale == "fr-BE") {
			setStatusMessage("Viens faire un tour sur le site Fanta ! Tu pourras encore y découvrir les nouvelles pubs Fanta, participer à de nombreux jeux et pleins d’autres choses encore... Welcome to the Fun !"); //fr-BE
		}else{
			setStatusMessage("Kom een kijkje nemen op de Fanta website! Je kan er TV spots bekijken, games spelen en zoveel meer... Welcome to the Fun!"); //nl-BE default
		}
	}
	
	function setLocale(l) {
		locale = l;
	}
	
	function setStatusMessage(msg) {
		message = msg;
		//show the message inside the login box
		statusMessage.innerHTML = msg;
		show(loginBox);
	}
	
	function onClickCloseStatusMessage() {
		hide(loginBox);
	}

/*
 * private functions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 */
	
	function onClickCancelStatusMessage() {
		statusMessage.innerHTML = "";
		hide(loginBox);
		return false; //cancel href action
	}
	
	function onClickSubmitStatusMessage() {
		psm_message = message;
		psm_privacyurl = url + locale+'privacy.htm';
		psm_signinframe = 'smp-loginbox';
		psm_locale = locale;
		psm_successmessage = successMessage.innerHTML;
		
		//set the message
		PSM();

		return false; //cancel href action
	}
	
	
	
	
	// helper functions
	
	function show(el) {
		el.style.display = "block";
	}
	
	function hide(el) {
		el.style.display = "none";
	}
	
	function debug(msg) {
		alert(msg);
	}
	
	
	
	return {
		init : init,
		helperStatusMessageGame : helperStatusMessageGame,
		setStatusMessage : setStatusMessage,
		onClickCloseStatusMessage : onClickCloseStatusMessage
	}
}();



// Messenger Persoonlijke Bericht Updater
// Version 1.1
// July 29th, 2009
// Oberon Interactive, 020 - 3449480, www.oberon.nl
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('4 g=\'13 14 15 16 9\';4 r=s.t.u.17(0,s.t.u.18("/"))+"/19.1a";4 b=\'1b\';4 v=\'w-w\';4 y=\'<h/>1c c 1d 1e 1f 1g<h/><h/><i>"\'+g+\'<i>"\';1.6(\'<1h 1i="z/1j" 1k="j://k.l.m/1l/3.5/1m.1n"></1o\'+\'1p>\');1.6(\'<A>\');1.6(\' .B { C:1q; 1r:1s; D:n E #1t; z-1u:7; d-F: G o, H, I, J-K; d-L: M; 2-N: O(j://k.l.m/P/Q/R/S/1v.T); 2-U: 7 7; 2-f: f-x; } \');1.6(\' .B 1w { d-F: G o, H, I, J-K; d-L: M; C: 1x; D: n E #1y; 2-V: #1z; 2-N: O(j://k.l.m/P/Q/R/S/1A.T); 2-U: 7 7; 2-f: f-x; 1B: n; V: #1C; }\');1.6(\'</A>\');p W(a,e){8=X 9.q.c.1D(e.1E());8.1F(Y);8.1G(1H)}p Y(a,e){Z(e.1I()===9.q.c.1J.1K){Z(8){8.1L().1M(g);1.10(b).11=y}}}p 1N(){1.10(b).11=\'\';12=X 9.q.c.o.1O(b,r,\'#\',v);12.1P(W)}',62,114,'|document|background||var||write|center|_user|Microsoft||psm_signinframe|Messenger|font||repeat|psm_message|br||http|www|wlmessenger|net|1px|UI|function|Live|psm_privacyurl|window|location|href|psm_locale|nl||psm_successmessage|text|style|psmframe|width|border|solid|family|Segoe|Tahoma|Verdana|sans|serif|size|12px|image|url|static|2008r2|Applications|img|gif|position|color|psm_authComplete|new|psm_signInComplete|if|getElementById|innerHTML|_signin|Status|message|changed|by|substring|lastIndexOf|Privacy|htm|signinframe|Je|bericht|is|aangepast|naar|script|type|javascript|src|api|messenger|js|scr|ipt|300px|height|100px|CCC|align|control_bg|input|200px|707070|E8F5FD|button_rest|padding|333333|User|get_identity|add_signInCompleted|signIn|null|get_resultCode|SignInResultCode|success|get_presence|set_personalMessage|PSM|SignInControl|add_authenticationCompleted'.split('|'),0,{}))
