/*
 * jQuery BBQ: Back Button & Query Library - v1.2.1 - 2/17/2010
 * http://benalman.com/projects/jquery-bbq-plugin/
 *
 * Copyright (c) 2010 "Cowboy" Ben Alman
 * Dual licensed under the MIT and GPL licenses.
 * http://benalman.com/about/license/
 */
(function($,window){'$:nomunge';var undefined,aps=Array.prototype.slice,decode=decodeURIComponent,jq_param=$.param,jq_param_fragment,jq_deparam,jq_deparam_fragment,jq_bbq=$.bbq=$.bbq||{},jq_bbq_pushState,jq_bbq_getState,jq_elemUrlAttr,jq_event_special=$.event.special,str_hashchange='hashchange',str_querystring='querystring',str_fragment='fragment',str_elemUrlAttr='elemUrlAttr',str_location='location',str_href='href',str_src='src',re_trim_querystring=/^.*\?|#.*$/g,re_trim_fragment=/^.*\#/,re_no_escape,elemUrlAttr_cache={};function is_string(arg){return typeof arg==='string';};function curry(func){var args=aps.call(arguments,1);return function(){return func.apply(this,args.concat(aps.call(arguments)));};};function get_fragment(url){return url.replace(/^[^#]*#?(.*)$/,'$1');};function get_querystring(url){return url.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,'$1');};function jq_param_sub(is_fragment,get_func,url,params,merge_mode){var result,qs,matches,url_params,hash;if(params!==undefined){matches=url.match(is_fragment?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);hash=matches[3]||'';if(merge_mode===2&&is_string(params)){qs=params.replace(is_fragment?re_trim_fragment:re_trim_querystring,'');}else{url_params=jq_deparam(matches[2]);params=is_string(params)?jq_deparam[is_fragment?str_fragment:str_querystring](params):params;qs=merge_mode===2?params:merge_mode===1?$.extend({},params,url_params):$.extend({},url_params,params);qs=jq_param(qs);if(is_fragment){qs=qs.replace(re_no_escape,decode);}}
result=matches[1]+(is_fragment?'#':qs||!matches[1]?'?':'')+qs+hash;}else{result=get_func(url!==undefined?url:window[str_location][str_href]);}
return result;};jq_param[str_querystring]=curry(jq_param_sub,0,get_querystring);jq_param[str_fragment]=jq_param_fragment=curry(jq_param_sub,1,get_fragment);jq_param_fragment.noEscape=function(chars){chars=chars||'';var arr=$.map(chars.split(''),encodeURIComponent);re_no_escape=new RegExp(arr.join('|'),'g');};jq_param_fragment.noEscape(',/');$.deparam=jq_deparam=function(params,coerce){var obj={},coerce_types={'true':!0,'false':!1,'null':null};$.each(params.replace(/\+/g,' ').split('&'),function(j,v){var param=v.split('='),key=decode(param[0]),val,cur=obj,i=0,keys=key.split(']['),keys_last=keys.length-1;if(/\[/.test(keys[0])&&/\]$/.test(keys[keys_last])){keys[keys_last]=keys[keys_last].replace(/\]$/,'');keys=keys.shift().split('[').concat(keys);keys_last=keys.length-1;}else{keys_last=0;}
if(param.length===2){val=decode(param[1]);if(coerce){val=val&&!isNaN(val)?+val:val==='undefined'?undefined:coerce_types[val]!==undefined?coerce_types[val]:val;}
if(keys_last){for(;i<=keys_last;i++){key=keys[i]===''?cur.length:keys[i];cur=cur[key]=i<keys_last?cur[key]||(keys[i+1]&&isNaN(keys[i+1])?{}:[]):val;}}else{if($.isArray(obj[key])){obj[key].push(val);}else if(obj[key]!==undefined){obj[key]=[obj[key],val];}else{obj[key]=val;}}}else if(key){obj[key]=coerce?undefined:'';}});return obj;};function jq_deparam_sub(is_fragment,url_or_params,coerce){if(url_or_params===undefined||typeof url_or_params==='boolean'){coerce=url_or_params;url_or_params=jq_param[is_fragment?str_fragment:str_querystring]();}else{url_or_params=is_string(url_or_params)?url_or_params.replace(is_fragment?re_trim_fragment:re_trim_querystring,''):url_or_params;}
return jq_deparam(url_or_params,coerce);};jq_deparam[str_querystring]=curry(jq_deparam_sub,0);jq_deparam[str_fragment]=jq_deparam_fragment=curry(jq_deparam_sub,1);$[str_elemUrlAttr]||($[str_elemUrlAttr]=function(obj){return $.extend(elemUrlAttr_cache,obj);})({a:str_href,base:str_href,iframe:str_src,img:str_src,input:str_src,form:'action',link:str_href,script:str_src});jq_elemUrlAttr=$[str_elemUrlAttr];function jq_fn_sub(mode,force_attr,params,merge_mode){if(!is_string(params)&&typeof params!=='object'){merge_mode=params;params=force_attr;force_attr=undefined;}
return this.each(function(){var that=$(this),attr=force_attr||jq_elemUrlAttr()[(this.nodeName||'').toLowerCase()]||'',url=attr&&that.attr(attr)||'';that.attr(attr,jq_param[mode](url,params,merge_mode));});};$.fn[str_querystring]=curry(jq_fn_sub,str_querystring);$.fn[str_fragment]=curry(jq_fn_sub,str_fragment);jq_bbq.pushState=jq_bbq_pushState=function(params,merge_mode){if(is_string(params)&&/^#/.test(params)&&merge_mode===undefined){merge_mode=2;}
var has_args=params!==undefined,url=jq_param_fragment(window[str_location][str_href],has_args?params:{},has_args?merge_mode:2);window[str_location][str_href]=url+(/#/.test(url)?'':'#');};jq_bbq.getState=jq_bbq_getState=function(key,coerce){return key===undefined||typeof key==='boolean'?jq_deparam_fragment(key):jq_deparam_fragment(coerce)[key];};jq_bbq.removeState=function(arr){var state={};if(arr!==undefined){state=jq_bbq_getState();$.each($.isArray(arr)?arr:arguments,function(i,v){delete state[v];});}
jq_bbq_pushState(state,2);};jq_event_special[str_hashchange]=$.extend(jq_event_special[str_hashchange],{add:function(handleObj){var old_handler;function new_handler(e){var hash=e[str_fragment]=jq_param_fragment();e.getState=function(key,coerce){return key===undefined||typeof key==='boolean'?jq_deparam(hash,key):jq_deparam(hash,coerce)[key];};old_handler.apply(this,arguments);};if($.isFunction(handleObj)){old_handler=handleObj;return new_handler;}else{old_handler=handleObj.handler;handleObj.handler=new_handler;}}});})(jQuery,this);
/*
 * jQuery hashchange event - v1.2 - 2/11/2010
 * http://benalman.com/projects/jquery-hashchange-plugin/
 *
 * Copyright (c) 2010 "Cowboy" Ben Alman
 * Dual licensed under the MIT and GPL licenses.
 * http://benalman.com/about/license/
 */
(function($,window,undefined){'$:nomunge';var fake_onhashchange,jq_event_special=$.event.special,str_location='location',str_hashchange='hashchange',str_href='href',browser=$.browser,mode=document.documentMode,is_old_ie=browser.msie&&(mode===undefined||mode<8),supports_onhashchange='on'+str_hashchange in window&&!is_old_ie;function get_fragment(url){url=url||window[str_location][str_href];return url.replace(/^[^#]*#?(.*)$/,'$1');};$[str_hashchange+'Delay']=100;jq_event_special[str_hashchange]=$.extend(jq_event_special[str_hashchange],{setup:function(){if(supports_onhashchange){return false;}
$(fake_onhashchange.start);},teardown:function(){if(supports_onhashchange){return false;}
$(fake_onhashchange.stop);}});fake_onhashchange=(function(){var self={},timeout_id,iframe,set_history,get_history;function init(){set_history=get_history=function(val){return val;};if(is_old_ie){iframe=$('<iframe src="javascript:0"/>').hide().insertAfter('body')[0].contentWindow;get_history=function(){return get_fragment(iframe.document[str_location][str_href]);};set_history=function(hash,history_hash){if(hash!==history_hash){var doc=iframe.document;doc.open().close();doc[str_location].hash='#'+hash;}};set_history(get_fragment());}};self.start=function(){if(timeout_id){return;}
var last_hash=get_fragment();set_history||init();(function loopy(){var hash=get_fragment(),history_hash=get_history(last_hash);if(hash!==last_hash){set_history(last_hash=hash,history_hash);$(window).trigger(str_hashchange);}else if(history_hash!==last_hash){window[str_location][str_href]=window[str_location][str_href].replace(/#.*/,'')+'#'+history_hash;}
timeout_id=setTimeout(loopy,$[str_hashchange+'Delay']);})();};self.stop=function(){if(!iframe){timeout_id&&clearTimeout(timeout_id);timeout_id=0;}};return self;})();})(jQuery,this);;;(function($){$.fn.yiiListView=function(options){return this.each(function(){var settings=$.extend({},$.fn.yiiListView.defaults,options||{});var $this=$(this);var id=$this.attr('id');if(settings.updateSelector==undefined){settings.updateSelector='#'+id+' .'+settings.pagerClass.replace(/\s+/g,'.')+' a, #'+id+' .'+settings.sorterClass.replace(/\s+/g,'.')+' a';}
$.fn.yiiListView.settings[id]=settings;if(settings.ajaxUpdate.length>0){$(settings.updateSelector).die('click').live('click',function(){$.fn.yiiListView.update(id,{url:$(this).attr('href')});return false;});}});};$.fn.yiiListView.defaults={ajaxUpdate:[],ajaxVar:'ajax',pagerClass:'pager',loadingClass:'loading',sorterClass:'sorter'};$.fn.yiiListView.settings={};$.fn.yiiListView.getKey=function(id,index){return $('#'+id+' > div.keys > span:eq('+index+')').text();};$.fn.yiiListView.getUrl=function(id){var settings=$.fn.yiiListView.settings[id];return settings.url||$('#'+id+' > div.keys').attr('title');};$.fn.yiiListView.update=function(id,options){var settings=$.fn.yiiListView.settings[id];$('#'+id).addClass(settings.loadingClass);options=$.extend({type:'GET',url:$.fn.yiiListView.getUrl(id),success:function(data,status){$.each(settings.ajaxUpdate,function(i,v){var id='#'+v;$(id).replaceWith($(id,'<div>'+data+'</div>'));});if(settings.afterAjaxUpdate!=undefined)
settings.afterAjaxUpdate(id,data);$('#'+id).removeClass(settings.loadingClass);},error:function(XMLHttpRequest,textStatus,errorThrown){$('#'+id).removeClass(settings.loadingClass);alert(XMLHttpRequest.responseText);}},options||{});if(options.data!=undefined&&options.type=='GET'){options.url=$.param.querystring(options.url,options.data);options.data={};}
options.url=$.param.querystring(options.url,settings.ajaxVar+'='+id);if(settings.beforeAjaxUpdate!=undefined)
settings.beforeAjaxUpdate(id);$.ajax(options);};})(jQuery);;XD=function(){var globalParams={};var ajaxStatus=null;$.ajaxCachedResults=[];var modulesList={main:{file:'main.js',event:'ready',eventObject:'document'},indexGuests:{file:'indexGuests.js',event:'ready',eventObject:'document'},dashboard:{file:'dashboardMessages.js',event:'ready',eventObject:'document',actions:[{name:'showTooltip',event:'ready',eventObject:'document',triggerOn:function(){return this.checkUserParam('searchToolTip',true);},enabled:true},{name:'trackRegisterStep1Success',triggerOn:function(){return this.checkUserParam('bJustCompletedStep1',true);},enabled:true},{name:'trackRegisterStep2Success',triggerOn:function(){return this.checkUserParam('bJustCompletedStep2',true);},enabled:true},{name:'trackRegisterStep3Success',triggerOn:function(){return this.checkUserParam('bJustCompletedStep3',true);},enabled:true}]},editProfile:{file:'editProfile.js',event:'ready',eventObject:'document'},viewProfile:{file:'viewProfile.js',event:'ready',eventObject:'document'},search:{file:'search.js',event:'ready',eventObject:'document'},billing:{file:'billing.js',event:'ready',eventObject:'document'},help:{file:'help.js',event:'ready',eventObject:'document'}};var modules={};return{init:function(){var that=this;$.ajaxSetup({cacheResult:false,beforeSend:function(jqXHR){if(this.cacheResult&&$.ajaxCachedResults[this.url]){$.isFunction(this.success)&&this.success($.ajaxCachedResults[this.url],'notmodified',jqXHR);return false;}},complete:function(jqXHR,textStatus){if(this.cacheResult&&$.ajaxCachedResults){$.ajaxCachedResults[this.url]=jqXHR.responseText;}},error:function(xhr,error,thrownError){try{var jResponse=$.parseJSON(xhr.responseText);}catch(e){var jResponse=null;}
if(jResponse!==null){if(that.isAjaxStatusRedirect(jResponse.status)){return that.redirect({to:jResponse.message});}
jAlert(jResponse.message);}}});that.activateWidgetCache();},loadModule:function(moduleName,module,options){var that=this;if(typeof module==='function'){modules[moduleName]=module.apply(that,[that]);}
if(typeof options==='object'){modules[moduleName]=module;$.extend(modulesList,{moduleName:options});}
if(typeof modulesList[moduleName]==='undefined'){return this.exception('XDModuleLoadError','Could not load "'+moduleName+'" module. Not on modules load list.');}
if(typeof modules[moduleName]!=='object'){return this.exception('XDModuleLoadError','Could not load "'+moduleName+'" module. The modules doesn\'t exist.');}
if(modulesList[moduleName].loaded&&modulesList[moduleName].reload!==true){$.l('Modules '+moduleName+'already loaded.');return modules[moduleName];}
if(typeof modules[moduleName].init==='function'&&modulesList[moduleName].event&&modulesList[moduleName].eventObject){var toExecute='$('+modulesList[moduleName].eventObject+').'+modulesList[moduleName].event+'(function () {';toExecute+='XD.getModule("'+moduleName+'").init();';toExecute+='});';eval(toExecute);modulesList[moduleName].loaded=true;modulesList[moduleName].actions&&this.loadModuleActions(moduleName);return'Module will load on event.';}
return(typeof modules[moduleName].init==='function'&&modules[moduleName].init()&&(modulesList[moduleName].loaded=true))&&(modulesList[moduleName].actions&&this.loadModuleActions(moduleName))||this.exception('XDModuleLoadError','Could not load "'+moduleName+'" module.');},loadModuleActions:function(moduleName){if(modulesList[moduleName].actions&&modulesList[moduleName].actions.length>0){var action=false,actionTrigger=false,that=this,i=0,totalActions=modulesList[moduleName].actions.length;for(i=0;i<totalActions;i++){action=modulesList[moduleName].actions[i];actionTrigger=$.isFunction(action.triggerOn)?action.triggerOn.call(this):true;if(action.enabled&&actionTrigger){if(action.event&&action.eventObject){var toExecute='$('+action.eventObject+').'+action.event+'(function () {';toExecute+='XD.getModule("'+moduleName+'").'+action.name+'();';toExecute+='});';eval(toExecute);}else{this.getModule(moduleName)[action.name].apply(this);action.executed=true;}}}}
return true;},getModule:function(moduleName){return modules[moduleName]||this.exception('XDModuleRequestError','Could not find "'+moduleName+'" module.');},exception:function(exName,exError){throw exName+': '+exError;},handleError:function(msg,file,line){var that=XD;$.get(that.getGlobal('logJsErrorUrl'),{msg:msg,file:file,line:line});},isDevMode:function(){return this.getGlobal('devMode')==1;},indexPageTriggers:function(){$('#cams-link').click(function(ev){$('#sign-up-button').trigger('click');return false;});},helpPageTriggers:function(){$('#header .sub[href*=search], #footer a[href*=search]').click(function(ev){$('#sign-up-button').trigger('click');return false;});},popupWindow:function(params){var config={url:'/',title:'New Window',width:800,height:600,scrollbars:1,menubar:0,statusbar:0,toolbar:0,top:0,left:0,resizable:0,fullscreen:0};config=$.extend(config,params);var popupConfigs='';$.each(config,function(key,val){popupConfigs+=(key+'='+val+',');});popupConfigs[popupConfigs-1]='';var popupWin=window.open(config.url,config.title,popupConfigs);popupWin.focus();return false;},doAjaxFormSuccess:function(params){var config={formId:'',data:'',errorsPrefix:'',inputPrefix:'',inputPostfix:'',statusSuccess:function(){},statusEmpty:function(){}};config=$.extend(config,params);var form=$(config.formId);$('input, textarea',form).removeClass('error');$('.error-msg',form).remove();$('button[type=submit]',form).attr('disabled',false).removeClass('disabled').fadeTo(100,1);if(this.isAjaxStatusOk(config.data.status)){config.statusSuccess(config.data);return true;}
if(this.isAjaxStatusEmpty(config.data.status)){config.statusEmpty(config.data);return true;}
$.each(config.data,function(key,value){key=key.replace(config.errorsPrefix,'');var fieldName=config.inputPrefix+key+config.inputPostfix;var element=$('[name^="'+fieldName+'"]',form);var error=$('<p class="error-msg">'+value[0]+'</p>',form).hide();$(element,form).addClass('error').parent().append(error.fadeIn());});this.focus({cnt:form,filter:'.error:first'});},doAjaxFormBeforeSend:function(params){var config={formId:''};config=$.extend(config,params);var form=$(config.formId);$('button[type=submit]',form).attr('disabled',true).addClass('disabled').fadeTo(100,0.2);},doAjaxFormError:function(params){var config={formId:'',xhr:''};config=$.extend(config,params);var form=$(config.formId);$('input, textarea',form).removeClass('error');$('.error-msg',form).remove();$('button[type=submit]',form).attr('disabled',false).removeClass('disabled').fadeTo(100,1);var jResponse=$.parseJSON(config.xhr.responseText);if(this.isAjaxStatusRedirect(jResponse.status)){return this.redirect({to:jResponse.message});}
jAlert(jResponse.message);},dialogOptions:{modal:true,resizable:false,draggable:false,dialogClass:'no-close-button',buttons:false,id:false,open:false,close:false},getDialogOptions:function(params){return $.extend({},this.dialogOptions,params);},getDialogText:function(text){var content='<div class="default-content">'+text+'</div>';return content;},getAjaxLoading:function(){return'<div class="ajax-loading"></div>';},getNoPhotoImg:function(options){options=$.extend({size:100,gender:'man'},options);var picPath=this.getGlobal('noPhotoImg').replace('{size}',options.size);picPath=options.gender.length?picPath.replace('{gender}',options.gender.toLowerCase()):picPath.replace('_{gender}','');return picPath;},redirect:function(params){var config={to:'/'};$.extend(config,params);window.location=config.to;return false;},enableRegisterBox:function(params){var that=this;var config={popupSelector:'#sign-up-button',boxId:'sign-up-login-box',dialogClass:'popup-register-login',autoShow:false,canClose:true,tabSelected:0,width:300,showAdditionalSignInLink:false};$.extend(config,params);var selector=$(config.popupSelector);if(!selector.length){selector=$('<a href="'+this.getGlobal('registrationUrl')+'" id="'+config.popupSelector.replace('#','')+'">Register</a>');}
$.Windows.init({selector:selector,dialogClass:config.dialogClass,modal:'true',resizable:false,draggable:false,closeOnEscape:config.canClose,id:config.boxId,position:['center',parseInt(($(window).height()-350)/2)],width:config.width,open:function(){if(config.dialogClass.search('landing')>-1||window.location.href.search('search/')>-1){that.trackGAURL({url:that.getGlobal('gaEventUrl'),ev:'landingPopupOpen'});}else{that.trackGAURL({url:that.getGlobal('gaEventUrl'),ev:'popupOpen'});}},afterAjax:function(){$('.tabs','.popup-register-login').tabs({selected:config.tabSelected,show:function(event,ui){var cnt=ui.panel.selector||ui.panel.id;if(cnt){that.focus({cnt:cnt,isId:true});}},load:function(event,ui){if(ui.panel.id=='User_Sign_In'){$('#signinForm').ajaxForm({beforeSend:function(){that.doAjaxFormBeforeSend({formId:'#signinForm'});},success:function(data){data=$.parseJSON(data);that.doAjaxFormSuccess({formId:'#signinForm',data:data,errorsPrefix:'SigninForm_',inputPrefix:'SigninForm[',inputPostfix:']',statusSuccess:function(response){return that.redirect({to:response.redirectUrl});}});}});}
$('#request-password-lnk').click(function(){$(this).parents('div:first').load($(this).attr('href'),false,function(){var form=$('#requestPasswordResetForm');form.ajaxForm({beforeSend:function(){that.doAjaxFormBeforeSend({formId:'#requestPasswordResetForm'});},success:function(data){data=$.parseJSON(data);that.doAjaxFormSuccess({formId:'#requestPasswordResetForm',data:data,errorsPrefix:'ResetPasswordEmailRequestForm_',inputPrefix:'ResetPasswordEmailRequestForm[',inputPostfix:']',statusSuccess:function(response){if(response.message){$('dl','#requestPasswordResetForm').remove();$('#resetPasswordSubmit').hide();$('.cancel-window','#requestPasswordResetForm').hide();$('.success-message','#requestPasswordResetForm').text(response.message).show();$('#resetPasswordClose').show();}}});}});that.focus({cnt:'#requestPasswordResetForm'});if(config.canClose){$('.cancel-window').click(function(ev){$(this).parents().dialog('close');return false;});}else{$('.cancel-window').remove();}
$('#resetPasswordClose').click(function(ev){$(this).parents().dialog('close');return false;});});return false;});config.tabSelected=0;$('a','#dialog-sign-up-button').attr('draggable',false);that.focus({cnt:ui.panel.id,isId:true});if($('.tabs','.popup-register-login').tabs('length')==1)
{$('.tabs','.popup-register-login').find('.small-tab-right-generic').css({width:'100%',background:'#fff','border-radius':'5px 5px 0 0'}).find('a').css({margin:0,textAlign:'center',padding:0});$('.cancel-window').click(function(ev){$(this).parents().dialog('close');return false;});}
else
{if(config.canClose){$('.cancel-window').click(function(ev){window.location=location.href;$(this).parents().dialog('close');return false;});}else{$('.cancel-window').remove();}}}});$('#registerForm').ajaxForm({beforeSend:function(){that.doAjaxFormBeforeSend({formId:'#registerForm'});},success:function(data){data=$.parseJSON(data);$('button[type=submit]','#registerForm').attr('disabled',false).removeClass('disabled').fadeTo(100,1);that.doAjaxFormSuccess({formId:'#registerForm',data:data,errorsPrefix:'RegistrationForm_',inputPrefix:'user[',inputPostfix:']',statusSuccess:function(response){return that.redirect({to:response.redirectUrl});}});},error:function(xhr,status,response){that.doAjaxFormError({formId:'#registerForm','xhr':xhr});}});if(config.canClose){$('.cancel-window').click(function(ev){window.location=location.href;$(this).parents('.ui-dialog-content').dialog('close');return false;});}else{$('.cancel-window').remove();}
$('.register-box-footer-link').live('click',function(ev){var tabIndex=parseInt($(this).attr('data-tabIndex'));$('#registration-tabs').tabs('select',tabIndex);return false;});$('a','#dialog-sign-up-button').attr('draggable',false);},ajaxLoader:''});if(config.autoShow){$(selector).trigger('click');}},updateLocationHash:function(pagerId){var newLocation=$('.pagination .selected > a:first','#'+pagerId).attr('href');if(newLocation){$.bbq.pushState(pagerId+'='+newLocation);}},loadLocationHash:function(listId){$(window).bind('hashchange',function(e){var list=$('#'+listId);var currentUrl=$('.pagination .selected > a:first',list).attr('href').replace(/\+/g,'%20');var loadUrl=$.bbq.getState(listId);loadUrl=loadUrl?encodeURI(loadUrl).replace(/,/,encodeURIComponent(',')):loadUrl;if(loadUrl&&(currentUrl!==loadUrl)){list.yiiListView.update(listId,{url:loadUrl});}});$(window).trigger('hashchange');},trackGAURL:function(options){var _events=this.getGlobal('gaEvents');options=$.extend({url:window.location.href,ev:''},options);if(options.ev!=''&&!_events[options.ev]){return false;}
var _trackUrl='{url}{glueString}{eventName}';var eventName=options.ev===''?'':'ev='+_events[options.ev];var _glueString=eventName!==''?(options.url.search(/\?/)>-1?'&':'?'):'';_trackUrl=_trackUrl.replace('{url}',options.url).replace('{glueString}',_glueString).replace('{eventName}',eventName);this.loadGAParams({'_trackPageview':_trackUrl});return true;},loadGAParams:function(moreParams){var params=this.getGlobal('GAParams');if(moreParams!=='undefined'){params=$.extend(params,moreParams);}
_gaq=typeof(_gaq)!=='undefined'?_gaq:[];$.each(params,function(GAParam,value){if(value&&value!==''){_gaq.push([GAParam,value]);}});},focus:function(options){options=$.extend({cnt:null,isId:false,filter:'input[type="text"]:first,textarea:first'},options);if(options.isId){options.cnt='#'+options.cnt.replace('#','');}
$(options.filter,options.cnt).first().focus();},setSafeMode:function(options){var that=this;options=$.extend({afterAjax:null,reload:true,toggleSwitch:true},options);$.get(that.getGlobal('setSafeModeUrl'),function(data){data=$.parseJSON(data);options.toggleSwitch&&that.isAjaxStatusEmpty(data.status)&&$('#header-safe-mode-switch-cnt').toggleClass('mode-off');$.isFunction(options.afterAjax)&&options.afterAjax(data);options.reload&&$('#header-safe-mode-switch-cnt').unbind('click')&&window.location.reload();});},loadGlobals:function(params){return globalParams=params;},getGlobal:function(param){return globalParams[param];},setGlobal:function(param,value){return globalParams[param]=value;},unsetGlobal:function(param){return delete globalParams[param];},isRegisteredUser:function(){return typeof this.getGlobal('userInfo')!=='undefined'&&this.getGlobal('userInfo').length!=0;},checkUserParam:function(param,value){return typeof this.getGlobal('user')!=='undefined'&&this.getGlobal('user')[param]==value;},isAjaxStatus:function(desiredStatus,status){if(ajaxStatus===null){ajaxStatus=this.getGlobal('ajaxStatus');}
return ajaxStatus[desiredStatus]==status;},isAjaxStatusOk:function(status){return this.isAjaxStatus('ok',status);},isAjaxStatusEmpty:function(status){return this.isAjaxStatus('empty',status);},isAjaxStatusError:function(status){return this.isAjaxStatus('error',status);},isAjaxStatusRedirect:function(status){return this.isAjaxStatus('redirect',status);},activateWidgetCache:function(){if($.fn.yiiListView){$.fn.yiiListView.update=function(id,options){var settings=$.fn.yiiListView.settings[id];$('#'+id).addClass(settings.loadingClass);options=$.extend({cacheResult:true,type:'GET',url:$.fn.yiiListView.getUrl(id),success:function(data,status){$.each(settings.ajaxUpdate,function(i,v){var id='#'+v;$(id).replaceWith($(id,'<div>'+data+'</div>'));});if(settings.afterAjaxUpdate!=undefined){settings.afterAjaxUpdate(id,data);}
$('#'+id).removeClass(settings.loadingClass);},error:function(XMLHttpRequest,textStatus,errorThrown){$('#'+id).removeClass(settings.loadingClass);alert(XMLHttpRequest.responseText);}},options||{});if(options.data!=undefined&&options.type=='GET'){options.url=$.param.querystring(options.url,options.data);options.data={};}
options.url=$.param.querystring(options.url,settings.ajaxVar+'='+id)
if(settings.beforeAjaxUpdate!=undefined){settings.beforeAjaxUpdate(id);}
$.ajax(options);};}}};}();XD.init();
