/*
	EpsilonRecordUpload Version 1.0 Minified
	Last Modified 07/22/2010
	© 3M 2010. All Rights Reserved
	Author: a1rqlzz
*/
(function(e){var f,d,c;d={client_name:null,client_token:null,p_list:null,s_list:null,action_type:"both",mailing_name:null,campaign:null,ep_s:b,ep_f:g,ep_c:a,submitButton:"#epRU_Submit",spin_img:"#epRU_waiting",source:"form"};c={newsletter_flg:"N",update_only:"N",upload_type:"merge_replace",check_email_addr:"Y",reset_num_ftd:"N",set_optout_flg:"N",optin_mask_add:null,optin_mask_del:null,mail_pref:null};e.fn.extend({epi_Post:function(h){if(h==null){h={}}return this.each(function(){var l,j,i,o,p=1,k,n,m;f="#"+this.id;l=e.parseJSON(e("*[rel=epRU]").makeJSON());j=e.parseJSON(e(" *[rel=epRU-C]").makeJSON());e.extend(d,l,h.profileOpts||{});e.extend(c,j,h.userOpts||{});i={email_addr:l.email_addr};e.extend(c,i);e(d.submitButton).attr("disabled",true);e(d.spin_img).show();o='<COLUMN xsi:type="xsd:string" TYPE="PROFILE_KEY">'+c.email_addr+"</COLUMN>";for(k in c){if(c[k]!=null&&c[k]!=""){o+='<COLUMN xsi:type="xsd:string" TYPE="'+k.toUpperCase()+'">'+c[k]+"</COLUMN>";p++}}n='<namesp1:PROFILE xmlns:namesp1="urn:Bigfoot"><ID CLIENT_TOKEN="'+d.client_token+'" CLIENT_NAME="'+d.client_name+'"/><LIST PLIST_NAME="'+d.p_list+'" CAMPAIGN_NAME="'+d.campaign+'" MAILING_NAME="'+d.mailing_name+'" ACTION_TYPE="'+d.action_type+'"/><ADD xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:ur-type['+p+']">'+o+"</ADD></namesp1:PROFILE>";m='<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body>'+n+"</SOAP-ENV:Body></SOAP-ENV:Envelope>";e.ajax({url:"http://"+document.domain+"/apxy/proxy?urlAlias=DWEB_RECORD_UPLOAD",type:"POST",dataType:"xml",data:m,success:function(r,s,q){d.ep_s(r,s,q)},error:function(q,s,r){d.ep_f(q,s,r)},complete:function(r,q){d.ep_c(r,q)},contentType:'text/xml; charset="utf-8"'})})},makeJSON:function(){var j="{",h=e(this).last().attr("name"),k,i;this.each(function(){k=e(this).attr("name");i=e(this).attr("value");if(k!=h){j+='"'+k+'": "'+i+'",'}else{j+='"'+k+'": "'+i+'"'}});j+="}";return j},resetEpRUForm:function(){e("#epRU_Status").html("");e("#epRU_Status").hide();e(f)[0].reset();e(f).show()}});function b(j,l,i){var k=e(i.responseXML).find("STATUS").text(),h=e(i.responseXML).find("STATUS_STRING").text();if(k=="OK"){e("#epRU_Status").html('<p>Thank you for signing up! You should receive a welcome email with additional details shortly.</p><p><a href="" onclick="jQuery(this).resetEpRUForm(); return false;">Close</a></p>');dcsMultiTrackHREF(this,"WT.cg_n","Epsilon_Success","WT.cg_s",d.source)}else{e("#epRU_Status").html("<p>An error has occurred while submitting. Please try again...</p><p>Error: "+h+"</p>");dcsMultiTrackHREF(this,"WT.cg_n","Epsilon_Fail","WT.cg_s",d.source+" : "+k+": "+h)}e(f).hide("fast");e("#epRU_Status").show()}function a(i,h){e(d.submitButton).attr("disabled",false);e(d.spin_img).hide();setTimeout("jQuery(this).resetEpRUForm()",10000)}function g(h,j,i){e("#epRU_Status").html("<p>An error has occurred while processing. Please try again...</p><p>Error Details: "+i+"..</p>");dcsMultiTrackHREF(this,"WT.cg_n","Epsilon_AJAX_Errors","WT.cg_s",d.source+":"+i);e(f).hide("fast");e("#epRU_Status").show();setTimeout("jQuery(this).resetEpRUForm()",8000)}})(jQuery);