/*
*/

function doubleLogin(act) {
	$('#vb_login_username').val($('#u').val());
	$('#vb_login_password').val($('#p').val());
	$('#cookieuser').val($('#k').val());
	md5hash($('#vb_login_password').get(0), $('#vb_login_md5password').get(0), $('#vb_login_md5password_utf').get(0), 0);	
	ajaxCallPage('forum/login.php#vb_login_username;vb_login_password;s;do;vb_login_md5password;vb_login_md5password_utf;cookieuser', 'POST', null, function(){
			ajaxCallPage('pages/login.submit.php#u;p;k', 'POST', null, function(rText){
					 if(rText==1) {
						 if(act=='loginFromForum') {
							 location.href='./forum/';
						 } else {
							 location.href='http://www.pes-league.gr/';
						 }
					 } else alert(rText); 
				});
		});
	
}

function checkIn(){
	ajaxCallPage('../pages/checkin.submit.php#u;p;e;a', 'POST', null, function(rText){
						 if(rText==1) {
							 alert('Check-in επιτυχές!');
							 $('#u').val('');
							 $('#p').val('');
						 } else {
							 alert(rText); 
							 $('#p').val('');
						 }
					});
}

function doubleLogout(logoutHash) {
	ajaxCallPage('forum/login.php?do=logout&logouthash='+logoutHash, 'GET', null, function(){
			ajaxCallPage('pages/logout.submit.php', 'POST', null, function(){location.href='./index.php'});
		});
}

function regUser() {
	$('#div_wait').show();
	$('#btn_register').hide();
	ajaxCallPage('pages/register.control.php?act=register#c_firstname;c_lastname;c_email;c_email_2;c_username;c_passa;c_passb','POST',null, function(rText){
		if(rText=='1'){
			location.href='./?page=register&act=regsuccess';
		} else {
			alert(rText);	
			$('#div_wait').hide();
			$('#btn_register').show();
		}
	});
}

function saveProfile() {
	var qVars = 'p_id;c_firstname;c_lastname;c_showname;p_gender;p_birthdate;p_tel;p_city;p_facebook;p_mirc;p_skype;p_icq;p_msn;p_image;p_nationality;p_fav_team;p_pes_team';
	$('#div_wait').show();
	$('#btn_save').hide();
	ajaxCallPage('pages/user.control.php?act=saveprofile#'+qVars,'POST',null, function(rText){
		if(rText=='1'){
			alert('Το προφίλ σας αποθηκεύτηκε επιτυχώς!');	
			$('#div_wait').hide();
			$('#btn_save').show();
			location.href='http://www.pes-league.gr/';
		} else {
			alert(rText);	
			$('#div_wait').hide();
			$('#btn_save').show();
		}
	});
}