var state="US:AK:Alaska|US:AL:Alabama|US:AR:Arkansas|US:AS:American Samoa|US:AZ:Arizona|US:CA:California|US:CO:Colorado|US:CT:Connecticut|US:DC:D.C.|US:DE:Delaware|US:FL:Florida|US:FM:Micronesia|US:GA:Georgia|US:GU:Guam|US:HI:Hawaii|US:IA:Iowa|US:ID:Idaho|US:IL:Illinois|US:IN:Indiana|US:KS:Kansas|US:KY:Kentucky|US:LA:Louisiana|US:MA:Massachusetts|US:MD:Maryland|US:ME:Maine|US:MH:Marshall Islands|US:MI:Michigan|US:MN:Minnesota|US:MO:Missouri|US:MP:Marianas|US:MS:Mississippi|US:MT:Montana|US:NC:North Carolina|US:ND:North Dakota|US:NE:Nebraska|US:NH:New Hampshire|US:NJ:New Jersey|US:NM:New Mexico|US:NV:Nevada|US:NY:New York|US:OH:Ohio|US:OK:Oklahoma|US:OR:Oregon|US:PA:Pennsylvania|US:PR:Puerto Rico|US:PW:Palau|US:RI:Rhode Island|US:SC:South Carolina|US:SD:South Dakota|US:TN:Tennessee|US:TX:Texas|US:UT:Utah|US:VA:Virginia|US:VI:Virgin Islands|US:VT:Vermont|US:WA:Washington|US:WI:Wisconsin|US:WV:West Virginia|US:WY:Wyoming|US:AA:Military Americas|US:AE:Military Europe/ME/Canada|US:AP:Military Pacific|CA:AB:Alberta|CA:MB:Manitoba|CA:AB:Alberta|CA:BC:British Columbia|CA:NB:New Brunswick|CA:NL:Newfoundland and Labrador|CA:NS:Nova Scotia|CA:NT:Northwest Territories|CA:NU:Nunavut|CA:ON:Ontario|CA:PE:Prince Edward Island|CA:QC:Quebec|CA:SK:Saskatchewan|CA:YT:Yukon Territory|AU:AAT:Australian Antarctic Territory|AU:ACT:Australian Capital Territory|AU:NT:Northern Territory|AU:NSW:New South Wales|AU:QLD:Queensland|AU:SA:South Australia|AU:TAS:Tasmania|AU:VIC:Victoria|AU:WA:Western Australia|BR:AC:Acre|BR:AL:Alagoas|BR:AM:Amazonas|BR:AP:Amapa|BR:BA:Baia|BR:CE:Ceara|BR:DF:Distrito Federal|BR:ES:Espirito Santo|BR:FN:Fernando de Noronha|BR:GO:Goias|BR:MA:Maranhao|BR:MG:Minas Gerais|BR:MS:Mato Grosso do Sul|BR:MT:Mato Grosso|BR:PA:Para|BR:PB:Paraiba|BR:PE:Pernambuco|BR:PI:Piaui|BR:PR:Parana|BR:RJ:Rio de Janeiro|BR:RN:Rio Grande do Norte|BR:RO:Rondonia|BR:RR:Roraima|BR:RS:Rio Grande do Sul|BR:SC:Santa Catarina|BR:SE:Sergipe|BR:SP:Sao Paulo|BR:TO:Tocatins|NL:DR:Drente|NL:FL:Flevoland|NL:FR:Friesland|NL:GL:Gelderland|NL:GR:Groningen|NL:LB:Limburg|NL:NB:Noord Brabant|NL:NH:Noord Holland|NL:OV:Overijssel|NL:UT:Utrecht|NL:ZH:Zuid Holland|NL:ZL:Zeeland|UK:AVON:Avon|UK:BEDS:Bedfordshire|UK:BERKS:Berkshire|UK:BUCKS:Buckinghamshire|UK:CAMBS:Cambridgeshire|UK:CHESH:Cheshire|UK:CLEVE:Cleveland|UK:CORN:Cornwall|UK:CUMB:Cumbria|UK:DERBY:Derbyshire|UK:DEVON:Devon|UK:DORSET:Dorset|UK:DURHAM:Durham|UK:ESSEX:Essex|UK:GLOUS:Gloucestershire|UK:GLONDON:Greater London|UK:GMANCH:Greater Manchester|UK:HANTS:Hampshire|UK:HERWOR:Hereford & Worcestershire|UK:HERTS:Hertfordshire|UK:HUMBER:Humberside|UK:IOM:Isle of Man|UK:IOW:Isle of Wight|UK:KENT:Kent|UK:LANCS:Lancashire|UK:LEICS:Leicestershire|UK:LINCS:Lincolnshire|UK:MERSEY:Merseyside|UK:NORF:Norfolk|UK:NHANTS:Northamptonshire|UK:NTHUMB:Northumberland|UK:NOTTS:Nottinghamshire|UK:OXON:Oxfordshire|UK:SHROPS:Shropshire|UK:SOM:Somerset|UK:STAFFS:Staffordshire|UK:SUFF:Suffolk|UK:SURREY:Surrey|UK:SUSS:Sussex|UK:WARKS:Warwickshire|UK:WMID:West Midlands|UK:WILTS:Wiltshire|UK:YORK:Yorkshire|EI:CO ANTRIM:County Antrim|EI:CO ARMAGH:County Armagh|EI:CO DOWN:County Down|EI:CO FERMANAGH:County Fermanagh|EI:CO DERRY:County Londonderry|EI:CO TYRONE:County Tyrone|EI:CO CAVAN:County Cavan|EI:CO DONEGAL:County Donegal|EI:CO MONAGHAN:County Monaghan|EI:CO DUBLIN:County Dublin|EI:CO CARLOW:County Carlow|EI:CO KILDARE:County Kildare|EI:CO KILKENNY:County Kilkenny|EI:CO LAOIS:County Laois|EI:CO LONGFORD:County Longford|EI:CO LOUTH:County Louth|EI:CO MEATH:County Meath|EI:CO OFFALY:County Offaly|EI:CO WESTMEATH:County Westmeath|EI:CO WEXFORD:County Wexford|EI:CO WICKLOW:County Wicklow|EI:CO GALWAY:County Galway|EI:CO MAYO:County Mayo|EI:CO LEITRIM:County Leitrim|EI:CO ROSCOMMON:County Roscommon|EI:CO SLIGO:County Sligo|EI:CO CLARE:County Clare|EI:CO CORK:County Cork|EI:CO KERRY:County Kerry|EI:CO LIMERICK:County Limerick|EI:CO TIPPERARY:County Tipperary|EI:CO WATERFORD:County Waterford|",
display_state_input=function(a,b){var c=jQuery("#input-state"),d=jQuery("#country-code option:selected").attr("value");if(jQuery.inArray(d,a)!=-1||!a.length){c.css("display","block");populateState(jQuery("#state"),jQuery("#country-code"),b)}else c.css("display","none");return false},TrimString=function(a){if(a){a=a.replace(/^\s+/g,"");return a.replace(/\s+$/g,"")}},populateState=function(a,b,c){a.removeOption(/./);a.addOption("","");for(var d=state.split("|"),g=0;g<d.length-1;g++){lineArray=d[g].split(":");
countryCode=TrimString(lineArray[0]);stateCode=TrimString(lineArray[1]);stateName=TrimString(lineArray[2]);b.attr("value")==countryCode&&countryCode!=""&&stateCode!=""&&a.addOption(stateCode,stateName)}c?a.selectOptions(c,true):a.selectOptions("",true);a.sortOptions()};
(function(a){a.fn.addOption=function(){var b=function(f,j,k,o){var l=document.createElement("option");l.value=j;l.text=k;k=f.options;var n=k.length;if(!f.cache){f.cache={};for(var m=0;m<n;m++)f.cache[k[m].value]=m}if(typeof f.cache[j]=="undefined")f.cache[j]=n;f.options[f.cache[j]]=l;if(o)l.selected=true},c=arguments;if(c.length==0)return this;var d=true,g=false,i,e,h;if(typeof c[0]=="object"){g=true;i=c[0]}if(c.length>=2){if(typeof c[1]=="boolean")d=c[1];else if(typeof c[2]=="boolean")d=c[2];if(!g){e=
c[0];h=c[1]}}this.each(function(){if(this.nodeName.toLowerCase()=="select")if(g)for(var f in i)b(this,f,i[f],d);else b(this,e,h,d)});return this};a.fn.ajaxAddOption=function(b,c,d,g,i){if(typeof b!="string")return this;if(typeof c!="object")c={};if(typeof d!="boolean")d=true;this.each(function(){var e=this;a.getJSON(b,c,function(h){a(e).addOption(h,d);if(typeof g=="function")typeof i=="object"?g.apply(e,i):g.call(e)})});return this};a.fn.removeOption=function(){var b=arguments;if(b.length==0)return this;
var c=typeof b[0],d,g;if(c=="string"||c=="object"||c=="function"){d=b[0];if(d.constructor==Array){c=d.length;for(var i=0;i<c;i++)this.removeOption(d[i],b[1]);return this}}else if(c=="number")g=b[0];else return this;this.each(function(){if(this.nodeName.toLowerCase()=="select"){if(this.cache)this.cache=null;var e=false,h=this.options;if(d)for(var f=h.length-1;f>=0;f--){if(d.constructor==RegExp){if(h[f].value.match(d))e=true}else if(h[f].value==d)e=true;if(e&&b[1]===true)e=h[f].selected;if(e)h[f]=null;
e=false}else(e=b[1]===true?h[g].selected:true)&&this.remove(g)}});return this};a.fn.sortOptions=function(b){var c=a(this).selectedValues(),d=typeof b=="undefined"?true:!!b;this.each(function(){if(this.nodeName.toLowerCase()=="select"){for(var g=this.options,i=g.length,e=[],h=0;h<i;h++)e[h]={v:g[h].value,t:g[h].text};e.sort(function(f,j){o1t=f.t.toLowerCase();o2t=j.t.toLowerCase();if(o1t==o2t)return 0;return d?o1t<o2t?-1:1:o1t>o2t?-1:1});for(h=0;h<i;h++){g[h].text=e[h].t;g[h].value=e[h].v}}}).selectOptions(c,
true);return this};a.fn.selectOptions=function(b,c){var d=typeof b;if(d=="object"&&b.constructor==Array){var g=this;a.each(b,function(){g.selectOptions(this,c)})}var i=c||false;if(d!="string"&&d!="function"&&d!="object")return this;this.each(function(){if(this.nodeName.toLowerCase()!="select")return this;for(var e=this.options,h=e.length,f=0;f<h;f++)if(b.constructor==RegExp)if(e[f].value.match(b))e[f].selected=true;else{if(i)e[f].selected=false}else if(e[f].value==b)e[f].selected=true;else if(i)e[f].selected=
false});return this};a.fn.copyOptions=function(b,c){var d=c||"selected";if(a(b).size()==0)return this;this.each(function(){if(this.nodeName.toLowerCase()!="select")return this;for(var g=this.options,i=g.length,e=0;e<i;e++)if(d=="all"||d=="selected"&&g[e].selected)a(b).addOption(g[e].value,g[e].text)});return this};a.fn.containsOption=function(b,c){var d=false,g=typeof b,i=typeof c;if(g!="string"&&g!="function"&&g!="object")return i=="function"?this:d;this.each(function(){if(this.nodeName.toLowerCase()!=
"select")return this;if(d&&i!="function")return false;for(var e=this.options,h=e.length,f=0;f<h;f++)if(b.constructor==RegExp){if(e[f].value.match(b)){d=true;i=="function"&&c.call(e[f],f)}}else if(e[f].value==b){d=true;i=="function"&&c.call(e[f],f)}});return i=="function"?this:d};a.fn.selectedValues=function(){var b=[];this.selectedOptions().each(function(){b[b.length]=this.value});return b};a.fn.selectedTexts=function(){var b=[];this.selectedOptions().each(function(){b[b.length]=this.text});return b};
a.fn.selectedOptions=function(){return this.find("option:selected")}})(jQuery);
jQuery(window).bind("main.js",function(){jQuery("a#mail-user-link").bind("click",function(){if(!User.isLogged()){Site.handleUserAuthentification();return false}});jQuery("a#link_print_user").bind("click",function(){window.print();return false});jQuery("form#user_send_to_friends_form").bind("submit",function(){user_sendToFriends(jQuery(this));return false});jQuery("form#mail_user_form").bind("submit",function(){user_mailUser(jQuery(this));return false});jQuery("a#link_add_to_my_friends").bind("click",
function(){return false});jQuery("a#link_see_user_blog").bind("click",function(){window.open(jQuery(this).attr("href"));return false});jQuery("a.link-display-recipes-as").bind("click",function(){user_updateView(jQuery(this).attr("href"),"user_recipe_list");return false});jQuery("a.link-display-friends-as").bind("click",function(){user_updateView(jQuery(this).attr("href"),"user_friend_list");return false});jQuery("div#user_recipe_list table td.next-page").bind("click",function(){var a=jQuery("div#user_recipe_list table td.page-numbers div.inactive-link").html();
a=parseInt(a)+1;a=jQuery("#recipe_pager_url").attr("value")+"?recipe_page="+a;user_updateView(a,"user_recipe_list");return false});jQuery("div#user_recipe_list table td.previous-page").bind("click",function(){var a=jQuery("div#user_recipe_list table td.page-numbers div.inactive-link").html();a=parseInt(a)-1;a=jQuery("#recipe_pager_url").attr("value")+"?user_recipes_page="+a;user_updateView(a,"user_recipe_list");return false});jQuery("div#user_recipe_list table td.page-numbers div.active-link a").bind("click",
function(){var a=jQuery("#recipe_pager_url").attr("value")+"?user_recipes_page="+jQuery(this).html();user_updateView(a,"user_recipe_list");return false});jQuery("div#favorite_recipe_list table td.next-page").bind("click",function(){var a=jQuery("div#favorite_recipe_list table td.page-numbers div.inactive-link").html();a=parseInt(a)+1;a=jQuery("#recipe_favorite_pager_url").attr("value")+"?favorite_recipes_page="+a;user_updateView(a,"favorite_recipe_list");return false});jQuery("div#favorite_recipe_list table td.previous-page").bind("click",
function(){var a=jQuery("div#favorite_recipe_list table td.page-numbers div.inactive-link").html();a=parseInt(a)-1;a=jQuery("#recipe_favorite_pager_url").attr("value")+"?favorite_recipes_page="+a;user_updateView(a,"favorite_recipe_list");return false});jQuery("div#favorite_recipe_list table td.page-numbers div.active-link a").bind("click",function(){var a=jQuery("#recipe_favorite_pager_url").attr("value")+"?favorite_recipes_page="+jQuery(this).html();user_updateView(a,"favorite_recipe_list");return false});
jQuery("div#user_friend_list table td.next-page").bind("click",function(){var a=jQuery("div#user_friend_list table td.page-numbers div.inactive-link").html();a=parseInt(a)+1;a=jQuery("#friend_pager_url").attr("value")+"?friend_page="+a;user_updateView(a,"user_friend_list");return false});jQuery("div#user_friend_list table td.previous-page").bind("click",function(){var a=jQuery("div#user_friend_list table td.page-numbers div.inactive-link").html();a=parseInt(a)-1;a=jQuery("#friend_pager_url").attr("value")+
"?friend_page="+a;user_updateView(a,"user_friend_list");return false});jQuery("div#user_friend_list table td.page-numbers div.active-link a").bind("click",function(){var a=jQuery("#friend_pager_url").attr("value")+"?friend_page="+jQuery(this).html();user_updateView(a,"user_friend_list");return false})});
var user_updateView=function(a,b){jQuery.ajax({type:"GET",processData:true,url:a,dataType:"html",success:function(c){jQuery("div#"+b).html(c)}})},user_sendToFriends=function(a){jQuery.ajax({type:"GET",dataType:"json",url:a.attr("action"),data:a.serialize(),success:function(b){if(b.hasErrors){jQuery("div.send-popup-error").show();jQuery("div.send-popup-success").hide();for(var c in b.errors)jQuery("#send_to_friends_"+c).addClass("error")}else{jQuery("div.send-popup-error").hide();jQuery("div.send-popup-success").show();
jQuery(":input",a).each(function(){var d=this.id;if(this.type=="checkbox")this.checked=false;if(d!="send_to_friends_your_email"&&d!="send_to_friends_object_id")this.value=""})}}})},user_mailUser=function(a){jQuery.ajax({type:"GET",dataType:"json",url:a.attr("action"),data:a.serialize(),success:function(b){if(b.hasErrors){jQuery("div.msg-popup-error").show();jQuery("div.msg-popup-success").hide();for(var c in b.errors)jQuery("#mail_message_"+c).addClass("error")}else{jQuery("div.msg-popup-error").hide();
jQuery("div.msg-popup-success").show();jQuery(":input",a).each(function(){if(this.type=="checkbox")this.checked=false;this.value=""})}}})};