/* ================================================================ 
This copyright notice must be kept untouched in the stylesheet at 
all times.

The original version of this script and the associated (x)html
is available at http://www.stunicholls.com/menu/pro_drop_1.html
Copyright (c) 2005-2007 Stu Nicholls. All rights reserved.
This script and the associated (x)html may be modified in any 
way to fit your requirements.
=================================================================== */
stuHover=function(){var cssRule;var newSelector;for(var i=0;i<document.styleSheets.length;i++){for(var x=0;x<document.styleSheets[i].rules.length;x++){cssRule=document.styleSheets[i].rules[x];if(cssRule.selectorText.indexOf("LI:hover")!=-1){newSelector=cssRule.selectorText.replace(/LI:hover/gi,"LI.iehover");document.styleSheets[i].addRule(newSelector,cssRule.style.cssText);}}}var getElm=document.getElementById("nav").getElementsByTagName("LI");for(var i=0;i<getElm.length;i++){getElm[i].onmouseover=function(){this.className+=" iehover";};getElm[i].onmouseout=function(){this.className=this.className.replace(new RegExp(" iehover\\b"),"");};}};if(window.attachEvent){window.attachEvent("onload",stuHover);}

var isIE=(navigator.appVersion.indexOf("MSIE")!=-1)?true:false;var isWin=(navigator.appVersion.toLowerCase().indexOf("win")!=-1)?true:false;var isOpera=(navigator.userAgent.indexOf("Opera")!=-1)?true:false;function ControlVersion(){var version;var axo;var e;try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");version=axo.GetVariable("$version");}catch(e){}if(!version){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");version="WIN 6,0,21,0";axo.AllowScriptAccess="always";version=axo.GetVariable("$version");}catch(e){}}if(!version){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");version=axo.GetVariable("$version");}catch(e){}}if(!version){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");version="WIN 3,0,18,0";}catch(e){}}if(!version){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");version="WIN 2,0,0,11";}catch(e){version=-1;}}return version;}function GetSwfVer(){var flashVer=-1;if(navigator.plugins!=null&&navigator.plugins.length>0){if(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]){var swVer2=navigator.plugins["Shockwave Flash 2.0"]?" 2.0":"";var flashDescription=navigator.plugins["Shockwave Flash"+swVer2].description;var descArray=flashDescription.split(" ");var tempArrayMajor=descArray[2].split(".");var versionMajor=tempArrayMajor[0];var versionMinor=tempArrayMajor[1];var versionRevision=descArray[3];if(versionRevision==""){versionRevision=descArray[4];}if(versionRevision[0]=="d"){versionRevision=versionRevision.substring(1);}else{if(versionRevision[0]=="r"){versionRevision=versionRevision.substring(1);if(versionRevision.indexOf("d")>0){versionRevision=versionRevision.substring(0,versionRevision.indexOf("d"));}}}var flashVer=versionMajor+"."+versionMinor+"."+versionRevision;}}else{if(navigator.userAgent.toLowerCase().indexOf("webtv/2.6")!=-1){flashVer=4;}else{if(navigator.userAgent.toLowerCase().indexOf("webtv/2.5")!=-1){flashVer=3;}else{if(navigator.userAgent.toLowerCase().indexOf("webtv")!=-1){flashVer=2;}else{if(isIE&&isWin&&!isOpera){flashVer=ControlVersion();}}}}}return flashVer;}function DetectFlashVer(reqMajorVer,reqMinorVer,reqRevision){versionStr=GetSwfVer();if(versionStr==-1){return false;}else{if(versionStr!=0){if(isIE&&isWin&&!isOpera){tempArray=versionStr.split(" ");tempString=tempArray[1];versionArray=tempString.split(",");}else{versionArray=versionStr.split(".");}var versionMajor=versionArray[0];var versionMinor=versionArray[1];var versionRevision=versionArray[2];if(versionMajor>parseFloat(reqMajorVer)){return true;}else{if(versionMajor==parseFloat(reqMajorVer)){if(versionMinor>parseFloat(reqMinorVer)){return true;}else{if(versionMinor==parseFloat(reqMinorVer)){if(versionRevision>=parseFloat(reqRevision)){return true;}}}}}return false;}}}function AC_AddExtension(src,ext){if(src.indexOf("?")!=-1){return src.replace(/\?/,ext+"?");}else{return src+ext;}}function AC_Generateobj(objAttrs,params,embedAttrs){var str="";if(isIE&&isWin&&!isOpera){str+="<object ";for(var i in objAttrs){str+=i+'="'+objAttrs[i]+'" ';}for(var i in params){str+='><param name="'+i+'" value="'+params[i]+'" /> ';}str+="></object>";}else{str+="<embed ";for(var i in embedAttrs){str+=i+'="'+embedAttrs[i]+'" ';}str+="> </embed>";}document.write(str);}function AC_FL_RunContent(){var ret=AC_GetArgs(arguments,".swf","movie","clsid:d27cdb6e-ae6d-11cf-96b8-444553540000","application/x-shockwave-flash");AC_Generateobj(ret.objAttrs,ret.params,ret.embedAttrs);}function AC_GetArgs(args,ext,srcParamName,classid,mimeType){var ret=new Object();ret.embedAttrs=new Object();ret.params=new Object();ret.objAttrs=new Object();for(var i=0;i<args.length;i=i+2){var currArg=args[i].toLowerCase();switch(currArg){case"classid":break;case"pluginspage":ret.embedAttrs[args[i]]=args[i+1];break;case"src":case"movie":args[i+1]=AC_AddExtension(args[i+1],ext);ret.embedAttrs["src"]=args[i+1];ret.params[srcParamName]=args[i+1];break;case"onafterupdate":case"onbeforeupdate":case"onblur":case"oncellchange":case"onclick":case"ondblClick":case"ondrag":case"ondragend":case"ondragenter":case"ondragleave":case"ondragover":case"ondrop":case"onfinish":case"onfocus":case"onhelp":case"onmousedown":case"onmouseup":case"onmouseover":case"onmousemove":case"onmouseout":case"onkeypress":case"onkeydown":case"onkeyup":case"onload":case"onlosecapture":case"onpropertychange":case"onreadystatechange":case"onrowsdelete":case"onrowenter":case"onrowexit":case"onrowsinserted":case"onstart":case"onscroll":case"onbeforeeditfocus":case"onactivate":case"onbeforedeactivate":case"ondeactivate":case"type":case"codebase":ret.objAttrs[args[i]]=args[i+1];break;case"id":case"width":case"height":case"align":case"vspace":case"hspace":case"class":case"title":case"accesskey":case"name":case"tabindex":ret.embedAttrs[args[i]]=ret.objAttrs[args[i]]=args[i+1];break;default:ret.embedAttrs[args[i]]=ret.params[args[i]]=args[i+1];}}ret.objAttrs["classid"]=classid;if(mimeType){ret.embedAttrs["type"]=mimeType;}return ret;}

jQuery.preloadCssImages=function(settings){settings=jQuery.extend({statusTextEl:null,statusBarEl:null,errorDelay:999,simultaneousCacheLoading:2},settings);var allImgs=[],loaded=0,imgUrls=[],thisSheetRules,errorTimer;function onImgComplete(){clearTimeout(errorTimer);if(imgUrls&&imgUrls.length&&imgUrls[loaded]){loaded++;if(settings.statusTextEl){var nowloading=(imgUrls[loaded])?"Now Loading: <span>"+imgUrls[loaded].split("/")[imgUrls[loaded].split("/").length-1]:"Loading complete";jQuery(settings.statusTextEl).html('<span class="numLoaded">'+loaded+'</span> of <span class="numTotal">'+imgUrls.length+'</span> loaded (<span class="percentLoaded">'+(loaded/imgUrls.length*100).toFixed(0)+'%</span>) <span class="currentImg">'+nowloading+"</span></span>");}if(settings.statusBarEl){var barWidth=jQuery(settings.statusBarEl).width();jQuery(settings.statusBarEl).css("background-position",-(barWidth-(barWidth*loaded/imgUrls.length).toFixed(0))+"px 50%");}loadImgs();}}function loadImgs(){if(imgUrls&&imgUrls.length&&imgUrls[loaded]){var img=new Image();img.src=imgUrls[loaded];if(!img.complete){jQuery(img).bind("error load onreadystatechange",onImgComplete);}else{onImgComplete();}errorTimer=setTimeout(onImgComplete,settings.errorDelay);}}function parseCSS(sheets,urls){var w3cImport=false,imported=[],importedSrc=[],baseURL;var sheetIndex=sheets.length;while(sheetIndex--){var cssPile="";if(urls&&urls[sheetIndex]){baseURL=urls[sheetIndex];}else{var csshref=(sheets[sheetIndex].href)?sheets[sheetIndex].href:"window.location.href";var baseURLarr=csshref.split("/");baseURLarr.pop();baseURL=baseURLarr.join("/");if(baseURL){baseURL+="/";}}if(sheets[sheetIndex].cssRules||sheets[sheetIndex].rules){thisSheetRules=(sheets[sheetIndex].cssRules)?sheets[sheetIndex].cssRules:sheets[sheetIndex].rules;var ruleIndex=thisSheetRules.length;while(ruleIndex--){if(thisSheetRules[ruleIndex].style&&thisSheetRules[ruleIndex].style.cssText){var text=thisSheetRules[ruleIndex].style.cssText;if(text.toLowerCase().indexOf("url")!=-1){cssPile+=text;}}else{if(thisSheetRules[ruleIndex].styleSheet){imported.push(thisSheetRules[ruleIndex].styleSheet);w3cImport=true;}}}}var tmpImage=cssPile.match(/[^\("]+\.(gif|jpg|jpeg|png)/g);if(tmpImage){var i=tmpImage.length;while(i--){var imgSrc=(tmpImage[i].charAt(0)=="/"||tmpImage[i].match("://"))?tmpImage[i]:baseURL+tmpImage[i];if(jQuery.inArray(imgSrc,imgUrls)==-1){imgUrls.push(imgSrc);}}}if(!w3cImport&&sheets[sheetIndex].imports&&sheets[sheetIndex].imports.length){for(var iImport=0,importLen=sheets[sheetIndex].imports.length;iImport<importLen;iImport++){var iHref=sheets[sheetIndex].imports[iImport].href;iHref=iHref.split("/");iHref.pop();iHref=iHref.join("/");if(iHref){iHref+="/";}var iSrc=(iHref.charAt(0)=="/"||iHref.match("://"))?iHref:baseURL+iHref;importedSrc.push(iSrc);imported.push(sheets[sheetIndex].imports[iImport]);}}}if(imported.length){parseCSS(imported,importedSrc);return false;}var downloads=settings.simultaneousCacheLoading;while(downloads--){setTimeout(loadImgs,downloads);}}parseCSS(document.styleSheets);return imgUrls;};

(function(D){var A="Lite-1.0";D.fn.cycle=function(E){return this.each(function(){E=E||{};if(this.cycleTimeout){clearTimeout(this.cycleTimeout)}this.cycleTimeout=0;this.cyclePause=0;var I=D(this);var J=E.slideExpr?D(E.slideExpr,this):I.children();var G=J.get();if(G.length<2){if(window.console&&window.console.log){window.console.log("terminating; too few slides: "+G.length)}return }var H=D.extend({},D.fn.cycle.defaults,E||{},D.metadata?I.metadata():D.meta?I.data():{});H.before=H.before?[H.before]:[];H.after=H.after?[H.after]:[];H.after.unshift(function(){H.busy=0});var F=this.className;H.width=parseInt((F.match(/w:(\d+)/)||[])[1])||H.width;H.height=parseInt((F.match(/h:(\d+)/)||[])[1])||H.height;H.timeout=parseInt((F.match(/t:(\d+)/)||[])[1])||H.timeout;if(I.css("position")=="static"){I.css("position","relative")}if(H.width){I.width(H.width)}if(H.height&&H.height!="auto"){I.height(H.height)}var K=0;J.css({position:"absolute",top:0,left:0}).hide().each(function(M){D(this).css("z-index",G.length-M)});D(G[K]).css("opacity",1).show();if(D.browser.msie){G[K].style.removeAttribute("filter")}if(H.fit&&H.width){J.width(H.width)}if(H.fit&&H.height&&H.height!="auto"){J.height(H.height)}if(H.pause){I.hover(function(){this.cyclePause=1},function(){this.cyclePause=0})}D.fn.cycle.transitions.fade(I,J,H);J.each(function(){var M=D(this);this.cycleH=(H.fit&&H.height)?H.height:M.height();this.cycleW=(H.fit&&H.width)?H.width:M.width()});J.not(":eq("+K+")").css({opacity:0});if(H.cssFirst){D(J[K]).css(H.cssFirst)}if(H.timeout){if(H.speed.constructor==String){H.speed={slow:600,fast:200}[H.speed]||400}if(!H.sync){H.speed=H.speed/2}while((H.timeout-H.speed)<250){H.timeout+=H.speed}}H.speedIn=H.speed;H.speedOut=H.speed;H.slideCount=G.length;H.currSlide=K;H.nextSlide=1;var L=J[K];if(H.before.length){H.before[0].apply(L,[L,L,H,true])}if(H.after.length>1){H.after[1].apply(L,[L,L,H,true])}if(H.click&&!H.next){H.next=H.click}if(H.next){D(H.next).bind("click",function(){return C(G,H,H.rev?-1:1)})}if(H.prev){D(H.prev).bind("click",function(){return C(G,H,H.rev?1:-1)})}if(H.timeout){this.cycleTimeout=setTimeout(function(){B(G,H,0,!H.rev)},H.timeout+(H.delay||0))}})};function B(J,E,I,K){if(E.busy){return }var H=J[0].parentNode,M=J[E.currSlide],L=J[E.nextSlide];if(H.cycleTimeout===0&&!I){return }if(I||!H.cyclePause){if(E.before.length){D.each(E.before,function(N,O){O.apply(L,[M,L,E,K])})}var F=function(){if(D.browser.msie){this.style.removeAttribute("filter")}D.each(E.after,function(N,O){O.apply(L,[M,L,E,K])})};if(E.nextSlide!=E.currSlide){E.busy=1;D.fn.cycle.custom(M,L,E,F)}var G=(E.nextSlide+1)==J.length;E.nextSlide=G?0:E.nextSlide+1;E.currSlide=G?J.length-1:E.nextSlide-1}if(E.timeout){H.cycleTimeout=setTimeout(function(){B(J,E,0,!E.rev)},E.timeout)}}function C(E,F,I){var H=E[0].parentNode,G=H.cycleTimeout;if(G){clearTimeout(G);H.cycleTimeout=0}F.nextSlide=F.currSlide+I;if(F.nextSlide<0){F.nextSlide=E.length-1}else{if(F.nextSlide>=E.length){F.nextSlide=0}}B(E,F,1,I>=0);return false}D.fn.cycle.custom=function(K,H,I,E){var J=D(K),G=D(H);G.css({opacity:0});var F=function(){G.animate({opacity:1},I.speedIn,I.easeIn,E)};J.animate({opacity:0},I.speedOut,I.easeOut,function(){J.css({display:"none"});if(!I.sync){F()}});if(I.sync){F()}};D.fn.cycle.transitions={fade:function(F,G,E){G.not(":eq(0)").css("opacity",0);E.before.push(function(){D(this).show()})}};D.fn.cycle.ver=function(){return A};D.fn.cycle.defaults={timeout:4000,speed:1000,next:null,prev:null,before:null,after:null,height:"auto",sync:1,fit:0,pause:0,delay:0,slideExpr:null}})(jQuery)

var isMSIE=
/*@cc_on!@*/
false;var isIEmac=false;
/*@cc_on @if(@_jscript&&!(@_win32||@_win16)&& 
(@_jscript_version<5.5)) isIEmac=true; @end @*/
var undefined;function isEmpty(s){return((s=="")||/^\s*$/.test(s));}var addBookmarkObj={linkText:"Добавить в закладки",css_padding:"10px 15px 5px 30px",css_background:"#fff url(css/images/bookmark.gif) no-repeat left 5px",title:document.title,URL:location.href,addTextLink:function(parId){var a=addBookmarkObj.makeLink(parId,1);if(a){jQuery(a).text(addBookmarkObj.linkText);jQuery(a).css("padding",addBookmarkObj.css_padding);jQuery(a).css("background",addBookmarkObj.css_background);return;}var cont=addBookmarkObj.getParent(parId);if(!cont){return;}jQuery(cont).append('<span style="font-family: Tahoma, Arial, sans-serif; font-size: 70%; color: #aaa; padding: '+addBookmarkObj.css_padding+"; background: "+addBookmarkObj.css_background+';">'+addBookmarkObj.findKeys()+"</span>");},addImageLink:function(parId,imgPath){if(!imgPath||isEmpty(imgPath)){return;}var o=addBookmarkObj,a=o.makeLink(parId),img=document.createElement("img");img.title=img.alt=o.modal?o.linkText:o.findKeys();img.src=imgPath;a.appendChild(img);},makeLink:function(parId,isText){var cont=addBookmarkObj.getParent(parId);if(!cont){return null;}var a=document.createElement("a");a.href=addBookmarkObj.URL;var s=document.createElement("div").style;var isFx35plus=((navigator.userAgent.toLowerCase().indexOf("firefox")!=-1)&&(s.wordWrap!==undefined)&&(s.MozTransform!==undefined));if(window.external&&isMSIE&&!isIEmac){a.onclick=function(){try{window.external.AddFavorite(addBookmarkObj.URL,addBookmarkObj.title);}catch(ex){var t=addBookmarkObj.findKeys();alert("После закройте это окно, "+t.charAt(0).toLowerCase()+t.slice(1));}return false;};addBookmarkObj.modal=1;}else{if(window.opera||isFx35plus){a.title=addBookmarkObj.title,a.rel="sidebar";addBookmarkObj.modal=1;}else{if(isText){return null;}else{a.onclick=function(){var t=this.firstChild.title;alert("После закройте это окно, "+t.charAt(0).toLowerCase()+t.slice(1));return false;};}}}return cont.appendChild(a);},getParent:function(parId){if(!document.getElementById||!document.createTextNode){return null;}parId=((typeof(parId)=="string")&&!isEmpty(parId))?parId:"addBookmarkContainer";return document.getElementById(parId)||null;},findKeys:function(){var ua=navigator.userAgent.toLowerCase(),isMac=(ua.indexOf("mac")!=-1),isWebkit=(ua.indexOf("webkit")!=-1),str=(isMac?"Command/Cmd":"CTRL");if(window.opera&&(!opera.version||(opera.version()<9))){str+="+T";}else{if(ua.indexOf("konqueror")!=-1){str+="+B";}else{if(window.opera||window.home||isWebkit||isMSIE||isMac){str+="+D";}}}return((str)?"Нажмите "+str+" для добавления страницы в закладки":str);}};

/*
 * Galleria v 1.2 prerelease 1.1 2010-11-04
 * http://galleria.aino.se
 *
 * Copyright (c) 2010, Aino
 * Licensed under the MIT license.
 */
(function($){var undef,window=this,doc=document,$doc=$(doc);var DEBUG=false,NAV=navigator.userAgent.toLowerCase(),HASH=window.location.hash.replace(/#\//,""),CLICK=function(){return Galleria.TOUCH?"touchstart":"click";},IE=(function(){var v=3,div=doc.createElement("div");while(div.innerHTML="<!--[if gt IE "+(++v)+"]><i></i><![endif]-->",div.getElementsByTagName("i")[0]){}return v>4?v:undef;}()),DOM=function(){return{html:doc.documentElement,body:doc.body,head:doc.getElementsByTagName("head")[0],title:doc.title};},_timeouts={trunk:{},add:function(id,fn,delay,loop){loop=loop||false;this.clear(id);if(loop){var old=fn;fn=function(){old();_timeouts.add(id,fn,delay);};}this.trunk[id]=window.setTimeout(fn,delay);},clear:function(id){var del=function(i){window.clearTimeout(this.trunk[i]);delete this.trunk[i];};if(!!id&&id in this.trunk){del.call(_timeouts,id);}else{if(typeof id=="undefined"){for(var i in this.trunk){del.call(_timeouts,i);}}}}},_galleries=[],_transitions={fade:function(params,complete){$(params.next).css("opacity",0).show().animate({opacity:1},params.speed,complete);if(params.prev){$(params.prev).css("opacity",1).show().animate({opacity:0},params.speed);}},flash:function(params,complete){$(params.next).css("opacity",0);if(params.prev){$(params.prev).animate({opacity:0},(params.speed/2),function(){$(params.next).animate({opacity:1},params.speed,complete);});}else{$(params.next).animate({opacity:1},params.speed,complete);}},pulse:function(params,complete){if(params.prev){$(params.prev).hide();}$(params.next).css("opacity",0).animate({opacity:1},params.speed,complete);},slide:function(params,complete){var image=$(params.next).parent(),images=this.$("images"),width=this._stageWidth,easing=this.getOptions("easing");image.css({left:width*(params.rewind?-1:1)});images.animate({left:width*(params.rewind?1:-1)},{duration:params.speed,queue:false,easing:easing,complete:function(){images.css("left",0);image.css("left",0);complete();}});},fadeslide:function(params,complete){var x=0,easing=this.getOptions("easing"),distance=this.getStageWidth();if(params.prev){x=Utils.parseValue($(params.prev).css("left"));$(params.prev).css({opacity:1,left:x}).animate({opacity:0,left:x+(distance*(params.rewind?1:-1))},{duration:params.speed,queue:false,easing:easing});}x=Utils.parseValue($(params.next).css("left"));$(params.next).css({left:x+(distance*(params.rewind?-1:1)),opacity:0}).animate({opacity:1,left:x},{duration:params.speed,complete:complete,queue:false,easing:easing});}},Utils=(function(){return{array:function(obj){return Array.prototype.slice.call(obj);},create:function(className,nodeName){nodeName=nodeName||"div";var elem=doc.createElement(nodeName);elem.className=className;return elem;},forceStyles:function(elem,styles){elem=$(elem);if(elem.attr("style")){elem.data("styles",elem.attr("style")).removeAttr("style");}elem.css(styles);},revertStyles:function(){$.each(Utils.array(arguments),function(i,elem){elem=$(elem).removeAttr("style");if(elem.data("styles")){elem.attr("style",elem.data("styles")).data("styles",null);}});},moveOut:function(elem){Utils.forceStyles(elem,{position:"absolute",left:-10000});},moveIn:function(){Utils.revertStyles.apply(Utils,Utils.array(arguments));},hide:function(elem,speed,callback){elem=$(elem);if(!elem.data("opacity")){elem.data("opacity",elem.css("opacity"));}var style={opacity:0};if(speed){elem.stop().animate(style,speed,callback);}else{elem.css(style);}},show:function(elem,speed,callback){elem=$(elem);var saved=parseFloat(elem.data("opacity"))||1,style={opacity:saved};if(saved==1){elem.data("opacity",null);}if(speed){elem.stop().animate(style,speed,callback);}else{elem.css(style);}},addTimer:function(){_timeouts.add.apply(_timeouts,Utils.array(arguments));return this;},clearTimer:function(){_timeouts.clear.apply(_timeouts,Utils.array(arguments));return this;},wait:function(options){options=$.extend({until:function(){return false;},success:function(){},error:function(){Galleria.raise("Could not complete wait function.");},timeout:3000},options);var start=Utils.timestamp(),elapsed,now;window.setTimeout(function(){now=Utils.timestamp();elapsed=now-start;if(options.until(elapsed)){options.success();return false;}if(now>=start+options.timeout){options.error();return false;}window.setTimeout(arguments.callee,2);},2);},toggleQuality:function(img,force){if(!(IE==7||IE==8)||!!img===false){return;}if(typeof force==="undefined"){force=img.style.msInterpolationMode=="nearest-neighbor";}img.style.msInterpolationMode=force?"bicubic":"nearest-neighbor";},insertStyleTag:function(styles){var style=doc.createElement("style");DOM().head.appendChild(style);if(style.styleSheet){style.styleSheet.cssText=styles;}else{var cssText=doc.createTextNode(styles);style.appendChild(cssText);}},loadScript:function(url,callback){var done=false,script=$("<scr"+"ipt>").attr({src:url,async:true}).get(0);script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;if(typeof callback=="function"){callback.call(this,this);}script.onload=script.onreadystatechange=null;}};var s=doc.getElementsByTagName("script")[0];s.parentNode.insertBefore(script,s);},parseValue:function(val){if(typeof val=="number"){return val;}else{if(typeof val=="string"){var arr=val.match(/\-?\d/g);return arr&&arr.constructor==Array?arr.join("")*1:0;}else{return 0;}}},timestamp:function(){return new Date().getTime();},loadCSS:function(href,id,callback){var link,ready=false,length;$("link[rel=stylesheet]").each(function(){if(new RegExp(href).test(this.href)){link=this;return false;}});if(typeof id=="function"){callback=id;id=undef;}callback=callback||function(){};if(link){callback.call(link,link);return link;}length=doc.styleSheets.length;if(DEBUG){href+="?"+Utils.timestamp();}if($("#"+id).length){$("#"+id).attr("href",href);length--;ready=true;}else{link=$("<link>").attr({rel:"stylesheet",href:href,id:id}).get(0);window.setTimeout(function(){var styles=$('link[rel="stylesheet"], style');if(styles.length){styles.get(0).parentNode.insertBefore(link,styles[0]);}else{DOM().head.appendChild(link);}if(IE){link.attachEvent("onreadystatechange",function(e){if(link.readyState=="complete"){ready=true;}});}else{ready=true;}},10);}if(typeof callback=="function"){Utils.wait({until:function(){return ready&&doc.styleSheets.length>length;},success:function(){Utils.addTimer("css",function(){callback.call(link,link);},100);},error:function(){Galleria.raise("Theme CSS could not load");},timeout:1000});}return link;}};})();Galleria=function(){var self=this;this._theme=undef;this._options={};this._playing=false;this._playtime=5000;this._active=null;this._queue={length:0};this._data=[];this._dom={};this._thumbnails=[];this._initialized=false;this._stageWidth=0;this._stageHeight=0;this._target=undef;this._id=Utils.timestamp();var divs="container stage images image-nav image-nav-left image-nav-right "+"info info-text info-title info-description info-author "+"thumbnails thumbnails-list thumbnails-container thumb-nav-left thumb-nav-right "+"loader counter tooltip",spans="current total";$.each(divs.split(" "),function(i,elemId){self._dom[elemId]=Utils.create("galleria-"+elemId);});$.each(spans.split(" "),function(i,elemId){self._dom[elemId]=Utils.create("galleria-"+elemId,"span");});var keyboard=this._keyboard={keys:{"UP":38,"DOWN":40,"LEFT":37,"RIGHT":39,"RETURN":13,"ESCAPE":27,"BACKSPACE":8,"SPACE":32},map:{},bound:false,press:function(e){var key=e.keyCode||e.which;if(key in keyboard.map&&typeof keyboard.map[key]=="function"){keyboard.map[key].call(self,e);}},attach:function(map){for(var key in map){var up=key.toUpperCase();if(up in keyboard.keys){keyboard.map[keyboard.keys[up]]=map[key];}}if(!keyboard.bound){keyboard.bound=true;$doc.bind("keydown",keyboard.press);}},detach:function(){keyboard.bound=false;$doc.unbind("keydown",keyboard.press);}};var controls=this._controls={0:undef,1:undef,active:0,swap:function(){controls.active=controls.active?0:1;},getActive:function(){return controls[controls.active];},getNext:function(){return controls[1-controls.active];}};var carousel=this._carousel={next:self.$("thumb-nav-right"),prev:self.$("thumb-nav-left"),width:0,current:0,max:0,hooks:[],update:function(){var w=0,h=0,hooks=[0];$.each(self._thumbnails,function(i,thumb){if(thumb.ready){w+=thumb.outerWidth||$(thumb.container).outerWidth(true);hooks[i+1]=w;h=Math.max(h,thumb.outerHeight||$(thumb.container).outerHeight());}});self.$("thumbnails-container").toggleClass("galleria-carousel",w>self._stageWidth);self.$("thumbnails").css({width:w,height:h});carousel.max=w;carousel.hooks=hooks;carousel.width=self.$("thumbnails-list").width();carousel.setClasses();},bindControls:function(){carousel.next.bind(CLICK(),function(e){e.preventDefault();if(self._options.carousel_steps=="auto"){for(var i=carousel.current;i<carousel.hooks.length;i++){if(carousel.hooks[i]-carousel.hooks[carousel.current]>carousel.width){carousel.set(i-2);break;}}}else{carousel.set(carousel.current+self._options.carousel_steps);}});carousel.prev.bind(CLICK(),function(e){e.preventDefault();if(self._options.carousel_steps=="auto"){for(var i=carousel.current;i>=0;i--){if(carousel.hooks[carousel.current]-carousel.hooks[i]>carousel.width){carousel.set(i+2);break;}else{if(i==0){carousel.set(0);break;}}}}else{carousel.set(carousel.current-self._options.carousel_steps);}});},set:function(i){i=Math.max(i,0);while(carousel.hooks[i-1]+carousel.width>carousel.max&&i>=0){i--;}carousel.current=i;carousel.animate();},getLast:function(i){return(i||carousel.current)-1;},follow:function(i){if(i==0||i==carousel.hooks.length-2){carousel.set(i);return;}var last=carousel.current;while(carousel.hooks[last]-carousel.hooks[carousel.current]<carousel.width&&last<=carousel.hooks.length){last++;}if(i-1<carousel.current){carousel.set(i-1);}else{if(i+2>last){carousel.set(i-last+carousel.current+2);}}},setClasses:function(){carousel.prev.toggleClass("disabled",!carousel.current);carousel.next.toggleClass("disabled",carousel.hooks[carousel.current]+carousel.width>carousel.max);},animate:function(to){carousel.setClasses();var num=carousel.hooks[carousel.current]*-1;if(isNaN(num)){return;}self.$("thumbnails").animate({left:num},{duration:self._options.carousel_speed,easing:self._options.easing,queue:false});}};var tooltip=this._tooltip={initialized:false,active:null,open:false,init:function(){tooltip.initialized=true;var css=".galleria-tooltip{padding:3px 8px;max-width:50%;background:#ffe;color:#000;z-index:3;position:absolute;font-size:11px;line-height:1.3"+"opacity:0;box-shadow:0 0 2px rgba(0,0,0,.4);-moz-box-shadow:0 0 2px rgba(0,0,0,.4);-webkit-box-shadow:0 0 2px rgba(0,0,0,.4);}";Utils.insertStyleTag(css);self.$("tooltip").css("opacity",0.8);Utils.hide(self.get("tooltip"));},move:function(e){var mouseX=self.getMousePosition(e).x,mouseY=self.getMousePosition(e).y,$elem=self.$("tooltip"),x=mouseX,y=mouseY,height=$elem.outerHeight(true)+1,width=$elem.outerWidth(true),limitY=height+15;var maxX=self._stageWidth-width,maxY=self._stageHeight-height;if(!isNaN(x)&&!isNaN(y)){x+=15;y-=35;x=Math.max(0,Math.min(maxX,x));y=Math.max(0,Math.min(maxY,y));if(mouseY<limitY){y=limitY;}$elem.css({left:x,top:y});}},bind:function(elem,value){if(!tooltip.initialized){tooltip.init();}var hover=function(elem,value){tooltip.define(elem,value);$(elem).hover(function(){tooltip.active=elem;Utils.clearTimer("switch_tooltip");self.$("container").unbind("mousemove",tooltip.move).bind("mousemove",tooltip.move).trigger("mousemove");tooltip.show(elem);Galleria.utils.addTimer("tooltip",function(){self.$("tooltip").stop();Utils.show(self.get("tooltip"),400);tooltip.open=true;},tooltip.open?0:1000);},function(){tooltip.active=null;self.$("container").unbind("mousemove",tooltip.move);Utils.clearTimer("tooltip");Utils.hide(self.get("tooltip"),200,function(){Utils.addTimer("switch_tooltip",function(){tooltip.open=false;},1000);});});};if(typeof value=="string"){hover((elem in self._dom?self.get(elem):elem),value);}else{$.each(elem,function(elemID,val){hover(self.get(elemID),val);});}},show:function(elem){var text=$(elem).data("tt");if(!text){return;}text=typeof text=="function"?text():text;self.$("tooltip").html(text.replace(/\s/,"&nbsp;"));},define:function(elem,value){if(typeof value!=="function"){var s=value;value=function(){return s;};}if(elem in self._dom){elem=self.get(elem);}$(elem).data("tt",value);tooltip.show(elem);},refresh:function(){$.each(arguments,function(i,elem){if(tooltip.active==elem){tooltip.show(elem);}});}};var fullscreen=this._fullscreen={scrolled:0,enter:function(callback){Utils.hide(self.getActiveImage());self.$("container").addClass("fullscreen");fullscreen.scrolled=$(window).scrollTop();Utils.forceStyles(self.get("container"),{position:"fixed",top:0,left:0,width:"100%",height:"100%",zIndex:10000});var htmlbody={height:"100%",overflow:"hidden",margin:0,padding:0};Utils.forceStyles(DOM().html,htmlbody);Utils.forceStyles(DOM().body,htmlbody);self.attachKeyboard({escape:self.exitFullscreen,right:self.next,left:self.prev});self.rescale(function(){Utils.addTimer("fullscreen_enter",function(){Utils.show(self.getActiveImage());if(typeof callback=="function"){callback.call(self);}},100);self.trigger(Galleria.FULLSCREEN_ENTER);});$(window).resize(function(){fullscreen.scale();});},scale:function(){self.rescale();},exit:function(callback){Utils.hide(self.getActiveImage());self.$("container").removeClass("fullscreen");Utils.revertStyles(self.get("container"),DOM().html,DOM().body);window.scrollTo(0,fullscreen.scrolled);self.detachKeyboard();self.rescale(function(){Utils.addTimer("fullscreen_exit",function(){Utils.show(self.getActiveImage());if(typeof callback=="function"){callback.call(self);}},50);self.trigger(Galleria.FULLSCREEN_EXIT);});$(window).unbind("resize",fullscreen.scale);}};var idle=this._idle={trunk:[],bound:false,add:function(elem,to){if(!elem){return;}if(!idle.bound){idle.addEvent();}elem=$(elem);var from={};for(var style in to){from[style]=elem.css(style);}elem.data("idle",{from:from,to:to,complete:true,busy:false});idle.addTimer();idle.trunk.push(elem);},remove:function(elem){elem=jQuery(elem);$.each(idle.trunk,function(i,el){if(el.length&&!el.not(elem).length){self._idle.show(elem);self._idle.trunk.splice(i,1);}});if(!idle.trunk.length){idle.removeEvent();Utils.clearTimer("idle");}},addEvent:function(){idle.bound=true;self.$("container").bind("mousemove click",idle.showAll);},removeEvent:function(){idle.bound=false;self.$("container").unbind("mousemove click",idle.showAll);},addTimer:function(){Utils.addTimer("idle",function(){self._idle.hide();},self._options.idle_time);},hide:function(){self.trigger(Galleria.IDLE_ENTER);$.each(idle.trunk,function(i,elem){var data=elem.data("idle");if(!data){return;}data.complete=false;elem.stop().animate(data.to,{duration:600,queue:false,easing:"swing"});});},showAll:function(){Utils.clearTimer("idle");$.each(self._idle.trunk,function(i,elem){self._idle.show(elem);});},show:function(elem){var data=elem.data("idle");if(!data.busy&&!data.complete){data.busy=true;self.trigger(Galleria.IDLE_EXIT);elem.animate(data.from,{duration:300,queue:false,easing:"swing",complete:function(){$(this).data("idle").busy=false;$(this).data("idle").complete=true;}});}idle.addTimer();}};var lightbox=this._lightbox={width:0,height:0,initialized:false,active:null,image:null,elems:{},init:function(){self.trigger(Galleria.LIGHTBOX_OPEN);if(lightbox.initialized){return;}lightbox.initialized=true;var elems="overlay box content shadow title info close prevholder prev nextholder next counter image",el={},op=self._options,css="",cssMap={overlay:"position:fixed;display:none;opacity:"+op.overlay_opacity+";top:0;left:0;width:100%;height:100%;background:"+op.overlay_background+";z-index:99990",box:"position:fixed;display:none;width:400px;height:400px;top:50%;left:50%;margin-top:-200px;margin-left:-200px;z-index:99991",shadow:"position:absolute;background:#000;width:100%;height:100%;",content:"position:absolute;background-color:#fff;top:10px;left:10px;right:10px;bottom:10px;overflow:hidden",info:"position:absolute;bottom:10px;left:10px;right:10px;color:#444;font:11px/13px arial,sans-serif;height:13px",close:"position:absolute;top:10px;right:10px;height:20px;width:20px;background:#fff;text-align:center;cursor:pointer;color:#444;font:16px/22px arial,sans-serif;z-index:99999",image:"position:absolute;top:10px;left:10px;right:10px;bottom:30px;overflow:hidden",prevholder:"position:absolute;width:50%;height:100%;cursor:pointer",nextholder:"position:absolute;width:50%;height:100%;right:0;cursor:pointer",prev:"position:absolute;top:50%;margin-top:-20px;height:40px;width:30px;background:#fff;left:20px;display:none;line-height:40px;text-align:center;color:#000",next:"position:absolute;top:50%;margin-top:-20px;height:40px;width:30px;background:#fff;right:20px;left:auto;display:none;line-height:40px;text-align:center;color:#000",title:"float:left",counter:"float:right;margin-left:8px"},hover=function(elem){return elem.hover(function(){$(this).css("color","#bbb");},function(){$(this).css("color","#444");});};$.each(cssMap,function(key,value){css+=".galleria-lightbox-"+key+"{"+value+"}";});Utils.insertStyleTag(css);$.each(elems.split(" "),function(i,elemId){self.addElement("lightbox-"+elemId);el[elemId]=lightbox.elems[elemId]=self.get("lightbox-"+elemId);});lightbox.image=new Galleria.Picture();self.append({"lightbox-box":["lightbox-shadow","lightbox-content","lightbox-close","lightbox-prevholder","lightbox-nextholder"],"lightbox-info":["lightbox-title","lightbox-counter"],"lightbox-content":["lightbox-info","lightbox-image"],"lightbox-prevholder":"lightbox-prev","lightbox-nextholder":"lightbox-next"});$(el.image).append(lightbox.image.container);$(DOM().body).append(el.overlay,el.box);hover($(el.close).bind(CLICK(),lightbox.hide).html("&#215;"));$.each(["Prev","Next"],function(i,dir){var $d=$(el[dir.toLowerCase()]).html(/v/.test(dir)?"&lt;&nbsp;":"&nbsp;&gt;");$(el[dir.toLowerCase()+"holder"]).hover(function(){$d.show();},function(){$d.fadeOut(200);}).bind(CLICK(),function(){lightbox["show"+dir]();});});$(el.overlay).bind(CLICK(),lightbox.hide);},rescale:function(event){var width=Math.min($(window).width(),lightbox.width),height=Math.min($(window).height(),lightbox.height),ratio=Math.min((width-60)/lightbox.width,(height-80)/lightbox.height),destWidth=(lightbox.width*ratio)+40,destHeight=(lightbox.height*ratio)+60,to={width:destWidth,height:destHeight,marginTop:Math.ceil(destHeight/2)*-1,marginLeft:Math.ceil(destWidth/2)*-1};if(event){$(lightbox.elems.box).css(to);}else{$(lightbox.elems.box).animate(to,self._options.lightbox_transition_speed,self._options.easing,function(){var image=lightbox.image,speed=self._options.lightbox_fade_speed;self.trigger({type:Galleria.LIGHTBOX_IMAGE,imageTarget:image.image});image.show();Utils.show(image.image,speed);Utils.show(lightbox.elems.info,speed);});}},hide:function(){lightbox.image.image=null;$(window).unbind("resize",lightbox.rescale);$(lightbox.elems.box).hide();Utils.hide(lightbox.elems.info);Utils.hide(lightbox.elems.overlay,200,function(){$(this).hide().css("opacity",self._options.overlay_opacity);self.trigger(Galleria.LIGHTBOX_CLOSE);});},showNext:function(){lightbox.show(self.getNext(lightbox.active));},showPrev:function(){lightbox.show(self.getPrev(lightbox.active));},show:function(index){lightbox.active=index=typeof index=="number"?index:self.getIndex();if(!lightbox.initialized){lightbox.init();}$(window).unbind("resize",lightbox.rescale);var data=self.getData(index),total=self.getDataLength();Utils.hide(lightbox.elems.info);lightbox.image.load(data.image,function(image){lightbox.width=image.original.width;lightbox.height=image.original.height;$(image.image).css({width:"100.5%",height:"100.5%",top:0,zIndex:99998,opacity:0});lightbox.elems.title.innerHTML=data.title;lightbox.elems.counter.innerHTML=(index+1)+" / "+total;$(window).resize(lightbox.rescale);lightbox.rescale();});$(lightbox.elems.overlay).show();$(lightbox.elems.box).show();}};return this;};Galleria.prototype={init:function(target,options){var self=this;_galleries.push(this);this._original={target:target,options:options,data:null};this._target=this._dom.target=target.nodeName?target:$(target).get(0);if(!this._target){Galleria.raise("Target not found.");return;}this._options={autoplay:false,carousel:true,carousel_follow:true,carousel_speed:400,carousel_steps:"auto",clicknext:false,data_config:function(elem){return{};},data_selector:"img",data_source:this._target,debug:undef,easing:"galleria",extend:function(options){},height:"auto",idle_time:3000,image_crop:false,image_margin:0,image_pan:false,image_pan_smoothness:12,image_position:"50%",keep_source:false,lightbox_fade_speed:200,lightbox_transition_speed:500,link_source_images:true,max_scale_ratio:undef,min_scale_ratio:undef,on_image:function(img,thumb){},overlay_opacity:0.85,overlay_background:"#0b0b0b",pause_on_interaction:true,popup_links:false,preload:2,queue:true,show:0,show_info:true,show_counter:true,show_imagenav:true,thumb_crop:true,thumb_event_type:CLICK(),thumb_fit:true,thumb_margin:0,thumb_quality:"auto",thumbnails:true,transition:"fade",transition_initial:undef,transition_speed:400,width:"auto"};if(options&&options.debug===true){DEBUG=true;}$(this._target).children().hide();if(Galleria.theme){this._init();}else{Utils.addTimer("themeload",function(){Galleria.raise("No theme found.",true);},2000);$doc.one(Galleria.THEMELOAD,function(){Utils.clearTimer("themeload");self._init.call(self);});}},_init:function(){var self=this;if(this._initialized){Galleria.raise("Init failed: Gallery instance already initialized.");return this;}this._initialized=true;if(!Galleria.theme){Galleria.raise("Init failed: No theme found.");return this;}$.extend(true,this._options,Galleria.theme.defaults,this._original.options);this.bind(Galleria.DATA,function(){this._original.data=this._data;this.get("total").innerHTML=this.getDataLength();var $container=this.$("container");var num={width:0,height:0};var testElem=Utils.create("galleria-image");Utils.wait({until:function(){$.each(["width","height"],function(i,m){if(self._options[m]&&typeof self._options[m]=="number"){num[m]=self._options[m];}else{num[m]=Utils.parseValue(self.$("target").css(m))||Utils.parseValue($container.css(m))||self.$("target")[m]()||$container[m]();}});var thumbHeight=function(){return true;};if(self._options.thumbnails){self.$("thumbnails").append(testElem);thumbHeight=function(){return !!$(testElem).height();};}return thumbHeight()&&num.width&&num.height>50;},success:function(){$(testElem).remove();$container.width(num.width);$container.height(num.height);if(Galleria.WEBKIT){window.setTimeout(function(){self._run();},1);}else{self._run();}},error:function(){Galleria.raise("Width & Height not found.",true);},timeout:2000});});var one=false;this.bind(Galleria.READY,function(){Utils.show(this.get("counter"));if(this._options.clicknext){$.each(this._data,function(i,data){delete data.link;});this.$("stage").css({cursor:"pointer"}).bind(CLICK(),function(e){self.next();});}if(this._options.carousel){this._carousel.bindControls();}if(this._options.autoplay){this.pause();if(typeof this._options.autoplay=="number"){this._playtime=this._options.autoplay;}this.trigger(Galleria.PLAY);this._playing=true;}if(one){if(typeof this._options.show=="number"){this.show(this._options.show);}return;}one=true;if(Galleria.History){Galleria.History.change(function(e){var val=parseInt(e.value.replace(/\//,""));if(isNaN(val)){window.history.go(-1);}else{self.show(val,undef,true);}});}Galleria.theme.init.call(this,this._options);this._options.extend.call(this,this._options);if(/^[0-9]{1,4}$/.test(HASH)&&Galleria.History){this.show(HASH,undef,true);}else{this.show(this._options.show);}});this.append({"info-text":["info-title","info-description","info-author"],"info":["info-text"],"image-nav":["image-nav-right","image-nav-left"],"stage":["images","loader","counter","image-nav"],"thumbnails-list":["thumbnails"],"thumbnails-container":["thumb-nav-left","thumbnails-list","thumb-nav-right"],"container":["stage","thumbnails-container","info","tooltip"]});Utils.hide(this.$("counter").append(this.get("current")," / ",this.get("total")));this.setCounter("&#8211;");$.each(new Array(2),function(i){var image=new Galleria.Picture();$(image.container).css({position:"absolute",top:0,left:0});self.$("images").append(image.container);self._controls[i]=image;});this.$("images").css({position:"relative",top:0,left:0,width:"100%",height:"100%"});this.$("thumbnails, thumbnails-list").css({overflow:"hidden",position:"relative"});this.$("image-nav-right, image-nav-left").bind(CLICK(),function(e){if(self._options.clicknext){e.stopPropagation();}if(self._options.pause_on_interaction){self.pause();}var fn=/right/.test(this.className)?"next":"prev";self[fn]();});$.each(["info","counter","image-nav"],function(i,el){if(self._options["show_"+el.replace(/-/,"")]===false){Utils.moveOut(self.get(el));}});this.load();if(!this._options.keep_source&&!IE){this._target.innerHTML="";}this.$("target").append(this.get("container"));if(this._options.carousel){this.bind(Galleria.THUMBNAIL,function(){this.updateCarousel();});}this.bind(Galleria.IMAGE,function(e){this._options.on_image.call(this,e.imageTarget,e.thumbTarget);});return this;},_run:function(){var self=this,o=this._options,width=0,height=0,optval=typeof o.thumbnails=="string"?o.thumbnails.toLowerCase():null;for(var i=0;this._data[i];i++){var thumb,data=this._data[i],$container;if(o.thumbnails===true){thumb=new Galleria.Picture(i);var src=data.thumb||data.image;this.$("thumbnails").append(thumb.container);$container=$(thumb.container);var getStyle=function(prop){return doc.defaultView&&doc.defaultView.getComputedStyle?doc.defaultView.getComputedStyle(thumb.container,null)[prop]:$container.css(prop);};thumb.data={width:Utils.parseValue(getStyle("width")),height:Utils.parseValue(getStyle("height")),order:i};$container.css((o.thumb_fit&&o.thumb_crop!==true)?{width:0,height:0}:{width:thumb.data.width,height:thumb.data.height});thumb.load(src,function(thumb){thumb.scale({width:thumb.data.width,height:thumb.data.height,crop:o.thumb_crop,margin:o.thumb_margin,complete:function(thumb){var top=["left","top"];var arr=["Width","Height"];$.each(arr,function(i,meassure){var m=meassure.toLowerCase();if((o.thumb_crop!==true||o.thumb_crop==m)&&o.thumb_fit){var css={};css[m]=thumb[m];$(thumb.container).css(css);css={};css[top[i]]=0;$(thumb.image).css(css);}thumb["outer"+meassure]=$(thumb.container)["outer"+meassure](true);});Utils.toggleQuality(thumb.image,o.thumb_quality===true||(o.thumb_quality=="auto"&&thumb.original.width<thumb.width*3));self.trigger({type:Galleria.THUMBNAIL,thumbTarget:thumb.image,index:thumb.data.order});}});});if(o.preload=="all"){thumb.add(data.image);}}else{if(optval=="empty"||optval=="numbers"){thumb={container:Utils.create("galleria-image"),image:Utils.create("img","span"),ready:true};if(optval=="numbers"){$(thumb.image).text(i+1);}$(thumb.container).append(thumb.image);this.$("thumbnails").append(thumb.container);self.trigger({type:Galleria.THUMBNAIL,thumbTarget:thumb.image,index:i});}else{thumb={container:null,image:null};}}$(thumb.container).add(o.keep_source&&o.link_source_images?data.original:null).data("index",i).bind(o.thumb_event_type,function(e){if(o.pause_on_interaction){self.pause();}var index=$(e.currentTarget).data("index");if(self.getIndex()!==index){self.show(index);}e.preventDefault();});this._thumbnails.push(thumb);}Utils.wait({until:function(){self._stageWidth=self.$("stage").width();self._stageHeight=self.$("stage").height();return(self._stageWidth&&self._stageHeight>50);},success:function(){self.trigger(Galleria.READY);},error:function(){Galleria.raise("stage meassures not found");}});},load:function(source,selector,config){var self=this;this._data=[];this._thumbnails=[];this.$("thumbnails").empty();if(typeof selector=="function"){config=selector;selector=null;}source=source||this._options.data_source;selector=selector||this._options.data_selector;config=config||this._options.data_config;if(source.constructor==Array){if(this.validate(source)){this._data=source;this.trigger(Galleria.DATA);}else{Galleria.raise("Load failed: JSON Array not valid.");}return this;}$(source).find(selector).each(function(i,img){var data={},img=$(img),parent=img.parent(),href=parent.attr("href");if(/\.(png|gif|jpg|jpeg)$/i.test(href)){data.image=href;}else{if(href){data.link=href;}}self._data.push($.extend({title:img.attr("title"),thumb:img.attr("src"),image:img.attr("src"),description:img.attr("alt"),link:img.attr("longdesc"),original:img.get(0)},data,config(img)));});if(this.getDataLength()){this.trigger(Galleria.DATA);}else{Galleria.raise("Load failed: no data found.");}return this;},_getActive:function(){return this._controls.getActive();},validate:function(data){return true;},bind:function(type,fn){this.$("container").bind(type,this.proxy(fn));return this;},unbind:function(type){this.$("container").unbind(type);return this;},trigger:function(type){type=typeof type=="object"?$.extend(type,{scope:this}):{type:type,scope:this};this.$("container").trigger(type);return this;},addIdleState:function(elem,styles){this._idle.add.apply(this._idle,Utils.array(arguments));return this;},removeIdleState:function(elem){this._idle.remove.apply(this._idle,Utils.array(arguments));return this;},enterIdleMode:function(){this._idle.hide();return this;},exitIdleMode:function(){this.idle._show();return this;},enterFullscreen:function(callback){this._fullscreen.enter.apply(this,Utils.array(arguments));return this;},exitFullscreen:function(callback){this._fullscreen.exit.apply(this,Utils.array(arguments));return this;},bindTooltip:function(elem,value){this._tooltip.bind.apply(this._tooltip,Utils.array(arguments));return this;},defineTooltip:function(elem,value){this._tooltip.define.apply(this._tooltip,Utils.array(arguments));return this;},refreshTooltip:function(){this._tooltip.refresh.apply(this._tooltip,Utils.array(arguments));return this;},openLightbox:function(){this._lightbox.show.apply(this._lightbox,Utils.array(arguments));return this;},closeLightbox:function(){this._lightbox.hide.apply(this._lightbox,Utils.array(arguments));return this;},getActiveImage:function(){return this._getActive().image||undef;},getActiveThumb:function(){return this._thumbnails[this._active].image||undef;},getMousePosition:function(e){return{x:e.pageX-this.$("stage").offset().left,y:e.pageY-this.$("stage").offset().top};},addPan:function(img){if(this._options.image_crop===false){return;}img=$(img||this.getActiveImage());var self=this,x=img.width()/2,y=img.height()/2,curX=destX=parseInt(img.css("left"))||0,curY=destY=parseInt(img.css("top"))||0,distX=0,distY=0,active=false,ts=Utils.timestamp(),cache=0,move=0,position=function(dist,cur,pos){if(dist>0){move=Math.round(Math.max(dist*-1,Math.min(0,cur)));if(cache!=move){cache=move;if(IE==8){img.parent()["scroll"+pos](move*-1);}else{var css={};css[pos.toLowerCase()]=move;img.css(css);}}}},calculate=function(e){if(Utils.timestamp()-ts<50){return;}active=true;x=self.getMousePosition(e).x;y=self.getMousePosition(e).y;},loop=function(e){if(!active){return;}distX=img.width()-self._stageWidth;distY=img.height()-self._stageHeight;destX=x/self._stageWidth*distX*-1;destY=y/self._stageHeight*distY*-1;curX+=(destX-curX)/self._options.image_pan_smoothness;curY+=(destY-curY)/self._options.image_pan_smoothness;position(distY,curY,"Top");position(distX,curX,"Left");};if(IE==8){img.parent().scrollTop(curY*-1).scrollLeft(curX*-1);img.css({top:0,left:0});}this.$("stage").unbind("mousemove",calculate).bind("mousemove",calculate);Utils.addTimer("pan",loop,50,true);return this;},proxy:function(fn,scope){if(typeof fn!=="function"){return function(){};}scope=scope||this;return function(){return fn.apply(scope,Utils.array(arguments));};},removePan:function(){if(IE==8){}this.$("stage").unbind("mousemove");Utils.clearTimer("pan");this.rescale();return this;},addElement:function(id){var dom=this._dom;$.each(Utils.array(arguments),function(i,blueprint){dom[blueprint]=Utils.create("galleria-"+blueprint);});return this;},attachKeyboard:function(map){this._keyboard.attach.apply(this._keyboard,Utils.array(arguments));return this;},detachKeyboard:function(){this._keyboard.detach.apply(this._keyboard,Utils.array(arguments));return this;},appendChild:function(parentID,childID){this.$(parentID).append(this.get(childID)||childID);return this;},prependChild:function(parentID,childID){this.$(parentID).prepend(this.get(childID)||childID);return this;},remove:function(elemID){this.$(Utils.array(arguments).join(",")).remove();return this;},append:function(data){for(var i in data){if(data[i].constructor==Array){for(var j=0;data[i][j];j++){this.appendChild(i,data[i][j]);}}else{this.appendChild(i,data[i]);}}return this;},_scaleImage:function(image,options){options=$.extend({width:this._stageWidth,height:this._stageHeight,crop:this._options.image_crop,max:this._options.max_scale_ratio,min:this._options.min_scale_ratio,margin:this._options.image_margin,position:this._options.image_position},options);(image||this._controls.getActive()).scale(options);return this;},updateCarousel:function(){this._carousel.update();return this;},rescale:function(width,height,complete){var self=this;if(typeof width=="function"){complete=width;width=undef;}var scale=function(){var o=self._options;self._stageWidth=width||self.$("stage").width();self._stageHeight=height||self.$("stage").height();self._scaleImage();if(self._options.carousel){self.updateCarousel();}self.trigger(Galleria.RESCALE);if(typeof complete=="function"){complete.call(self);}};if(Galleria.WEBKIT&&!width&&!height){Utils.addTimer("scale",scale,5);}else{scale.call(self);}return this;},refreshImage:function(){this._scaleImage();if(this._options.image_pan){this.addPan();}return this;},show:function(index,rewind,_history){if(index===false||!this._options.queue&&this._queue.stalled){return;}index=Math.max(0,Math.min(parseInt(index),this.getDataLength()-1));rewind=typeof rewind!="undefined"?!!rewind:index<this.getIndex();_history=_history||false;if(!_history&&Galleria.History){Galleria.History.value(index.toString());return;}this._active=index;Array.prototype.push.call(this._queue,{index:index,rewind:rewind});if(!this._queue.stalled){this._show();}return this;},_show:function(){var self=this,queue=this._queue[0],data=this.getData(queue.index);if(!data){return;}var src=data.image,active=this._controls.getActive(),next=this._controls.getNext(),cached=next.isCached(src),thumb=this._thumbnails[queue.index];var complete=function(){self._queue.stalled=false;Utils.toggleQuality(next.image,self._options.image_quality);$(active.container).css({zIndex:0,opacity:0});$(next.container).css({zIndex:1,opacity:1});self._controls.swap();if(self._options.image_pan){self.addPan(next.image);}if(data.link){$(next.image).css({cursor:"pointer"}).bind(CLICK(),function(){if(self._options.popup_links){var win=window.open(data.link,"_blank");}else{window.location.href=data.link;}});}Array.prototype.shift.call(self._queue);if(self._queue.length){self._show();}self._playCheck();self.trigger({type:Galleria.IMAGE,index:queue.index,imageTarget:next.image,thumbTarget:thumb.image});};if(this._options.carousel&&this._options.carousel_follow){this._carousel.follow(queue.index);}if(this._options.preload){var p,n=this.getNext();try{for(var i=this._options.preload;i>0;i--){p=new Galleria.Picture();p.add(self.getData(n).image);n=self.getNext(n);}}catch(e){}}Utils.show(next.container);$(self._thumbnails[queue.index].container).addClass("active").siblings(".active").removeClass("active");self.trigger({type:Galleria.LOADSTART,cached:cached,index:queue.index,imageTarget:next.image,thumbTarget:thumb.image});next.load(src,function(next){self._scaleImage(next,{complete:function(next){Utils.show(next.container);if("image" in active){Utils.toggleQuality(active.image,false);}Utils.toggleQuality(next.image,false);self._queue.stalled=true;self.removePan();self.setInfo(queue.index);self.setCounter(queue.index);self.trigger({type:Galleria.LOADFINISH,cached:cached,index:queue.index,imageTarget:next.image,thumbTarget:self._thumbnails[queue.index].image});var transition=active.image===null&&self._options.transition_initial?self._options.transition_initial:self._options.transition;if(transition in _transitions===false){complete();}else{var params={prev:active.image,next:next.image,rewind:queue.rewind,speed:self._options.transition_speed||400};_transitions[transition].call(self,params,complete);}}});});},getNext:function(base){base=typeof base=="number"?base:this.getIndex();return base==this.getDataLength()-1?0:base+1;},getPrev:function(base){base=typeof base=="number"?base:this.getIndex();return base===0?this.getDataLength()-1:base-1;},next:function(){if(this.getDataLength()>1){this.show(this.getNext(),false);}return this;},prev:function(){if(this.getDataLength()>1){this.show(this.getPrev(),true);}return this;},get:function(elemId){return elemId in this._dom?this._dom[elemId]:null;},getData:function(index){return index in this._data?this._data[index]:this._data[this._active];},getDataLength:function(){return this._data.length;},getIndex:function(){return typeof this._active==="number"?this._active:false;},getStageHeight:function(){return this._stageHeight;},getStageWidth:function(){return this._stageWidth;},getOptions:function(key){return typeof key=="undefined"?this._options:this._options[key];},setOptions:function(key,value){if(typeof key=="object"){$.extend(this._options,key);}else{this._options[key]=value;}return this;},play:function(delay){this.trigger(Galleria.PLAY);this._playing=true;this._playtime=delay||this._playtime;this._playCheck();return this;},pause:function(){this.trigger(Galleria.PAUSE);this._playing=false;return this;},playToggle:function(delay){return(this._playing)?this.pause():this.play(delay);},_playCheck:function(){var self=this,played=0,interval=20,now=Utils.timestamp();if(this._playing){Utils.clearTimer("play");var fn=function(){played=Utils.timestamp()-now;if(played>=self._playtime&&self._playing){Utils.clearTimer("play");self.next();return;}if(self._playing){self.trigger({type:Galleria.PROGRESS,percent:Math.ceil(played/self._playtime*100),seconds:Math.floor(played/1000),milliseconds:played});Utils.addTimer("play",fn,interval);}};Utils.addTimer("play",fn,interval);}},setIndex:function(val){this._active=val;return this;},setCounter:function(index){if(typeof index=="number"){index++;}else{if(typeof index=="undefined"){index=this.getIndex()+1;}}this.get("current").innerHTML=index;if(IE==8){var opacity=this.$("counter").css("opacity");this.$("counter").css("opacity",opacity);}return this;},setInfo:function(index){var self=this,data=this.getData(index);$.each(["title","description","author"],function(i,type){var elem=self.$("info-"+type);if(!!data[type]){elem[data[type].length?"show":"hide"]().html(data[type]);}else{elem.empty().hide();}});return this;},hasInfo:function(index){var d=this.getData(index);var check="title description".split(" ");for(var i=0;check[i];i++){if(!!this.getData(index)[check[i]]){return true;}}return false;},jQuery:function(str){var self=this,ret=[];$.each(str.split(","),function(i,elemId){elemId=$.trim(elemId);if(self.get(elemId)){ret.push(elemId);}});var jQ=$(self.get(ret.shift()));$.each(ret,function(i,elemId){jQ=jQ.add(self.get(elemId));});return jQ;},$:function(){return this.jQuery.apply(this,Utils.array(arguments));}};$.extend(Galleria,{DATA:"g_data",READY:"g_ready",THUMBNAIL:"g_thumbnail",LOADSTART:"g_loadstart",LOADFINISH:"g_loadfinish",IMAGE:"g_image",THEMELOAD:"g_themeload",PLAY:"g_play",PAUSE:"g_pause",PROGRESS:"g_progress",FULLSCREEN_ENTER:"g_fullscreen_enter",FULLSCREEN_EXIT:"g_fullscreen_exit",IDLE_ENTER:"g_idle_enter",IDLE_EXIT:"g_idle_exit",RESCALE:"g_rescale",LIGHTBOX_OPEN:"g_lightbox_open",LIGHTBOX_CLOSE:"g_lightbox_close",LIGHTBOX_IMAGE:"g_lightbox_image",IE9:IE==9,IE8:IE==8,IE7:IE==7,IE6:IE==6,IE:!!IE,WEBKIT:/webkit/.test(NAV),SAFARI:/safari/.test(NAV),CHROME:/chrome/.test(NAV),QUIRK:(IE&&doc.compatMode&&doc.compatMode=="BackCompat"),MAC:/mac/.test(navigator.platform.toLowerCase()),OPERA:!!window.opera,IPHONE:/iphone/.test(NAV),IPAD:/ipad/.test(NAV),ANDROID:/android/.test(NAV),TOUCH:!!(/iphone/.test(NAV)||/ipad/.test(NAV)||/android/.test(NAV))});Galleria.addTheme=function(theme){if(!!theme["name"]===false){Galleria.raise("No theme name specified");}if(typeof theme.defaults!="object"){theme.defaults={};}if(typeof theme.css=="string"){var css;$("script").each(function(i,script){var reg=new RegExp("galleria\\."+theme.name.toLowerCase()+"\\.");if(reg.test(script.src)){css=script.src.replace(/[^\/]*$/,"")+theme.css;Utils.addTimer("css",function(){Utils.loadCSS(css,"galleria-theme",function(){Galleria.theme=theme;$doc.trigger(Galleria.THEMELOAD);});},1);}});if(!css){Galleria.raise("No theme CSS loaded");}}return theme;};Galleria.loadTheme=function(src,options){var loaded=false,length=_galleries.length;Galleria.theme=undef;Utils.loadScript(src,function(){loaded=true;});Utils.wait({until:function(){return loaded;},error:function(){Galleria.raise("Theme at "+src+" could not load, check theme path.",true);},success:function(){if(length){var refreshed=[];$.each(Galleria.get(),function(i,instance){var op=$.extend(instance._original.options,{data_source:instance._data},options);instance.$("container").remove();var g=new Galleria();g._id=instance._id;g.init(instance._original.target,op);refreshed.push(g);});_galleries=refreshed;}},timeout:1000});};Galleria.get=function(index){if(!!_galleries[index]){return _galleries[index];}else{if(typeof index!=="number"){return _galleries;}else{Galleria.raise("Gallery index "+index+" not found");}}};Galleria.addTransition=function(name,fn){_transitions[name]=fn;};Galleria.utils=Utils;Galleria.log=function(){try{window.console.log.apply(window.console,Utils.array(arguments));}catch(e){try{opera.postError.apply(opera,arguments);}catch(er){alert(Utils.array(arguments).split(", "));}}};Galleria.raise=function(msg,fatal){if(DEBUG||fatal){var type=fatal?"Fatal error":"Error";throw new Error(type+": "+msg);}};Galleria.Picture=function(id){this.id=id||null;this.image=null;this.container=Utils.create("galleria-image");$(this.container).css({overflow:"hidden",position:"relative"});this.original={width:0,height:0};this.ready=false;this.loaded=false;};Galleria.Picture.prototype={cache:{},add:function(src){var self=this;var image=new Image();$(image).css("display","block");if(self.cache[src]){image.src=src;self.loaded=true;self.original={height:image.height,width:image.width};return image;}image.onload=function(){self.original={height:this.height,width:this.width};self.cache[src]=src;self.loaded=true;};image.src=src;return image;},show:function(){Utils.show(this.image);},hide:function(){Utils.moveOut(this.image);},clear:function(){this.image=null;},isCached:function(src){return !!this.cache[src];},load:function(src,callback){var self=this;$(this.container).empty(true);this.image=this.add(src);Utils.hide(this.image);$(this.container).append(this.image);Utils.wait({until:function(){return self.loaded&&self.image.complete&&self.image.width;},success:function(){window.setTimeout(function(){callback.call(self,self);},50);},error:function(){window.setTimeout(function(){callback.call(self,self);},50);Galleria.raise("image not loaded in 10 seconds: "+src);},timeout:10000});return this.container;},scale:function(options){options=$.extend({width:0,height:0,min:undef,max:undef,margin:0,complete:function(){},position:"center",crop:false},options);if(!this.image){return this.container;}var width,height,self=this,$container=$(self.container);Utils.wait({until:function(){width=options.width||$container.width()||Utils.parseValue($container.css("width"));height=options.height||$container.height()||Utils.parseValue($container.css("height"));return width&&height;},success:function(){var newWidth=(width-options.margin*2)/self.original.width,newHeight=(height-options.margin*2)/self.original.height,cropMap={"true":Math.max(newWidth,newHeight),"width":newWidth,"height":newHeight,"false":Math.min(newWidth,newHeight)},ratio=cropMap[options.crop.toString()];if(options.max){ratio=Math.min(options.max,ratio);}if(options.min){ratio=Math.max(options.min,ratio);}$(self.container).width(width).height(height);$.each(["width","height"],function(i,m){$(self.image)[m](self[m]=Math.ceil(self.original[m]*ratio));});var pos={},mix={},getPosition=function(value,meassure,margin){var result=0;if(/\%/.test(value)){var flt=parseInt(value)/100;result=Math.ceil($(self.image)[meassure]()*-1*flt+margin*flt);}else{result=Utils.parseValue(value);}return result;},positionMap={"top":{top:0},"left":{left:0},"right":{left:"100%"},"bottom":{top:"100%"}};$.each(options.position.toLowerCase().split(" "),function(i,value){if(value=="center"){value="50%";}pos[i?"top":"left"]=value;});$.each(pos,function(i,value){if(positionMap.hasOwnProperty(value)){$.extend(mix,positionMap[value]);}});pos=pos.top?$.extend(pos,mix):mix;pos=$.extend({top:"50%",left:"50%"},pos);$(self.image).css({position:"relative",top:getPosition(pos.top,"height",height),left:getPosition(pos.left,"width",width)});self.show();self.ready=true;options.complete.call(self,self);},error:function(){Galleria.raise("Could not scale image: "+self.image.src);},timeout:1000});return this;}};$.extend($.easing,{galleria:function(_,t,b,c,d){if((t/=d/2)<1){return c/2*t*t*t*t+b;}return -c/2*((t-=2)*t*t*t-2)+b;},galleriaIn:function(_,t,b,c,d){return c*(t/=d)*t*t*t+b;},galleriaOut:function(_,t,b,c,d){return -c*((t=t/d-1)*t*t*t-1)+b;}});$.fn.galleria=function(options){return this.each(function(){var gallery=new Galleria();gallery.init(this,options);});};window.Galleria=Galleria;})(jQuery);

function DisableForm(form_id)
{
	/*$("#" + form_id).css("opacity", 0.5);*/

	$("#" + form_id + " :input").attr("disabled", "disabled");
	$("#" + form_id + " *").not(":hidden").fadeTo("normal", 0.5);
}

function EnableForm(form_id)
{
	/*$("#" + form_id).css("opacity", 1);*/

	$("#" + form_id + " *").not(":hidden").fadeTo("normal", 1);
	$("#" + form_id + " :input").removeAttr("disabled");
}

function refreshCaptcha(img_id)
{
	//alert(img_id);

	$.post("captcha/captcha.php",
		{ },
		function(data)
		{
			/*alert("Ответ: " + data);
			return;*/

			$("#" + img_id).attr("src", "captcha/captcha.php?" + (new Date()).getTime());
		});
}


