/* Copyright 2009 EQAL, Inc. */

var U={version:0.1,branch:'devel',ENV:'dev',loadJS:function(file){document.write('<script type="text/javascript" src="'+file+'?v='+this.version+'"></script>');return this;},loadCSS:function(file){document.write('<link rel="stylesheet" href="'+file+'?v='+this.version+'" />');return this;},init:function(){this.Error.init();},getRequestUrl:function(name){},constructActionUrl:function(data){return"/"+data['module_url_string']+"/"+data['action']+data['params'];},setCookie:function(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}
else expires="";document.cookie=name+"="+value+expires+"; path=/";},Error:{items:new Array(),log:function(message){this.items.push(message);this._show();},_show:function(){this.items.each(function(item){$log(item.replace("\t"," "));},this);},getString:function(error){var message='ERROR: ';for(var i in error)message+=i+' - '+error[i]+'\n';return message;},__onError:function(desc,page,line){this.log('ERROR: \ndescription: \t'+desc+'\nPage address:\t'+page+'\nLine number:\t'+line);return true;},init:function(){if(U.ENV!='dev'||Browser.Engine.trident4)
window.onerror=this.__onError.bind(this);}},getCookie:function(name)
{if(document.cookie.length>0)
{c_start=document.cookie.indexOf(name+"=");if(c_start!=-1)
{c_start=c_start+name.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1)c_end=document.cookie.length;return unescape(document.cookie.substring(c_start,c_end));}}
return"";},openClickedLink:function(element)
{var url=element.innerHTML;window.open(url);return false;},Pages:{}}
U.init();var $newid=function(){return'elm-'+$newid.id++};$newid.id=1;var $guid=function(){var result='';for(var j=0;j<32;j++){if(j==8||j==12||j==16||j==20)result+='-';result+=Math.floor(Math.random()*16).toString(16).toUpperCase();};return result;}
Array.implement({__typeName:'Array',add:function(item){this[this.length]=item;return this;},aggregate:function(seed,callback){var length=this.length;for(var index=0;index<length;index++){seed=callback(seed,this[index],index,this);}return seed;},contains:function(item){var index=this.indexOf(item);return(index>=0);},extract:function(index,count){if(!count){return this.slice(index);}return this.slice(index,index+count);},groupBy:function(callback){var length=this.length;var groups=[];var keys={};for(var index=0;index<length;index++){var key=callback(this[index],index);if(String.isNullOrEmpty(key)){continue;}var items=keys[key];if(!items){items=[];items.key=key;keys[key]=items;groups.add(items);}items.add(this[index]);}return groups;},index:function(callback){var length=this.length;var items={};for(var index=0;index<length;index++){var key=callback(this[index],index);if(String.isNullOrEmpty(key)){continue;}items[key]=this[index];}return items;},insert:function(index,item){this.splice(index,0,item);},remove:function(item){var index=this.indexOf(item);if(index>=0){this.splice(index,1);return true;}return false;},removeAt:function(index){return this.splice(index,1)[0];}});var $log=function(text){if(window.console&&window.console.log)window.console.log(text)}
$extend(String.prototype,{toLower:function(){return this.toLowerCase();},toUpper:function(){return this.toUpperCase();},mask:function(){return this.replace(/\S/g,'*')},trim:function(){return this.replace(/^\s*([\s\S]*\S+)\s*$|^\s*$/,'$1');},formatWith:function(){var s=this;$A(arguments).forEach(function(str,i){s=s.replace(new RegExp("(\{)"+i+"(\})","g"),str)});return s;},getTagContent:function(name){var text=this;var regex=new RegExp('<'+name+'>((([^<]*)(<(?!/'+name+'))?)*)</'+name+'>');var regMatch=regex.exec(text);if(regMatch&&regMatch.length>1&&regMatch[1]!=null)return regMatch[1];else return'';},isEmail:function(){var re=/^[a-z0-9]([a-z0-9_\-\.]*)@([a-z0-9_\-\.]*)(\.[a-z]{2,3}(\.[a-z]{2}){0,2})$/i;return re.test(this.trim());},isMoney:function(){var re=/^\-?\d+(\.\d{2})$/;return re.test(this.trim());},isDate:function(){var re=/^((0?\d)|(1[0-2]))(\\|\/|-)((0?\d)|([1-2]\d)|(3[0-1]))(\\|\/|-)(\d{2}|\d{4})$/;return re.test(this);},isZip:function(){return/^\d{5,6}|\d{5}|[A-Z]\d[A-Z]\d[A-Z]\d$/.test(this);},isEmail:function(){return/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(this);},isTime:function(){var re=/^(((0?[1-9]|1[0-2])(:|\.)[0-5]\d((:|\.)[0-5]\d)?( )?(([aA]|[pP])[mM]))|((0?\d|1\d|2[0-3])(:|\.)[0-5]\d((:|\.)[0-5]\d)?))$/;return re.test(this);},isHtml:function(){return(/<\/?[^>]+>/gi).test(this);},isDateTime:function(){var re=/^((0?\d)|(1[0-2]))(\\|\/|-)((0?\d)|([1-2]\d)|(3[0-1]))(\\|\/|-)(\d{2}|\d{4})( )(((0?[1-9]|1[0-2])(:|\.)[0-5]\d((:|\.)[0-5]\d)?( )?(([aA]|[pP])[mM]))|((0?\d|1\d|2[0-3])(:|\.)[0-5]\d((:|\.)[0-5]\d)?))$/;if(this.isDate())return true;if(this.isTime())return true;if(re.test(this))return true;return false;},isInt:function(){return new RegExp(/\d+/).test(this.trim());},containedIn:function(value,separator){separator=$pick(separator,',');var s=this,values=value.split(separator);for(var i=values.length;i>=0;i--){if(values[i]==s)return true;}
return false;},translate:function(){var s;if(typeof(U.Dictionary)=='object'&&(s=U.Dictionary[this])){for(var i=0,nL=arguments.length;i<nL;i++){s=s.replace(new RegExp("(\{)"+i+"(\})","g"),arguments[i]);}
return s;}
return this;},truncate:function(length,truncation){length=$pick(length,30);truncation=$pick(truncation,'...');return(this.length>length)?this.slice(0,length-truncation.length)+truncation:this;},strip:function(){return this.replace(/^\s+/,'').replace(/\s+$/,'');},matches:function(regexp){return regexp.test(this);},zf:function(l){return'0'.string(l-this.length)+this;},string:function(l){var s='',i=0;while(i++<l){s+=this;}return s;}});Number.prototype.zf=function(l){return this.toString().zf(l);};Number.prototype.to2digits=function(n){return n<10?"0"+n:n;};var __globalSmoothScroll=null;Element.implement({visible:function(){return this.style.display!='none';},toggle:function(){if(this.visible())this.hide();else this.show();return this;},hide:function(){this.style.display='none';return this;},show:function(){this.style.display='';return this;},smoothScrollTo:function(options){var options=$extend({},options||{elementOffset:0});try{var scrollY=(window.pageYOffset)?window.pageYOffset:document.documentElement.scrollTop;if((!options.minPageOffset&&!options.maxPageOffset)||(options.minPageOffset&&scrollY>options.minPageOffset)||(options.maxPageOffset&&scrollY<options.maxPageOffset))
if(!__globalSmoothScroll)__globalSmoothScroll=new Fx.Scroll(window);__globalSmoothScroll.toElement(this);}catch(e){Logger.log('smoothScrollTo: '+e.message);}
return this;}});U.Element=new Class({initialize:function(element){this.element=$(element);},show:function(){if(this.element){this.element.show();}
return this;},hide:function(){this.element.hide();return this;}});if(document.location.hash.toString()=='#debugmode'&&(!("console"in window)||!("firebug"in console))){U.loadJS("/js/firebug-lite.js")};U.Dictionary={state:"State",country:"Country",defaultCountry:"US"};U.UI={Select:new Class({Extends:U.Element,initialize:function(element,onchange){this.parent(element);this._onchange=onchange||$empty;if(this.element){this.hasWm=this.element.hasClass('watermark');this.element.addEvent('change',this._onChange.bind(this));}},_onChange:function(){this._onchange();if(this.hasWm){if(!this.getValue().containedIn("-1,"))this.element.removeClass('watermark');else this.element.addClass('watermark');}},getValue:function(){return this.element.getSelected().get('value')[0];},getText:function(){return this.element.getSelected().get('html')[0];},getIndex:function(){return this.element.selectedIndex;},setIndex:function(index){var elm=this.element;elm.selectedIndex=index;$(elm.options[index]).set('selected','selected');return this;},selectByText:function(text){var elm=this.element;$A(this.element.options).each(function(opt,i){if(opt.get('html')==text){opt.set('selected','selected');elm.selectedIndex=i;return this;}},this);return this;},selectByValue:function(val){var elm=this.element;$A(this.element.options).each(function(opt,i){if(opt.get('value')==val){opt.set('selected','selected');elm.selectedIndex=i;return this;}},this);return this;},addOption:function(val,text,className){var elm=new Element('option',{value:val,text:text}).inject(this.element);if(className)elm.addClass(className);return this;}}),_TextBoxes:{},GetTextBox:function(element){$log('reference='+U.UI._TextBoxes[element]+' element = '+element)
if(U.UI._TextBoxes[element])return U.UI._TextBoxes[element];else return new U.UI.TextBox(element);},TextBox:new Class({Extends:U.Element,initialize:function(element){this.parent(element);U.UI._TextBoxes[typeof(element)=='string'?element:element.id]=this;$log('constructor='+U.UI._TextBoxes[element]+' element = '+element)
if(this.element){this.autoClear=this.element.hasClass('watermark');}
if(this.autoClear&&this.element.value==""){this.defaultValue=this.element.get('defvalue');this.element.value=this.defaultValue;$log('adding blur event')
this.element.addEvent('focus',this._focus.bind(this));this.element.addEvent('blur',this._blur.bind(this));}},addEvent:function(evt,call){this.element.addEvent(evt,call);},_focus:function(){var val=this.element.value;if(val==this.defaultValue)this.element.set('value','').removeClass('watermark');},_blur:function(){if(this.element.value=='')this.element.set('value',this.defaultValue).addClass('watermark');},getValue:function(){var val=this.element.get('value');if(this.autoClear&&val==this.defaultValue)val='';return val;},setValue:function(text){this.element.set('value',text);this.autoClear=false;},setDefaultValue:function(text){this.defaultValue=text;}}),Password:new Class({Extends:U.Element,initialize:function(element){this.parent(element);this.element.value="";this.text=$(this.element.id+'-mark').addEvent('click',this._show.bind(this)).addEvent('focus',this._show.bind(this));this.element.addEvent('blur',this._hide.bind(this));},_show:function(){this.show();this.text.hide();this.element.focus();this.element.value="";},_hide:function(){if(this.element.value.length==0){this.hide();this.text.show();}},getValue:function(){return this.element.value;}}),FileUpload:new Class({Implements:Events,initialize:function(element){if(!U.Request.Manager.hasConfig('fileprogress')){U.Request.Manager.addConfig('fileprogress','CheckFileStatus',{upload_key:'',checking:true});U.Request.Manager.addConfig('uploadfile','/photo_upload/xml_avatar_upload',{upload_key:''});}
this.element=$(element);this.submitName=this.element.name;$log('fileUpload.submitName = '+this.submitName);this.element.name=this.element.id;this.form=this.element.form;this.container=this.element.getParent('.file-input');this.fileContainer=this.container.getElements('div')[0];this.prefix=this.container.get('id');$log('FileUpload = '+this.prefix)
this.file=$(this.prefix+'-file');this.fileId=$(this.prefix+'-fileid');this.progress=$(this.prefix+'-progress');this.progressBar=this.progress.getElements('.progress')[0];this.preview=$(this.prefix+'-preview');this.upload=$(this.prefix+'-upload');this.firstLoaded=false;this.disabled=false;this.iframe=new IFrame({id:this.prefix+'-iframe',src:'about:blank',styles:{position:'absolute',width:'1px',height:'1px',border:'0px solid #fff',top:'-2000px',left:'-2000px'},events:{load:this._loadAvatarUploadWindow.bind(this)}});this.iframe.inject(document.body);this.request=null;this._setEvents();this.frequency=0.8;this.fx=new Fx.Tween(this.progressBar,{'duration':this.frequency*1100});},_setEvents:function(){this.element.addEvents({'change':this._loadAvatarUploadWindow.bind(this),'mouseover':this._changeClass.bind(this,true),'mouseout':this._changeClass.bind(this,false)});},_changeClass:function(on){this.upload[on?'addClass':'removeClass']('fake-input-on');},_uploadClick:function(){this.fireEvent('disabledClick',this);},_loadAvatarUploadWindow:function(){if(!this.firstLoaded){this.firstLoaded=true;return;}
var fileUpload=this.element;var formUpload=this.form;if(this.element.className=="identity"){var url=imageUploadURL;}else{var url=imageUploadMaskURL;}
var fileUrl=YAHOO.util.Dom.getAttribute(fileUpload,'value');$log(fileUpload);var url1=url.split(",");getSignUpAvatarCropper(url1[0],url1[1],formUpload,this.element);},_iframeLoad:function(contentWindow,thedocument){if(!this.firstLoaded){$log('iframe firstLoaded')
this.firstLoaded=true;return;}
$log('iframe has loaded = '+this.iframe.contentWindow.document.body.innerHTML);this._reportProgress(this.iframe.contentWindow.document.body.innerHTML);return true;},_onChange:function(){if(this.disabled)return;this.fireEvent('start',this);$log('_onChange');var oldTarget=this.form.target;var oldAction=this.form.action;var guid=$guid();var config=U.Request.Manager.getConfig('uploadfile');$log('_onChange config url = '+config.url);this.form.target=this.prefix+'-iframe';this.form.action=(this.prefix.indexOf('mask')>0)?config.url+'/mask':config.url+'/identity';this.fileId=guid;this.element.name=this.submitName;$log('_onChange on before form submit');this.form.submit();this.element.name=this.element.id;this.form.action=oldAction;this.form.target=oldTarget;this.fileContainer.hide();this.preview.hide();this.progress.show();this.progressBar.setStyle('width','0%');this.progressWidth=null;},disable:function(){this.file.hide();},enable:function(){this.file.show();},_reportProgress:function(responseText){var status=eval('('+responseText.replace(/json/gi,'json').getTagContent('json')+')');if(!this.progressWidth)this.progressWidth=this.progress.getSize().x-2;if(status.cancel_upload){this._finishUpload(false);this.fireEvent('fail',[this,status.error]);}else if(!status.done){var pct=0;if(status.current!=0)pct=parseInt(this.progressWidth*(status.current/status.total));this.fx.start('width',pct);this.fireEvent('uploading',[this,status.current,status.total,pct]);}else if(status.done){this.fx.start('width',this.progressWidth);this._finishUpload.delay(1000,this,status);}},_finishUpload:function(status){this.progress.hide();if(status)this.preview.set('html','<img src="'+status.temp_filename+'" />');this.fileContainer.show();this.preview.show();if(status)this.fireEvent('complete',[this,{container:this.prefix,filename:status.temp_filename,input:this.file}]);this.element.set('value','');}}),Location:new Class({Implements:new Events,initialize:function(id){$log(id);$log(U.UI.GetTextBox(id+'-input-city'));$log(U.UI.GetTextBox(id+'-input-city'));$log(U.UI.GetTextBox(id+'-input-city'));if(U.UI.GetTextBox(id+'-input-city').element){this.city=U.UI.GetTextBox(id+'-input-city');this.state=new U.UI.Select(id+'-option-state',this._setState.bind(this)).show();this.country=new U.UI.Select(id+'-option-country',this._setStates.bind(this,true)).show();this.country.element.addEvent('blur',this._showCountry.bind(this,false));this.countryName=$(id+'-country-name').hide();this.countryActivator=$(id+'-country-activator').addEvent('click',this._showCountry.bind(this,true));this.countryFlag=this.countryActivator.getElements('.flag')[0];$log(this.countryFlag)
this.selectedCountry='defaultCountry'.translate();this.stateText=new U.UI.TextBox(id+'-input-state','state'.translate()).hide();this.stateValue=$(id+'-hidden-state');this.stateText.element.addEvent('blur',this._setState.bind(this));this.hasStates=false;this._build();}},getLocation:function(){return{city:this.city.getValue(),state:this.stateValue.value,country:this.country.getValue()}},getValue:function(divider){var city=this.city.getValue();if(city.length>0&&divider)city+=divider;if(this.hasStates)return city+' '+this.stateValue.value;else return city+' '+this.country.getText();},setLocation:function(city,state,country){this.city.setValue(city,true);this.stateValue.value=state;this.country.selectByValue(country);this._setStates();if(this.hasStates)this.state.selectByValue(state==''?0:state);else this.stateText.setValue(state);return this;},_build:function(){U.UI.Location.Countries.each(function(value,key){this.country.addOption(key,value);},this);this.country.selectByValue(this.selectedCountry);this._setStates();this._displayCountry();},_setState:function(){this.stateValue.value="";var val=this.state.getValue();$log('_setstate = '+val)
if(this.hasStates&&val!=''&&val!=-1)this.stateValue.value=val;else this.stateValue.value=this.stateText.getValue();if(this.stateValue.value!='')this.fireEvent('change');},_setStateWithValue:function(val){this.stateValue.value="";this.state.selectByValue(val);$log('_setstate = '+val)
if(this.hasStates&&val!=''&&val!=-1)this.stateValue.value=val;else this.stateValue.value=this.stateText.getValue();if(this.stateValue.value!='')this.fireEvent('change');},_setStates:function(fireEvent){var state=this.state.element;this.hasStates=this._hasStates();if(this.hasStates&&this.country.getValue()=="US"){this.state.show();state.empty();this.countryName.hide();this._populateStates();}else{this.state.hide();$log('show country name')
this.countryName.show();}
this.countryActivator.set('title',this.country.getText());this._displayCountry();this._showCountry(false);if(fireEvent)this.fireEvent('change');},_populateStates:function(){var currCountry=this.country.getValue();this.state.addOption(-1,'state'.translate(),'watermark');U.UI.Location.States.forEach(function(value,key){if(key.substr(0,2)==currCountry){this.state.addOption(key.substr(3).replace(/_/gi,' '),value);}},this);this.state.setIndex(0);},_displayCountry:function(){this.countryFlag.setStyle('background-image','url(http://static.lg15.com/img/flags/'+this.country.getValue().toLower()+'.gif)');this.countryFlag.setStyle('background-repeat','no-repeat');this.countryName.set('html',this.country.getText());},_hasStates:function(){var currentCountry=this.country.getValue();for(var i in U.UI.Location.States){if(i.substr(0,2)==currentCountry)return true;}
return false;},_showCountry:function(show){$(this.country.element.parentNode)[show?'show':'hide']();$(this.state.element.parentNode.parentNode)[show?'hide':'show']();}}),Expandable:new Class({initialize:function(element){var objs=element.getElements('.expander');if(objs.length>0){this.element=element;this.opened=this.element.hasClass('expanded');objs.each(function(item){item.addEvent('click',this._toggle.bind(this))},this);}
return this;},_toggle:function(event){new Event(event).stop();if(this.opened)this.element.removeClass('expanded');else this.element.addClass('expanded');this.opened=!this.opened;}})};U.UI.Location.States=new Hash({US_AK:'Alaska',US_AL:'Alabama',US_AR:'Arkansas',US_AZ:'Arizona',US_CA:'California',US_CO:'Colorado',US_CT:'Connecticut',US_DC:'D.C.',US_DE:'Delaware',US_FL:'Florida',US_GA:'Georgia',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_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_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',CA_AB:'Alberta',CA_MB:'Manitoba',CA_AB:'Alberta',CA_BC:'British Columbia',CA_MB:'Manitoba',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'});U.UI.Location.Countries=new Hash({AF:'Afghanistan',AL:'Albania',DZ:'Algeria',AS:'American Samoa',AD:'Andorra',AO:'Angola',AI:'Anguilla',AQ:'Antarctica',AG:'Antigua and Barbuda',AR:'Argentina',AM:'Armenia',AW:'Aruba',AU:'Australia',AT:'Austria',AZ:'Azerbaijan',AP:'Azores',BS:'Bahamas',BH:'Bahrain',BD:'Bangladesh',BB:'Barbados',BY:'Belarus',BE:'Belgium',BZ:'Belize',BJ:'Benin',BM:'Bermuda',BT:'Bhutan',BO:'Bolivia',BA:'Bosnia And Herzegowina',XB:'Bosnia-Herzegovina',BW:'Botswana',BV:'Bouvet Island',BR:'Brazil',IO:'British Indian Ocean Territory',VG:'British Virgin Islands',BN:'Brunei Darussalam',BG:'Bulgaria',BF:'Burkina Faso',BI:'Burundi',KH:'Cambodia',CM:'Cameroon',CA:'Canada',CV:'Cape Verde',KY:'Cayman Islands',CF:'Central African Republic',TD:'Chad',CL:'Chile',CN:'China',CX:'Christmas Island',CC:'Cocos (Keeling) Islands',CO:'Colombia',KM:'Comoros',CG:'Congo',CD:'Congo, The Democratic Republic O',CK:'Cook Islands',XE:'Corsica',CR:'Costa Rica',CI:'Cote d` Ivoire (Ivory Coast)',HR:'Croatia',CU:'Cuba',CY:'Cyprus',CZ:'Czech Republic',DK:'Denmark',DJ:'Djibouti',DM:'Dominica',DO:'Dominican Republic',TP:'East Timor',EC:'Ecuador',EG:'Egypt',SV:'El Salvador',GQ:'Equatorial Guinea',ER:'Eritrea',EE:'Estonia',ET:'Ethiopia',FK:'Falkland Islands (Malvinas)',FO:'Faroe Islands',FJ:'Fiji',FI:'Finland',FR:'France (Includes Monaco)',FX:'France, Metropolitan',GF:'French Guiana',PF:'French Polynesia',TA:'French Polynesia (Tahiti)',TF:'French Southern Territories',GA:'Gabon',GM:'Gambia',GE:'Georgia',DE:'Germany',GH:'Ghana',GI:'Gibraltar',GR:'Greece',GL:'Greenland',GD:'Grenada',GP:'Guadeloupe',GU:'Guam',GT:'Guatemala',GN:'Guinea',GW:'Guinea-Bissau',GY:'Guyana',HT:'Haiti',HM:'Heard And Mc Donald Islands',VA:'Holy See (Vatican City State)',HN:'Honduras',HK:'Hong Kong',HU:'Hungary',IS:'Iceland',IN:'India',ID:'Indonesia',IR:'Iran',IQ:'Iraq',IE:'Ireland',EI:'Ireland (Eire)',IL:'Israel',IT:'Italy',JM:'Jamaica',JP:'Japan',JO:'Jordan',KZ:'Kazakhstan',KE:'Kenya',KI:'Kiribati',KP:'Korea, Democratic People\'S Repub',KW:'Kuwait',KG:'Kyrgyzstan',LA:'Laos',LV:'Latvia',LB:'Lebanon',LS:'Lesotho',LR:'Liberia',LY:'Libya',LI:'Liechtenstein',LT:'Lithuania',LU:'Luxembourg',MO:'Macao',MK:'Macedonia',MG:'Madagascar',ME:'Madeira Islands',MW:'Malawi',MY:'Malaysia',MV:'Maldives',ML:'Mali',MT:'Malta',MH:'Marshall Islands',MQ:'Martinique',MR:'Mauritania',MU:'Mauritius',YT:'Mayotte',MX:'Mexico',FM:'Micronesia, Federated States Of',MD:'Moldova, Republic Of',MC:'Monaco',MN:'Mongolia',MS:'Montserrat',MA:'Morocco',MZ:'Mozambique',MM:'Myanmar (Burma)',NA:'Namibia',NR:'Nauru',NP:'Nepal',NL:'Netherlands',AN:'Netherlands Antilles',NC:'New Caledonia',NZ:'New Zealand',NI:'Nicaragua',NE:'Niger',NG:'Nigeria',NU:'Niue',NF:'Norfolk Island',MP:'Northern Mariana Islands',NO:'Norway',OM:'Oman',PK:'Pakistan',PW:'Palau',PS:'Palestinian Territory, Occupied',PA:'Panama',PG:'Papua New Guinea',PY:'Paraguay',PE:'Peru',PH:'Philippines',PN:'Pitcairn',PL:'Poland',PT:'Portugal',PR:'Puerto Rico',QA:'Qatar',RE:'Reunion',RO:'Romania',RU:'Russian Federation',RW:'Rwanda',KN:'Saint Kitts And Nevis',SM:'San Marino',ST:'Sao Tome and Principe',SA:'Saudi Arabia',SN:'Senegal',XS:'Serbia-Montenegro',SC:'Seychelles',SL:'Sierra Leone',SG:'Singapore',SK:'Slovak Republic',SI:'Slovenia',SB:'Solomon Islands',SO:'Somalia',ZA:'South Africa',GS:'South Georgia And The South Sand',KR:'South Korea',ES:'Spain',LK:'Sri Lanka',NV:'St. Christopher and Nevis',SH:'St. Helena',LC:'St. Lucia',PM:'St. Pierre and Miquelon',VC:'St. Vincent and the Grenadines',SD:'Sudan',SR:'Suriname',SJ:'Svalbard And Jan Mayen Islands',SZ:'Swaziland',SE:'Sweden',CH:'Switzerland',SY:'Syrian Arab Republic',TW:'Taiwan',TJ:'Tajikistan',TZ:'Tanzania',TH:'Thailand',TG:'Togo',TK:'Tokelau',TO:'Tonga',TT:'Trinidad and Tobago',XU:'Tristan da Cunha',TN:'Tunisia',TR:'Turkey',TM:'Turkmenistan',TC:'Turks and Caicos Islands',TV:'Tuvalu',UG:'Uganda',UA:'Ukraine',AE:'United Arab Emirates',UK:'United Kingdom',GB:'Great Britain',US:'United States',UM:'United States Minor Outlying Isl',UY:'Uruguay',UZ:'Uzbekistan',VU:'Vanuatu',XV:'Vatican City',VE:'Venezuela',VN:'Vietnam',VI:'Virgin Islands (U.S.)',WF:'Wallis and Furuna Islands',EH:'Western Sahara',WS:'Western Samoa',YE:'Yemen',YU:'Yugoslavia',ZR:'Zaire',ZM:'Zambia',ZW:'Zimbabwe'});U.UI.Select.getValue=function(element){return element.getSelected().get('value')[0];};;U.Form=new Class({Implements:[Events,Options],groups:{},elements:{},showingError:false,_uploads:{},options:{classes:{error:'error',info:'info'},hasUpload:false,doSubmit:true,processingText:'Please wait..',validations:{required:/[^.*]/,alpha:/^[a-z ._-]+$/i,alphanum:/^[a-z0-9 ._-]+$/i,digit:/^[-+]?[0-9]+$/,nodigit:/^[^0-9]+$/,number:/^[-+]?\d*\.?\d+$/,email:/^[a-z0-9._%-]+@[a-z0-9.-]+\.[a-z]{2,4}$/i,phone:/^[\d\s ().-]+$/},errors:{digit:"Please enter a valid integer.",digitmin:"The number must be at least {0}",digitrange:"The value must be between {0} and {1}",length:"Minimum {0} characters please",rangelength:"Between {0} and {1} characters please",fixlength:"It must be exactly {0} characters please",maxlength:"Max {0} characters please",minlength:"Minimum {0} characters please",uploadInProgress:"Please wait for the other upload to finish",containerTemplate:'<ul>{0}</ul>',itemTemplate:'<li>{0}</li>'},rowTag:'li',errorBoxSelector:'.message-container',showErrors:true},initialize:function(element,options){this.element=$(element);this.setOptions(options);var messageBox=this.element.getElements(this.options.errorBoxSelector)[0];this.messageBox=new U.Form.MessageBox(messageBox);var infoBox=messageBox.clone().inject(messageBox.parentNode);this.infoBox=new U.Form.MessageBox(infoBox).addEvents({show:this._showError.bind(this,false),hide:this._showError.bind(this,true)});if(this.options.hasUpload){this.fileBox=new U.Form.MessageBox(messageBox.clone().inject(messageBox.parentNode));}
if(this.element==null){alert('You must pass a valid form element');return;}
$A(this.element.elements).each(function(item,index){item=$(item);var rules=item.get('validate');var elmType=item.type;if(rules==null&&elmType!='file')return;eval("rules = "+rules);if(rules&&!this.groups[rules.group])this.groups[rules.group]={};$log('elmType = '+elmType)
if(!elmType.containedIn('submit,file')){var formItem=this.groups[rules.group][item.id]=new U.Form.Item(item,rules,item.getParent(this.options.rowTag));this.elements[item.name]=formItem;formItem.addValidation({type:'required'});for(var i in rules){if(!i.containedIn('msg,group,info,wait')){formItem.addValidation({type:i,rule:rules[i]});}else if(i=='info'){item.addEvent('focus',this._showInfo.bind(this,[formItem,true]));item.addEvent('blur',this._showInfo.bind(this,[formItem,false]));}}
this._addItem(formItem);}else if(elmType=='submit'){item.store('processingText',$pick(rules.processingText,this.options.processingText)).store('defaultText',item.value);item.addEvent('click',this._validate.bind(this,[rules.group,item]));}else if(elmType=='file'&&this.options.hasUpload){this._uploads[item.id]=new U.UI.FileUpload(item).addEvents({fail:this._fileUploadError.bind(this),complete:this._fileUploadDone.bind(this)});}},this);this.element.addEvent('submit',this._onSubmit.bind(this));},_addItem:function(item){if(!this._isChildElement(item)){item.element.addEvent('blur',this._validateItem.bind(this,item));}},_onSubmit:function(event){new Event(event).stop();},_showInfo:function(item,show){if(show){this.infoBox.showInfo(item.getMessage('info'),item.getParent())}else{this.infoBox.hide();}},_showError:function(show){if(this.showingError){this.messageBox[show?'show':'hide']();}},_validate:function(group,btn){var groups=group.split(',');$log(groups[1])
var ok=true;for(var i=0,nL=groups.length,group;i<nL;i++){group=this.groups[groups[i]];$log('group='+groups[i])
for(var item in group){$log('group item ='+item)
ok=this._validateItem(group[item]);(function(){if(this.currErrorItem)this.currErrorItem.element.focus()}).delay(100,this);if(!ok)return false;}}
btn.addClass('processing')
btn.value=btn.retrieve('processingText');btn.disabled=true;if(this.options.doSubmit)this.element.submit();else this.fireEvent('submit');},getCurrentError:function(){return this.currErrorItem;},_validateItem:function(item){if(this.showingError&&item!=this.currErrorItem)return false;if(!item.element.visible()&&item.element.type!='password')return true;var validations=item.getValidations();var ok=true,type='required',msg='';if(!this._isChildElement(item)){for(var i=0,nL=validations.length,validation,regex,value;i<nL;i++){validation=validations[i];type=validation.type;regex=this.options.validations[type];if(type=='length'){var val=this.options.validations,rule=validation.rule,err=this.options.errors;if(rule){if(rule[1]){if(rule[1]==-1){regex=new RegExp("^[\\s\\S]{"+rule[0]+",}$");msg=err.minlength.formatWith(rule[0]);}else if(rule[0]==rule[1]){regex=new RegExp("^[\\s\\S]{"+rule[0]+"}$");msg=err.fixlength.formatWith(rule[0]);}else{regex=new RegExp("^[\\s\\S]{"+rule[0]+","+rule[1]+"}$");msg=err.rangelength.formatWith(rule[0],rule[1]);}}else if(rule[0]){regex=new RegExp("^.{0,"+rule[0]+"}$");msg=err.maxlength.formatWith(rule[0]);}}}
value=item.getValue();if(!regex.test(value)){ok=false;break;}else if(type=='digit'){if(validation.rule&&validation.rule.length){if(value<validation.rule[0]){ok=false;msg=this.options.errors.digitmin.formatWith(validation.rule[0]);break;}else if(value>=validation.rule[0]&&(value>validation.rule[1]&&validation.rule[1]!=-1)){ok=false;msg=this.options.errors.digitrange.formatWith(validation.rule[0],validation.rule[1]);break;}}}}}else ok=this._validateItemGroup(item);if(!ok){this.messageBox.showError((msg=='')?item.getMessage():msg,item.getParent());this.showingError=true;this.currErrorItem=item;item.showError();return false;}else{this.clearError();return true;}
return true;},clearError:function(){if(!this.currErrorItem)return;this.messageBox.hide();this.currErrorItem.hideError();this.showingError=this.currErrorItem=false;},_isChildElement:function(item){return item.element.type.toLowerCase()=='radio';},_validateItemGroup:function(item){var group=this.element[item.element.get("name")];for(var i=0,nL=group.length;i<nL;i++){if(group[i].checked){return true;}}
return false;},_disableUploads:function(disable){for(var i in this._uploads){this._uploads[i][disable?'disable':'enable']();}},_fileUploadError:function(obj,message){$log('_fileUploadError message = '+message)
this.fileBox.showError(message,obj.container);},_fileUploadDone:function(obj,data){$log('_fileUploadDone')
this.fireEvent('uploaddone',data);},_fileUploadDisabledClicked:function(obj){this.fileBox.showError(this.options.errors.uploadInProgress,obj.container);},showErrors:function(errors){var error;var output="";for(var i in errors){this.elements[i].showError();output+=this.options.errors.itemTemplate.formatWith(errors[i]);}
if(!this.ajaxError)this.ajaxError=$(this.element.id+'-ajax-error');this.ajaxError.innerHTML=this.options.errors.containerTemplate.formatWith(output);}});U.Form.Item=new Class({validations:[],initialize:function(element,rules,parent){this.element=element;this.isPassword=false;if(this.element.type=='text'||this.element.get('tag')=='textarea'){this.textBox=new U.UI.TextBox(this.element);}else if(this.element.type=='password'){this.textBox=new U.UI.Password(this.element);this.isPassword=true;}
this.message=rules.msg;this.info=rules.info;this.wait=rules.wait;this.parent=parent;},getValue:function(){if(this.textBox){return this.textBox.getValue();}
else if(!this.element.options)return this.element.value;else{var value=this.element.getSelected().get('value')[0];if(value=='-1')return'';}},getParent:function(){return this.parent},addValidation:function(validation){this.validations.push(validation);},getValidations:function(){return this.validations},getMessage:function(type){if(!type)return this.message;else return this[type];},showError:function(){this.element.addClass('error');if(this.isPassword)this.textBox.text.addClass('error');},hideError:function(){this.element.removeClass('error');if(this.isPassword)this.textBox.text.removeClass('error');}});U.Form.MessageBox=new Class({Implements:Events,initialize:function(element){this.element=$(element);this.message=this.element.getElements('.message')[0];this.currentClass='error';this.hidden=true;},_show:function(message,where,className){if(this.hidden){this.element.show();this.hidden=false;}
this.element.fade('hide');this.message.set('html',message);this.element.removeClass(this.currentClass)
this.element.addClass(this.currentClass=className);this.element.inject(where);this.fireEvent('show');this.show();},showError:function(message,where){this._show(message,where,'message-error');},showInfo:function(message,where){this._show(message,where,'message-info');},showWait:function(message,where){this._show(message,where,'message-wait');},show:function(){$log('showing');this.element.fade(0.9);},hide:function(){$log('hiding')
this.element.fade('out');this.fireEvent('hide');}});;Request.Periodical=new Class({Extends:Request,initaliaze:function(options){this.parent(options);this.timer=null;this.frequency=this.options.frequency||1;},start:function(options){var me=this;$log('frequency = '+this.frequency);this.timer=this._continue.periodical(1000,this,options);this.send(options);},_continue:function(options){$log('sending again');this.cancel();this.send(options);},stop:function(){$log('stopping request');$clear(this.timer);this.cancel();}});U.Request=new Class({Implements:Events,initialize:function(config,noKill){this.currentRequest=null;this.setConfig(config);this.noKill=noKill||false;this.uid=$newid();this.aborted=false;},setConfig:function(config){this.config=($type(config)=='string'?U.Request.Manager(config):config);return this;},sendPeriodical:function(config,onsuccess,frequency){var config=config||this.config;config.data.frequency=$pick(frequency,1);this._send(config,onsuccess,true);return this;},send:function(config,onsuccess){var config=config||this.config;this._send(config,onsuccess,false);return this;},_send:function(config,onsuccess,isPeriodical){this.fireEvent('beforesend');config.data.v=U.version;if(config.fresh)config.data.r=$time();if(onsuccess==null)onsuccess=$empty;if(!this.noKill)U.Request.Manager.checkIn(this);var options=$extend(config.toOption(),{onSuccess:function(responseText){if(this.__checkServerError(responseText))return;try{this.fireEvent('success',responseText);onsuccess(responseText);}catch(e){var error=U.Error.getString(e);this.__handleClientError();}finally{if(!this.noKill)U.Request.Manager.checkOut(this);}}.bind(this),onFailure:this._onFailure.bind(this),onException:this._onException.bind(this),headers:{'If-Modified-Since':'Sat, 1 Jan 2000 00:00:00 GMT'}});$log('_send before create request url='+options.url);if(!this.currentRequest)this.currentRequest=(!isPeriodical)?new Request(options):new Request.Periodical(options);$log('_send before sending request');this.currentRequest[(isPeriodical)?'start':'send'](options);this.fireEvent('aftersend');},_onFailure:function(instance){U.Error.log("AJAX FAILURE: "+this.__buildErrorLog());this.fireEvent('failure');this.currentRequest.cancel();},_onException:function(headerName,value){U.Error.log("AJAX FAILURE: headerName : "+headerName+" value : "+value);this.fireEvent('exception');this.currentRequest.cancel();},processScripts:function(responseText){var script=responseText.getTagContent('eval');$exec(script);return this;},__checkServerError:function(responseText){var index=responseText.indexOf('<b>Fatal error</b>');if(index>-1){try{var error=responseText.substr(index);$log('SERVER SIDE ERROR: '+error);this.fireEvent('error',['server',error]);}catch(e){}
return true;}
return false;},__handleClientError:function(error){$log('CLIENT SIDE ERROR: '+error);this.fireEvent('error',['client',error]);},__buildErrorLog:function(){var config=this.config;var message='URL: '+config.url+"\n\n";params=config.data;for(var i in data){message+='param: '+i+' - value: '+data[i]+"\n"};return message;},stopPeriodical:function(){if(!this.currentRequest)return this;this.currentRequest.stop();this.currentRequest=null;return this;},cancel:function(){if(this.currentRequest&&this.currentRequest.running){this.aborted=true;this.currentRequest.cancel();this.currentRequest=null;}
return this;}});U.Request.Manager={_active:{},_items:{},hasConfig:function(key){return this._items[key]!=null;},addConfig:function(key,url,data,method,fresh){this._items[key]=new U.Request.Config(url,data,method,name,fresh);},getConfig:function(key,urlreplace){var config=$pick(this._items[key],this._findInForm(key),new U.Request.Config(U.constructActionUrl("notconfigured"),null));if(urlreplace){for(var i in urlreplace){config.url=config.url.replace('#'+i,urlreplace[i]);}}
return config},getFormConfig:function(key){var config=this._findInForm(key);var form=$(key);for(var i=0,nL=form.elements.length,elm;i<nL;i++){var val=this._getElmValue(elm=$(form.elements[i]));if(val!=null){config.data[elm.name]=val;}}
return config;},_getElmValue:function(elm){var val=null;switch(elm.type){case'password':case'text':case'textarea':case'hidden':val=elm.value;break;case'checkbox':case'radio':if(elm.checked)val=elm.value;break;case'select-one':val=U.UI.Select.getValue(elm);break;default:break;}
return val;},checkIn:function(request){this._active[request.uid]=request;},checkOut:function(request){var ref=this._active[request.uid];ref=null;delete ref;},unload:function(){var active;for(var i in this._active){active=this._active[i];if(active!=null)active.cancel();}},_findInForm:function(key){var obj=$(key+'-ajax-url');if(obj){this._items[key]=new U.Request.Config(obj.value);return this._items[key];}
return null;}};U.Request.Config=new Class({initialize:function(url,data,method,name,fresh){this.url=url;this.data=data||{};this.method=method||'post';this.name=name;this.fresh=fresh||false;},toOption:function(){return{url:this.url,data:this.data,method:this.method};}});window.addEvent('unload',function(){U.Request.Manager.unload()});U.Request.Manager.addConfig('getHtml','GetHtml',{file:''});U.Request.Manager.addConfig('performAction','PerformAction',{module_url_string:'',action:'',params:''});;U.UI.Social=new Class({Extends:U.Element,Implements:Events,_closed:true,_sizes:{opened:392,closed:32},initialize:function(){this.parent('u-social');if(!this.element)return;if(Browser.Engine.trident4){this.element.setStyle('position','absolute');window.addEvents({scroll:this._setPosition.bind(this),resize:this._setPosition.bind(this),load:this._setPosition.bind(this)});this.ie6Fx=new Fx.Tween(this.element,{duration:200});}else{this.element.setStyles({position:'fixed',bottom:'0'})};this.content=$('u-social-content');this.show();this.fx=new Fx.Tween(this.element,{duration:200});this.element.setStyles({visibility:'visible',height:this._sizes.closed});this.toggleBtn=$('u-social-toggle');if(this.toggleBtn!=null)this.toggleBtn.addEvent('click',this.toggle.bind(this));},toggle:function(){if(this._closed)this.maximize();else this.minimize();return this;},minimize:function(){if(this._closed)return;$log('minimize');this.fx.start('height',this._sizes.closed);if(Browser.Engine.trident4)this.ie6Fx.start('top',(document.documentElement.clientHeight+document.documentElement.scrollTop-this._sizes.closed)+'px');this._closed=true;$log('minimize _closed set');return this;},maximize:function(){if(!this._closed)return;$log('maximize');this.fx.start('height',this._sizes.opened);if(Browser.Engine.trident4)this.ie6Fx.start('top',(document.documentElement.clientHeight+document.documentElement.scrollTop-this._sizes.opened)+'px');this._closed=false;return this;},hide:function(){this.element.style.visibility='hidden';return this;},unHide:function(){this.element.style.visibility="visible";return this;},_setPosition:function(){var y=this._closed?this._sizes.closed:this._sizes.opened;this.element.setStyle('top',(document.documentElement.clientHeight+document.documentElement.scrollTop-y)+'px');},adopt:function(element,replace){if(replace)this.content.empty();this.content.adopt(element);return this;},loadHtml:function(text){this.content.set('html',text);return this;},loadUrl:function(url,replace){if(replace)this.content.empty();new IFrame({id:$newid(),src:url,styles:{width:'100%',height:'100%',border:'0 solid #fff'}}).inject(this.content);return this;},loadImage:function(url,replace){if(replace)this.content.empty();new Element('img',{src:url}).inject(this.content);return this;}});var $usocial;window.addEvent('domready',function(){$usocial=new U.UI.Social()});;String.prototype.trim=function(){return this.replace(/^\s*/,"").replace(/\s*$/,"");}
U.User=$extend({set:function(props){$extend(this,props);},showLogin:function(){new U.Request().send(U.Request.Manager.getConfig('getLoginForm'),this._showLogin.bind(this));},_showLogin:function(html){this._showInTaskbar(html);new U.Form('login-form');if($('pd-login-form')){new U.Form('pd-login-form');}},showLoginSuccess:function(html){window.location=html;},showBdayQuestion:function(containerId){if(!document.getElementById(containerId+'_c')){bdayQuestionModal=openModal(containerId);}
bdayQuestionModal.render(document.body);bdayQuestionModal.show();this.hideTaskBar();},executeGoogleJS:function(){var googDiv=$('google_div');var script=googDiv.innerHTML;eval(script);},hideTaskBar:function(){$usocial.hide();},showTaskBar:function(){$usocial.unHide();},showSignUp:function(){new U.Request().send(U.Request.Manager.getConfig('getSignUpForm'),this._showSignUp.bind(this));},_showSignUp:function(html){this._showInTaskbar(html);this.signUp=new U.User.SignUp();this.cbsSignUp=new U.User.CBSLogin();},showSignUpSuccess:function(html){newDiv=document.createElement("div");newDiv.innerHTML=html;children=newDiv.childNodes;if(children[0]&&children[0].id=="signup-by-invite"){redirect=children[0].firstChild.nodeValue;window.location=redirect;return;}
this._showInTaskbar(html);},showLostPwd:function(){new U.Request().send(U.Request.Manager.getConfig('getLostpwForm'),this._showLostPwd.bind(this));},_showLostPwd:function(html){this._showInTaskbar(html);new U.User.LostPassword();},showLostPasswordSuccess:function(){$log('about to request')
new U.Request().send(U.Request.Manager.getConfig('getLostPwdSuccessHtml'),this._showInTaskbar.bind(this));},showProfile:function(user_id){var config=U.Request.Manager.getConfig('getProfile',{userid:user_id});new U.Request().send(config,this._showProfile.bind(this));},_showProfile:function(html){this._showInTaskbar(html);},showRequests:function(user_id){var config=U.Request.Manager.getConfig('getRequests',{userid:user_id});new U.Request().send(config,this._showRequests.bind(this));},_showRequests:function(html){this._showInTaskbar(html);},showNotifications:function(user_id){var config=U.Request.Manager.getConfig('getNotifications',{userid:user_id});new U.Request().send(config,this._showNotifications.bind(this));},_showNotifications:function(html){this._showInTaskbar(html);},showMessages:function(user_id){var config=U.Request.Manager.getConfig('getMessages',{userid:user_id});new U.Request().send(config,this._showMessages.bind(this));},_showMessages:function(html){this._showInTaskbar(html);},showSearch:function(){var config=U.Request.Manager.getConfig('getSearch');new U.Request().send(config,this._showSearch.bind(this));},_showSearch:function(html){this._showInTaskbar(html);},showInvite:function(){var config=U.Request.Manager.getConfig('getInvite');new U.Request().send(config,this._showInvite.bind(this));},_showInvite:function(html){this._showInTaskbar(html);},_showInTaskbar:function(html){$usocial.loadHtml(html).maximize();},doAction:function(options){$log(options.action);this.fireEvent(options.action,options.message);},getCrossSiteDomain:function()
{var domainDiv=$('eqal_callback_base_url');return domainDiv.innerHTML;},getConfigUrl:function(action_string)
{var crossSiteDomain=this.getCrossSiteDomain();var ajaxCallbackUrl="/eqal-xd-ajax.php"+'?forwarding_url='+crossSiteDomain;var eqalSessionCookie=U.getCookie('eqal_sso_session');var eqalSessionCookieString="&external_session_cookie="+eqalSessionCookie;return ajaxCallbackUrl+action_string+eqalSessionCookieString;}},new Events);U.User.SignUp=new Class({SIGNUP_FORM_VIEW_1:1,SIGNUP_FORM_VIEW_2:2,initialize:function()
{this.view1Validated=false;this.form=new U.Form('signup-form',{doSubmit:false}).addEvent('submit',this._send.bind(this));this.toggle=$('signup_form_toggle_to_recaptcha');this.toggle.addEvent('click',this._toggle.bind(this,this.SIGNUP_FORM_VIEW_2));},_signUpOk:function(){$log('calling : showSignUpSuccess')
U.User.showSignUpSuccess();},_signUpFailed:function(){},_send:function(){if(!this.view1Validated)
{this._toggle(this.SIGNUP_FORM_VIEW_2);return;}
var config=U.Request.Manager.getFormConfig('signup-form');new U.Request().send(config,this._sendResponse.bind(this));},_sendResponse:function(responseText){eval('var r = '+responseText.getTagContent('eval'));if(r.success)
{try
{U.User.showSignUpSuccess(responseText.getTagContent('html'));}
catch(e)
{}}
else
{U.User.showSignUpSuccess(responseText.getTagContent('html'));try
{this.initialize();}
catch(e)
{}}},_validateView1:function()
{var view1IsValid=true;try
{var submitButtonElement=$('signup_form_submit');var rules=submitButtonElement.get('validate');eval("rules = "+rules);var groups=rules.group.split(',');for(var i=0,nL=groups.length,group;i<nL;i++)
{group=this.form.groups[groups[i]];for(var item in group)
{view1IsValid=this.form._validateItem(group[item]);if(!view1IsValid)
{return false;}}}}
catch(e)
{return false;}
return view1IsValid;},_toggle:function(viewOption)
{if(this.view1Validated=this._validateView1())
{var submitButtonElement=$('signup_form_toggle_to_recaptcha');submitButtonElement.addClass('processing')
submitButtonElement.value='Please wait..';submitButtonElement.disabled=true;this.form.fireEvent('submit');}}});U.User.Login=new Class({initialize:function(){this.form=new U.Form('login-form',{doSubmit:false}).addEvent('submit',this._send.bind(this));this.email=U.UI.GetTextBox('login-form-input-email');this.password=U.UI.GetTextBox('login-form-input-password');},_signUpOk:function(){$log('calling : showLoginSuccess')
U.User.showLoginSuccess();},_signUpFailed:function(){},_send:function(){var config=U.Request.Manager.getFormConfig('login-form');new U.Request().send(config,this._sendResponse.bind(this));},_sendResponse:function(responseText){$log('we got the response');eval('var r = '+responseText.getTagContent('eval'));if(r.success){U.User.showLoginSuccess(responseText.getTagContent('html'));}else{this.form.showErrors(r.errors);}}});U.User.CBSLogin=new Class({initialize:function(){this.form=new U.Form('cbs-signup-form',{doSubmit:true});this.email=U.UI.GetTextBox('cbs_signup_form_input_email');this.password=U.UI.GetTextBox('cbs_signup_form_password');}});U.User.LostPassword=new Class({initialize:function(){this.form=new U.Form('lostpw-form',{doSubmit:false}).addEvent('submit',this._send.bind(this));this.email=U.UI.GetTextBox('lostpw-form-email');$log('got here')
U.User.addEvent('lostPasswordOk',this._lostPasswordOk.bind(this))},_lostPasswordOk:function(){$log('calling : showSignUpSuccess')
U.User.showLostPasswordSuccess();},_send:function(){var config=U.Request.Manager.getConfig('lostpw');config.data.email=this.email.getValue();new U.Request().send(config,this._sendResponse.bind(this));},_sendResponse:function(responseText){eval(responseText.getTagContent('eval'));}});;function removeNotificationPost(link,notifyId){var deleteNotificationLink=link;var notificationId=notifyId;var notificationListId="notification_"+notificationId;var notificationList=document.getElementById(notificationListId);sendDeleteNotification=function(){postJsonResponse(deleteNotificationLink,5000,"",loadDeleteNotificationSuccess)};loadDeleteNotificationSuccess=function(response){if(response['success']){var notificationAnimation=new YAHOO.util.Anim(notificationList,{opacity:{to:0}},0.35,YAHOO.util.Easing.easeOut);notificationAnimation.onComplete.subscribe(removeNotificationElement);notificationAnimation.animate();}};removeNotificationElement=function(){notificationList.parentNode.removeChild(notificationList);};sendDeleteNotification();};var postJsonResponseRequest;function getResponse(link,timeout,target,loadSuccess){this.link=link;this.timeout=timeout;this.target=target;this.loadSuccess=loadSuccess;this.startGetResponse;this.callback={success:function(oResponse){loadSuccess(oResponse.responseText);},failure:function(oResponse){},argument:{"target":target,"loadTarget":loadSuccess},timeout:timeout};YAHOO.util.Connect.asyncRequest('GET',this.link,this.callback);}
function getJsonResponse(link,timeout,target,loadSuccess){this.link=link;this.timeout=timeout;this.target=target;this.loadSuccess=loadSuccess;this.startJsonGetResponse;this.callback={success:function(oResponse){try{loadSuccess(YAHOO.lang.JSON.parse(oResponse.responseText.trim()),target);}catch(e){$log(e);}},failure:function(oResponse){},argument:{"target":target,"loadTarget":loadSuccess},timeout:timeout};YAHOO.util.Connect.asyncRequest('GET',this.link,this.callback);}
function postJsonResponse(link,timeout,target,loadSuccess,values,argument){this.link=link;this.timeout=timeout;this.target=target;this.loadSuccess=loadSuccess;this.startJsonPostResponse;this.values=values;if(postJsonResponseRequest){YAHOO.util.Connect.abort(postJsonResponseRequest);}
this.callback={success:function(oResponse){try{loadSuccess(YAHOO.lang.JSON.parse(oResponse.responseText.trim()),target,oResponse.argument);}catch(e){$log(e);}},failure:function(oResponse){},upload:function(oResponse){$log(oResponse);loadSuccess(YAHOO.lang.JSON.parse(oResponse.responseText.trim()),target,oResponse.argument);},argument:argument,time:timeout};postJsonResponseRequest=YAHOO.util.Connect.asyncRequest('POST',this.link,this.callback,this.values);}
function postXMLResponse(link,timeout,target,loadSuccess,values,argument){this.link=link;this.timeout=timeout;this.target=target;this.loadSuccess=loadSuccess;this.startJsonPostResponse;this.values=values;this.callback={success:function(oResponse){loadSuccess(oResponse.responseText.trim(),target,oResponse.argument);},failure:function(oResponse){},upload:function(oResponse){loadSuccess(oResponse.responseText.trim(),target,oResponse.argument);},argument:argument,time:timeout};YAHOO.util.Connect.asyncRequest('POST',this.link,this.callback,this.values);}
function formData2QueryString(docForm)
{var submitString='';var formElement='';var lastElementName='';for(i=0;i<docForm.elements.length;i++){formElement=docForm.elements[i];switch(formElement.type){case'text':case'button':case'select-one':case'hidden':case'password':submitString+=formElement.name+'='+paramEscape(formElement.value)+'&';break;case'textarea':formEditText=tinyMCE.activeEditor.getContent();submitString+=formElement.name+'='+paramEscape(tinyMCE.activeEditor.getContent())+'&';break;case'radio':if(formElement.checked){submitString+=formElement.name+'='+paramEscape(formElement.value)+'&';}
break;case'checkbox':if(formElement.checked){if(formElement.name==lastElementName){if(submitString.lastIndexOf('&')==submitString.length-1){submitString=submitString.substring(0,submitString.length-1);}
submitString+=','+paramEscape(formElement.value);}else{submitString+=formElement.name+'='+paramEscape(formElement.value);}
submitString+='&';lastElementName=formElement.name;}
break;}}
submitString=submitString.substring(0,submitString.length-1);return submitString;}
function postFormResponse(link,theForm,loadSuccess)
{var result;var jsonTimeOut=5000;this.postLink=link;this.postForm=theForm;var loadPostSuccess=loadSuccess;submitPost=function(postLink,postForm)
{YAHOO.util.Connect.setForm(postForm,false);clearForm(postForm);lockButton(postForm);new postXMLResponse(postLink,jsonTimeOut,'',loadPostSuccess,"","");};submitPost(this.postLink,this.postForm);}
function deleteComment(link,deleteSuccess)
{var result;var jsonTimeOut=5000;this.commentDeleteLink=link;var deleteCommentSuccess=deleteSuccess;submitDeleteComment=function(commentDeleteLink,deleteCommentSuccess)
{new postJsonResponse(commentDeleteLink,jsonTimeOut,"",deleteCommentSuccess,"","");};submitDeleteComment(this.commentDeleteLink,deleteCommentSuccess)}
function openModal(elementId,newContainer,elementContent,elementTitle,center)
{var modal=true;var isNewContainer=newContainer;var fixedcenter=center;var containerId=elementId;if(isNewContainer){if(document.getElementById(containerId)){modalPanel.destroy();}
modalPanel=document.createElement('div');}else{YAHOO.util.Dom.setStyle(document.getElementById(containerId),'display','block');}
modalPanel=new YAHOO.widget.Panel(elementId,{fixedcenter:true,visible:true,draggable:false,close:true,iframe:true,modal:modal});if(isNewContainer){modalPanel.setHeader(elementTitle);modalPanel.setBody(elementContent);}
if(modal){modalPanel.hideEvent.subscribe(U.User.showTaskBar);}
return modalPanel;}
function submitThreadPost(theURL,theFormValues,threadElement,theForm,refresh)
{var transaction;if(!refresh){transaction=postXMLResponse(theURL,5000,"",loadThreadPost,theFormValues,threadElement);}
else{transaction=postXMLResponse(theURL,5000,"",loadRefreshThreadPost,theFormValues,threadElement);}
for(i=0;i<theForm.length;i++){if(theForm[i].getAttribute('type').toLowerCase()=='button'){buttonDisable=theForm[i];buttonDisable.disabled=false;}}}
function loadRefreshThreadPost(){tinyMCE.activeEditor.setContent("");window.location.reload();}
function loadThreadPost(response,target,threadElement)
{var animTime=0.500;var animOpacity="1";var responseText;try{responseText=YAHOO.lang.JSON.parse(response);window.location=responseText.link;}catch(e){var threadElementClassName=threadElement;var threadElementObject=YAHOO.util.Dom.getElementsByClassName(threadElementClassName)[0];var responseElement=document.createElement('li');responseElement.innerHTML=response;responseElement=responseElement.firstChild;YAHOO.util.Dom.setStyle(responseElement,'opacity','0');if(threadElementObject.getElementsByTagName('li')!=null){threadElementObject.appendChild(responseElement);threadNaturalHeight=responseElement.offsetHeight;YAHOO.util.Dom.setStyle(responseElement,'height','0px');animThread=new YAHOO.util.Anim(responseElement,{opacity:{to:animOpacity},height:{to:threadNaturalHeight}},animTime);animThread.animate();}}}