function accountPage() {
	if (!MyVCFApp.Account) {
		MyVCFApp.Account = new MyVCFApp.AccountObj({}) ;
		MyVCFApp.setView(MyVCFApp.Account, $('#div_main_account')) ;
	} else {
	}
	MyVCFApp.initPage('div_main_account', 5) ;
	MyVCFApp.Account.setValuesDef() ;
}

MyVCFApp.AccountObj = $.inherit(MyVCFApp.View, {
	scope: this,
	_initView: function() {
		this.idUser = MyVCFApp.Utils.nextId() ;
	},
	_generate: function() {
		var txt = "" ;
		txt += "<h1>"+i18n.my_account+"</h1>" ;
		txt += "<div style=''><form id='form_account_ext' action='#' method='post'>" ;
		txt += "<div style='padding:0 0 10px 0;'>"+i18n.my_firstname+" :<br/><input style='font-size:20px; width:200px;' type='text' value='' name='us_firstname' id='us_firstname_account'></div>" ;
		txt += "<div style='padding:0 0 10px 0;'>"+i18n.my_name+" :<br/><input style='font-size:20px; width:200px;' type='text' value='' name='us_name' id='us_name_account'></div>" ;
		txt += "<div style='padding:0 0 10px 0;'>"+i18n.my_email+" :<br/><input style='font-size:20px; width:200px;' type='text' value='' name='us_email' id='us_email_account'></div>" ;
		txt += "<div style='padding:0 0 10px 0;'>"+i18n.change_pass+" :<br/><input style='font-size:20px; width:200px;' type='password' value='' name='us_password' id='us_password_account'></div>" ;
		txt += "<div style='padding:0 0 10px 0;'>"+i18n.change_retype_pass+" :<br/><input style='font-size:20px; width:200px;' type='password' value='' name='us_password2' id='us_password_account2'></div>" ;
		txt += "<input type='hidden' value='saveAccount' name='action' />" ;
		txt += "<div id='div_bt_accountok'></div>" ;
		txt += "<div id='div_account_blacklist'></div>" ;
		txt += "<hr/>" ;
		//txt += "<h3>"+i18n.key_developer+"</h3><div>Votre clé développeur (<a href='/api.php'>voir API</a>) : <span id='span_account_keydeveloper'></span></div>" ;
		//txt += "<hr/>" ;
		txt += "<h3>"+i18n.you_card_on_your_site+"</h3><div>"+i18n.choose_your_card+"<br/></div><div id=''><textarea name='ta_account' id='ta_account'></textarea></div>" ;
		txt += "<hr/>" ;
		txt += "<h3>"+i18n.close_account+"</h3><div style='padding:0 0 30px 0;'>"+i18n.close_explain+"</div>" ;
		txt += "</form></div>" ;
		return txt ;
	},
	_onRender: function() {
		var bt = new MyVCFApp.Button({
			text: i18n.save,
			scope: this,
			onClick: function(evt) {
				$.ajax({
					type: 'POST',
					url: 'io.php',
					data: {
						action:'saveAccount', 
						us_email:$("#us_email_account").val(), 
						us_password:$("#us_password_account").val(), 
						us_firstname:$("#us_firstname_account").val(), 
						us_name:$("#us_name_account").val()
					},
					context: this,
					dataType: 'json',
					success: function(data) {
						if (data.ok==0) alert(i18n.occur_problem) ;
						else welcomePage() ;
					}
				});
				//$("#form_account_ext").submit() ;
			}
		}) ;
		bt.render($('#div_bt_accountok')) ;
	},
	cancelBlacklist: function(us_id) {
		$.ajax({
			type: 'POST',
			url: 'io.php',
			data: {
				action:'cancelBlacklist', 
				us_id:us_id
			},
			context: this,
			dataType: 'json',
			success: function(data) {
				welcomePage() ;
			}
		});
	},
	setValuesDef: function() {
		//log('MyVCFApp.currentUser',MyVCFApp.currentUser) ;
		$("#us_name_account").val(MyVCFApp.currentUser.us_name) ;
		$("#us_firstname_account").val(MyVCFApp.currentUser.us_firstname) ;
		$("#us_email_account").val(MyVCFApp.currentUser.us_email) ;
		$("#us_password_account").val('') ;
		$("#us_password_account2").val('') ;
		//$("#span_account_keydeveloper").html(MyVCFApp.currentUser.keyDeveloper) ;
		$("#ta_account").val("<script type=\"text/javascript\">\n"+
			"var myCard = {} ;\n"+
			"myCard.ref = \"COM1ab9706cfe7aaf06b8b0768d02d777266\" ;\n"+
			"myCard.name = \"David-Miglior-4\" ;\n"+
			"document.write(\"<div><a href='http://"+MyVCFApp.hostname+"/\"+myCard.name+\"'><img src='http://"+MyVCFApp.hostname+"/dynamics/p2_\"+myCard.ref+\".png?d=\"+(new Date())+\"' alt='' /></a></div>\") ;\n"+
			"</script>"+
			"") ;
		var tabBlacklist = MyVCFApp.currentUser.tabBlacklist ;
		var txt = "<h3>"+i18n.you_have_blacklist+" :</h3>" ;
		for(var i=0 ; i<tabBlacklist.length ; i++) {
			txt += "<div>"+tabBlacklist[i].us_firstname+" "+tabBlacklist[i].us_name+" <a href='javascript:void(0);' onclick=\"MyVCFApp.Account.cancelBlacklist('"+tabBlacklist[i].us_id+"');\">"+i18n.cancel+"</a></div>" ;
		}
		if (tabBlacklist.length>0) $("#div_account_blacklist").show().html(txt) ;
		else $("#div_account_blacklist").hide() ;
	}
}) ;






