var translations={'First Name':'Prénom','Last Name':'Nom','Email':'Courriel','Postal Code':'Code postal','Your Friend\'s Email':'Le courriel de vos amis','Your Email Address':'Votre courriel','people have already claimed their seats to demand bold action at the 2010 Summit Tables. We want our leaders to end poverty, arrest global warming and create a global economy that\'s fair for all of us.':'personnes ont déjà pris leur place et exigé des actions audacieuses à la table des sommets de 2010. Nous voulons que nos dirigeants mettent fin à la pauvreté, freinent le réchauffement de la planète et créent une économie mondiale juste pour tous.','Take Your':'Prenez votre','Place Now':'place','Take Your Place':'PRENEZ VOTRE PLACE','I call on the leaders of the 2010 G8 and G20 to act in the interests of all the world\'s citizens. I urge you to take bold and concrete action on:':'Je demande aux dirigeants du G8 et du G20 de 2010 d\'agir dans l\'intérêt de tous les citoyens et citoyennes du monde. Je vous incite à adopter des mesures audacieuses et concrètes sur les enjeux suivants :','Climate Change':'changements climatiques','The Global Economy':'économie mondiale','Poverty':'pauvreté','Privacy Policy':'Politique de confidentialité','THANKS FOR TAKING YOUR PLACE':'MERCI D\'AVOIR PRIS VOTRE PLACE À TABLE.','You are in seat':'Vous occupez le siége','at the table.':'à table.','Your name will be included in a message to G8 and G20 leaders.':'Votre nom sera inscrit dans un message adressé aux dirigeants du G8 et du G20.','Please forward/share with a friend...':'Invitez vos amis à participer...','Send me email updates':'Envoyez-moi des mises','on the campaign':'à jour sur la campagne','Country':'Pays','We were unable to process your request at this time. Please try again later.':'Nous n\'avons pas réussi à traiter votre demande. Veuillez réessayer plus tard.','We will not store your friends\' email addresses.':'Nous ne conserverons pas l\'adresse courriel de vos amis.','Submit':'Soumettre','This June, the G8 and G20 leaders will meet in Canada. Your friend wants you':'En juin prochain, les dirigeants du G8 et du G20 se rencontreront au Canada. Vos amis veulent que vous','to help send them a message to act in the interests of all the world\'s citizens.':'aidiez à envoyer un appel à l\'action dans l\'intérêt de tous les citoyens et les citoyennes du monde.','Please join us in calling for bold and concrete action on climate change, the global economy and poverty.':'Veuillez vous joindre à  nous pour demander des actions audacieuses et concrètes sur les plans des changements climatiques, de l\'économie mondiale et de la pauvreté.','Here\'s what you can do to get involved:':'Voici ce que vous pouvez faire pour participer à cet appel à l\'action :','1. Visit atthetable2010.org':'1. Visitez atable2010.org','2. Sign the Take Your Place declaration':'2. Signez la déclaration « Prenez votre place »','3. Upload your own photo and message in the Flat Leader photo petition':'3. Téléversez une photo de vous et votre message, en compagnie de votre « dirigeant aplati » dans notre pétition photo','Take Your Place - Make your voice heard.':'Prenez votre place à table - Faites entendre votre voix','Thank you sharing this with a friend!':'Merci d\'avoir invité vos amis à participer!','Invalid value entered':'L\'information saisie est invalide.','Invalid Email Address':'Veuillez inscrire une adresse courriel valide','Loading...':'Chargement...','http://atthetable2010.org/privacy':'http://atable2010.org/confidentialite',"You've already signed the declaration. Thanks for your support.":'Vous avez déjà signé la déclaration. Merci de votre appui.','http://atthetable2010.org':'http://atable2010.org','mph_e_logo':'mph_e_logo_fr'}
function translate(msg)
{if(!lang){lang='en';}
if(lang=='en'){return msg;}
t=translations[msg];if(t){return t;}
return msg;}
var lang='en';var apiUri='http://widget.atthetable2010.org/api';var imgLocation='http://widget.atthetable2010.org';var seatCount='';var yourEmailAddress='';var inputDefaultText={firstName:translate('First Name'),lastName:translate('Last Name'),emailAddress:translate('Email'),postalCode:translate('Postal Code'),friendEmailAddress:translate('Your Friend\'s Email'),yourEmailAddress:translate('Your Email Address')};$j=jQuery.noConflict();$j.flXHRproxy.registerOptions(apiUri,{xmlResponseText:false,swfIdPrefix:'mph',autoUpdatePlayer:true});$j(document).ready(function(){loadCssFile();$j('#mph-widget').bind('init',function(){$j(this).empty();});$j('#mph-widget').bind('screen1',function(){$j(this).trigger('init');var mphBody=$j('<div class="mph_e_body" id="mph_e_screen1"></div>');var mphSpeech=$j('<div class="mph_e_speech" id="mph_e_counter"></div>');mphSpeech.append('<div class="mph_e_speech_in"><h1><span><span id="mph_e_seat_count"><img src="'+imgLocation+'/imgs/load-white.gif"></span></span></h1></div>');mphBody.append(mphSpeech);mphBody.append('<p>'+translate('people have already signed-on to demand bold action at the 2010 Summit Tables. We want our leaders to end poverty, tackle global warming and create a global economy that\'s fair for all of us.')+'</p>');var takeYourPlace=$j('<a href="#" class="mph_e_btn"><span>'+translate('sign-on')+'<br />'+translate('Now')+'</span></a>');takeYourPlace.click(function(){$j('#mph-widget').trigger('screen2');return false;});var takeYourPlaceDiv=$j('<div id="mph_e_takeyourplace"></div>');takeYourPlaceDiv.append(takeYourPlace);$j(this).append(mphBody);$j(this).append('<div class="'+translate('mph_e_logo')+'"><a href="'+translate('http://atthetable2010.org')+'"><!--  --></a></div>');$j(this).append(takeYourPlaceDiv);$j(this).append('<div class="clear"><!--  --></div>');$j.ajax({type:'GET',dataType:'jsonp',url:apiUri+'/v1/seats?head=true&jsoncallback=?',success:function(data){seatCount=data.count;$j('#mph_e_seat_count').text(seatCount+1319159);}});});$j('#mph-widget').bind('screen2',function(){$j(this).trigger('init');var mphBody=$j('<div class="mph_e_body" id="mph_e_screen2"></div>');var mphSpeech=$j('<div class="mph_e_speech" id="mph_e_counter"></div>');var mphSpeechIn=$j('<div class="mph_e_speech_in"></div>');mphSpeechIn.append('<h1><span><span>'+translate('Take action now')+'</span></span></h1>');mphSpeechIn.append('<p>'+translate('I call on the leaders of the 2010 G8 and G20 to act in the interests of all the world\'s citizens. I urge you to take bold and concrete action to:')+'</p>');mphSpeechIn.append('<ul><li>'+translate('Tackle climate change')+'</li><li>'+translate('Fight poverty & inequality')+'</li><li>'+translate('Rethink the global economy')+'</li></ul>');mphSpeech.append(mphSpeechIn);mphBody.append(mphSpeech);var privacyPolicy=$j('<a href="'+translate('http://atthetable2010.org/privacy')+'" target="_blank">'+translate('Privacy Policy')+'</a>');var privacyPolicyDiv=$j('<div class="mph_e_privacy-link"></div>');privacyPolicyDiv.append(privacyPolicy);var formWrapper=$j('<div class="mph_e_form"></div>');formWrapper.append(buildSignupForm());$j(this).append(mphBody);$j(this).append(formWrapper);$j(this).append(privacyPolicyDiv);$j(this).append('<div class="clear"><!--  --></div>');});$j('#mph-widget').bind('screen3',function(e,seatNumber){$j(this).trigger('init');var mphBody=$j('<div class="mph_e_body" id="mph_e_screen3"></div>');var mphSpeech=$j('<div class="mph_e_speech" id="mph_e_thanks"></div>');mphSpeech.append('<div class="mph_e_speech_in"><h1><span><span>'+translate('THANKS FOR TAKING YOUR PLACE')+'<br /><span>'+translate('You are in seat')+' '+parseInt(seatNumber)+' '+translate('at the table.')+'</span></span></span></h1></div>');var formWrapper=$j('<div class="mph_e_form"></div>');formWrapper.append(buildFriendForm());mphBody.append(mphSpeech);mphBody.append('<p>'+translate('Your name will be included in a message to G8 and G20 leaders.')+'</p>');mphBody.append('<p id="mph_please">'+translate('Please forward/share with a friend...')+'</p>');mphBody.append(formWrapper);mphBody.append('<script src="http://s7.addthis.com/js/250/addthis_widget.js#username=xa-4ba26a6d64aca2f5"></script>');var addThis=$j('<div class="addthis_toolbox addthis_default_style"></div>');var addThisLink=$j('<a href="#" class="addthis_button_compact"><img src="http://s7.addthis.com/static/btn/v2/lg-share-en.gif" /></a>');addThisLink.mouseover(function(){return addthis_open(this,'','[URL]','[TITLE]');});addThisLink.click(function(){return addthis_sendto();});addThisLink.mouseout(function(){addthis_close();});addThis.append(addThisLink);mphBody.append(addThis);$j(this).append(mphBody);$j(this).append('<div class="clear"><!--  --></div>');});if($j('#mph-widget-skip-screen1').length){$j('#mph-widget').trigger('screen2');}else{$j('#mph-widget').trigger('screen1');}});function loadCssFile()
{var elt=document.createElement('style');elt.setAttribute('type','text/css');var cssText=".mph_e {position:relative;background:#ffc423;width:300px !important;height:auto !important;min-height:300px;padding:20px 0;font-family:helvetica, arial, sans-serif;} .mph_e * {padding:0;margin:0;} .mph_e a {text-decoration:none;margin:0;padding:0;color:#000;} .mph_e a img {border:none;} .mph_e .clear {clear:both;} .mph_e_speech {width:277px;background:url("+imgLocation+"/imgs/speech-top.png) no-repeat scroll left top;padding-top:12px;margin:0 -10px;} .mph_e_speech h1 {line-height:100%;} .mph_e_speech_in {background:url("+imgLocation+"/imgs/speech-btm.png) no-repeat scroll left bottom;padding:0 12px 38px 12px;} #mph_e_counter h1 {font-size:38px;text-align:right;height:38px;} #mph_e_screen2 .mph_e_speech h1 {font-size:16px;text-transform:uppercase;text-align:left;} #mph_e_screen3 .mph_e_speech h1 {line-height:16px;font-size:12px;text-transform:uppercase;text-align:left;} #mph_e_screen3 .mph_e_speech h1 span span span {text-transform:none;font-weight:normal;} .mph_e_body {font-size:12px;margin:0 22px;} #mph_e_screen1.mph_e_body {margin-bottom:10px;} .mph_e_body p {line-height:140%;} #mph_e_screen1 p {padding:12px;} #mph_e_screen1 {border-bottom:6px solid #000;} .mph_e_logo, .mph_e_logo_fr {width:90px;height:66px;float:left;margin-left:24px;} .mph_e_logo_fr {width:69px;height:65px;} .mph_e_logo a {display:block;height:100%;width:100%;background:url("+imgLocation+"/imgs/logo_e.png) no-repeat scroll left top;} .mph_e_logo_fr a {display:block;height:100%;width:100%;background:url("+imgLocation+"/imgs/logo_f.png) no-repeat scroll left top;} #mph_e_takeyourplace {float:right;margin:0 22px 0 0;padding-top:16px;} .mph_e button {background:transparent;border:none;padding:0;margin:6px 0 0 0;font-family:helvetica, arial, sans-serif;text-transform:uppercase;float:right;} .mph_e .mph_e_btn {font-size:14px;text-transform:uppercase;display:block;background:#ffc423 url("+imgLocation+"/imgs/btn.png) no-repeat scroll right 46%;border:1px solid #000;padding-right:28px;} .mph_e_btn span {background:#000;color:#fff;display:block;padding:4px;font-weight:bold;} .mph_e_body ul {list-style:none;margin:6px 0 0 32px;} .mph_e_body ul li {padding-left:14px;background:url("+imgLocation+"/imgs/bullet.png) no-repeat scroll left 3px;} .mph_e_form form fieldset {border:none;padding:3px 22px 0 22px;} #mph_e_screen3 .mph_e_form form fieldset {padding:3px 0 0 0;} .mph_e_form form fieldset input, .mph_e_form form fieldset select {background:#fff;border:1px solid #000;padding:4px;font-size:12px;color:#000;} .mph_e_form form fieldset .mph_e_form-error {background:#FFDFDF;border-color:#cc0000;color:#cc0000;} .mph_e_form form fieldset select {padding:3px;} #mph_e_first-name {float:left;} #mph_e_last-name {float:right;} #mph_e_first-name input, #mph_e_last-name input {width:116px} #mph_e_email {clear:both;} #mph_e_email input {width:250px;} .mph_e_form-border {margin-bottom:6px;} #mph_e_pcode {float:left;} #mph_e_pcode input {width:75px;} #mph_e_country {float:right;} #mph_e_country select {width:170px;} #mph_e_signup {display:block;font-size:9px;float:left;line-height:11px;margin-top:6px;} #mph_e_signup input, #mph_e_signup span {float:left;} #mph_e_signup span {margin-left:3px;} #mph_e_signup .mph_clear {display:block;clear:both;float:none;margin:0;} .mph_e_privacy-link {font-size:9px;text-decoration:underline;margin:12px 0 0 0;text-align:center;} #mph_please {font-weight:bold;margin-bottom:8px;} #mph_e_friend-email input, #mph_e_your-email input {width:246px;} #mph_e_your-email {display:none;} #mph_willnot {font-size:8px;margin-top:-6px;margin-bottom:8px;} #loading-image {width:16px;left:142px;position:absolute;top:2px;} .addthis_toolbox {margin-top:-21px;}";if($j.browser.msie){cssText=".mph_e {position:relative;background:#ffc423;width:300px !important;height:auto !important;min-height:300px;padding:20px 0;font-family:helvetica, arial, sans-serif;} .mph_e * {padding:0;margin:0;} .mph_e a {text-decoration:none;margin:0;padding:0;color:#000;} .mph_e a img {border:none;} .mph_e .clear {clear:both;} .mph_e_speech {width:277px;background:url("+imgLocation+"/imgs/speech-top.png) no-repeat scroll left top;padding-top:12px;margin:0 -10px;} .mph_e_speech h1 {line-height:100%;} .mph_e_speech_in {background:url("+imgLocation+"/imgs/speech-btm.png) no-repeat scroll left bottom;padding:0 12px 38px 12px;} #mph_e_counter h1 {font-size:38px;text-align:right;height:38px;} #mph_e_screen2 .mph_e_speech h1 {font-size:16px;text-transform:uppercase;text-align:left;} #mph_e_screen3 .mph_e_speech h1 {line-height:16px;font-size:12px;text-transform:uppercase;text-align:left;} #mph_e_screen3 .mph_e_speech h1 span span span {text-transform:none;font-weight:normal;} .mph_e_body {font-size:12px;margin:0 22px;} #mph_e_screen1.mph_e_body {margin-bottom:10px;} .mph_e_body p {line-height:140%;} #mph_e_screen1 p {padding:12px;} #mph_e_screen1 {border-bottom:6px solid #000;} .mph_e_logo, .mph_e_logo_fr {width:90px;height:66px;float:left;margin-left:24px;} .mph_e_logo_fr {width:69px;height:65px;} .mph_e_logo a {display:block;height:100%;width:100%;background:url("+imgLocation+"/imgs/logo_e.png) no-repeat scroll left top;} .mph_e_logo_fr a {display:block;height:100%;width:100%;background:url("+imgLocation+"/imgs/logo_f.png) no-repeat scroll left top;}  #mph_e_takeyourplace {float:right;margin:0 22px 0 0;padding-top:16px;} .mph_e button {background:transparent;border:none;padding:0;margin:6px 0 0 0;font-family:helvetica, arial, sans-serif;text-transform:uppercase;float:right;} .mph_e .mph_e_btn {font-size:14px;text-transform:uppercase;display:block;background:#ffc423 url("+imgLocation+"/imgs/btn.png) no-repeat scroll right 46%;border:1px solid #000;padding-right:28px;} .mph_e_btn span {background:#000;color:#fff;display:block;padding:4px;font-weight:bold;width:auto;} .mph_e_body ul {list-style:none;margin:6px 0 0 32px;} .mph_e_body ul li {padding-left:14px;background:url("+imgLocation+"/imgs/bullet.png) no-repeat scroll left 3px;} .mph_e_form form fieldset {border:none;padding:3px 22px 0 22px;} #mph_e_screen3 .mph_e_form form fieldset {padding:3px 0 0 0;} .mph_e_form form fieldset input, .mph_e_form form fieldset select {background:#fff;border:1px solid #000;padding:4px;font-size:12px;color:#000;} .mph_e_form form fieldset .mph_e_form-error {background:#FFDFDF;border-color:#cc0000;color:#cc0000;} .mph_e_form form fieldset select {padding:3px;} #mph_e_first-name {float:left;} #mph_e_last-name {float:right;} #mph_e_first-name input, #mph_e_last-name input {width:116px} #mph_e_email {clear:both;} #mph_e_email input {width:246px;} .mph_e_form-border {margin-bottom:6px;} #mph_e_pcode {float:left;} #mph_e_pcode input {width:75px;} #mph_e_country {float:right;} #mph_e_country select {width:160px;margin-top:3px;} #mph_e_signup {display:block;font-size:9px;float:left;line-height:11px;margin-top:6px;width:100px;} .mph_e_form form fieldset #mph_e_signup input {background:transparent;border:none;padding:0;margin:-4px 0 0 -2px;} #mph_e_signup input, #mph_e_signup span {float:left;} #mph_e_signup span {margin-left:3px;} #mph_e_signup .mph_clear {display:block;clear:both;float:none;margin:0;} .mph_e_privacy-link {font-size:9px;text-decoration:underline;margin:12px 0 0 0;text-align:center;} #mph_please {font-weight:bold;margin-bottom:8px;} #mph_e_friend-email input, #mph_e_your-email input {width:246px;} #mph_e_your-email {display:none;} #mph_willnot {font-size:8px;float:left;margin-top:-6px;margin-bottom:8px;} #loading-image {width:16px;left:142px;position:absolute;top:2px;} .addthis_toolbox {margin-top:12px;float:right;}";elt.styleSheet.cssText=cssText;}else{elt.appendChild(document.createTextNode(cssText));}
document.getElementsByTagName('body')[0].appendChild(elt);}
function loadJsFile(src)
{var elt=document.createElement('script');elt.setAttribute('type','text/javascript');elt.setAttribute('src',src);document.getElementsByTagName('head')[0].appendChild(elt);}
function buildSignupForm()
{if ($j('#mph-widget-uncheck-updates').length){var checkUpdates='';}else{var checkUpdates='checked="checked"';}var suForm=$j('<form></form>');var suFieldset=$j('<fieldset></fieldset>');var firstName=$j('<input type="text" name="firstName" class="mph_e_form-input required" value="'+inputDefaultText.firstName+'" />').focus(inputFocus).blur(inputBlur);var lastName=$j('<input type="text" name="lastName" class="mph_e_form-input required" value="'+inputDefaultText.lastName+'" />').focus(inputFocus).blur(inputBlur);var emailAddress=$j('<input type="text" name="emailAddress" class="mph_e_form-input required" value="'+inputDefaultText.emailAddress+'" />').focus(inputFocus).blur(inputBlur);var postalCode=$j('<input type="text" name="postalCode" class="mph_e_form-input" value="'+inputDefaultText.postalCode+'" />').focus(inputFocus).blur(inputBlur);var sendUpdates=$j('<input type="checkbox" name="sendUpdates" value="1" '+checkUpdates+'/>');var affiliate=$j('<input type="hidden" name="affiliate" value="'+getAffiliate()+'" />');sendUpdatesLabel=$j('<label class="mph_e_inline" id="mph_e_signup"></label>');sendUpdatesLabel.append(sendUpdates);sendUpdatesLabel.append('<span>'+translate('Send me email updates')+'<br />'+translate('on the campaign')+'</span><span class="mph_clear"><!-- --></span>');suFieldset.append($j('<div class="mph_e_form-border" id="mph_e_first-name"></div>').append(firstName));suFieldset.append($j('<div class="mph_e_form-border" id="mph_e_last-name"></div>').append(lastName));suFieldset.append($j('<div class="mph_e_form-border" id="mph_e_email"></div>').append(emailAddress));suFieldset.append($j('<div class="mph_e_form-border" id="mph_e_pcode"></div>').append(postalCode));var countryPulldown=$j('<select name="countryId"></select>');countryPulldown.append('<option value="">'+translate('Country')+'</option>');suFieldset.append($j('<div class="mph_e_form-border" id="mph_e_country"></div>').append(countryPulldown));suFieldset.append('<div class="clear"><!--  --></div>');$j.getJSON(apiUri+'/v1/countries.js?jsoncallback=?',function(data){$j(data).each(function(i,country){countryPulldown.append('<option value="'+country.id+'">'+country.name+'</option>');});});suFieldset.append(sendUpdatesLabel);var submitBtn=$j('<button type="submit" name="submit" value="true"><span class="mph_e_btn"><span>'+translate('Submit')+'</span></span></button>');suFieldset.append(submitBtn);submitBtn.click(function(){return validateSignupForm(suForm);});suFieldset.append('<div class="clear"><!--  --></div>');suFieldset.append(affiliate);suForm.append(suFieldset);suForm.submit(function(){$j.ajax({transport:'flXHRproxy',type:'POST',url:apiUri+'/v1/seats',data:suForm.serialize(),dataType:'json',success:function(data,status,xhr){data=JSON.parse(xhr.responseText);if(data.firstName=='Email Address already exists'){errorObj={error:translate("You've already signed the declaration. Thanks for your support.")};submissionError(errorObj.error);endLoading();return false;}
yourEmailAddress=suForm.find('input[name="emailAddress"]').val();$j('#mph-widget').trigger('screen3',[data.id]);return true;},error:function(xhr,textStatus,errorThrown){console.log(xhr);console.log(textStatus);console.log(errorThrown);if(xhr.readyState!=2){return false;}
errorObj={error:translate('We were unable to process your request at this time. Please try again later.')};submissionError(errorObj.error);endLoading();},beforeSend:beginLoading,completed:endLoading});return false;});return suForm;}
function buildFriendForm()
{var frForm=$j('<form></form>');var frFieldset=$j('<fieldset></fieldset>');var friendEmail=$j('<input type="text" name="friendEmailAddress" value="'+inputDefaultText.friendEmailAddress+'" />').focus(inputFocus).blur(inputBlur);var yourEmail=$j('<input type="text" name="yourEmailAddress" />').focus(inputFocus).blur(inputBlur);if(yourEmailAddress){yourEmail.val(yourEmailAddress);}else{yourEmail.val(inputDefaultText.yourEmailAddress);}
frFieldset.append($j('<div class="mph_e_form-border" id="mph_e_friend-email"></div>').append(friendEmail));frFieldset.append($j('<div class="mph_e_form-border" id="mph_e_your-email"></div>').append(yourEmail));frFieldset.append($j('<p id="mph_willnot">'+translate('We will not store your friends\' email addresses.')+'</p>'));var submitBtn=$j('<button type="submit" name="submit" value="true"><span class="mph_e_btn"><span>'+translate('Submit')+'</span></span></button>');frFieldset.append(submitBtn);submitBtn.click(function(){return validateFriendForm(frForm);});frFieldset.append('<div class="clear"><!--  --></div>');frForm.append(frFieldset);frForm.submit(function(){formParams=frForm.serializeArray();var msgBody=translate("This June, the G8 and G20 leaders will meet in Canada. Your friend wants you")+" "
+translate("to help send them a message to act in the interests of all the world's citizens.")+" \n\n"
+translate("Please join us in calling for bold and concrete action on climate change, the global economy and poverty.")+" \n\n"
+translate("Here's what you can do to get involved:")+" \n\n"
+translate("1. Visit atthetable2010.org")+" \n"
+translate("2. Sign the Take Your Place declaration")+" \n"
+translate("3. Upload your own photo and message in the Flat Leader photo petition")+" \n";params={toEmailAddress:formParams[0].value,fromEmailAddress:formParams[1].value,subject:translate('Take Your Place - Make your voice heard.'),bodyText:msgBody};$j.ajax({transport:'flXHRproxy',type:'POST',url:apiUri+'/v1/send-email',data:params,dataType:'json',success:function(data,status,xhr){alert(translate('Thank you sharing this with a friend!'));$j('input[name="friendEmailAddress"]').val(inputDefaultText.friendEmailAddress);endLoading();},error:function(xhr,textStatus,errorThrown){errorObj={error:translate('We were unable to process your request at this time. Please try again later.')};submissionError(errorObj.error);endLoading();},beforeSend:beginLoading,completed:endLoading});return false;});return frForm;}
function validateSignupForm(suForm)
{clearFormErrors(suForm);var hasError=false;suForm.find('input.required').each(function(i,obj){if(!obj.value||obj.value==inputDefaultText[obj.name]){formError($j(obj),translate('Invalid value entered'));hasError=true;}});var emailAddress=suForm.find('input[name="emailAddress"]');if(emailAddress.val()&&emailAddress.val()!=inputDefaultText.emailAddress&&!emailAddressIsValid(emailAddress.val())){formError(emailAddress,translate('Invalid Email Address'));hasError=true;}
return!hasError;}
function validateFriendForm(frForm)
{clearFormErrors(frForm);var hasError=false;frForm.find('input[type="text"]').each(function(i,emailAddress){if(!emailAddress.value||(emailAddress.value==inputDefaultText[emailAddress.name])||!emailAddressIsValid(emailAddress.value)){formError($j(emailAddress),translate('Invalid Email Address'));hasError=true;}});return!hasError;}
function emailAddressIsValid(emailAddress)
{var validator=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;return validator.test(emailAddress);}
function inputFocus()
{if(this.value==inputDefaultText[this.name]){this.value='';}}
function inputBlur()
{if(!this.value){this.value=inputDefaultText[this.name];}}
function submissionError(msg)
{alert(msg);}
function formError(elts,msg)
{elts.addClass('mph_e_form-error');elts.attr('title',msg);}
function clearFormErrors(frm)
{frm.find('.mph_e_form-error').removeClass('mph_e_form-error');frm.find('.mph_e_form-error').attr('title','');}
function getAffiliate()
{return location.hostname;}
function beginLoading(xhr)
{if(!$j('#loading-image').length){$j('#mph-widget').prepend('<img id="loading-image" src="'+imgLocation+'/imgs/load.gif" alt="'+translate('Loading...')+'" title="'+translate('Loading...')+'" />');}}
function endLoading(xhr)
{$j('#loading-image').remove();}
if(!this.JSON){this.JSON={};}
(function(){function f(n){return n<10?'0'+n:n;}
if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+
f(this.getUTCMonth()+1)+'-'+
f(this.getUTCDate())+'T'+
f(this.getUTCHours())+':'+
f(this.getUTCMinutes())+':'+
f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
if(typeof rep==='function'){value=rep.call(holder,key,value);}
switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
v=partial.length===0?'[]':gap?'[\n'+gap+
partial.join(',\n'+gap)+'\n'+
mind+']':'['+partial.join(',')+']';gap=mind;return v;}
if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+
mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
return str('',{'':value});};}
if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
return reviver.call(holder,key,value);}
cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+
('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
throw new SyntaxError('JSON.parse');};}}());