var loc_register=new Array();loc_register['commander_name_length_err']='Votre nom de Commandant doit faire entre 3 et 25 caractères';loc_register['email_err']='Email non valide';loc_register['password_length_error']='Votre mot de passe doit faire entre 3 et 25 caractères'; function login() { //window.location=("site/_common/ident/loginForm/login.php"); var login=$('#login').val(); var pass=$('#pass').val(); var queryString=("login="+login+"&pass="+pass); $.post("site/_common/ident/loginForm/login.php",queryString,function(data){ if(data=="ok"){ window.location=("site/"); } else { $.modal("

Erreur



"+data+"
"); } }); } function register() { pageTracker._trackPageview("/welcome_page/register_box"); $(".titre").hide('fast'); $(".separation1").hide('fast'); $("#id_of_gallery").remove(); $("#buttons").hide('fast'); $("#preview_div").hide('fast'); $("#buttons2").remove(); $("input").val(''); $('#register_box').show('slow'); } /* function preview() { $(".titre").hide('fast'); $(".separation1").hide('fast'); $("#buttons").hide('fast'); //$.getScript("libraries/jquery-gallery/jquery.gallery.0.3.min.js"); var output=""; output+=''; output+='
'; output+=' Retour

'; output+=' Inscrivez-vous maintenant !'; output+='
'; $('.content').append(output); $('#id_of_gallery').gallery({ interval: 5500, height: '465px', width: '600px', slideshow:false }); $('#id_of_gallery').center(); $(".register").click(function(event){ event.preventDefault(); register(); }); $(".homepage").click(function(event){ event.preventDefault(); window.location.replace("http://www.weymery.com/"); }); }*/ function preview() { $(".titre").hide('fast'); $(".separation1").hide('fast'); $("#buttons").hide('fast'); pageTracker._trackPageview("/welcome_page/preview"); $.ajax({ url: 'preview.html', cache: false, success: function(data) { $('.content').append(data); $('a.lightbox').lightBox(); $(".register").click(function(event){ event.preventDefault(); register(); }); $(".homepage").click(function(event){ event.preventDefault(); window.location.replace("http://www.weymery.com/"); }); } }); } jQuery.fn.center = function () { this.css("position","absolute"); this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px"); this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px"); return this; } jQuery.fn.horiz_center = function () { this.css("position","absolute"); this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px"); return this; } function registerPlayer() { pageTracker._trackPageview("/welcome_page/register_player"); //alert($('#register_form').serialize()); var $queryString = $('#register_form').serialize(); $queryString+=("&function=register®isterPlayer=1"); $.post("http://www.weymery.com//site/register/registerPlayer.php",$queryString,function(data){ var $url=data.substr(0,4) ; if($url=="http")window.location=data; else { $.modal("

Erreur



"+data+"
"); } },"text"); } function validate_string($string,$min,$max) { if($string.length<$min||$string.length>$max) { return(loc_register['commander_name_length_err']); } return""; } function validate_password($string,$min,$max) { if($string.length<$min||$string.length>$max) { return(loc_register['password_length_error']); } return""; } function getSpecialSkills(idRace) { $.post("http://www.weymery.com//utils/functions/registerUtils.php",{ "function":"getSpecialSkillsTranslated", "registerUtils":1, "jq":1, "race":idRace },function(special_skills){ var $output=''; $('#special_skills_list').empty(); $output+='"; $('#special_skills_list').append($output); $('#special_skills_line').show(); },"json"); } function isValidEmailAddress(emailAddress) { var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i); if(pattern.test(emailAddress)==false) { return(loc_register['email_err']); } return ""; } $(document).ready(function() { pageTracker._trackPageview("/welcome_page/splash"); $('#login').val("Nom de Commandant"); $('#pass').val(""); $("#login_button").click(function(event){ event.preventDefault(); login(); }); $(".register").click(function(event){ event.preventDefault(); register(); }); $(".preview").click(function(event){ event.preventDefault(); preview(); }); $("a[id=join_weymery]").click(function(event){ event.preventDefault(); registerPlayer(); }); $('#login').focus(function(){ $(this).val(""); }); $('#register_box').center(); $('#ajaxBusyIndicator').center(); $('.horiz_center').horiz_center(); $("input[id='commander_name']").keyup( function() { $("#commander_name_error").html(validate_string($(this).val(),3,25)); }); $("input[id='password']").keyup( function() { $("#password_error").html(validate_password($(this).val(),3,25)); }); $("input[id='email']").keyup( function() { $("#email_error").html(isValidEmailAddress($(this).val())); }); $("select[id='race']").change(function(){ getSpecialSkills($(this).val()); }); //Check if enter key pressed $(document).keydown(function(event){ if (event.keyCode == 13) { if($('#pass').val().length>0) { login(); } } }); }); // Ajax activity indicator bound // to ajax start/stop document events $(document).ajaxStart(function(){ $('#ajaxBusyIndicator').show(); }).ajaxStop(function(){ $('#ajaxBusyIndicator').hide(); });