var $j = jQuery.noConflict(); function msiAuthSys(system) { $j('input').serialize(); var captbox = $j("input[name='captchaSelection']").val(); var url, data; if ( system == 'reg' ) { url = "http://www.epgamers.com/msi/remote.php?act=doreg"; data = { username: $j('#username').val(), nickname: $j('#nickname').val(), email: $j('#email').val(), password: $j('#password').val(), password2 : $j('#password2').val(), captSelect : captbox }; } else if ( system == 'login' ) { url = "http://www.epgamers.com/msi/remote.php?act=dologin"; data = { username : $j('#username').val(), email : $j('#email').val(), password : $j('#password').val(), captSelect : captbox }; } else if ( system == 'usercp' ) { url = "http://www.epgamers.com/msi/remote.php?act=doedit"; data = { id: $j('#id').val(), username: $j('#username').val(), nickname: $j('#nickname').val(), email : $j('#email').val(), oldpassword: $j('#oldpassword').val(), password: $j('#password').val(), newpassword : $j('#newpassword').val(), captSelect : captbox }; } else if ( system == 'activate' ) { url = "http://www.epgamers.com/msi/remote.php?act=doactivate"; data = { email : $j('#email').val() }; } else if ( system == 'pwd' ) { url = "http://www.epgamers.com/msi/remote.php?act=dopwd"; data = { email : $j('#email').val() }; } $j.ajax({ type: 'GET', cache: false, global: true, dataType: 'jsonp', url: url, data: data, success: function (user) { //alert(user.error); if ( user.error != '' ) { if ( $j('#msgBox').hasClass('success') == true ) { $j('#msgBox').removeClass('success'); } $j('#msgBox .msgContent').hide(); $j('#msgBox .msgContent').html(user.error).fadeIn('slow'); } else { if ( system == 'reg' || system == 'activate' || system == 'pwd') { msiPreBox(user.msg); $j('#msiUniBox').hide().fadeIn(1000); } else if ( system == 'usercp' ) { //reload new content msiLoadBox(system, user.msg); $j('#msiUniBox').hide().fadeIn(1000); } else { window.location.href = 'http://epgamers.com/forum'; } } } }); } function msiPreBox(text) { $j('#msiUniBox').html(text); //Get the window height and width var winH = $j(window).height(); var winW = $j(window).width(); //Set the popup window to center $j('#msiUniBox').css('top', (winH - $j('#msiUniBox').height()) / 3); $j('#msiUniBox').css('left', (winW - $j('#msiUniBox').width()) / 2); //if close button is clicked $j('#msiClose').click(function(e) { //Cancel the link behavior e.preventDefault(); $j('#msiMask').fadeOut('slow'); $j('.window').hide(); }); //test sub box event $j('a[title=msiubox2]').click(function(e) { //Cancel the link behavior e.preventDefault(); //Get the A tag var id = $j(this).attr('name'); msiLoadBox(id); }); } function msiLoadBox(id, msg) { var url = "http://www.epgamers.com/msi/remote.php"; var data = {act : id, msg : msg}; $j.ajax({ type: 'GET', cache: false, global: true, dataType: 'jsonp', url: url, data: data, success: function (resp) { msiPreBox(resp.data); if ( msg != null ) { $j('#msgBox').addClass('success'); $j('#msgBox .msgContent').html(msg).fadeIn(1500); } //Captcha box loading var captIntro = "Verify your action by select "; var captPath = "http://www.epgamers.com/msi/lib/js/captcha.php"; } }); } $j(document).ready(function() { $j('a[title=msiubox]').click(function(e) { //Cancel the link behavior e.preventDefault(); //Get the A tag var id = $j(this).attr('name'); //Get the screen height and width //var maskHeight = $j(window).height(); var maskHeight = $j(document).height(); var maskWidth = $j(window).width(); //Set heigth and width to mask to fill up the whole screen $j('#msiMask').css({'width':maskWidth,'height':maskHeight}); //transition effect $j('#msiMask').fadeTo(500,0.5); $j('#msiMask').fadeIn(500); //Parse content msiLoadBox(id); //transition effect $j('#msiUniBox').fadeIn(1000); }); //if mask is clicked $j('#msiMask').click(function() { $j(this).fadeOut(250); $j('.window').hide(); }); }); //Ajax loading init $j(document).ajaxStart(function(){ //alert('ajax start'); $j('#aniload').fadeIn('slow'); $j('#msgBox .msgContent').hide(); }).ajaxSend(function(){ //alert('ajax send'); $j('#aniload').fadeIn('slow'); $j('#msgBox .msgContent').hide(); }).ajaxComplete(function(){ //alert('ajax stops'); $j('#aniload').fadeOut('slow'); }); //Mask to cover the whole screen document.write("