y5Url=(function(){var c={UNDEF:"undefined"};c.Types={UNDEF:1<<0,UNDEFINED:1<<0,OBJECT:1<<1,FUNCTION:1<<2,NUMBER:1<<3,STRING:1<<4,BOOLEAN:1<<5,DATE:1<<10,REGEXP:1<<11,ARRAY:1<<12,NULL:1<<13,EVENT:1<<14,NODE:1<<15,TYPES:{"undefined":1<<0,"object":1<<1,"function":1<<2,"number":1<<3,"string":1<<4,"boolean":1<<5},type:function(l){var i=this.TYPES[typeof l];
if(l===null){return this.NULL;}if(i==this.OBJECT){if(l.nodeName||this.document(l)){return this.NODE;}}if(i==this.OBJECT||i==this.FUNCTION){switch(l.constructor){case Array:return this.ARRAY;case RegExp:return this.REGEXP;case Date:return this.DATE;}}if(this.event(l)){return this.EVENT;}return i;},test:function(l,i){return !!(this.type(l)&i);
},def:function(i){return typeof i!=r;},undef:function(i){return typeof i==r;},object:function(i){return typeof i=="object";},func:function(i){return typeof i=="function";},nativeFunc:function(i){return this.func(i)&&isNativeFunc.test(i.toString());},number:function(i){return typeof i=="number";},string:function(i){return typeof i=="string";
},bool:function(i){return typeof i=="boolean";},nul:function(i){return i===null;},array:function(i){return i instanceof Array;},regexp:function(i){return i instanceof RegExp;},date:function(i){return i instanceof Date;},event:function(i){return i&&typeof i.type!=r&&typeof(i.stopPropagation||i.cancelBubble)!=r;
},element:function(i){return checkDomNode(i,Node.ELEMENT_NODE);},attribute:function(i){return checkDomNode(i,Node.ATTRIBUTE_NODE);},text:function(i){return checkDomNode(i,Node.TEXT_NODE);},document:function(i){return(i&&typeof i.documentElement!=r)||false;},comment:function(i){return checkDomNode(i,Node.COMMENT_NODE);
},node:function(i){return(i&&typeof i.nodeType!=r);}};var r=c.UNDEF,v=c.Types,s=/^((((\w+):)\/\/)?(([\w\-\.]+\.\w+|localhost)(\:(\d+))?))?(\/?[^\?#]*)?(\?([^#]*))?(#(.*))?$/,y=/^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/,m="E9F6F3EAE5EDE3F8F9E7F5FAF4FBE2E0EFF0EEEBE4E6FDFFF7F1ECE8F2FCE1FEB8C9D6D3CAC5CDC3D8D9C7D5DAD4DBC2C0CFD0CECBC4C6DDDFD7D1CCC8D2DCC1DEA8".match(/../g),x="%D0%B9%D1%86%D1%83%D0%BA%D0%B5%D0%BD%D0%B3%D1%88%D1%89%D0%B7%D1%85%D1%8A%D1%84%D1%8B%D0%B2%D0%B0%D0%BF%D1%80%D0%BE%D0%BB%D0%B4%D0%B6%D1%8D%D1%8F%D1%87%D1%81%D0%BC%D0%B8%D1%82%D1%8C%D0%B1%D1%8E%D1%91%D0%99%D0%A6%D0%A3%D0%9A%D0%95%D0%9D%D0%93%D0%A8%D0%A9%D0%97%D0%A5%D0%AA%D0%A4%D0%AB%D0%92%D0%90%D0%9F%D0%A0%D0%9E%D0%9B%D0%94%D0%96%D0%AD%D0%AF%D0%A7%D0%A1%D0%9C%D0%98%D0%A2%D0%AC%D0%91%D0%AE%D0%81".match(/.{6}/g),q={},f=encodeURIComponent,n=[".xml",".html",".xhtml",".jpg",".gif",".png",".css",".js",".xsl",".php",".py",".pl"],w=0,t=m.length,e=/%3B|%2C|%2F|%3F|%3A|%40|%26|%3D|%2B|%24/gi;
for(;w<t;w++){q[m[w]]=x[w];}function b(i,l){return q[l]||i;}function a(i){return i.replace(/%([A-Fa-f0-9]{2})/g,b);}function p(i){var A=i.replace(/\+/g,"%20");try{var z=decodeURIComponent(A);if(z==undefined){throw"malformed URI sequence";}return z;}catch(l){try{return decodeURIComponent(a(A));}catch(l){return unescape(A);
}}}function o(i){try{var z=decodeURI(i);if(z==undefined){throw"malformed URI sequence";}return z;}catch(l){try{return decodeURI(a(i));}catch(l){return unescape(i);}}}function g(i,l,z){if(v.undef(i[l])){i[l]=[];}if(v.array(z)){i[l]=i[l].concat(z);}else{i[l].push(z);}}function d(B,C){var E=B[C],A=E.length,z=new Array(A),l=f(C),D=0;
for(;D<A;D++){z[D]=l+"="+f(E[D]);}return z;}function j(G){var D={},E=G.replace(/\+/g,"%20").split("&"),F,A,C,B=0,z=E.length;for(;B<z;B++){F=E[B].split("=");A=F.shift();if(A){C=F.length>1?F.join("="):(F[0]||"");g(D,p(A),p(C));}}return D;}c.URL=function(i){i=v.def(i)?i.toString():window.location.href;var l=i.match(s);
if(!l){return;}this.Host=l[6]||"";this.Path=l[9]||"";if(l[6]){var z=l[6].substring(l[6].lastIndexOf("."));var A=$.inArray(z,n);if(A!=-1){this.Path=l[6];this.Host="";}}this.Href=l[0];this.Proto=l[4]||"";this.Port=l[8]||0;this.Path=o(this.Path);this.Query=j(l[11]||"");this.Hash=p(l[13]||"");};c.URL.prototype={go:function(){window.location.href=this.toString();
},toString:function(){var l="";if(this.Proto||this.Host){if(this.Host){l+=(this.Proto||"http")+"://"+this.Host;if(this.Port){l+=":"+this.Port;}}}if(this.Path){if(this.Host&&this.Path.indexOf("/")!=0){l+="/";}e.lastIndex=0;var z,D=0,E=[];while(z=e.exec(this.Path)){if(e.lastIndex>D){if(z[0]){E.push(this.Path.slice(D,z.index));
E.push(z[0]);D=z.index+z[0].length;}}}if(D!==this.Path.length){E.push(this.Path.slice(D));}E[0]=encodeURI(E[0]);var C=[];for(var A=0;A<E.length;A++){C[A]=(A%2)?E[A]:encodeURI(E[A]);}l+=C.join("");}var B=this.query();if(B){l+="?"+B;}if(this.Hash){l+="#"+f(this.Hash);}return l;},clone:function(){return new c.URL(this.toString());
},proto:function(){},host:function(){},port:function(){},path:function(){},hash:function(){},query:function(z){if(v.def(z)){this.clearQuery();if(v.string(z)){this.Query=j(z);}else{this.replaceParams(z);}return this;}var i=[];for(var l in this.Query){i=i.concat(d(this.Query,l));}return i.join("&");},queryKeys:function(){var i=[];
for(var l in this.Query){i.push(l);}return i.sort();},addParam:function(i,l){g(this.Query,i,l);return this;},addParams:function(l){for(var i in l){g(this.Query,i,l[i]);}return this;},removeParams:function(B){for(var A=0,z=B.length;A<z;A++){delete this.Query[B[A]];}return this;},replaceParams:function(z){var l=[];
for(var i in z){l.push(i);}this.removeParams(l);this.addParams(z);return this;},clearQuery:function(){this.Query={};return this;},getParam:function(i){var l=this.Query[i];return l?l[0]:null;},getParams:function(i){return this.Query[i]||[];}};var h=c.URL,u=h.prototype;var k={proto:"Proto",host:"Host",port:"Port",path:"Path",hash:"Hash"};
for(w in k){u[w]=(function(i){return function(l){if(v.def(l)){this[i]=l;return this;}return this[i];};})(k[w]);}u.get=u.toString;c.Url=function(i){return new h(i);};h.isValid=function(i){return y.test(i);};return c.Url;})();if(typeof Widget=="undefined"){Widget=function(b,a){this._(b,a);};document.Widget=Widget;(function($){Widget.prototype={undef:function(param){return param;},_:function(id,params){this._prefs={};var src=params.src?params.src:false;var wauth=params.wauth?params.wauth:false;var type=params.type?params.type:"raw";
this.params=params;this.type=type;this.id=id;this.classId=id.replace(/-[0-9]+$/i,"");this.instanceId=id.replace(/^(.*)-([0-9]+)$/i,"$2");this.htmlId=id;this.src=src;this.onLoad=this.onload=false;this.bound=false;if(wauth!=""){this.setValue("wauth",wauth);}},init:function(){var widget=this;this.bound=true;
var loadFrom=function(){widget.loadFromSrc({isBinding:true});};Widget.Framework.register(this);if(this.type!="iframe-inside"){new Widget.Wrapper(this);}if(this.params.prefs){for(var i=0;i<this.params.prefs.length;i++){if(this.params.prefs[i]!==false){this.setValue(this.params.prefs[i][0],this.params.prefs[i][1]);
}}}var storedWidgetPrefs=Widget.Framework.widgetPrefs[this.id];if(storedWidgetPrefs){this._prefs=storedWidgetPrefs;}if(this.params.css&&(this.type!=="iframe")){this.css(this.params.css);}if(this.params.js&&(this.type!=="iframe")){this.library(this.params.js,loadFrom);}else{loadFrom();}},showPreloader:function(now){var widget=this;
function p(){widget.$().html(Widget.Framework.params.preloader);}if(now){p();}else{window.setTimeout(function(){if(widget._inlineLoading||widget._inlinePending){p();}},100);}},loadFromSrc:function(params){if(!params){params={noPreloader:false,isBinding:false};}if((this.type=="inline")&&(this.src==false)&&params.isBinding){return;
}if((this.type=="inline")||(this.type=="iframe")||(this.type=="json")){if(!params.noPreloader&&Widget.Framework._domloaded){this.showPreloader("now");}this[this.type+"From"](this.src);}if(!params.isBinding){if(this.type=="raw"){this.rawFrom(Widget.Framework.params.rawBodyUrl+this.getWidgetId()+"?wauth="+this.getAuth()+"&ncrnd="+Math.random());
}if((this.type=="inline")&&(this.src==false)){this.inlineFrom(Widget.Framework.params.rawBodyUrl+this.getWidgetId()+"?ncrnd="+Math.random());}}},_autoValue:function(value,defaultValue){if(parseInt(value,10)>0){return parseInt(value,10)+"px";}return defaultValue;},iframeElement:function(src,args,is_prefs){src=this._addParams(src,args,"isIframe");
var widget=this;var width,height;if(!is_prefs){width="100%";height=this._autoValue(this.params.height,Widget.Framework.params.iframeHeight);}else{width=this._autoValue(this.params.prefs_width,Widget.Framework.params.iframeWidth);height=this._autoValue(this.params.prefs_height,Widget.Framework.params.iframeHeight);
}var iframe=$('<iframe style="border:none" allowTransparency="true" frameborder="0"></iframe>').attr({id:widget.wrapper.$$("iframe"),src:src}).css({width:width,height:height,margin:0,padding:0});if($.browser.msie){iframe.css({position:"absolute",visibility:"hidden"}).bind("load",function(){iframe.unbind("load",arguments.callee).css({position:"",visibility:""});
});}return iframe;},iframeFrom:function(src,showAnyway){var widget=this;$(document).ready(function(){widget.$().html("");try{var iframeElem=widget.iframeElement(src,arguments);if($.browser.mozilla||$.browser.safari){iframeElem.appendTo(widget.$()).attr({src:iframeElem[0].src+"&rnd="+Math.random()});}else{iframeElem.appendTo(widget.$());
}}catch(e){}});},jsonFrom:function(src){src=this._addParams(src,arguments);var widget=this;$.getScript(src+"&ncrnd="+Math.random());},inlineFrom:function(src){src=this._addParams(src,arguments);var widget=this;Widget.Framework.inlineLoading(+1);this._inlineLoading=true;$.get(src,function(data){widget._inlineFromHtml(data);
});},rawFrom:function(src){var widget=this;Widget.Framework.inlineLoading(+1);this._inlineLoading=true;$.get(src,function(data){widget._inlineFromHtml(data);});},_inlineFromJson:function(html){Widget.Framework.inlineLoading(+1);return this._inlineFromHtml(html);},_inlineLoading:false,_inlinePending:"",_inlineFromHtml:function(html){if(!Widget.Framework._domloaded){this._inlineLoading=false;
this._inlinePending=html;return;}Widget.Framework.inlineLoading(-1);var styleRe=/(<style[^>]*>((\s|\S)+?)<\/style>)/img;var scriptRe=/<script[^>]*>((\s|\S)+?)<\/script>/img;var match;var widget=this;if(this.wrapper.$().hasClass("b-widget-fixed")){this.wrapper.$().addClass("b-widget-fixed");}if(this.$().length==0){$("<div />").attr({"id":this.$$(),"class":"b-widget-data"}).appendTo(this.wrapper.$());
}this.$().html(html.replace(scriptRe,"").replace(Widget.Framework.params.idTemplate,this.id));var root=document.getElementsByTagName("head")[0]||document.documentElement;while((match=styleRe.exec(html))!=null){var newSS=document.createElement("link");newSS.rel="stylesheet";newSS.href="data:text/css,"+escape(match[2]);
root.appendChild(newSS);}scriptRe.lastIndex=0;while((match=scriptRe.exec(html))!=null){eval(match[1]);}this._inlineLoading=false;this._inlinePending=false;if(Widget.Framework._domloaded){this.finalize();}},_addParams:function(src,args,isIframe){if(isIframe){this._prefs["."]=location.protocol+"//"+location.host+"|"+document.domain;
}var args2=[args,["[empty]",this._prefs]];var url=y5Url(location.href);var params={};for(var k=0;k<args2.length;k++){for(var i=1;i<args2[k].length;i++){if(args2[k][i] instanceof Array){for(var j=0;j<args2[k][i].length;j++){if(url.getParam(args2[k][i][j])!==null){params[args2[k][i][j]]=url.getParam(args2[k][i][j]);
}}}else{for(var j in args2[k][i]){if(typeof(args2[k][i][j])!="function"&&typeof(args2[k][i][j])!="object"){params[j]=args2[k][i][j];}}}}}return y5Url(src).addParams(params).toString();},_disableAutoStats:false,hookStats:function(){return Widget.Framework.hookStats(this);},disableAutoStats:function(){this._disableAutoStats=true;
},onload:function(){},resetAuth:function(){this._splitterAuth=false;},getAuth:function(){return this.getValue("wauth");},_splittedAuth:false,splitAuth:function(){if(!this._splittedAuth){this._splittedAuth=Widget.Framework.splitAuth(this.getAuth());}return this._splittedAuth;},getWidgetId:function(){return this.splitAuth()["id"];
},getOwner:function(){return this.splitAuth()["owner"];},getViewer:function(){return this.splitAuth()["viewer"];},setValue:function(name,value){this._prefs[name]=value;if(name=="wauth"){Widget.Framework.registerWauth(this);}},getValue:function(name){return this._prefs[name]?this._prefs[name]:this.undef();
},getBoolean:function(name){var v=this.getValue(name);return v===true||v==="true";},_encodeValues:function(values){if(values==this.undef()){values=this._prefs;}var temp=y5Url("");temp.query(values);return temp.query();},setValues:function(values){for(var k in values){if(typeof(values[k])!="function"&&typeof(values[k])!="object"){this.setValue(k,values[k]);
}}},saveValues:function(values){if(values==this.undef()){values=this._prefs;}this.setValues(values);var u=y5Url((Widget.Framework.params.fullproxyDomain||"")+Widget.Framework.params.formUrl);u.query({widget:this.getWidgetId(),wauth:this.getAuth(),usrCh:this.params.usrCh|2,s:this._encodeValues(values)});
$.getScript(u.toString(),function(){$(window).trigger({type:"widgetSettingsSaved",id:this.id});});},dropValues:function(callback){var u=y5Url((Widget.Framework.params.fullproxyDomain||"")+Widget.Framework.params.formUrl);var widget=this;$.get(u.toString(),{widget:this.getWidgetId(),wauth:this.getAuth(),s:"DROP"},function(data){Widget.Framework.widgetPrefs[widget.id]=false;
widget.reload(callback,widget._prefs.showAnyway);});},reload:function(callback,showAnyway){if(this.wrapper){this._prefs.showAnyway=showAnyway;return Widget.Framework.reload(this,callback,showAnyway);}else{location.href=this._addParams("//"+location.host+"/"+location.pathname,[],"isIframe");}},setTitle:function(title){if(this.wrapper){this.wrapper.setTitle(title);
}else{Widget.Framework.xframe(this,"Widget::setTitle",title);}},savePreferences:function(values){this.saveValues(values);this._updateOnHide=true;},dropPreferences:function(callback){var wauth=this.getAuth();this._prefs={};this.setValue("wauth",wauth);if(this.wrapper){this.dropValues(callback);$(window).trigger({type:"widgetSettingsClosed",id:this.id});
}else{Widget.Framework.xframe(this,"Widget::dropPreferences","",callback);}},showPreferences:function(){if(this.wrapper){this.wrapper.showPreferences();}else{Widget.Framework.xframe(this,"Widget::showPreferences");}},hidePreferences:function(){if(this.wrapper){if(this._updateOnHide){this.loadFromSrc();
Widget.Framework.params.notifyChangesHandler(this);}this.wrapper.hidePreferences();}else{Widget.Framework.xframe(this,"Widget::hidePreferences",this._updateOnHide?("<>"+this._encodeValues()):"");}this._updateOnHide=false;},setIFrameHeight:function(newHeight){if(this.wrapper){this.wrapper.setIFrameHeight(newHeight);
}else{Widget.Framework.xframe(this,"Widget::setIFrameHeight",newHeight);}},setIFrameWidth:function(newWidth){if(this.wrapper){this.wrapper.setIFrameWidth(newWidth);}else{Widget.Framework.xframe(this,"Widget::setIFrameWidth",newWidth);}},setIFrameSize:function(newWidth,newHeight){if(this.wrapper){this.wrapper.setIFrameSize(newWidth,newHeight);
}else{Widget.Framework.xframe(this,"Widget::setIFrameSize",newWidth+","+newHeight);}},_calculateCss:function($,css){var value=$.css(css);var xvalue=value.replace(/(\.[0-9]+)?px$/,"");if(css=="height"&&(value=="auto"||parseInt(value,10)==0)){return document.body.scrollHeight;}if(value!=xvalue){return parseInt(value,10);
}else{return 0;}},_sumCss:function($,css_list){var x=0;for(var i=0;i<css_list.length;i++){x+=this._calculateCss($,css_list[i]);}return x;},adjustIFrameHeight:function(){var widget=this;window.clearTimeout(this._adjustIFrameHeightTimeout);this._adjustIFrameHeightTimeout=window.setTimeout(function(){widget._adjustIFrameHeight();
},100);},_adjustIFrameHeightPrevious:-1,_adjustIFrameHeightTimeout:false,_adjustIFrameHeight:function(){var $body;if(this.type=="iframe-inside"){$body=$("body");}else{$body=this.$();}$body.css("overflow","hidden");var size=this._sumCss($body,["marginTop","marginBottom","height"]);if(size!=this._adjustIFrameHeightPrevious){if($.browser.opera){size+=20;
}this._adjustIFrameHeightPrevious=size;return this.setIFrameHeight(size);}},library:function(libs,callback){var widget=this;this._libraryLoading=true;Widget.Framework.library(libs,function(){widget._libraryLoading=false;if(callback){callback();}else{widget.finalize();}});},css:function(urls){return Widget.Framework.css(urls);
},finalize:function(){var widget=this;var oldTimer=Widget.Framework.widgetAutoReloadTimers[this.id];if(oldTimer){clearTimeout(oldTimer);}if(this.params.rebind){var refreshRate=this.params.rebind*1000;var newTimer=setTimeout(function(){if(Widget.Framework.focused){widget.reload();}else{var onFocusFunc=function(){if($.browser.msie){$(document).unbind("focusin",arguments.callee);
}else{$(window).unbind("focus",arguments.callee);}var currentFunc=arguments.callee;var time=Math.round(Math.random()*4000);var reloadTimeout=setTimeout(function(){widget.reload();},time);};if($.browser.msie){$(document).bind("focusin",onFocusFunc);}else{$(window).bind("focus",onFocusFunc);}}},refreshRate);
Widget.Framework.widgetAutoReloadTimers[this.id]=newTimer;}if(this.onload){this.onload();}if(this.onLoad){this.onLoad();}if(!this._disableAutoStats){this.hookStats();}$(window).trigger({type:"widgetLoaded",id:this.id});},$:function(id){return $("#"+this.$$(id));},$$:function(id){return Widget.Framework.params.idPrefix+this.id+((id==this.undef())?"":id);
},end:true};})(jQuery);}if(typeof Widget!="undefined"&&typeof Widget.Wrapper=="undefined"){(function(b){var a=function(c){return c;};Widget.Wrapper=function(c){this._(c);};Widget.Wrapper.prototype={undef:function(c){return c;},_:function(c){this.widget=c;this.widget.wrapper=this;Widget.Framework._wrappers[this.$$()]=c;},$:function(c){return b("#"+this.$$(c));
},$$:function(c){return Widget.Framework.params.wrapperPrefix+(c==this.undef()?"wrapper":c)+Widget.Framework.params.wrapperPostfix+this.widget.id;},setTitle:function(c){this.$("title").html((""+c).replace(/</g,"&lt;"));},_px:function(c){if((""+c).match("^[0-9]+$")){c=c+"px";}return c;},setIFrameHeight:function(c){this.$("iframe").css("height",this._px(c));
},setIFrameWidth:function(c){this.$("iframe").css("width",this._px(c));},setIFrameSize:function(d,c){this.$("iframe").css("height",this._px(c)).css("width",this._px(d));},showPreferences:function(){Widget.Framework.params.showPreferencesHandler(this.widget);},hidePreferences:function(){Widget.Framework.params.hidePreferencesHandler(this.widget);
},showEditForm:function(c){return Widget.Framework.showEditForm(this.widget.id,c);}};})(jQuery);}if(typeof Widget!="undefined"&&typeof Widget.Framework=="undefined"){(function($){Widget.Framework={undef:function(param){return param;},params:false,_id:{},_wauth:{},_no:{},_widgets:[],_wrappers:{},widgetAutoReloadTimers:{},widgetPrefs:{},get:function(id){return Widget.Framework._id[id];},getByWauth:function(wauth){return Widget.Framework._wauth[wauth];
},getByWrapperId:function(id){return Widget.Framework._wrappers[id];},getByClass:function(classId){if(this._no[classId]==this.undef()){return[];}var result=[];for(var i=0;i<this._widgets.length;i++){if(this._widgets[i].classId==classId){result[result.length]=this._widgets[i];}}return result;},updateNo:function(classId,instanceId){var instanceNo=parseInt((""+instanceId).replace(/^[^\-]+-/,""),10);
if(this._no[classId]==this.undef()){this._no[classId]=0;}if(this._no[classId]<=instanceNo){this._no[classId]=instanceNo+1;}return this._no[classId];},register:function(widget){this.registerWauth(widget);this._id[widget.id]=widget;this.updateNo(widget.classId,widget.instanceId);this._widgets[this._widgets.length]=widget;
},registerWauth:function(widget){var wauth=widget.getValue("wauth");if(wauth!=""){this._wauth[wauth]=widget;}widget.resetAuth();},all:function(){return this._widgets;},bindIframe:function(){var wauth=y5Url(location.href).getParam("wauth");if(wauth){this.inIframe=true;var auth_parts=this.splitAuth(wauth);
var widget=this.bind(auth_parts.id,{type:"iframe-inside",wauth:wauth});this.setValuesFromUrl(widget);document.documentElement.id=this.params.idPrefix+widget.id;return widget;}else{this.inIframe=false;return false;}},getValuesFromUrl:function(query){var u=y5Url(location.href);if(query!=this.undef()){u.query(query);
}var keys=u.queryKeys();var result=[];for(var i=0;i<keys.length;i++){if(u.getParam(keys[i])==this.undef()){result[result.length]=[keys[i],""];}else{result[result.length]=[keys[i],u.getParam(keys[i])];}}return result;},setValuesFromUrl:function(widget){var values=this.getValuesFromUrl();for(var i=0;i<values.length;
i++){if(values[i][0]=="."){var p=values[i][1].split("|");this.params.fullproxyDomain=p[0];this.params.fullproxyUrl=p[0]+this.params.proxyUrl;this.params.proxyDomain=p[1];}else{widget.setValue(values[i][0],values[i][1]);}}},_inlineLoadingCount:0,inlineLoading:function(diff){this._inlineLoadingCount+=diff;
this.onInlineLoadingChange(this._inlineLoadingCount,diff);},onInlineLoadingChange:function(value,diff){},bind:function(id,params){var widget=this.prebind(id,params);widget.init();return widget;},prebind:function(id,params){return new Widget(id,params);},init:function(params){if(this.params===false){this.params=params;
}else{for(x in this.params){if(params[x]!==this.undef()){this.params[x]=params[x];}}}},_insertData:function(data,element,callback,is_replace){var html=data;var scriptRe=/<script[^>]*>((\s|\S)+?)<\/script>/img;var styleRe=/(<style[^>]*>((\s|\S)+?)<\/style>)/img;var match;var root=document.getElementsByTagName("head")[0]||document.documentElement;
while((match=styleRe.exec(html))!=null){$(root).append("<style>"+match[2]+"</style>");}var el=document.createElement("div");el.innerHTML=html;var widget_container=el.getElementsByTagName("div")[0];if(is_replace){widget_container.style.display=$(element).css("display");$(element).replaceWith(widget_container);
}else{element.appendChild(widget_container);}scriptRe.lastIndex=0;while((match=scriptRe.exec(html))!=null){eval(match[1]);}if(widget.bound&&(widget.type=="raw"||(widget.type=="inline"&&widget.src==false))){widget.finalize();}if(callback){callback(widget,widget_container);}},insert:function(element,data,callback){return this._insertData(data,element,callback);
},replace:function(old_widget,data,callback){this._insertData(data,old_widget.wrapper.$(),callback,"is_replace");},reload:function(widget,callback,showAnyway){if(showAnyway){widget._prefs.showAnyway=showAnyway;}var params={wauth:widget.getAuth(),wid:widget.id,usrCh:widget.params.usrCh,fixed:this.params.layoutFixed?"1":"",showanyway:widget._prefs.showAnyway?1:0};
if(typeof g_sid!="undefined"){params.g_sid=g_sid;}if(typeof widget.params.is_default!="undefined"){params.is_default=widget.params.is_default==true?1:0;}if(Widget.Framework.widgetPrefs[widget.id]!==false){Widget.Framework.widgetPrefs[widget.id]=widget._prefs;}else{Widget.Framework.widgetPrefs[widget.id]=null;
}$.get(this.params.addUrl,params,function(data){Widget.Framework.replace(widget,data,callback);});},add:function(widgetClassId,element,callbacks,params){var instanceId=this.updateNo(widgetClassId,0);this.updateNo(widgetClassId,instanceId);var succesCallback,errorCallback;if(typeof callbaks=="function"){succesCallback=callbacks;
}else{succesCallback=callbacks.success;errorCallback=callbacks.error;}params=params?params:{fixed:false};var options={wauth:this.params.wauth,wid:widgetClassId+"-"+instanceId,smart:params.smart?"1":"",fixed:params.fixed?"1":""};if(typeof g_sid!="undefined"){options.g_sid=g_sid;}if(params.settings){options["settings"]=params.settings;
}$.ajax({url:this.params.addUrl,data:options,success:function(data){Widget.Framework.insert(element,data,succesCallback);},error:errorCallback});},fromJson:function(wauth,data){var widget=this.getByWauth(wauth);if(widget){widget._inlineFromJson(data);}},splitAuth:function(auth){var parts=auth.split(".");
if(parts.length>4){return{id:parts[3],owner:parts[6],viewer:parts[5]};}else{return{id:parts[0],owner:parts[1],viewer:parts[2]};}},scripts:{},library:function(libs,callback){var scripts=this.prepareLibrary(libs);var i=0;var that=this;var next=function(callback_queue_url){if(callback_queue_url!=that.undef()&&that.scripts[callback_queue_url]!="loaded"){for(var j=0;
j<that.scripts[callback_queue_url].length;j++){that.scripts[callback_queue_url][j]();}that.scripts[callback_queue_url]="loaded";}if(i>=scripts.length){if(callback!=that.undef()){callback();}return;}var s=scripts[i];i++;if(that.scripts[s]==that.undef()&&s!=false){that.scripts[s]=[];$.getScript(s,(function(s){return function(){next(s);
};})(s));}else{if(that.scripts[s]==="loaded"){next();}else{that.scripts[s].push(next);}}};next();},prepareLibrary:function(name,version){var script_queue=[];if(name instanceof Array){for(var i=0;i<name.length;i++){if(name[i] instanceof Array){script_queue=script_queue.concat(this.prepareLibrary(name[i][0],name[i][1]));
}else{script_queue=script_queue.concat(this.prepareLibrary(name[i]));}}}else{if(name!=false){script_queue=name;}}return script_queue;},_css:{},css:function(urls){if(urls instanceof Array){this.loadCss(urls);}else{if(urls.any instanceof Array){this.loadCss(urls.any);}if($.browser.msie&&(urls.msie instanceof Array)){this.loadCss(urls.msie);
}if(!$.browser.msie&&(urls.non_msie instanceof Array)){this.loadCss(urls.non_msie);}}},loadCss:function(urls){for(var i=0;i<urls.length;i++){if(!this._css[urls[i]]){this._css[urls[i]]=true;var newSS=document.createElement("link");newSS.rel="stylesheet";newSS.href=urls[i];document.getElementsByTagName("head")[0].appendChild(newSS);
}}},_click:function(path){var s="http://clck.yandex.ru/jclck/dtype=stred"+"/pid="+this.params.statParams.pid+"/cid="+this.params.statParams.cid+"/path="+path+"/rnd="+Math.random()+"/*"+location.href.replace(/^[^\/]+\/+/,"");try{$.getScript(s);}catch(e){}},hookStats:function(widget){var that=this;if(widget.type=="iframe-inside"){$("a").not(".yandex-hook-stat").mousedown(function(){that._click(widget.classId+".anchors");
}).addClass("yandex-hook-stat");}else{widget.wrapper.$("title").not(".yandex-hook-stat").mousedown(function(){that._click(widget.classId+".title");}).addClass("yandex-hook-stat");widget.$().find("a").not(".yandex-hook-stat").mousedown(function(){var path=widget.classId+".anchors";if($(this).attr("rev")){var attr=$(this).attr("rev");
if(attr=="none"){return;}else{path=path+"."+attr;}}that._click(path);}).addClass("yandex-hook-stat");}},_domloaded:false,domLoaded:function(){if(this._domloaded){return false;}this._domloaded=true;for(var i=0;i<this._widgets.length;i++){with(this._widgets[i]){if(_inlineLoading){showPreloader();}else{if(_inlinePending){_inlineFromHtml(_inlinePending);
}else{finalize();}}}}},xframe:function(widget,name,value,callback){var url=y5Url();url.clearQuery();url.addParams({"wauth":widget.getAuth(),"name":name,"value":value});url.hash(url.query());url.clearQuery();if(this._xframe){document.body.removeChild(this._xframe);}var el=document.createElement("iframe");
el.style.visibility="hidden";el.style.position="absolute";el.style.top=el.style.left=el.style.width=el.style.height=0;this._xframe=document.body.insertBefore(el,document.body.firstChild);this.xframeSrc(this._xframe,this.params.fullproxyUrl+"#"+this.params.proxyDomain+"&"+url.hash(),callback);},xframeGet:function(msg){if(this.inIframe){return;
}var url=new y5Url();url.query(msg.replace(/^#/,""));var w=this.getByWauth(url.getParam("wauth"));var value=url.getParam("value");if(w){switch(url.getParam("name")){case"Widget::setTitle":w.setTitle(value);break;case"Widget::setIFrameHeight":w.setIFrameHeight(value);break;case"Widget::showPreferences":w.showPreferences();
break;case"Widget::hidePreferences":if(value!=""){var vv=msg.split("<>"),vv_split="<>";if(vv.length<2){vv=msg.split("%3C%3E");vv_split="%3C%3E";}value=[];for(var i=1;i<vv.length;i++){value[value.length]=vv[i];}value=value.join(vv_split);var values={};var valuesUrl=this.getValuesFromUrl(value);if(vv_split!="<>"){valuesUrl=this.getValuesFromUrl(valuesUrl[0][0]);
}for(var i=0;i<valuesUrl.length;i++){values[valuesUrl[i][0]]=valuesUrl[i][1];}if(values["wauth"]==w.getAuth()){w.setValues(values);w.loadFromSrc();this.params.notifyChangesHandler(w);}$(window).trigger({type:"widgetSettingsSaved",id:w.id});}w.hidePreferences();break;case"Widget::dropPreferences":w.dropPreferences();
break;}}},xframeSrc:function(iframe,src,callback){var el;if($.browser.msie){el=iframe.cloneNode(true);el.style.position="absolute";el.style.visibility="hidden";el.id="";$(el).bind("load",function(){$(el).unbind("load",arguments.callee);el.style.position="";el.style.visibility="";if(callback){callback();
}});el.src=src+"&rnd="+Math.random();document.body.appendChild(el);}else{$(iframe).bind("load",function(){$(iframe).unbind("load",arguments.callee);if(callback){callback();}});iframe.src=src+"&rnd="+Math.random();}},showEditForm:function(widget_id,element){var widget=this.get(widget_id);if((widget.params.prefs_src!=this.undef())&&widget.params.prefs_src!=""){$(element).empty().append(widget.iframeElement(widget.params.prefs_src,[],"preferences"));
}else{$.get(this.params.formUrl,{widget:widget.getWidgetId(),wauth:widget.getAuth()},function(data){eval(data);});}},end:true};Widget.Framework.init({jsonUrl:"",addUrl:"/adddata/",rawBodyUrl:"/inline/",formUrl:"/form.html",proxyUrl:"/xframeproxy.html",wauth:false,idTemplate:/WIDGETID/g,idPrefix:"wd-",wrapperPrefix:"wd-",wrapperPostfix:"-",iframeHeight:"auto",iframeWidth:400,layoutFixed:false,statParams:{pid:132,cid:2947},patternId:false,yu:false,is_default:false,geoid:false,region:false,havePrefsFrom:false,isWidgetNormal:false,open_settings_on_add:false,title:"",showPreferencesHandler:function(widget){wg.showEditForm(widget.id);
},hidePreferencesHandler:function(widget){$(window).trigger({type:"widgetSettingsClosed",id:this.id});wg.closeSettingsForm(true);},notifyChangesHandler:function(widget){wg.changed=true;if(wg.psettings.newpattern=="1"&&(!wg.editmode||wg.editmode=="0")&&(typeof widget.params.open_settings_on_add=="undefined"||widget.params.open_settings_on_add==false||widget.params.open_settings_on_add==0)){wg.savePattern();
}},preloader:'<div style="position:relative;margin:5px;color:#666"><img style="margin: 0 5px 0 0; float:left;" src="http://lego.static.yandex.net/2.0/common/block/b-spin/_size/b-spin_16.gif"/>Данные загружаются<br clear="all" /></div>'});})(jQuery);Widget.GetInstance=function(a){return Widget.Framework.get(a);
};Widget.GetInstanceByWauth=function(a){return Widget.Framework.getByWauth(a);};Widget.Init=function(a){return Widget.Framework.init(a);};Widget.Bind=function(b,a){return Widget.Framework.bind(b,a);};Widget.BindOnAdd=function(b,a){return Widget.Framework.prebind(b,a);};$(document).ready(function(){Widget.Framework.domLoaded();
});Widget.Framework.focused=true;if($.browser.msie){$(document).bind("focusout",function(){Widget.Framework.focused=false;});$(document).bind("focusin",function(){Widget.Framework.focused=true;});}else{$(window).focus(function(){Widget.Framework.focused=true;});$(window).blur(function(){Widget.Framework.focused=false;
});}var widget=Widget.Framework.bindIframe();if(!widget){window.WidgetMessaging=function(a){Widget.Framework.xframeGet(a);};}}
