/* * SimpleModal register Form * http://www.ericmmartin.com/projects/simplemodal/ * http://code.google.com/p/simplemodal/ * * Copyright (c) 2010 Eric Martin - http://ericmmartin.com * * Licensed under the MIT license: * http://www.opensource.org/licenses/mit-license.php * * Revision: $Id: register.js 243 2010-03-15 14:23:14Z emartin24 $ * */ jQuery(function ($) { //message //init //open //show //close //error //validate //validateEmail //showError var register = { message: null, init: function () { $('#register-form input.register, #register-form a.register').click(function (e) { e.preventDefault(); // load the register form using ajax $.get("http://www.ictjobz.com/jregister.php", function(data){ // create a modal dialog with the data $(data).modal({ closeHTML: "x", //autoPosition: true, position: ["15%",""], overlayId: 'register-overlay', containerId: 'register-container', onOpen: register.open, onShow: register.show, onClose: register.close }); }); }); }, open: function (dialog) { // add padding to the buttons in firefox/mozilla if ($.browser.mozilla) { $('#register-container .register-button').css({ 'padding-bottom': '2px' }); } // input field font size if ($.browser.safari) { $('#register-container .register-input').css({ 'font-size': '.9em' }); } // determine height var h = 320; var title = $('#register-container .register-title').html(); $('#register-container .register-title').html('Loading...'); dialog.overlay.fadeIn(200, function () { dialog.container.fadeIn(200, function () { dialog.data.fadeIn(200, function () { $('#register-container .register-content').animate({ height: h }, function () { $('#register-container .register-title').html(title); $('#register-container form').fadeIn(200, function () { $('#register-container #register-email').focus(); // fix png's for IE 6 if ($.browser.msie && $.browser.version < 7) { $('#register-container .register-button').each(function () { if ($(this).css('backgroundImage').match(/^url[("']+(.*\.png)[)"']+$/i)) { var src = RegExp.$1; $(this).css({ backgroundImage: 'none', filter: 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + src + '", sizingMethod="crop")' }); } }); } }); }); }); }); }); }, show: function (dialog) { $('#register-container .register-send').click(function (e) { e.preventDefault(); // validate form if (register.validate()) { var msg = $('#register-container .register-message'); msg.fadeOut(function () { msg.removeClass('register-error').empty(); }); $('#register-container .register-title').html('Sending...'); $('#register-container form').fadeOut(200); $('#register-container .register-content').animate({ height: '80px' }, function () { $('#register-container .register-loading').fadeIn(200, function () { $.ajax({ url: '/jregister.php', data: $('#register-container form').serialize() + '&action=send', type: 'post', cache: false, dataType: 'html', success: function (data) { $('#register-container .register-loading').fadeOut(200, function () { $('#register-container .register-title').html(data); msg.html(data).fadeIn(200); // $.ajaxSetup({ // complete: function (xhr) { // var redirect = xhr.getResponseHeader('Redirect'); // if (redirect) alert(redirect); //if(redirect) window.location = redirect; // } // }); $('#register-container .register-title').html('