1jQuery(function ($) { 2 var contact = { 3 message: null, 4 init: function () { 5 $('#academy-form input.contact, #academy-form a.contact').click(function (e) { 6 e.preventDefault(); 7 8 // load the contact form using ajax 9 $.get("/misc/form_arm.php", function(data){ 10 // create a modal dialog with the data 11 $(data).modal({ 12 closeHTML: "<a href='#' title='ÕÕ¡Õ¯Õ¥Õ¬' class='modal-close'>x</a>", 13 position: ["25%",], 14 overlayId: 'contact-overlay', 15 containerId: 'contact-container', 16 onOpen: contact.open, 17 onShow: contact.show, 18 onClose: contact.close 19 }); 20 }); 21 }); 22 }, 23 open: function (dialog) { 24 // add padding to the buttons in firefox/mozilla 25 if ($.browser.mozilla) { 26 $('#contact-container .contact-button').css({ 27 'padding-bottom': '2px' 28 }); 29 } 30 // input field font size 31 if ($.browser.safari) { 32 $('#contact-container .contact-input').css({ 33 'font-size': '.9em' 34 }); 35 } 36 37 // dynamically determine height 38 var h = 330; 39 if ($('#contact-subject').length) { 40 h += 26; 41 } 42 if ($('#contact-cc').length) { 43 h += 22; 44 } 45 46 var title = $('#contact-container .contact-title').html(); 47 $('#contact-container .contact-title').html('Ô²Õ¥Õ¼Õ¶Õ¸ÖÕ´...'); 48 dialog.overlay.fadeIn(200, function () { 49 dialog.container.fadeIn(200, function () { 50 dialog.data.fadeIn(200, function () { 51 $('#contact-container .contact-content').animate({ 52 height: h 53 }, function () { 54 $('#contact-container .contact-title').html(title); 55 $('#contact-container form').fadeIn(200, function () { 56 $('#contact-container #contact-name').focus(); 57 58 $('#contact-container .contact-cc').click(function () { 59 var cc = $('#contact-container #contact-cc'); 60 cc.is(':checked') ? cc.attr('checked', '') : cc.attr('checked', 'checked'); 61 });
62 63 // fix png's for IE 6 64 if ($.browser.msie && $.browser.version < 7) { 65 $('#contact-container .contact-button').each(function () { 66 if ($(this).css('backgroundImage').match(/^url[("']+(.*\.png)[)"']+$/i)) { 67 var src = RegExp.$1; 68 $(this).css({ 69 backgroundImage: 'none', 70 filter: 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + src + '", sizingMethod="crop")' 71 }); 72 } 73 }); 74 } 75 }); 76 }); 77 }); 78 }); 79 }); 80 }, 81 show: function (dialog) { 82 $('#contact-container .contact-send').click(function (e) { 83 e.preventDefault(); 84 // validate form 85 if (contact.validate()) { 86 var msg = $('#contact-container .contact-message'); 87 msg.fadeOut(function () { 88 msg.removeClass('contact-error').empty(); 89 }); 90 $('#contact-container .contact-title').html('ÕÖÕ²Õ¡ÖÕ¯Õ¸ÖÕ´...'); 91 $('#contact-container form').fadeOut(200); 92 $('#contact-container .contact-content').animate({ 93 height: '80px' 94 }, function () { 95 $('#contact-container .contact-loading').fadeIn(200, function () { 96 $.ajax({
97 url: '/misc/form_arm.php', 98 data: $('#contact-container form').serialize() + '&action=send', 99 type: 'post', 100 cache: false, 101 dataType: 'html', 102 success: function (data) { 103 $('#contact-container .contact-loading').fadeOut(200, function () { 104 $('#contact-container .contact-title').html('ÕÕ¶Õ¸ÖÕ°Õ¡Õ¯Õ¡Õ¬Õ¸ÖÕ©ÕµÕ¸ÖÕ¶!'); 105 msg.html(data).fadeIn(200); 106 }); 107 }, 108 error: contact.error 109 }); 110 }); 111 }); 112 } 113 else { 114 if ($('#contact-container .contact-message:visible').length > 0) { 115 var msg = $('#contact-container .contact-message div'); 116 msg.fadeOut(200, function () { 117 msg.empty(); 118 contact.showError(); 119 msg.fadeIn(200); 120 }); 121 } 122 else { 123 $('#contact-container .contact-message').animate({ 124 height: '30px' 125 }, contact.showError); 126 } 127 128 } 129 }); 130 }, 131 close: function (dialog) { 132 $('#contact-container .contact-message').fadeOut(); 133 $('#contact-container .contact-title').html('ÕÕ¡Õ»Õ¸Õ²Õ¸ÖÕ©ÕµÕ¸ÖÕ¶...'); 134 $('#contact-container form').fadeOut(200); 135 $('#contact-container .contact-content').animate({ 136 height: 40 137 }, function () { 138 dialog.data.fadeOut(200, function () { 139 dialog.container.fadeOut(200, function () { 140 dialog.overlay.fadeOut(200, function () { 141 $.modal.close(); 142 }); 143 }); 144 }); 145 }); 146 }, 147 error: function (xhr) { 148 alert(xhr.statusText); 149 }, 150 validate: function () { 151 contact.message = ''; 152 if (!$('#contact-container #contact-name').val()) { 153 contact.message += 'Ô³ÖÕ¥ÕÖ ÕÕ¥Ö Õ¡Õ¶Õ¸ÖÕ¶Õ¨: '; 154 } 155 156 var email = $('#contact-container #contact-email').val(); 157 if (!email) { 158 contact.message += 'Ô³ÖÕ¥ÕÖ ÕÕ¥Ö Õ§Õ¬. ÖÕ¸Õ½Õ¿Õ« Õ°Õ¡Õ½ÖÕ¥Õ¶: '; 159 } 160 else { 161 if (!contact.validateEmail(email)) { 162 contact.message += 'ÕÕ¥Ö Õ§Õ¬. ÖÕ¸Õ½Õ¿Õ« Õ°Õ¡Õ½ÖÕ¥Õ¶ Õ½ÕÕ¡Õ¬ Õ§: '; 163 } 164 } 165 166 if (!$('#contact-container #contact-message').val()) { 167 contact.message += 'Ô³ÖÕ¥ÕÖ Õ°Õ¡Õ²Õ¸ÖÕ¤Õ¡Õ£ÖÕ¸ÖÕ©ÕµÕ¸ÖÕ¶Õ¨:'; 168 } 169 170 if (contact.message.length > 0) { 171 return false; 172 } 173 else { 174 return true; 175 } 176 }, 177 validateEmail: function (email) { 178 var at = email.lastIndexOf("@"); 179 180 // Make sure the at (@) sybmol exists and 181 // it is not the first or last character 182 if (at < 1 || (at + 1) === email.length) 183 return false; 184 185 // Make sure there aren't multiple periods together 186 if (/(\.{2,})/.test(email)) 187 return false; 188 189 // Break up the local and domain portions 190 var local = email.substring(0, at); 191 var domain = email.substring(at + 1); 192 193 // Check lengths 194 if (local.length < 1 || local.length > 64 || domain.length < 4 || domain.length > 255) 195 return false; 196 197 // Make sure local and domain don't start with or end with a period 198 if (/(^\.|\.$)/.test(local) || /(^\.|\.$)/.test(domain)) 199 return false; 200 201 // Check for quoted-string addresses 202 // Since almost anything is allowed in a quoted-string address, 203 // we're just going to let them go through 204 if (!/^"(.+)"$/.test(local)) { 205 // It's a dot-string address...check for valid characters 206 if (!/^[-a-zA-Z0-9!#$%*\/?|^{}`~&'+=_\.]*$/.test(local)) 207 return false; 208 } 209 210 // Make sure domain contains only valid characters and at least one period 211 if (!/^[-a-zA-Z0-9\.]*$/.test(domain) || domain.indexOf(".") === -1) 212 return false; 213 214 return true; 215 }, 216 showError: function () { 217 $('#contact-container .contact-message') 218 .html($('<div class="contact-error"></div>').append(contact.message)) 219 .fadeIn(200); 220 } 221 }; 222 223 contact.init(); 224 225});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.