var email_p=0;var email_pageid=0;var email_yourname="";var email_youremail="";var email_yourremarks="";var email_friendname="";var email_friendemail="";var email_friendnames="";var email_friendemails="";var email_imageverify="";emailL10n.max_allowed=parseInt(emailL10n.max_allowed);function validate_email_form(){var b=false;var a=emailL10n.text_error+"\n";a=a+"__________________________________\n\n";if(jQuery("#yourname").length){if(isEmpty(email_yourname)||!is_valid_name(email_yourname)){a=a+emailL10n.text_name_invalid+"\n";b=true}}if(jQuery("#youremail").length){if(isEmpty(email_youremail)||!is_valid_email(email_youremail)){a=a+emailL10n.text_email_invalid+"\n";b=true}}if(jQuery("#yourremarks").length){if(!isEmpty(email_yourremarks)){if(!is_valid_remarks(email_yourremarks)){a=a+emailL10n.text_remarks_invalid+"\n";b=true}}}if(jQuery("#friendname").length){if(isEmpty(email_friendname)){a=a+emailL10n.text_friend_names_empty+"\n";b=true}else{for(i=0;i<email_friendnames.length;i++){if(isEmpty(email_friendnames[i])||!is_valid_name(email_friendnames[i])){a=a+emailL10n.text_friend_name_invalid+email_friendnames[i]+"\n";b=true}}}if(email_friendnames.length>emailL10n.max_allowed){a=a+emailL10n.text_max_friend_names_allowed+"\n";b=true}}if(isEmpty(email_friendemail)){a=a+emailL10n.text_friend_emails_empty+"\n";b=true}else{for(i=0;i<email_friendemails.length;i++){if(isEmpty(email_friendemails[i])||!is_valid_email(email_friendemails[i])){a=a+emailL10n.text_friend_email_invalid+email_friendemails[i]+"\n";b=true}}}if(email_friendemails.length>emailL10n.max_allowed){a=a+emailL10n.text_max_friend_emails_allowed+"\n";b=true}if(jQuery("#friendname").length){if(email_friendnames.length!=email_friendemails.length){a=a+emailL10n.text_friends_tally+"\n";b=true}}if(jQuery("#imageverify").length){if(isEmpty(email_imageverify)){a=a+emailL10n.text_image_verify_empty+"\n";b=true}}if(b==true){alert(a);return false}else{return true}}function isEmpty(a){if(jQuery.trim(a)==""){return true}return false}function is_valid_name(a){filter=/[(\*\(\)\[\]\+\,\/\?\:\;\'\"\`\~\\#\$\%\^\&\<\>)+]/;return !filter.test(jQuery.trim(a))}function is_valid_email(a){filter=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;return filter.test(jQuery.trim(a))}function is_valid_remarks(a){a=jQuery.trim(a);injection_strings=new Array("apparently-to","cc","bcc","boundary","charset","content-disposition","content-type","content-transfer-encoding","errors-to","in-reply-to","message-id","mime-version","multipart/mixed","multipart/alternative","multipart/related","reply-to","x-mailer","x-sender","x-uidl");for(i=0;i<injection_strings.length;i++){if(a.indexOf(injection_strings[i])!=-1){return false}}return true}function email_popup(a){window.open(a,"_blank","width=500,height=500,toolbar=0,menubar=0,location=0,resizable=0,scrollbars=1,status=0")}function email_form(){if(jQuery("#yourname").length){email_yourname=jQuery("#yourname").val()}if(jQuery("#youremail").length){email_youremail=jQuery("#youremail").val()}if(jQuery("#yourremarks").length){email_yourremarks=jQuery("#yourremarks").val()}if(jQuery("#friendname").length){email_friendname=jQuery("#friendname").val();email_friendnames=email_friendname.split(",")}email_friendemail=jQuery("#friendemail").val();email_friendemails=email_friendemail.split(",");if(jQuery("#imageverify").length){email_imageverify=jQuery("#imageverify").val()}if(jQuery("#p").length){email_p=jQuery("#p").val()}if(jQuery("#page_id").length){email_pageid=jQuery("#page_id").val()}if(validate_email_form()){email_ajax_data="wp-email=1";jQuery("#wp-email-submit").attr("disabled",true);jQuery("#wp-email-loading").show();if(jQuery("#yourname").length){email_ajax_data+="&yourname="+email_yourname;jQuery("#yourname").attr("disabled",true)}if(jQuery("#youremail").length){email_ajax_data+="&youremail="+email_youremail;jQuery("#youremail").attr("disabled",true)}if(jQuery("#yourremarks").length){email_ajax_data+="&yourremarks="+email_yourremarks;jQuery("#yourremarks").attr("disabled",true)}if(jQuery("#friendname").length){email_ajax_data+="&friendname="+email_friendname;jQuery("#friendname").attr("disabled",true)}if(jQuery("#friendemail").length){email_ajax_data+="&friendemail="+email_friendemail;jQuery("#friendemail").attr("disabled",true)}if(jQuery("#imageverify").length){email_ajax_data+="&imageverify="+email_imageverify;jQuery("#imageverify").attr("disabled",true)}if(jQuery("#p").length){email_ajax_data+="&p="+email_p}if(jQuery("#page_id").length){email_ajax_data+="&page_id="+email_pageid}jQuery.ajax({type:"POST",url:emailL10n.ajax_url,data:email_ajax_data,cache:false,success:function(a){jQuery("#wp-email-content").html(a)}})}};