/**
 * @author Vlad Yakovlev (red.scorpix@gmail.com)
 * @copyright Art.Lebedev Studio (http://www.artlebedev.ru)
 * @version 0.2 (2009-06-04)
 * @requires jQuery
 */
var ie6FixPngImagePath=(function(){var prefix='file:///';return prefix==location.href.substr(0,prefix.length)?'./i/0.gif':'/f/1/global/i/0.gif';})();jCommon={cookie:function(name,value,options){if('undefined'!=typeof value){options=options||{};if(null===value){value='';options.expires=-1;}
var expires='';if(options.expires&&('number'==typeof options.expires||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}
expires='; expires='+date.toUTCString();}
var path=options.path?'; path='+options.path:'';var domain=options.domain?'; domain='+options.domain:'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');return this;}
var cookieValue=null;if(document.cookie&&''!=document.cookie){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}
return cookieValue;},object:{extend:function(destination,source,replace){for(var i in source){if((replace||'undefined'==typeof(destination[i]))&&'undefined'!=typeof(source[i])){destination[i]=source[i];}}
return destination;}},utils:{popupDefaults:{height:600,menubar:'no',resizeable:'yes',scrollbars:'yes',status:'yes',toolbar:'no',width:540},popup:function(url,name,options){options=jCommon.object.extend(jCommon.utils.popupDefaults,options,true);var leftOffset=screen.availWidth/2-options.width/2;var topOffset=screen.availHeight/2-options.height/2;var newWindow=window.open(url,'','left='+leftOffset+', top = '+topOffset+', width='+options.width+', height='+
options.height+', menubar='+options.menubar+', toolbar='+options.toolbar+', resizable='+options.resizeable+', scrollbars='+options.scrollbars+', status='+options.status);if(url.match(/\.(gif|jpe?g|png)$/i)){newWindow.document.open();newWindow.document.write('<html><head>'+(''!=name?'<title>'+name+'</title>':'')+'</head><body style="background: #FFF; margin: 0; padding: 0;">'+'<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%"><tr><td align="center">'+'<img src="'+url+'" />'+'</td></tr></table></body></html>');newWindow.document.close();}
newWindow.focus();return false;},navigationLinks:{'start':{keyCode:0x24},'prev':{keyCode:0x25},'index':{keyCode:0x26},'next':{keyCode:0x27},'down':{keyCode:0x28}},keyNavigationInit:function(){var me=this;$('link').each(function(){var rel=$(this).attr('rel');if(me.navigationLinks[rel]){me.navigationLinks[rel].href=$(this).attr('href');}});$(document).keydown(function(event){if(!event.ctrlKey)return true;var links=jCommon.utils.navigationLinks;for(var rel in links){if(links[rel].keyCode==event.keyCode&&''!=links[rel].href&&undefined!==links[rel].href){document.location=links[rel].href;}}});}}};jCommon.measurer=(function(){var
callbacks={},interval=500,genId=1,curHeight,el,isInit=false,isDocReady=false;$(function(){isDocReady=true;isInit&&initBlock();});function initBlock(){el=$('<div></div>').css({height:'1em',left:0,lineHeight:'1em',position:'absolute',top:'-1em',visibility:'hidden',width:'100%'}).appendTo('body');curHeight=el.height();setInterval(function(){checkScale();},interval);$(window).resize(callFuncs);}
function checkScale(){var newHeight=el.height();if(newHeight!=curHeight){curHeight=newHeight;callFuncs();}}
function callFuncs(){for(var id in callbacks){callbacks[id]();}}
return{onUpdate:function(name,callback){if(!$.isFunction(name)&&!$.isFunction(callback)){callbacks[name]&&(delete callbacks[name]);return;}
isInit=true;isDocReady&&initBlock();if($.isFunction(name)){callbacks[genId.toString()]=name;genId++;}else{callbacks[name]=callback;}}};})();jCommon.object.extend(String.prototype,{stripTags:function(){return this.replace(/<\/?[^>]+>/gi,'');},formatNumber:function(groupSeparator,fractionSeparator){var
groupSeparator=groupSeparator||' ',fractionSeparator=fractionSeparator||',',fractionIndex=this.indexOf('.'),fraction=fractionIndex>-1?this.substring(fractionIndex+1):'',number=fractionIndex>-1?this.substring(0,fractionIndex):this;if(5>number.length){return number+(fractionIndex>-1?fractionSeparator+fraction:'');}
var result='';while(3<number.length){result=number.substring(number.length-3)+(result.length>0?groupSeparator:'')+result;number=number.substring(0,number.length-3);}
result=number+groupSeparator+result+(-1<fractionIndex?fractionSeparator+fraction:'');return result;}});jCommon.object.extend(Number.prototype,{formatNumber:function(groupSeparator,fractionSeparator){return this.toString().formatNumber(groupSeparator,fractionSeparator);}});$(document.documentElement).addClass('js');$(function(){$('.popup').click(function(){return jCommon.utils.popup($(this).attr('href'),'');});jCommon.utils.keyNavigationInit();});$.browser.safari||$(function(){$('input[placeholder]').each(function(){makePlaceholder(this);});function makePlaceholder(elem,classEmpty){classEmpty=('string'===typeof classEmpty)?classEmpty:'empty';$(elem).focus(function(){if(this.value===$(this).attr('placeholder')){this.value='';}
$(this).removeClass(classEmpty);});$(elem).blur(function(){if(!this.value.length){this.value=$(this).attr('placeholder');$(this).addClass(classEmpty);}});elem.value.length||$(elem).blur();}});jCommon.isCanvas=(function(){if('undefined'!=typeof(HTMLCanvasElement))return true;if(!document.namespaces['v']){document.namespaces.add('v','urn:schemas-microsoft-com:vml');document.namespaces.add('o','urn:schemas-microsoft-com:office:office');var ss=document.createStyleSheet();ss.cssText='v\\:arc, v\\:curve, v\\:extrusion, v\\:fill, v\\:formulas, v\\:group, v\\:handles, v\\:image, v\\:imagedata, v\\:line, v\\:oval, v\\:path, v\\:polyline, v\\:rect, v\\:roundrect, v\\:shadow, v\\:shape, v\\:shapetype, v\\:stroke, v\\:textbox, v\\:textpath, v\\:vmlframe {behavior:url(#default#VML);display:block;} o\\:callout, o\\:locks, o\\:skew {behavior:url(#default#VML);}';}
return false;})();if($.browser.msie&&6>=parseInt($.browser.version)){try{document.execCommand('BackgroundImageCache',false,true);}catch(e){}
function fixIePng(element){if(!(/MSIE (5\.5|6).+Win/.test(navigator.userAgent))||undefined===window.ie6FixPngImagePath)return;var src;if('IMG'==element.tagName||('INPUT'==element.tagName&&'image'==element.type)){if(/\.png$/.test(element.src)){src=element.src;element.src=window.ie6FixPngImagePath;}}else{src=element.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i);if(src){src=src[1];element.runtimeStyle.backgroundImage='none';}}
var reScaleMode=/iesizing\-(\w+)/;var m=reScaleMode.exec(element.className);if(src){var scaleMode=m?m[1]:'crop';element.runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"',sizingMethod='"+scaleMode+"')";}}}