
/* localization.js */
EDO.l10n={};EDO.l10n.translate=function(str){try{if(EDO.l10n._values[str]){return EDO.l10n._values[str];}}catch(e){}
return str;}
EDO.l10n._values={'/edit':'/edit','/travel-guide':'/travel-guide','Add a new article':'Add a new article','Add a new place':'Add a new place','Character remaining':'Character remaining','Choose location':'Choose location','City':'City','Comment':'Comment','Country':'Country','Drag the marker to place a object to a new position':'Drag the marker to spot a place to a new position','Enter a valid email address':'Enter a valid email address','My city is not in the list':'My city is not in the list','Name is too short':'Name is too short','No category selected':'No category selected','Please revise your data':'Please revise your data','Post on activity stream':'Post on activity stream','Save':'Save','Select a category':'Please select a category','Select a city':'Please select a city','Select a subcategory':'Cannot add in this category, please select a subcategory','Your browser does not support AJAX!':'Your browser does not support AJAX!','Your comment/question is too long':'Your comment/question is too long','Your comment/question is too short':'Your comment/question is too short','add':'add','of':'of'};
/* jquery.toJson.js */
(function($){var m={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},s={'array':function(x){var a=['['],b,f,i,l=x.length,v;for(i=0;i<l;i+=1){v=x[i];f=s[typeof v];if(f){v=f(v);if(typeof v=='string'){if(b){a[a.length]=',';}
a[a.length]=v;b=true;}}}
a[a.length]=']';return a.join('');},'boolean':function(x){return String(x);},'null':function(x){return"null";},'number':function(x){return isFinite(x)?String(x):'null';},'object':function(x){if(x){if(x instanceof Array){return s.array(x);}
var a=['{'],b,f,i,v;for(i in x){v=x[i];f=s[typeof v];if(f){v=f(v);if(typeof v=='string'){if(b){a[a.length]=',';}
a.push(s.string(i),':',v);b=true;}}}
a[a.length]='}';return a.join('');}
return'null';},'string':function(x){if(/["\\\x00-\x1f]/.test(x)){x=x.replace(/([\x00-\x1f\\"])/g,function(a,b){var c=m[b];if(c){return c;}
c=b.charCodeAt();return'\\u00'+
Math.floor(c/16).toString(16)+
(c%16).toString(16);});}
return'"'+x+'"';}};$.toJSON=function(v){var f=isNaN(v)?s[typeof v]:s['number'];if(f)return f(v);};$.parseJSON=function(v,safe){if(safe===undefined)safe=$.parseJSON.safe;if(safe&&!/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(v))
return undefined;return eval('('+v+')');};$.parseJSON.safe=false;})(jQuery);
/* jquery.limittextlength.js */
(function($){$.fn.limitTextLength=function(iLimit){if($(this).length>0){function getFormattedString(object){var text=$(object).val();var textlength=text.length;return(parseInt(iLimit)-parseInt(textlength)<0?0:(parseInt(iLimit)-parseInt(textlength)))+' '+EDO.l10n.translate("of")+' '+iLimit+' '+EDO.l10n.translate("Character remaining");}
$(this).after("<div>"+getFormattedString($(this))+"</div>");$(this).keyup(function(){var text=$(this).val();var textlength=text.length;if(textlength>iLimit){$(this).val(text.substr(0,iLimit));}
$(this).next().html(getFormattedString($(this)));});}}})(jQuery);
/* jquery.autocomplete.js */
jQuery.autocomplete=function(input,options){var me=this;var $input=$(input).attr("autocomplete","off");if(options.inputClass)$input.addClass(options.inputClass);var results=document.createElement("div");var $results=$(results);$results.hide().addClass(options.resultsClass).css("position","absolute");if(options.width>0)$results.css("width",options.width);$("body").append(results);input.autocompleter=me;var timeout=null;var prev="";var active=-1;var cache={};var keyb=false;var hasFocus=false;var lastKeyPressCode=null;function flushCache(){cache={};cache.data={};cache.length=0;};flushCache();if(options.data!=null){var sFirstChar="",stMatchSets={},row=[];if(typeof options.url!="string")options.cacheLength=1;for(var i=0;i<options.data.length;i++){row=((typeof options.data[i]=="string")?[options.data[i]]:options.data[i]);if(row[0].length>0){sFirstChar=row[0].substring(0,1).toLowerCase();if(!stMatchSets[sFirstChar])stMatchSets[sFirstChar]=[];stMatchSets[sFirstChar].push(row);}}
for(var k in stMatchSets){options.cacheLength++;addToCache(k,stMatchSets[k]);}}
$input.keydown(function(e){$("#"+options.hidden).val('');lastKeyPressCode=e.keyCode;switch(e.keyCode){case 38:e.preventDefault();moveSelect(-1);break;case 40:e.preventDefault();moveSelect(1);break;case 9:case 13:if(selectCurrent()){$input.get(0).blur();e.preventDefault();}
break;default:active=-1;if(timeout)clearTimeout(timeout);timeout=setTimeout(function(){onChange();},options.delay);break;}}).focus(function(){hasFocus=true;}).blur(function(){hasFocus=false;hideResults();});hideResultsNow();function onChange(){if(lastKeyPressCode==46||(lastKeyPressCode>8&&lastKeyPressCode<32))return $results.hide();var v=$input.val();if(v==prev)return;prev=v;if(v.length>=options.minChars){$input.addClass(options.loadingClass);requestData(v);}else{$input.removeClass(options.loadingClass);$results.hide();}};function moveSelect(step){var lis=$("li",results);if(!lis)return;active+=step;if(active<0){active=0;}else if(active>=lis.size()){active=lis.size()-1;}
lis.removeClass("ac_over");$(lis[active]).addClass("ac_over");};function selectCurrent(){var li=$("li.ac_over",results)[0];if(!li){var $li=$("li",results);if(options.selectOnly){if($li.length==1)li=$li[0];}else if(options.selectFirst){li=$li[0];}}
if(li){selectItem(li);return true;}else{return false;}};function selectItem(li){if(!li){li=document.createElement("li");li.extra=[];li.selectValue="";}
var v=(li.selectValue?li.selectValue:li.innerHTML);input.lastSelected=v;prev=v;$results.html("");$input.val($(li).find('div:first').text());$("#"+options.hidden).val(v);hideResultsNow();if(options.onItemSelect)setTimeout(function(){options.onItemSelect(li)},1);};function createSelection(start,end){var field=$input.get(0);if(field.createTextRange){var selRange=field.createTextRange();selRange.collapse(true);selRange.moveStart("character",start);selRange.moveEnd("character",end);selRange.select();}else if(field.setSelectionRange){field.setSelectionRange(start,end);}else{if(field.selectionStart){field.selectionStart=start;field.selectionEnd=end;}}
field.focus();};function autoFill(sValue){if(lastKeyPressCode!=8){$input.val($input.val()+sValue.substring(prev.length));createSelection(prev.length,sValue.length);}};function showResults(){var pos=findPos(input);var iWidth=(options.width>0)?options.width:$input.width();$results.css({width:parseInt(iWidth)+"px",top:(pos.y+input.offsetHeight)+"px",left:pos.x+"px"}).show();};function hideResults(){if(timeout)clearTimeout(timeout);timeout=setTimeout(hideResultsNow,200);};function hideResultsNow(){if(timeout)clearTimeout(timeout);$input.removeClass(options.loadingClass);if($results.is(":visible")){$results.hide();}
if(options.mustMatch){var v=$input.val();if(v!=input.lastSelected){selectItem(null);}}};function receiveData(q,data){if(data){$input.removeClass(options.loadingClass);results.innerHTML="";if(!hasFocus||data.length==0)return hideResultsNow();if($.browser.msie){$results.append(document.createElement('iframe'));}
results.appendChild(dataToDom(data));if(options.autoFill&&($input.val().toLowerCase()==q.toLowerCase()))autoFill(data[0].name);showResults();}else{hideResultsNow();}};function parseData(data){if(!data)return null;var parsed=[];var jsonData=eval('('+data+')');for(var currentPacket=0;currentPacket<jsonData.response.docs.length;currentPacket++){var elem=jsonData.response.docs[currentPacket];parsed.push({id:elem.id,name:elem.name,ancestorName:((elem.ancestorName)?elem.ancestorName:[]),ancestor:elem.ancestor,edoPath:elem.edo_path,city:elem.city})}
return parsed;};function dataToDom(data){var ul=document.createElement("ul");var num=data.length;if((options.maxItemsToShow>0)&&(options.maxItemsToShow<num))num=options.maxItemsToShow;for(var i=0;i<num;i++){var row=data[i];if(!row)continue;var li=document.createElement("li");if(row.ancestorName.length>2){li.innerHTML='<div>'+row.name+", "+row.ancestorName[1]+'</div>';li.innerHTML+='<div>'+row.ancestorName[2]+", "+row.ancestorName[1]+'</div>';}else if(row.ancestorName.length>1){li.innerHTML='<div>'+row.name+", "+row.ancestorName[1]+'</div>';li.innerHTML+='<div>'+row.ancestorName[1]+'</div>';}else{li.innerHTML='<div>'+row.name+'</div>';li.innerHTML+='<div>'+row.ancestorName[0]+'</div>';}
li.selectValue=row.id;li.selectText=row.name;var extra=null;li.extra=row;ul.appendChild(li);$(li).hover(function(){$("li",ul).removeClass("ac_over");$(this).addClass("ac_over");active=$("li",ul).indexOf($(this).get(0));},function(){$(this).removeClass("ac_over");}).click(function(e){e.preventDefault();e.stopPropagation();selectItem(this)});}
return ul;};function requestData(q){if(!options.matchCase)q=q.toLowerCase();var data=options.cacheLength?loadFromCache(q):null;if(data){receiveData(q,data);}else if((typeof options.url=="string")&&(options.url.length>0)){$.get(makeUrl(q),function(data){data=parseData(data);addToCache(q,data);receiveData(q,data);});}else{$input.removeClass(options.loadingClass);}};function makeUrl(q){var url=options.url+"?q="+encodeURI('+('+q+' '+q+'*)')+'&max-results=7';for(var i in options.extraParams){url+="&"+i+"="+encodeURI(options.extraParams[i]);}
return url;};function loadFromCache(q){if(!q)return null;if(cache.data[q])return cache.data[q];};function matchSubset(s,sub){if(!options.matchCase)s=s.toLowerCase();var i=s.indexOf(sub);if(i==-1)return false;return i==0||options.matchContains;};this.flushCache=function(){flushCache();};this.setExtraParams=function(p){options.extraParams=p;};this.findValue=function(){var q=$input.val();if(!options.matchCase)q=q.toLowerCase();var data=options.cacheLength?loadFromCache(q):null;if(data){findValueCallback(q,data);}else if((typeof options.url=="string")&&(options.url.length>0)){$.get(makeUrl(q),function(data){data=parseData(data)
addToCache(q,data);findValueCallback(q,data);});}else{findValueCallback(q,null);}}
function findValueCallback(q,data){if(data)$input.removeClass(options.loadingClass);var num=(data)?data.length:0;var li=null;for(var i=0;i<num;i++){var row=data[i];if(row[0].toLowerCase()==q.toLowerCase()){li=document.createElement("li");if(options.formatItem){li.innerHTML=options.formatItem(row,i,num);li.selectValue=row[0];}else{li.innerHTML=row[0];li.selectValue=row[0];}
var extra=null;if(row.length>1){extra=[];for(var j=1;j<row.length;j++){extra[extra.length]=row[j];}}
li.extra=extra;}}
if(options.onFindValue)setTimeout(function(){options.onFindValue(li)},1);}
function addToCache(q,data){if(!data||!q)return;cache.data[q]=data;};function findPos(obj){var curleft=obj.offsetLeft||0;var curtop=obj.offsetTop||0;while(obj=obj.offsetParent){curleft+=obj.offsetLeft
curtop+=obj.offsetTop}
return{x:curleft,y:curtop};}}
jQuery.fn.autocomplete=function(url,options,data){options=options||{};options.url=url;options.data=((typeof data=="object")&&(data.constructor==Array))?data:null;options.inputClass=options.inputClass||"ac_input";options.resultsClass=options.resultsClass||"ac_results";options.lineSeparator=options.lineSeparator||"\n";options.cellSeparator=options.cellSeparator||"|";options.minChars=options.minChars||1;options.delay=options.delay||400;options.matchCase=options.matchCase||0;options.matchSubset=options.matchSubset||1;options.matchContains=options.matchContains||0;options.cacheLength=options.cacheLength||1;options.mustMatch=options.mustMatch||0;options.extraParams=options.extraParams||{};options.loadingClass=options.loadingClass||"ac_loading";options.selectFirst=options.selectFirst||false;options.selectOnly=options.selectOnly||false;options.maxItemsToShow=options.maxItemsToShow||-1;options.autoFill=options.autoFill||false;options.width=parseInt(options.width,10)||0;this.each(function(){var input=this;new jQuery.autocomplete(input,options);});return this;}
jQuery.fn.autocompleteArray=function(data,options){return this.autocomplete(null,options,data);}
jQuery.fn.indexOf=function(e){for(var i=0;i<this.length;i++){if(this[i]==e)return i;}
return-1;};
/* edo.tag.js */
EDO.tag=function(){var userId=EDO.current.user.id;var tagApiBase=EDO.apiUrl+'/tag/'+EDO.current.user.id;var tagFlagBase=EDO.apiUrl+'/tag/flag';var createEntry=function(object,callback){$.post(tagApiBase,jQuery.toJSON(object),callback,"json");}
var updateEntry=function(object,callback){if(object.id&&object.id>0){$.put(tagApiBase+'/'+object.id,jQuery.toJSON(object),callback,"json");}}
var deleteEntry=function(id,callback,flag){if(id>0){if(flag==true){$.delete_(tagFlagBase+'/'+id,null,callback,"json");}else{$.delete_(tagApiBase+'/'+id,null,callback,"json");}}}
var getEntryById=function(id,callback){$.getJSON(tagApiBase+'/'+id,callback);}
var getEntryByRefAndTag=function(ref,tag,callback){$.getJSON(tagApiBase+ref+'/'+tag,callback);}
var getFlagByRefAndTag=function(ref,tag,callback){$.getJSON(tagFlagBase+ref+'/'+tag,callback);}
return{openTagDialog:function(object,title,callback){if($('#tag_dialog').length==0)$('#wrapper').append('<div id="tag_dialog"></div>');var dialogElement=$('#tag_dialog').dialog({title:title,autoOpen:false,bgiframe:true,resizable:false,width:450,modal:true,overlay:{backgroundColor:'#000',opacity:0.5}});dialogElement.html($('<form></form>').append('<label for="DialogTripComment">'+EDO.l10n.translate('Comment')+'</label>','<textarea id="DialogTripComment" style="width:100%" name="comment">'+object.comment+'</textarea>','<input id="DialogTripPublic" type="checkbox" name="public" value="1"'+((object.public)?'checked="checked"':'')+'" />','<label for="DialogTripPublic">'+EDO.l10n.translate('Post on activity stream')+'</label>',$('<input type="submit" value="'+EDO.l10n.translate('Save')+'" />').click(function(){object.comment=$('#DialogTripComment').val();object.public=($('#DialogTripPublic').attr('checked'))?true:false;callback(object);dialogElement.dialog('close');return false;})));dialogElement.dialog('open');},saveTag:function(object,callback){if(object.id){updateEntry(object,callback);}else{createEntry(object,callback);}},deleteTag:function(id,callback,flag){deleteEntry(id,callback,flag);},getTag:function(id,tag,callback){if(tag instanceof Function){getEntryById(id,tag);}else{getEntryByRefAndTag(id,tag,callback);}},getFlag:function(id,tag,callback){getFlagByRefAndTag(id,tag,callback);}};}();(function($){$.fn.edoTag=function(options){var options=jQuery.extend({'tagName':'follow','ref':'/marker/'+EDO.current.location.id,'comment':false,'commentDialogTitle':'Went there','buttonTitle':'Went there','buttonId':'went_there','flag':false},options);var tagElement=$('<span id="'+options.buttonId+'" class="title-checkbox uncheck"><span class="check">&nbsp;</span><span class="label">'+options.buttonTitle+'</span></span>');$(this).append(tagElement);var tagObject={name:options.tagName,user_id:EDO.current.user.id,ref:options.ref,public:true,comment:''};var initTagButton=function(data){if(data.response.length){tagObject=data.response[0];tagElement.removeClass('uncheck').addClass('check');}
if(data.response.id){tagObject=data.response;tagElement.removeClass('uncheck').addClass('check');}
if(options.comment){tagElement.click(function(){EDO.tag.openTagDialog(tagObject,options.commentDialogTitle,saveCommentedTag);});}else{tagElement.click(toggleTagButton);}}
var toggleTagButton=function(){if(tagObject.id&&tagObject.id>0){EDO.tag.deleteTag(tagObject.id,null,options.flag);tagObject.id=null;tagElement.removeClass('check').addClass('uncheck');}else{EDO.tag.saveTag(tagObject,function(data){if(data.response.id){tagObject=data.response;}});tagElement.removeClass('uncheck').addClass('check');}}
var saveCommentedTag=function(object){tagObject=object;if(tagObject.id&&tagObject.id>0){EDO.tag.saveTag(tagObject);}else{EDO.tag.saveTag(tagObject,function(data){if(data.response.id){tagObject=data.response;}});tagElement.removeClass('uncheck').addClass('check');}}
if(options.flag){EDO.tag.getFlag(options.ref,options.tagName,function(data){initTagButton(data);});}else{EDO.tag.getTag(options.ref,options.tagName,function(data){initTagButton(data);});}}})(jQuery);(function($){$.fn.edoTagListElement=function(){var tagListElement=$(this);var tagId=parseInt(tagListElement.attr('id').replace(/tag\/\d+\//,''));var editButton=$(tagListElement.find('.edit')[0]);var deleteButton=$(tagListElement.find('.delete')[0]);var tagComment=$(tagListElement.find('.comment')[0]);var tagObject={id:tagId,user_id:EDO.current.user.id,name:'visited'};deleteButton.click(function(){EDO.tag.deleteTag(tagObject.id);tagObject.id=null;tagListElement.remove();return false;});editButton.click(function(){EDO.tag.getTag(tagObject.id,function(data){if(data.response){tagObject=data.response;EDO.tag.openTagDialog(tagObject,'Edit trip',function(object){EDO.tag.saveTag(object,updateListElement);tagComment.html(object.comment);});}});return false;});var updateListElement=function(data){if(data.response){tagObject=data.response;}}}})(jQuery);(function($){$.fn.edoMarkerTagForm=function(){var formElement=$(this);var markerId=$('#TripMarkerId');var tripComment=$('#TripComment');var tripPublic=$('#TripPublic');var tripLocation=$('#TripLocation');var tagObject={name:'visited',user_id:EDO.current.user.id};formElement.submit(function(){if(markerId.val()>0){tagObject.ref='/marker/'+markerId.val(),tagObject.comment=tripComment.val();tagObject.public=(tripPublic.attr('checked'))?true:false;EDO.tag.saveTag(tagObject,prependListElement);}else{alert('Please select a location');}
return false;});var prependListElement=function(data){if(data.response){$('#my_trips_teaser').hide();$('#my_trips_list').show();tagObject=data.response;$.getJSON(EDO.apiUrl+'/'+tagObject.ref,function(data){var html=$('<li id="tag/'+EDO.current.user.id+'/'+tagObject.id+'"><div class="location">'
+'<a href="/trval-guide"'+data.response.edo_path+' "class"="green-arrow">'+data.response.name+'</a>'
+'</div><div class="comment">'+((tagObject.comment)?tagObject.comment:'')+'</div>'
+'<div class="trip_action"><span class="edit button arrow"><a href="#">Edit</a></span> '
+'<span class="delete button minus"><a href="#">Remove</a></span></div></li>');$("#trips-list").prepend(html);$(html).edoTagListElement();markerId.val(0),tripComment.val('');tripPublic.attr('checked',true);tripLocation.val('');tagObject={user_id:EDO.current.user.id,name:'visited'}});}}}})(jQuery);(function($){$.fn.edoFlag=function(options){var options=jQuery.extend({'ref':'/marker/'+EDO.current.location.id,'title':'Location flags'},options);var flagHolder=$('<div class="marker_flags"><h2>'+options.title+'</h2></div>');$(this).append(flagHolder);flagHolder.edoTag({buttonTitle:'Show on homepage',buttonId:'show_on_homepage_marker',tagName:'show-on-homepage',ref:options.ref,flag:true});flagHolder.edoTag({buttonTitle:'Copyright infringement',buttonId:'copyright_infringement_marker',tagName:'copyright-infringement',ref:options.ref,flag:true});flagHolder.edoTag({buttonTitle:'First person',buttonId:'first_person_marker',tagName:'first-person',ref:options.ref,flag:true});flagHolder.edoTag({buttonTitle:'Commercial',buttonId:'commercial_marker',tagName:'commercial',ref:options.ref,flag:true});flagHolder.edoTag({buttonTitle:'Stub',buttonId:'stub_marker',tagName:'stub',ref:options.ref,flag:true});flagHolder.edoTag({buttonTitle:'Offensive',buttonId:'offensive_marker',tagName:'offensive',ref:options.ref,flag:true});flagHolder.edoTag({buttonTitle:'Wrong location',buttonId:'wrong_location_marker',tagName:'wrong-location',ref:options.ref,flag:true});flagHolder.edoTag({buttonTitle:'Bad formatting',buttonId:'bad_formatting_marker',tagName:'bad-formatting',ref:options.ref,flag:true});}})(jQuery);
/* edo.functions.js */
$(document).ready(function(){EDO.setEventHandlers();});EDO.dom={};EDO.setEventHandlers=function(){switch(true){case(EDO.current.route.controller=='Pages'&&EDO.current.route.action=='contactus'):EDO.dom['questionCategory']=$("#questionCategory");EDO.dom['techCategory']=$("#techCategory");EDO.dom['questionCategory'].change(function(){if($(this).val()==2){EDO.dom['techCategory'].show();}else{EDO.dom['techCategory'].hide();}});$("#ContactComments").limitTextLength(3000);break;case(EDO.current.route.controller=='Users'&&EDO.current.route.action=='login'):$('#forgotPasswordRequest').click(function(){$("#hidden1").val($('#emailid').val());$("#SubmitUsers").submit();});$('#emailid').focus();break;case(EDO.current.route.controller=='Profiles'&&EDO.current.route.action=='edit'):$('#ProfileRestClientPhilosophy').limitTextLength(160);$('#ProfileRestClientLocation').autocomplete(EDO.apiUrl+"/location/solr",{hidden:'ProfileRestClientMarkerId',extraParams:{city:1}});break;case(EDO.current.route.controller=='Profiles'&&EDO.current.route.action=='my_world'):var activityPage=1;var disabled=false;var loadActivityStream=function(){$.getJSON(EDO.websiteUrl+'activity.php',{page:activityPage},function(data){var html='';var k=0;while(k<data.length){html+='<div class="event"><div class="img">';if(data[k].user_photo){html+='<a href="/my-profile/'+data[k].user_path+'"><img alt="'+data[k].user_name+'" src="'+EDO.staticUrl+'/img/user_avatars/u_'+data[k].user_photo+'"/></a>';}else{html+='<img alt="" src="/img/overview/default_avatar_50.png"/>';}
html+='</div><h3>';if(data[k].user_id){html+='<a href="/my-profile/'+data[k].user_path+'">'+data[k].user_name+'</a>';}else{html+='Anonymous';}
html+='</h3><div class="what" style="float:left;width:312px;"><ul>'
do{html+='<li>'+data[k].event_description+'</li>';k++;}while(data[k]&&data[k].user_id==data[k-1].user_id);html+='</ul></div></div>';}
$("#ajax-loading").hide();$("#activity_stream").append(html);activityPage++;if(data.length<30){disabled=true;$('#load_activity_stream').hide();return false;}
$('#ajax-loading-more').hide();$('#load_activity_stream').show();disabled=false;});}
$('#load_activity_stream').click(function(){if(disabled)return false;$('#load_activity_stream').hide();$('#ajax-loading-more').show();disabled=true;loadActivityStream();return false;});loadActivityStream();break;case(EDO.current.route.controller=='Profiles'&&EDO.current.route.action=='view'):if(EDO.current.user.id>0){if(EDO.current.user.level>1&&EDO.current.profile.id!=EDO.current.user.id){}}
break;case(EDO.current.route.controller=='Users'&&EDO.current.route.action=='registration'):$('#UserRestClientHometownId').autocomplete(EDO.apiUrl+"/location/solr",{hidden:'UserRestClientParentMarkerId',extraParams:{city:1}});break;case(EDO.current.route.controller=='Profiles'&&EDO.current.route.action=='registerForAmbassador'):$('#AmbassadorRestClientLocation').autocomplete(EDO.apiUrl+"/location/solr",{hidden:'AmbassadorRestClientMarkerId'});$("#AmbassadorRestClientReasonForApplying").limitTextLength(100);break;case(EDO.current.route.controller=='Users'&&EDO.current.route.action=='permissionMail'):$('#preview_mail').click(function(){$("#prv").val('1');$("#permissionmail").submit();});break;case(EDO.current.route.controller=='Maps'&&EDO.current.route.action=='largemap'):EDO.map.CategoryFilter=[];EDO.map.addOverlay();$(".opened, .closed").click(function(){if($(this).hasClass("closed")){$(this).attr("class","opened");$("~ ul",this).show();}else{$(this).attr("class","closed");$("~ ul",this).hide();}});$(".checked").click(function(){if($(this).hasClass('unchecked')){jQuery(this).parent().find(".checked").removeClass('unchecked');}else{jQuery(this).parent().find(".checked").addClass('unchecked');}
EDO.map.CategoryFilter=[];jQuery("#sidebar .checked").each(function(){if(!$(this).hasClass('unchecked')){EDO.map.CategoryFilter.push(parseInt(this.id.split('_')[1]));}});EDO.map.reloadTileOverlay();});$("#sidebar a").click(function(){jQuery(this).parent().find("span:first").trigger('click');return false;});break;case(EDO.current.route.controller=='Contribution'&&EDO.current.route.action=='index'):var items={};EDO.contribution_selected_location={};var loadPlaces=function(){var name=$('#contribution_name').val();var location=$('#contribution_location_id').val();var url=EDO.websiteUrl+"contribution/search";var options={};if(name!='')options.topic=name;if(location!='')options.location=location;if(name!=''||location!=''){$.getJSON(url,options,function(data){var html='';items={};$.each(data.found,function(i,item){items[item.UID]=item;html+='<li><a id="'+item.UID+'" href="/travel-guide'+item.edo_path+'">'+item.name+'</a></li>';});var missingHtml='';$.each(data.missing,function(i,item){missingHtml+='<li><a href="/travel-guide'+item.edo_path+'">'+item.name+'</a></li>';});if(missingHtml!='')missingHtml='<h2>Start a new article:</h2><ul>'+missingHtml+'</ul>';if(html!='')html='<h2>Edit place/topic:</h2><ul>'+html+'</ul>';html+=missingHtml;$('#contribution_results').html(html);});}}
$("#contribution_location").autocomplete(EDO.apiUrl+"/location/solr",{hidden:'contribution_location_id',onItemSelect:function(li){EDO.contribution_selected_location=li.extra;loadPlaces();}});$('#contribution_search').submit(function(event){return false;});$('#contribution_name').change(loadPlaces);$('#contribution_results a').live('click',function(event){var item=items[event.target.id];var html='<h3>Preview</h3>';html+='<h2 class="name">';html+='<span class="button arrow"><a href="'+EDO.l10n.translate('/edit')+item.edo_path+'">Edit</a></span>';html+=item.name;html+='</h2>';html+='<h2>Description</h2>'+item.description;$('#selected_result').html(html);return false;});if($('#contribution_location_id').val()!=''){$.getJSON(EDO.apiUrl+'/marker/solr?q=%2Bid_search:'+$('#contribution_location_id').val(),function(data){if(data.response.docs[0]){var elem=data.response.docs[0];EDO.contribution_selected_location={id:elem.id,name:elem.name,ancestorName:((elem.ancestorName)?elem.ancestorName:[]),ancestor:elem.ancestor,edoPath:elem.edo_path,city:elem.city}}});}
loadPlaces();break;case(EDO.current.route.controller=='ImageGallery'&&EDO.current.route.action=='slideshow'):function adjustLinks(){var prevIndex=(EDO.slideShow.objectImages[EDO.slideShow.currentIndex-1])?EDO.slideShow.currentIndex-1:EDO.slideShow.objectImages.length-1;var nextIndex=(EDO.slideShow.objectImages[EDO.slideShow.currentIndex+1])?EDO.slideShow.currentIndex+1:0;var currentHref=window.location.toString().replace(/#.*$/,'')+'#';$("#object_image_previous").attr('href',currentHref+EDO.slideShow.objectImages[prevIndex].file_name);$("#object_image_next").attr('href',currentHref+EDO.slideShow.objectImages[nextIndex].file_name);$("#object_image_link").attr('href',currentHref+EDO.slideShow.objectImages[nextIndex].file_name);window.location=currentHref+EDO.slideShow.objectImages[EDO.slideShow.currentIndex].file_name;}
adjustLinks();function changeImage(newIndex){$("#object_image").attr("src",EDO.staticUrl+'/img/objects/g_'+EDO.slideShow.objectImages[newIndex].file_name);$("#object_image").attr("alt",'Picture-'+EDO.slideShow.objectImages[newIndex].file_name);if(EDO.slideShow.objectImages[newIndex].original_title){$("#slide_image_name").html('<br>'+'Image name:'+EDO.slideShow.objectImages[newIndex].original_title);}else if(EDO.slideShow.objectImages[newIndex].file_name){$("#slide_image_name").html('<br>'+'Image name:'+EDO.slideShow.objectImages[newIndex].file_name);}
if(EDO.slideShow.objectImages[newIndex].original_author){$("#slide_author_name").html('<br>'+'Photographer:'+EDO.slideShow.objectImages[newIndex].original_author);}else{$("#slide_author_name").html('<br>'+'Photographer:'+'unknown');}
if(EDO.slideShow.objectImages[newIndex].original_source){$("#slide_licence_info").html('<br>'+'Source Url:'+EDO.slideShow.objectImages[newIndex].original_source);}else{$("#slide_licence_info").html('');}
$("#object_image_title").text(EDO.slideShow.objectImages[newIndex].file_name);$('#main_title h1').text($('#main_title h1').text().replace(/#\d+\s*$/,'#'+(newIndex+1).toString()));$("#object_images_current").text(newIndex+1);adjustLinks();}
$("#object_image_previous").click(function(event){event.preventDefault();EDO.slideShow.currentIndex=(EDO.slideShow.objectImages[EDO.slideShow.currentIndex-1])?EDO.slideShow.currentIndex-1:EDO.slideShow.currentIndex=EDO.slideShow.objectImages.length-1;changeImage(EDO.slideShow.currentIndex);});$("#object_image_link,#object_image_next").click(function(event){event.preventDefault();EDO.slideShow.currentIndex=(EDO.slideShow.objectImages[EDO.slideShow.currentIndex+1])?EDO.slideShow.currentIndex+1:0;changeImage(EDO.slideShow.currentIndex);});$('#view_original_image').click(function(event){event.preventDefault();window.location=EDO.staticUrl+'/img/objects/'+EDO.slideShow.objectImages[EDO.slideShow.currentIndex].file_name;});$(document).keypress(function(e){switch(e.keyCode)
{case 39:EDO.slideShow.currentIndex=(EDO.slideShow.objectImages[EDO.slideShow.currentIndex+1])?EDO.slideShow.currentIndex+1:0;changeImage(EDO.slideShow.currentIndex);break;case 37:EDO.slideShow.currentIndex=(EDO.slideShow.objectImages[EDO.slideShow.currentIndex-1])?EDO.slideShow.currentIndex-1:EDO.slideShow.currentIndex=EDO.slideShow.objectImages.length-1;changeImage(EDO.slideShow.currentIndex);break;}});break;case(EDO.current.route.action=='version_compare'):$('#revisionSelect').each(function(){this.reset();});$("#revisionSelect select").change(function(){this.form.submit();});break;case(EDO.current.route.action=='version'):$('#revisionSelect').each(function(){this.reset();});$("#revisionSelect select").change(function(){this.form.submit();});break;case(EDO.current.route.action=='version_changes'):var checked=0;var lastChecked;$('#historyLinksForm').each(function(){this.reset();});$("#historyLinksTable input").click(function(){if($(this).attr("checked")==true){checked++;if(checked>2){checked--;if(confirm("Only two articles are allowed to be compared. \nPress <OK> to uncheck the last one or <CANCEL> to uncheck the other")){$(this).attr("checked",false);}else{$("#"+lastChecked).attr("checked",false);lastChecked=$(this).attr('id');}}else{lastChecked=$(this).attr('id');}}else{checked--;}});$("#compareSelected").bind("click",function(){if(checked<2){alert("Please select at least two articles to compare");return false;}else{this.form.submit();}});break;case((EDO.current.route.controller=='Location'||EDO.current.route.controller=='Object'||EDO.current.route.controller=='Article'||EDO.current.route.controller=='ImageGallery')&&(EDO.current.route.action=='edit'||EDO.current.route.action=='upload_objimage')):if(EDO.current.route.controller=='Location'){$("#checkall").click(function(){for(var i=1;i<=12;i++){$("#MarkerRestClientWhenToGo"+i).attr('checked',true);}});$("#uncheckall").click(function(){for(var i=1;i<=12;i++){$("#MarkerRestClientWhenToGo"+i).attr('checked',false);}});}
if(EDO.current.route.controller=='Object'||EDO.current.route.controller=='Article'){EDO.tinyMCE={regex_wikipedia_footnote:/(<sup id=['"][\w\-]*['"] class=['"][\w \.\/\:\=\(\)\- ]*['"]><a href=['"][\w \.\/\:\=\-\?%#& ]*['"]><span>\[<\/span>[\d]*<span>\]<\/span><\/a><\/sup>)?/g,regex_wikipedia_link:/<a href=['"][\w \.\/\:\=\-\?%#&, ]*['"] title=['"][\wāäöüß \.\/\:\=\(\)\-,'" ]*['"](?: class=['"][\w \.\/\:\=\(\)\- ]*['"])?>([<>\wāäöüß° \-\&\;\/\(\)\.,'"]*)(<\/a>)+/ig,regex_wikipedia_note:/(<span class=['"][\w \.\/\:\=\(\)\- ]*['"]><sup id=['"][\w\-]*['"]><a href=['"][\w \.\/\:\=\-\?%#& ]*['"]>\[[ivxlm]*\]<\/a><\/sup><\/span>)?/g,regex_wikipedia_editlink:/<span class=['"][\w \.\/\:\=\(\)\- ]*['"]>\[<a href=['"][\w \.\/\:\=\-\?%#&;,_ ]*['"] title=['"][\wāäöüß \.\/\:\=\(\)\-, ]*['"]>edit<\/a>\]<\/span>/ig,pastePreProcess:function(pl,o){o.content=o.content.replace(this.regex_wikipedia_link,"$1");o.content=o.content.replace(this.regex_wikipedia_editlink,"");o.content=o.content.replace(this.regex_wikipedia_footnote,"");o.content=o.content.replace(this.regex_wikipedia_note,"");}}}
if(EDO.current.route.controller=='Object'&&EDO.current.route.action=='edit'){$('#ObjectRestClientCityAutocomplete').autocomplete(EDO.apiUrl+"/location/solr",{hidden:'ObjectRestClientCityAutocompleteId',extraParams:{city:1}});}
function enableDisableSave(){var str=$("#blinkyellow input:checked").val();if(str=="myself"){enableSave();}else if((str=="commoncontent")&&url_validate($('#sorce input').val())){enableSave();}else{disableSave();}}
function url_validate(userUrl)
{var urlArray=userUrl.split(',');var urlset=false;var prvstatus=true;jQuery.each(urlArray,function(){var regUrl=/^(http|https|ftp):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/;if(regUrl.test($.trim(this))==false)
{urlset=false;prvstatus=false;}else{if(prvstatus!=false){urlset=true;}else{urlset=false;}}});return urlset;}
function enableSave(){$("#submit").attr("disabled","");$("#submit-button").removeClass('disabled-button');$('#submitEdit').unbind('click').click(function(){closingVar=false;document.editForm.submit();return false;});}
function disableSave(){$("#submit").attr("disabled","disabled");$("#submit-button").addClass('disabled-button');$('#submitEdit').unbind('click').click(function(event){event.preventDefault();doBlink('#blinkyellow',1,3);return false;});}
function showHideCC(str){if(str=='commoncontent'){$("#sorce").show();$("#myself").hide();$("#sorce input").focus(function(){$("#sorce .default").hide();});$("#sorce .default").click(function(){$(this).hide();$("#sorce input").eq(0).focus();});}else{if(str=='myself'){$("#sorce").hide();$("#myself").show();$("#sorce input").val('');}}}
function doBlink(obj,start,finish){$(obj).animate({backgroundColor:"yellow"},200).animate({backgroundColor:"white"},200);if(start!=finish){start=start+1;doBlink(obj,start,finish);}}
$("#sorce input").eq(0).bind("keyup paste",function(){var url=$(this).val();if(url.length>7&&url.substr(0,7)!='http://'){$(this).val('http://'+url);}
enableDisableSave();});var sel=$('#blinkyellow input:checked').val();showHideCC(sel);$('#blinkyellow input').click(function(){enableDisableSave();var str=$('#blinkyellow input:checked').val();showHideCC(str);});enableDisableSave();var closingVar=true;$('#discardEdit').click(function(){closingVar=false});$('#submitEdit').click(function(){closingVar=false});$('#submitbut').click(function(){closingVar=false});$('#objectsubmit').click(function(){closingVar=false});window.onbeforeunload=function(){if(closingVar==true){return"WARNING: The edits you have made have not been saved. Changes will be lost if you click ok.";}}
break;case(EDO.current.route.controller=='Profiles'&&EDO.current.route.action=='trips'):$('#TripLocation').autocomplete(EDO.apiUrl+"/location/solr",{hidden:'TripMarkerId'});$("#TripComment").limitTextLength(140);$('#AddNewTrip').edoMarkerTagForm();$('#trips-list li').each(function(){$(this).edoTagListElement();});break;case(EDO.current.route.controller=='Location'&&EDO.current.route.action=='display'):if(EDO.current.user.id>0){$('#main_title h1').edoTag({buttonTitle:'Like',buttonId:'recommend_marker',tagName:'recommend',ref:'/marker/'+EDO.current.location.id});if(EDO.current.user.level>1){$('#sidebar').edoFlag({'ref':'/marker/'+EDO.current.location.id,'title':'Location flags'});}}
break;case(EDO.current.route.controller=='Object'&&EDO.current.route.action=='display'):if(EDO.current.user.id>0){$('#main_title h1').edoTag({buttonTitle:'Like',buttonId:'recommend_marker',tagName:'recommend',ref:'/marker/'+EDO.current.marker.id});if(EDO.current.user.level>1){$('#sidebar').edoFlag({'ref':'/marker/'+EDO.current.location.id,'title':'Location flags'});$('#sidebar').edoFlag({'ref':'/marker/'+EDO.current.marker.id,'title':'Place flags'});}}
break;case(EDO.current.route.controller=='Category'&&EDO.current.route.action=='display'):if(EDO.current.user.id>0){if(EDO.current.user.level>1){$('#sidebar').edoFlag({'ref':'/marker/'+EDO.current.location.id,'title':'Location flags'});if(EDO.current.article.id){$('#sidebar').edoFlag({'ref':'/article/'+EDO.current.article.id,'title':'Article flags'});}}}
break;default:break;}}
$('#SearchQ').ready(function(){var defaultSearchQValue;defaultSearchQValue=$("#SearchQ").val();$("#SearchQ").click(function(){if($("#SearchQ").val()==defaultSearchQValue)$("#SearchQ").val('');});$("#SearchQ").blur(function(){if($("#SearchQ").val()=="")$("#SearchQ").val(defaultSearchQValue);});$("#search input.search-button").click(function(){if($("#SearchQ").val()==defaultSearchQValue){$("#SearchQ").click();$("#SearchQ").focus();return false;}});$('#SearchQ').autocomplete(EDO.apiUrl+"/location/solr",{hidden:'SearchMarkerId',onItemSelect:function(item){location.href=EDO.l10n.translate('/travel-guide')+item.extra.edoPath;}});});$('#myworld_link, #myworld').mouseover(function(){$('#myworld').show();});$('#myworld_link, #myworld').mouseout(function(){$('#myworld').hide();});$(function(){$("#report_bugs").live('click',function(ev){var protocol=document.location.protocol;var href=$(this).attr('href');var timeout=setTimeout(function()
{window.location=href;},5000);$.getScript(protocol+'//s3.amazonaws.com/getsatisfaction.com/feedback/feedback.js',function(){clearTimeout(timeout);timeout=null;GSFN.feedback(protocol+'//getsatisfaction.com/earthorg/feedback/topics/new?display=overlay&style=problem',{container:$('<div id="gsfn-container"></div>').appendTo('body:first')[0].id,placement:'hidden'});GSFN.show();});return false;});});jQuery.extend({put:function(url,data,callback,type){return _ajax_request(url,data,callback,type,'PUT');},delete_:function(url,data,callback,type){return _ajax_request(url,data,callback,type,'DELETE');}});function _ajax_request(url,data,callback,type,method){if(jQuery.isFunction(data)){callback=data;data={};}
return jQuery.ajax({type:method,url:url,data:data,success:callback,dataType:type});}
/* edo.contribution.js */
$(document).ready(function(){if(EDO.current.route.controller=='Contribution'){EDO.setContributeBehaviors=function(){$('#wrapper').append("<div id='dialog'></div>");$('#dialog').dialog({autoOpen:false,bgiframe:true,resizable:false,height:309,width:800,modal:true,overlay:{backgroundColor:'#000',opacity:0.5},title:'Default title...'});EDO.article_select_container=$("<div id='article_categories_container'></div>");EDO.object_select_container=$("<div id='object_categories_container'></div>");EDO.flattened_cat_hash={};EDO.flattened_cat_list_hash={};$.getJSON(EDO.websiteUrl+"contribution/objectTree",function(data){createObjectTreeSelect(data,EDO.object_select_container);});$.getJSON(EDO.websiteUrl+"contribution/articleTree",function(data){createArticleTreeSelect(data,EDO.article_select_container);});function createArticleTreeSelect(data_obj,container){var topSelectNode=$("<select id='category_level_0' size='10' style='width:250px;margin-right:6px;'></select>");container.append(topSelectNode,"<select id='category_level_1' size='10' style='width:250px;margin-right:6px;'></select><select id='category_level_2' size='10' style='width:250px;margin-right:6px;'></select>");populateSelectFromData(topSelectNode,data_obj);}
function createObjectTreeSelect(data_obj,container){var topSelectNode=$("<select id='category_level_0' size='10' style='width:250px;margin-right:6px;'></select>");container.append(topSelectNode,"<select id='category_level_1' size='10' style='width:250px;margin-right:6px;'></select><select id='category_level_2' size='10' style='width:250px;margin-right:6px;'></select>");populateSelectFromData(topSelectNode,data_obj);}
function populateSelectFromData(selectNode,data_obj){selectNode.change(function(){$(this).nextAll().each(function(i){$(this).empty();});var next_data_obj=EDO.flattened_cat_hash[$(this).children(":selected").val()];populateSelectFromData($(this).next(),next_data_obj);populatePlacesCategoryPath();});for(var item in data_obj){var category=data_obj[item];var optionNode=$("<option name='"+category['title']+"' value='"+category['id']+"'>"+category['title']+"</option>");EDO.flattened_cat_list_hash[category['id']]=category;if(category['nodes']){EDO.flattened_cat_hash[category['id']]=category['nodes'];}
selectNode.append(optionNode);}
return;}
function populatePlacesCategoryPath(){$('#new_place_category_path').text('');EDO.selected_category_url='';$("#category_level_0 option:selected").each(function(){$('#new_place_category_path').append('<span>'+$(this).text()+' &gt; </span>');EDO.selected_category=$("#category_level_0").val();EDO.selected_category_url=EDO.flattened_cat_list_hash[$("#category_level_0").val()].edo_path;});$("#category_level_1 option:selected").each(function(){$('#new_place_category_path').append('<span>'+$(this).text()+' &gt; </span>');EDO.selected_category=$("#category_level_1").val();EDO.selected_category_url=EDO.flattened_cat_list_hash[$("#category_level_1").val()].edo_path;});$("#category_level_2 option:selected").each(function(){$('#new_place_category_path').append('<span>'+$(this).text()+' &gt; </span>');EDO.selected_category=$("#category_level_2").val();EDO.selected_category_url=EDO.flattened_cat_list_hash[$("#category_level_2").val()].edo_path;});}
EDO.selected_location_url='';EDO.selected_category=false;EDO.selected_category_url='';EDO.modal_place_html=$("<form id='contribute_place'></form>").append("<input id='places_search_marker_id' type='hidden' />","<label>"+EDO.l10n.translate('City')+"</label> ",$("<input id='contribute_location' type='text' />").autocomplete(EDO.apiUrl+"/location/solr",{extraParams:{city:1},hidden:'places_search_marker_id',onItemSelect:function(li){try{$('#new_place_location_path').text('');EDO.selected_location_url=li.extra.edoPath;$.each(li.extra.ancestorName,function(i,ancestor)
{$('#new_place_location_path').append('<span>'+ancestor+' &gt; </span>');});}catch(e){}}}),EDO.object_select_container,$('<div id="new_place_path"><span id="new_place_location_path">&nbsp;</span> <span id="new_place_category_path">&nbsp;</span></div>'),$("<span class='blue-button'><input id='add_object' type='button' value='"+EDO.l10n.translate('add')+"'></span>").click(function(){if(EDO.selected_location_url!=''){if(EDO.selected_category_url!=''){if(EDO.flattened_cat_list_hash[EDO.selected_category]['nodes']){alert(EDO.l10n.translate('Select a subcategory'));return false;}
window.location=EDO.l10n.translate('/travel-guide')+EDO.selected_location_url+EDO.selected_category_url+EDO.l10n.translate('/addobject');return false;}else{alert(EDO.l10n.translate('Select a category'));return false;}}else{alert(EDO.l10n.translate('Select a city'));return false;}
$('#dialog').dialog('close');}));EDO.modal_article_html=$("<form id='contribute_article'></form>").append("<input id='articles_search_marker_id' type='hidden' />","<label>"+EDO.l10n.translate('City')+"/"+EDO.l10n.translate('Country')+"</label> ",$("<input id='contribute_location' type='text' />").autocomplete(EDO.apiUrl+"/location/solr",{hidden:'articles_search_marker_id',onItemSelect:function(li){try{$('#new_place_location_path').text('');EDO.selected_location_url=li.extra.edoPath;$.each(li.extra.ancestorName,function(i,ancestor)
{$('#new_place_location_path').append('<span>'+ancestor+' &gt; </span>');});}catch(e){}}}),EDO.article_select_container,$('<div id="new_place_path"><span id="new_place_location_path"></span> <span id="new_place_category_path"></span>&nbsp;</div>'),$("<span class='blue-button'><input id='add_article' type='button' value='"+EDO.l10n.translate('add')+"'></span>").click(function(){if(EDO.selected_location_url!=''){if(EDO.selected_category_url!=''){if(EDO.flattened_cat_list_hash[EDO.selected_category].article_type=='0'||EDO.flattened_cat_list_hash[EDO.selected_category].article_type=='4'){alert(EDO.l10n.translate('Select a subcategory'));return false;}
window.location=EDO.l10n.translate('/edit')+EDO.selected_location_url+EDO.selected_category_url;return false;}else{alert(EDO.l10n.translate('Select a category'));return false;}}else{alert(EDO.l10n.translate('Select a city'));return false;}
$('#dialog').dialog('close');}));$('#add_contribution_place').click(function(){$('#dialog').dialog('option','title',EDO.l10n.translate('Add a new place'));$("#dialog").html(EDO.modal_place_html);if(EDO.contribution_selected_location.id&&EDO.contribution_selected_location.city){$('#places_search_marker_id').val(EDO.contribution_selected_location.id);$('#contribute_location').val($('#contribution_location').val());try{$('#new_place_location_path').text('');EDO.selected_location_url=EDO.contribution_selected_location.edoPath;$.each(EDO.contribution_selected_location.ancestorName,function(i,ancestor)
{$('#new_place_location_path').append('<span>'+ancestor+' &gt; </span>');});}catch(e){}}
$('#dialog').dialog('open');});$('#add_contribution_article').click(function(){$('#dialog').dialog('option','title',EDO.l10n.translate('Add a new article'));$("#dialog").html(EDO.modal_article_html);if(EDO.contribution_selected_location.id){$('articles_search_marker_id').val(EDO.contribution_selected_location.id);$('#contribute_location').val($('#contribution_location').val());try{$('#new_place_location_path').text('');EDO.selected_location_url=EDO.contribution_selected_location.edoPath;$.each(EDO.contribution_selected_location.ancestorName,function(i,ancestor)
{$('#new_place_location_path').append('<span>'+ancestor+' &gt; </span>');});}catch(e){}}
$('#dialog').dialog('open');});};EDO.setContributeBehaviors();};});
/* jquery.MultiFile.js */
;if(window.jQuery)(function($){$.fn.MultiFile=function(options){if(this.length==0)return this;if(typeof arguments[0]=='string'){if(this.length>1){var args=arguments;return this.each(function(){$.fn.MultiFile.apply($(this),args);});};$.fn.MultiFile[arguments[0]].apply(this,$.makeArray(arguments).slice(1)||[]);return this;};var options=$.extend({},$.fn.MultiFile.options,options||{});$('form').not('MultiFile-intercepted').addClass('MultiFile-intercepted').submit($.fn.MultiFile.disableEmpty);if($.fn.MultiFile.options.autoIntercept){$.fn.MultiFile.intercept($.fn.MultiFile.options.autoIntercept);$.fn.MultiFile.options.autoIntercept=null;};this.not('.MultiFile-applied').addClass('MultiFile-applied').each(function(){window.MultiFile=(window.MultiFile||0)+1;var group_count=window.MultiFile;var MultiFile={e:this,E:$(this),clone:$(this).clone()};if(typeof options=='number')options={max:options};var o=$.extend({},$.fn.MultiFile.options,options||{},($.metadata?MultiFile.E.metadata():($.meta?MultiFile.E.data():null))||{},{});if(!(o.max>0)){o.max=MultiFile.E.attr('maxlength');if(!(o.max>0)){o.max=(String(MultiFile.e.className.match(/\b(max|limit)\-([0-9]+)\b/gi)||['']).match(/[0-9]+/gi)||[''])[0];if(!(o.max>0))o.max=-1;else o.max=String(o.max).match(/[0-9]+/gi)[0];}};o.max=new Number(o.max);o.accept=o.accept||MultiFile.E.attr('accept')||'';if(!o.accept){o.accept=(MultiFile.e.className.match(/\b(accept\-[\w\|]+)\b/gi))||'';o.accept=new String(o.accept).replace(/^(accept|ext)\-/i,'');};$.extend(MultiFile,o||{});MultiFile.STRING=$.extend({},$.fn.MultiFile.options.STRING,MultiFile.STRING);$.extend(MultiFile,{n:0,slaves:[],files:[],instanceKey:MultiFile.e.id||'MultiFile'+String(group_count),generateID:function(z){return MultiFile.instanceKey+(z>0?'_F'+String(z):'');},trigger:function(event,element){var handler=MultiFile[event],value=$(element).attr('value');if(handler){var returnValue=handler(element,value,MultiFile);if(returnValue!=null)return returnValue;}
return true;}});if(String(MultiFile.accept).length>1){MultiFile.accept=MultiFile.accept.replace(/\W+/g,'|').replace(/^\W|\W$/g,'');MultiFile.rxAccept=new RegExp('\\.('+(MultiFile.accept?MultiFile.accept:'')+')$','gi');};MultiFile.wrapID=MultiFile.instanceKey+'_wrap';MultiFile.E.wrap('<div class="MultiFile-wrap" id="'+MultiFile.wrapID+'"></div>');MultiFile.wrapper=$('#'+MultiFile.wrapID+'');MultiFile.e.name=MultiFile.e.name||'file'+group_count+'[]';if(!MultiFile.list){MultiFile.wrapper.append('<div class="MultiFile-list" id="'+MultiFile.wrapID+'_list"></div>');MultiFile.list=$('#'+MultiFile.wrapID+'_list');};MultiFile.list=$(MultiFile.list);MultiFile.addSlave=function(slave,slave_count){MultiFile.n++;slave.MultiFile=MultiFile;if(slave_count>0)slave.id=slave.name='';if(slave_count>0)slave.id=MultiFile.generateID(slave_count);slave.name=String(MultiFile.namePattern.replace(/\$name/gi,$(MultiFile.clone).attr('name')).replace(/\$id/gi,$(MultiFile.clone).attr('id')).replace(/\$g/gi,group_count).replace(/\$i/gi,slave_count));if((MultiFile.max>0)&&((MultiFile.n-1)>(MultiFile.max)))
slave.disabled=true;MultiFile.current=MultiFile.slaves[slave_count]=slave;slave=$(slave);slave.val('').attr('value','')[0].value='';slave.addClass('MultiFile-applied');slave.change(function(){$(this).blur();if(!MultiFile.trigger('onFileSelect',this,MultiFile))return false;var ERROR='',v=String(this.value||'');if(MultiFile.accept&&v&&!v.match(MultiFile.rxAccept))
ERROR=MultiFile.STRING.denied.replace('$ext',String(v.match(/\.\w{1,4}$/gi)));for(var f in MultiFile.slaves)
if(MultiFile.slaves[f]&&MultiFile.slaves[f]!=this)
if(MultiFile.slaves[f].value==v)
ERROR=MultiFile.STRING.duplicate.replace('$file',v.match(/[^\/\\]+$/gi));var newEle=$(MultiFile.clone).clone();newEle.addClass('MultiFile');if(ERROR!=''){MultiFile.error(ERROR);MultiFile.n--;MultiFile.addSlave(newEle[0],slave_count);slave.parent().prepend(newEle);slave.remove();return false;};$(this).css({position:'absolute',top:'-3000px'});slave.after(newEle);MultiFile.addToList(this,slave_count);MultiFile.addSlave(newEle[0],slave_count+1);if(!MultiFile.trigger('afterFileSelect',this,MultiFile))return false;});$(slave).data('MultiFile',MultiFile);};MultiFile.addToList=function(slave,slave_count){if(!MultiFile.trigger('onFileAppend',slave,MultiFile))return false;var
r=$('<div class="MultiFile-label"></div>'),v=String(slave.value||''),a=$('<span class="MultiFile-title" title="'+MultiFile.STRING.selected.replace('$file',v)+'">'+MultiFile.STRING.file.replace('$file',v.match(/[^\/\\]+$/gi)[0])+'</span>'),b=$('<a class="MultiFile-remove" href="#'+MultiFile.wrapID+'">'+MultiFile.STRING.remove+'</a>');MultiFile.list.append(r.append(b,' ',a));b.click(function(){if(!MultiFile.trigger('onFileRemove',slave,MultiFile))return false;MultiFile.n--;MultiFile.current.disabled=false;MultiFile.slaves[slave_count]=null;$(slave).remove();$(this).parent().remove();$(MultiFile.current).css({position:'',top:''});$(MultiFile.current).reset().val('').attr('value','')[0].value='';if(!MultiFile.trigger('afterFileRemove',slave,MultiFile))return false;return false;});if(!MultiFile.trigger('afterFileAppend',slave,MultiFile))return false;};if(!MultiFile.MultiFile)MultiFile.addSlave(MultiFile.e,0);MultiFile.n++;MultiFile.E.data('MultiFile',MultiFile);});};$.extend($.fn.MultiFile,{reset:function(){var settings=$(this).data('MultiFile');if(settings)settings.list.find('a.MultiFile-remove').click();return $(this);},disableEmpty:function(klass){klass=(typeof(klass)=='string'?klass:'')||'mfD';var o=[];$('input:file.MultiFile').each(function(){if($(this).val()=='')o[o.length]=this;});return $(o).each(function(){this.disabled=true}).addClass(klass);},reEnableEmpty:function(klass){klass=(typeof(klass)=='string'?klass:'')||'mfD';return $('input:file.'+klass).removeClass(klass).each(function(){this.disabled=false});},intercepted:{},intercept:function(methods,context,args){var method,value;args=args||[];if(args.constructor.toString().indexOf("Array")<0)args=[args];if(typeof(methods)=='function'){$.fn.MultiFile.disableEmpty();value=methods.apply(context||window,args);setTimeout(function(){$.fn.MultiFile.reEnableEmpty()},1000);return value;};if(methods.constructor.toString().indexOf("Array")<0)methods=[methods];for(var i=0;i<methods.length;i++){method=methods[i]+'';if(method)(function(method){$.fn.MultiFile.intercepted[method]=$.fn[method]||function(){};$.fn[method]=function(){$.fn.MultiFile.disableEmpty();value=$.fn.MultiFile.intercepted[method].apply(this,arguments);setTimeout(function(){$.fn.MultiFile.reEnableEmpty()},1000);return value;};})(method);};}});$.fn.MultiFile.options={accept:'',max:-1,namePattern:'$name',STRING:{remove:'x',denied:'You cannot select a $ext file.\nTry again...',file:'$file',selected:'File selected: $file',duplicate:'This file has already been selected:\n$file'},autoIntercept:['submit','ajaxSubmit','ajaxForm','validate'],error:function(s){alert(s);}};$.fn.reset=function(){return this.each(function(){try{this.reset();}catch(e){}});};$(function(){$("input[type=file].multi").MultiFile();});})(jQuery);
/* edo.analytics.js */
var _gaq=_gaq||[];_gaq.push(['_setAccount',EDO.gaTracker]);_gaq.push(['_trackPageview']);_gaq.push(['all._setAccount','UA-1286768-6']);_gaq.push(['all._trackPageview']);(function(){var ga=document.createElement('script');ga.type='text/javascript';ga.async=true;ga.src=('https:'==document.location.protocol?'https://ssl':'http://www')+'.google-analytics.com/ga.js';(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(ga);})();