var SWFUpload;if(SWFUpload==undefined){SWFUpload=function(settings){this.initSWFUpload(settings);};}
SWFUpload.prototype.initSWFUpload=function(settings){try{this.customSettings={};this.settings=settings;this.eventQueue=[];this.movieName="SWFUpload_"+SWFUpload.movieCount++;this.movieElement=null;SWFUpload.instances[this.movieName]=this;this.initSettings();this.loadFlash();this.displayDebugInfo();}catch(ex){delete SWFUpload.instances[this.movieName];throw ex;}};SWFUpload.instances={};SWFUpload.movieCount=0;SWFUpload.version="2.2.0 2009-03-25";SWFUpload.QUEUE_ERROR={QUEUE_LIMIT_EXCEEDED:-100,FILE_EXCEEDS_SIZE_LIMIT:-110,ZERO_BYTE_FILE:-120,INVALID_FILETYPE:-130};SWFUpload.UPLOAD_ERROR={HTTP_ERROR:-200,MISSING_UPLOAD_URL:-210,IO_ERROR:-220,SECURITY_ERROR:-230,UPLOAD_LIMIT_EXCEEDED:-240,UPLOAD_FAILED:-250,SPECIFIED_FILE_ID_NOT_FOUND:-260,FILE_VALIDATION_FAILED:-270,FILE_CANCELLED:-280,UPLOAD_STOPPED:-290};SWFUpload.FILE_STATUS={QUEUED:-1,IN_PROGRESS:-2,ERROR:-3,COMPLETE:-4,CANCELLED:-5};SWFUpload.BUTTON_ACTION={SELECT_FILE:-100,SELECT_FILES:-110,START_UPLOAD:-120};SWFUpload.CURSOR={ARROW:-1,HAND:-2};SWFUpload.WINDOW_MODE={WINDOW:"window",TRANSPARENT:"transparent",OPAQUE:"opaque"};SWFUpload.completeURL=function(url){if(typeof(url)!=="string"||url.match(/^https?:\/\//i)||url.match(/^\//)){return url;}
var currentURL=window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"");var indexSlash=window.location.pathname.lastIndexOf("/");if(indexSlash<=0){path="/";}else{path=window.location.pathname.substr(0,indexSlash)+"/";}
return path+url;};SWFUpload.prototype.initSettings=function(){this.ensureDefault=function(settingName,defaultValue){this.settings[settingName]=(this.settings[settingName]==undefined)?defaultValue:this.settings[settingName];};this.ensureDefault("upload_url","");this.ensureDefault("preserve_relative_urls",false);this.ensureDefault("file_post_name","Filedata");this.ensureDefault("post_params",{});this.ensureDefault("use_query_string",false);this.ensureDefault("requeue_on_error",false);this.ensureDefault("http_success",[]);this.ensureDefault("assume_success_timeout",0);this.ensureDefault("file_types","*.*");this.ensureDefault("file_types_description","All Files");this.ensureDefault("file_size_limit",0);this.ensureDefault("file_upload_limit",0);this.ensureDefault("file_queue_limit",0);this.ensureDefault("flash_url","swfupload.swf");this.ensureDefault("prevent_swf_caching",true);this.ensureDefault("button_image_url","");this.ensureDefault("button_width",1);this.ensureDefault("button_height",1);this.ensureDefault("button_text","");this.ensureDefault("button_text_style","color: #000000; font-size: 16pt;");this.ensureDefault("button_text_top_padding",0);this.ensureDefault("button_text_left_padding",0);this.ensureDefault("button_action",SWFUpload.BUTTON_ACTION.SELECT_FILES);this.ensureDefault("button_disabled",false);this.ensureDefault("button_placeholder_id","");this.ensureDefault("button_placeholder",null);this.ensureDefault("button_cursor",SWFUpload.CURSOR.ARROW);this.ensureDefault("button_window_mode",SWFUpload.WINDOW_MODE.WINDOW);this.ensureDefault("debug",false);this.settings.debug_enabled=this.settings.debug;this.settings.return_upload_start_handler=this.returnUploadStart;this.ensureDefault("swfupload_loaded_handler",null);this.ensureDefault("file_dialog_start_handler",null);this.ensureDefault("file_queued_handler",null);this.ensureDefault("file_queue_error_handler",null);this.ensureDefault("file_dialog_complete_handler",null);this.ensureDefault("upload_start_handler",null);this.ensureDefault("upload_progress_handler",null);this.ensureDefault("upload_error_handler",null);this.ensureDefault("upload_success_handler",null);this.ensureDefault("upload_complete_handler",null);this.ensureDefault("debug_handler",this.debugMessage);this.ensureDefault("custom_settings",{});this.customSettings=this.settings.custom_settings;if(!!this.settings.prevent_swf_caching){this.settings.flash_url=this.settings.flash_url+(this.settings.flash_url.indexOf("?")<0?"?":"&")+"preventswfcaching="+new Date().getTime();}
if(!this.settings.preserve_relative_urls){this.settings.upload_url=SWFUpload.completeURL(this.settings.upload_url);this.settings.button_image_url=SWFUpload.completeURL(this.settings.button_image_url);}
delete this.ensureDefault;};SWFUpload.prototype.loadFlash=function(){var targetElement,tempParent;if(document.getElementById(this.movieName)!==null){throw"ID "+this.movieName+" is already in use. The Flash Object could not be added";}
targetElement=document.getElementById(this.settings.button_placeholder_id)||this.settings.button_placeholder;if(targetElement==undefined){throw"Could not find the placeholder element: "+this.settings.button_placeholder_id;}
tempParent=document.createElement("div");tempParent.innerHTML=this.getFlashHTML();targetElement.parentNode.replaceChild(tempParent.firstChild,targetElement);if(window[this.movieName]==undefined){window[this.movieName]=this.getMovieElement();}};SWFUpload.prototype.getFlashHTML=function(){return['<object id="',this.movieName,'" type="application/x-shockwave-flash" data="',this.settings.flash_url,'" width="',this.settings.button_width,'" height="',this.settings.button_height,'" class="swfupload">','<param name="wmode" value="',this.settings.button_window_mode,'" />','<param name="movie" value="',this.settings.flash_url,'" />','<param name="quality" value="high" />','<param name="menu" value="false" />','<param name="allowScriptAccess" value="always" />','<param name="flashvars" value="'+this.getFlashVars()+'" />','</object>'].join("");};SWFUpload.prototype.getFlashVars=function(){var paramString=this.buildParamString();var httpSuccessString=this.settings.http_success.join(",");return["movieName=",encodeURIComponent(this.movieName),"&amp;uploadURL=",encodeURIComponent(this.settings.upload_url),"&amp;useQueryString=",encodeURIComponent(this.settings.use_query_string),"&amp;requeueOnError=",encodeURIComponent(this.settings.requeue_on_error),"&amp;httpSuccess=",encodeURIComponent(httpSuccessString),"&amp;assumeSuccessTimeout=",encodeURIComponent(this.settings.assume_success_timeout),"&amp;params=",encodeURIComponent(paramString),"&amp;filePostName=",encodeURIComponent(this.settings.file_post_name),"&amp;fileTypes=",encodeURIComponent(this.settings.file_types),"&amp;fileTypesDescription=",encodeURIComponent(this.settings.file_types_description),"&amp;fileSizeLimit=",encodeURIComponent(this.settings.file_size_limit),"&amp;fileUploadLimit=",encodeURIComponent(this.settings.file_upload_limit),"&amp;fileQueueLimit=",encodeURIComponent(this.settings.file_queue_limit),"&amp;debugEnabled=",encodeURIComponent(this.settings.debug_enabled),"&amp;buttonImageURL=",encodeURIComponent(this.settings.button_image_url),"&amp;buttonWidth=",encodeURIComponent(this.settings.button_width),"&amp;buttonHeight=",encodeURIComponent(this.settings.button_height),"&amp;buttonText=",encodeURIComponent(this.settings.button_text),"&amp;buttonTextTopPadding=",encodeURIComponent(this.settings.button_text_top_padding),"&amp;buttonTextLeftPadding=",encodeURIComponent(this.settings.button_text_left_padding),"&amp;buttonTextStyle=",encodeURIComponent(this.settings.button_text_style),"&amp;buttonAction=",encodeURIComponent(this.settings.button_action),"&amp;buttonDisabled=",encodeURIComponent(this.settings.button_disabled),"&amp;buttonCursor=",encodeURIComponent(this.settings.button_cursor)].join("");};SWFUpload.prototype.getMovieElement=function(){if(this.movieElement==undefined){this.movieElement=document.getElementById(this.movieName);}
if(this.movieElement===null){throw"Could not find Flash element";}
return this.movieElement;};SWFUpload.prototype.buildParamString=function(){var postParams=this.settings.post_params;var paramStringPairs=[];if(typeof(postParams)==="object"){for(var name in postParams){if(postParams.hasOwnProperty(name)){paramStringPairs.push(encodeURIComponent(name.toString())+"="+encodeURIComponent(postParams[name].toString()));}}}
return paramStringPairs.join("&amp;");};SWFUpload.prototype.destroy=function(){try{this.cancelUpload(null,false);var movieElement=null;movieElement=this.getMovieElement();if(movieElement&&typeof(movieElement.CallFunction)==="unknown"){for(var i in movieElement){try{if(typeof(movieElement[i])==="function"){movieElement[i]=null;}}catch(ex1){}}
try{movieElement.parentNode.removeChild(movieElement);}catch(ex){}}
window[this.movieName]=null;SWFUpload.instances[this.movieName]=null;delete SWFUpload.instances[this.movieName];this.movieElement=null;this.settings=null;this.customSettings=null;this.eventQueue=null;this.movieName=null;return true;}catch(ex2){return false;}};SWFUpload.prototype.displayDebugInfo=function(){this.debug(["---SWFUpload Instance Info---\n","Version: ",SWFUpload.version,"\n","Movie Name: ",this.movieName,"\n","Settings:\n","\t","upload_url:               ",this.settings.upload_url,"\n","\t","flash_url:                ",this.settings.flash_url,"\n","\t","use_query_string:         ",this.settings.use_query_string.toString(),"\n","\t","requeue_on_error:         ",this.settings.requeue_on_error.toString(),"\n","\t","http_success:             ",this.settings.http_success.join(", "),"\n","\t","assume_success_timeout:   ",this.settings.assume_success_timeout,"\n","\t","file_post_name:           ",this.settings.file_post_name,"\n","\t","post_params:              ",this.settings.post_params.toString(),"\n","\t","file_types:               ",this.settings.file_types,"\n","\t","file_types_description:   ",this.settings.file_types_description,"\n","\t","file_size_limit:          ",this.settings.file_size_limit,"\n","\t","file_upload_limit:        ",this.settings.file_upload_limit,"\n","\t","file_queue_limit:         ",this.settings.file_queue_limit,"\n","\t","debug:                    ",this.settings.debug.toString(),"\n","\t","prevent_swf_caching:      ",this.settings.prevent_swf_caching.toString(),"\n","\t","button_placeholder_id:    ",this.settings.button_placeholder_id.toString(),"\n","\t","button_placeholder:       ",(this.settings.button_placeholder?"Set":"Not Set"),"\n","\t","button_image_url:         ",this.settings.button_image_url.toString(),"\n","\t","button_width:             ",this.settings.button_width.toString(),"\n","\t","button_height:            ",this.settings.button_height.toString(),"\n","\t","button_text:              ",this.settings.button_text.toString(),"\n","\t","button_text_style:        ",this.settings.button_text_style.toString(),"\n","\t","button_text_top_padding:  ",this.settings.button_text_top_padding.toString(),"\n","\t","button_text_left_padding: ",this.settings.button_text_left_padding.toString(),"\n","\t","button_action:            ",this.settings.button_action.toString(),"\n","\t","button_disabled:          ",this.settings.button_disabled.toString(),"\n","\t","custom_settings:          ",this.settings.custom_settings.toString(),"\n","Event Handlers:\n","\t","swfupload_loaded_handler assigned:  ",(typeof this.settings.swfupload_loaded_handler==="function").toString(),"\n","\t","file_dialog_start_handler assigned: ",(typeof this.settings.file_dialog_start_handler==="function").toString(),"\n","\t","file_queued_handler assigned:       ",(typeof this.settings.file_queued_handler==="function").toString(),"\n","\t","file_queue_error_handler assigned:  ",(typeof this.settings.file_queue_error_handler==="function").toString(),"\n","\t","upload_start_handler assigned:      ",(typeof this.settings.upload_start_handler==="function").toString(),"\n","\t","upload_progress_handler assigned:   ",(typeof this.settings.upload_progress_handler==="function").toString(),"\n","\t","upload_error_handler assigned:      ",(typeof this.settings.upload_error_handler==="function").toString(),"\n","\t","upload_success_handler assigned:    ",(typeof this.settings.upload_success_handler==="function").toString(),"\n","\t","upload_complete_handler assigned:   ",(typeof this.settings.upload_complete_handler==="function").toString(),"\n","\t","debug_handler assigned:             ",(typeof this.settings.debug_handler==="function").toString(),"\n"].join(""));};SWFUpload.prototype.addSetting=function(name,value,default_value){if(value==undefined){return(this.settings[name]=default_value);}else{return(this.settings[name]=value);}};SWFUpload.prototype.getSetting=function(name){if(this.settings[name]!=undefined){return this.settings[name];}
return"";};SWFUpload.prototype.callFlash=function(functionName,argumentArray){argumentArray=argumentArray||[];var movieElement=this.getMovieElement();var returnValue,returnString;try{returnString=movieElement.CallFunction('<invoke name="'+functionName+'" returntype="javascript">'+__flash__argumentsToXML(argumentArray,0)+'</invoke>');returnValue=eval(returnString);}catch(ex){throw"Call to "+functionName+" failed";}
if(returnValue!=undefined&&typeof returnValue.post==="object"){returnValue=this.unescapeFilePostParams(returnValue);}
return returnValue;};SWFUpload.prototype.selectFile=function(){this.callFlash("SelectFile");};SWFUpload.prototype.selectFiles=function(){this.callFlash("SelectFiles");};SWFUpload.prototype.startUpload=function(fileID){this.callFlash("StartUpload",[fileID]);};SWFUpload.prototype.cancelUpload=function(fileID,triggerErrorEvent){if(triggerErrorEvent!==false){triggerErrorEvent=true;}
this.callFlash("CancelUpload",[fileID,triggerErrorEvent]);};SWFUpload.prototype.stopUpload=function(){this.callFlash("StopUpload");};SWFUpload.prototype.getStats=function(){return this.callFlash("GetStats");};SWFUpload.prototype.setStats=function(statsObject){this.callFlash("SetStats",[statsObject]);};SWFUpload.prototype.getFile=function(fileID){if(typeof(fileID)==="number"){return this.callFlash("GetFileByIndex",[fileID]);}else{return this.callFlash("GetFile",[fileID]);}};SWFUpload.prototype.addFileParam=function(fileID,name,value){return this.callFlash("AddFileParam",[fileID,name,value]);};SWFUpload.prototype.removeFileParam=function(fileID,name){this.callFlash("RemoveFileParam",[fileID,name]);};SWFUpload.prototype.setUploadURL=function(url){this.settings.upload_url=url.toString();this.callFlash("SetUploadURL",[url]);};SWFUpload.prototype.setPostParams=function(paramsObject){this.settings.post_params=paramsObject;this.callFlash("SetPostParams",[paramsObject]);};SWFUpload.prototype.addPostParam=function(name,value){this.settings.post_params[name]=value;this.callFlash("SetPostParams",[this.settings.post_params]);};SWFUpload.prototype.removePostParam=function(name){delete this.settings.post_params[name];this.callFlash("SetPostParams",[this.settings.post_params]);};SWFUpload.prototype.setFileTypes=function(types,description){this.settings.file_types=types;this.settings.file_types_description=description;this.callFlash("SetFileTypes",[types,description]);};SWFUpload.prototype.setFileSizeLimit=function(fileSizeLimit){this.settings.file_size_limit=fileSizeLimit;this.callFlash("SetFileSizeLimit",[fileSizeLimit]);};SWFUpload.prototype.setFileUploadLimit=function(fileUploadLimit){this.settings.file_upload_limit=fileUploadLimit;this.callFlash("SetFileUploadLimit",[fileUploadLimit]);};SWFUpload.prototype.setFileQueueLimit=function(fileQueueLimit){this.settings.file_queue_limit=fileQueueLimit;this.callFlash("SetFileQueueLimit",[fileQueueLimit]);};SWFUpload.prototype.setFilePostName=function(filePostName){this.settings.file_post_name=filePostName;this.callFlash("SetFilePostName",[filePostName]);};SWFUpload.prototype.setUseQueryString=function(useQueryString){this.settings.use_query_string=useQueryString;this.callFlash("SetUseQueryString",[useQueryString]);};SWFUpload.prototype.setRequeueOnError=function(requeueOnError){this.settings.requeue_on_error=requeueOnError;this.callFlash("SetRequeueOnError",[requeueOnError]);};SWFUpload.prototype.setHTTPSuccess=function(http_status_codes){if(typeof http_status_codes==="string"){http_status_codes=http_status_codes.replace(" ","").split(",");}
this.settings.http_success=http_status_codes;this.callFlash("SetHTTPSuccess",[http_status_codes]);};SWFUpload.prototype.setAssumeSuccessTimeout=function(timeout_seconds){this.settings.assume_success_timeout=timeout_seconds;this.callFlash("SetAssumeSuccessTimeout",[timeout_seconds]);};SWFUpload.prototype.setDebugEnabled=function(debugEnabled){this.settings.debug_enabled=debugEnabled;this.callFlash("SetDebugEnabled",[debugEnabled]);};SWFUpload.prototype.setButtonImageURL=function(buttonImageURL){if(buttonImageURL==undefined){buttonImageURL="";}
this.settings.button_image_url=buttonImageURL;this.callFlash("SetButtonImageURL",[buttonImageURL]);};SWFUpload.prototype.setButtonDimensions=function(width,height){this.settings.button_width=width;this.settings.button_height=height;var movie=this.getMovieElement();if(movie!=undefined){movie.style.width=width+"px";movie.style.height=height+"px";}
this.callFlash("SetButtonDimensions",[width,height]);};SWFUpload.prototype.setButtonText=function(html){this.settings.button_text=html;this.callFlash("SetButtonText",[html]);};SWFUpload.prototype.setButtonTextPadding=function(left,top){this.settings.button_text_top_padding=top;this.settings.button_text_left_padding=left;this.callFlash("SetButtonTextPadding",[left,top]);};SWFUpload.prototype.setButtonTextStyle=function(css){this.settings.button_text_style=css;this.callFlash("SetButtonTextStyle",[css]);};SWFUpload.prototype.setButtonDisabled=function(isDisabled){this.settings.button_disabled=isDisabled;this.callFlash("SetButtonDisabled",[isDisabled]);};SWFUpload.prototype.setButtonAction=function(buttonAction){this.settings.button_action=buttonAction;this.callFlash("SetButtonAction",[buttonAction]);};SWFUpload.prototype.setButtonCursor=function(cursor){this.settings.button_cursor=cursor;this.callFlash("SetButtonCursor",[cursor]);};SWFUpload.prototype.queueEvent=function(handlerName,argumentArray){if(argumentArray==undefined){argumentArray=[];}else if(!(argumentArray instanceof Array)){argumentArray=[argumentArray];}
var self=this;if(typeof this.settings[handlerName]==="function"){this.eventQueue.push(function(){this.settings[handlerName].apply(this,argumentArray);});setTimeout(function(){self.executeNextEvent();},0);}else if(this.settings[handlerName]!==null){throw"Event handler "+handlerName+" is unknown or is not a function";}};SWFUpload.prototype.executeNextEvent=function(){var f=this.eventQueue?this.eventQueue.shift():null;if(typeof(f)==="function"){f.apply(this);}};SWFUpload.prototype.unescapeFilePostParams=function(file){var reg=/[$]([0-9a-f]{4})/i;var unescapedPost={};var uk;if(file!=undefined){for(var k in file.post){if(file.post.hasOwnProperty(k)){uk=k;var match;while((match=reg.exec(uk))!==null){uk=uk.replace(match[0],String.fromCharCode(parseInt("0x"+match[1],16)));}
unescapedPost[uk]=file.post[k];}}
file.post=unescapedPost;}
return file;};SWFUpload.prototype.testExternalInterface=function(){try{return this.callFlash("TestExternalInterface");}catch(ex){return false;}};SWFUpload.prototype.flashReady=function(){var movieElement=this.getMovieElement();if(!movieElement){this.debug("Flash called back ready but the flash movie can't be found.");return;}
this.cleanUp(movieElement);this.queueEvent("swfupload_loaded_handler");};SWFUpload.prototype.cleanUp=function(movieElement){try{if(this.movieElement&&typeof(movieElement.CallFunction)==="unknown"){this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");for(var key in movieElement){try{if(typeof(movieElement[key])==="function"){movieElement[key]=null;}}catch(ex){}}}}catch(ex1){}
window["__flash__removeCallback"]=function(instance,name){try{if(instance){instance[name]=null;}}catch(flashEx){}};};SWFUpload.prototype.fileDialogStart=function(){this.queueEvent("file_dialog_start_handler");};SWFUpload.prototype.fileQueued=function(file){file=this.unescapeFilePostParams(file);this.queueEvent("file_queued_handler",file);};SWFUpload.prototype.fileQueueError=function(file,errorCode,message){file=this.unescapeFilePostParams(file);this.queueEvent("file_queue_error_handler",[file,errorCode,message]);};SWFUpload.prototype.fileDialogComplete=function(numFilesSelected,numFilesQueued,numFilesInQueue){this.queueEvent("file_dialog_complete_handler",[numFilesSelected,numFilesQueued,numFilesInQueue]);};SWFUpload.prototype.uploadStart=function(file){file=this.unescapeFilePostParams(file);this.queueEvent("return_upload_start_handler",file);};SWFUpload.prototype.returnUploadStart=function(file){var returnValue;if(typeof this.settings.upload_start_handler==="function"){file=this.unescapeFilePostParams(file);returnValue=this.settings.upload_start_handler.call(this,file);}else if(this.settings.upload_start_handler!=undefined){throw"upload_start_handler must be a function";}
if(returnValue===undefined){returnValue=true;}
returnValue=!!returnValue;this.callFlash("ReturnUploadStart",[returnValue]);};SWFUpload.prototype.uploadProgress=function(file,bytesComplete,bytesTotal){file=this.unescapeFilePostParams(file);this.queueEvent("upload_progress_handler",[file,bytesComplete,bytesTotal]);};SWFUpload.prototype.uploadError=function(file,errorCode,message){file=this.unescapeFilePostParams(file);this.queueEvent("upload_error_handler",[file,errorCode,message]);};SWFUpload.prototype.uploadSuccess=function(file,serverData,responseReceived){file=this.unescapeFilePostParams(file);this.queueEvent("upload_success_handler",[file,serverData,responseReceived]);};SWFUpload.prototype.uploadComplete=function(file){file=this.unescapeFilePostParams(file);this.queueEvent("upload_complete_handler",file);};SWFUpload.prototype.debug=function(message){this.queueEvent("debug_handler",message);};SWFUpload.prototype.debugMessage=function(message){if(this.settings.debug){var exceptionMessage,exceptionValues=[];if(typeof message==="object"&&typeof message.name==="string"&&typeof message.message==="string"){for(var key in message){if(message.hasOwnProperty(key)){exceptionValues.push(key+": "+message[key]);}}
exceptionMessage=exceptionValues.join("\n")||"";exceptionValues=exceptionMessage.split("\n");exceptionMessage="EXCEPTION: "+exceptionValues.join("\nEXCEPTION: ");SWFUpload.Console.writeLine(exceptionMessage);}else{SWFUpload.Console.writeLine(message);}}};SWFUpload.Console={};SWFUpload.Console.writeLine=function(message){var console,documentForm;try{console=document.getElementById("SWFUpload_Console");if(!console){documentForm=document.createElement("form");document.getElementsByTagName("body")[0].appendChild(documentForm);console=document.createElement("textarea");console.id="SWFUpload_Console";console.style.fontFamily="monospace";console.setAttribute("wrap","off");console.wrap="off";console.style.overflow="auto";console.style.width="700px";console.style.height="350px";console.style.margin="5px";documentForm.appendChild(console);}
console.value+=message+"\n";console.scrollTop=console.scrollHeight-console.clientHeight;}catch(ex){alert("Exception: "+ex.name+" Message: "+ex.message);}};;var SWFUpload;if(typeof(SWFUpload)==="function"){SWFUpload.queue={};SWFUpload.prototype.initSettings=(function(oldInitSettings){return function(){if(typeof(oldInitSettings)==="function"){oldInitSettings.call(this);}
this.queueSettings={};this.queueSettings.queue_cancelled_flag=false;this.queueSettings.queue_upload_count=0;this.queueSettings.user_upload_complete_handler=this.settings.upload_complete_handler;this.queueSettings.user_upload_start_handler=this.settings.upload_start_handler;this.settings.upload_complete_handler=SWFUpload.queue.uploadCompleteHandler;this.settings.upload_start_handler=SWFUpload.queue.uploadStartHandler;this.settings.queue_complete_handler=this.settings.queue_complete_handler||null;};})(SWFUpload.prototype.initSettings);SWFUpload.prototype.flashReady=function(fileID){}
SWFUpload.prototype.startUpload=function(fileID){overHideAccess=0;this.queueSettings.queue_cancelled_flag=false;this.callFlash("StartUpload",[fileID]);};SWFUpload.prototype.cancelQueue=function(){this.queueSettings.queue_cancelled_flag=true;this.stopUpload();var stats=this.getStats();while(stats.files_queued>0){this.cancelUpload();stats=this.getStats();}};SWFUpload.queue.uploadStartHandler=function(file){var returnValue;if(typeof(this.queueSettings.user_upload_start_handler)==="function"){returnValue=this.queueSettings.user_upload_start_handler.call(this,file);}
returnValue=(returnValue===false)?false:true;this.queueSettings.queue_cancelled_flag=!returnValue;return returnValue;};SWFUpload.queue.uploadCompleteHandler=function(file){overHideAccess=1;setCookie("uploadedFiles",getCookie("uploadedFiles")+"["+file.name+"]")
var user_upload_complete_handler=this.queueSettings.user_upload_complete_handler;var continueUpload;if(file.filestatus===SWFUpload.FILE_STATUS.COMPLETE){this.queueSettings.queue_upload_count++;}
if(typeof(user_upload_complete_handler)==="function"){continueUpload=(user_upload_complete_handler.call(this,file)===false)?false:true;}else if(file.filestatus===SWFUpload.FILE_STATUS.QUEUED){continueUpload=false;}else{continueUpload=true;}
if(continueUpload){var stats=this.getStats();if(stats.files_queued>0&&this.queueSettings.queue_cancelled_flag===false){this.startUpload();}else if(this.queueSettings.queue_cancelled_flag===false){this.queueEvent("queue_complete_handler",[this.queueSettings.queue_upload_count]);this.queueSettings.queue_upload_count=0;}else{this.queueSettings.queue_cancelled_flag=false;this.queueSettings.queue_upload_count=0;}}};};function FileProgress(file,targetID){this.fileProgressID=file.id;this.opacity=100;this.height=0;this.fileProgressWrapper=document.getElementById(this.fileProgressID);if(!this.fileProgressWrapper){this.fileProgressWrapper=document.createElement("div");this.fileProgressWrapper.className="progressWrapper";this.fileProgressWrapper.id=this.fileProgressID;this.fileProgressElement=document.createElement("div");this.fileProgressElement.className="progressContainer";var progressCancel=document.createElement("a");progressCancel.href="#";progressCancel.style.visibility="hidden";progressCancel.appendChild(document.createTextNode(" "));var progressText=document.createElement("div");progressText.className="progressName";progressText.appendChild(document.createTextNode(file.name));progressText.style.display="none";var progressBarContainer=document.createElement("div");progressBarContainer.className="PBContainer";var progressBar=document.createElement("div");progressBar.className="progressBarInProgress";var progressBarStatValue=document.createElement("div");progressBarStatValue.className="progressBarStatusValue";var progressStatus=document.createElement("div");progressStatus.className="progressBarStatus";progressStatus.innerHTML="&nbsp;";this.fileProgressElement.appendChild(progressCancel);this.fileProgressElement.appendChild(progressText);this.fileProgressElement.appendChild(progressStatus);progressBarContainer.appendChild(progressBar);this.fileProgressElement.appendChild(progressBarContainer);this.fileProgressElement.appendChild(progressBarStatValue);this.fileProgressWrapper.appendChild(this.fileProgressElement);document.getElementById(targetID).appendChild(this.fileProgressWrapper);}else{this.fileProgressElement=this.fileProgressWrapper.firstChild;this.reset();}
this.height=this.fileProgressWrapper.offsetHeight;this.setTimer(null);}
FileProgress.prototype.setTimer=function(timer){this.fileProgressElement["FP_TIMER"]=timer;};FileProgress.prototype.getTimer=function(timer){return this.fileProgressElement["FP_TIMER"]||null;};FileProgress.prototype.reset=function(){this.fileProgressElement.className="progressContainer";this.fileProgressElement.childNodes[2].innerHTML="&nbsp;";this.fileProgressElement.childNodes[2].className="progressBarStatus";this.fileProgressElement.childNodes[3].childNodes[0].className="progressBarInProgress";this.fileProgressElement.childNodes[3].childNodes[0].style.width="0%";this.appear();};FileProgress.prototype.setProgress=function(percentage){this.fileProgressElement.className="progressContainer green";this.fileProgressElement.childNodes[3].childNodes[0].className="progressBarInProgress";this.fileProgressElement.childNodes[3].childNodes[0].style.width=percentage+"%";this.appear();};FileProgress.prototype.setComplete=function(){this.fileProgressElement.className="progressContainer blue";this.fileProgressElement.childNodes[3].childNodes[0].className="progressBarComplete";this.fileProgressElement.childNodes[3].childNodes[0].style.width="";var oSelf=this;this.setTimer(setTimeout(function(){oSelf.disappear();},10000));};FileProgress.prototype.setError=function(){this.fileProgressElement.className="progressContainer red";this.fileProgressElement.childNodes[3].childNodes[0].className="progressBarError";this.fileProgressElement.childNodes[3].childNodes[0].style.width="";var oSelf=this;this.setTimer(setTimeout(function(){oSelf.disappear();},5000));};FileProgress.prototype.setCancelled=function(){this.fileProgressElement.className="progressContainer";this.fileProgressElement.childNodes[3].childNodes[0].className="progressBarError";this.fileProgressElement.childNodes[3].childNodes[0].style.width="";var oSelf=this;this.setTimer(setTimeout(function(){oSelf.disappear();},2000));};FileProgress.prototype.setStatus=function(status){this.fileProgressElement.childNodes[4].innerHTML=status;};FileProgress.prototype.setStatusName=function(status){this.fileProgressElement.childNodes[2].innerHTML=status;};FileProgress.prototype.toggleCancel=function(show,swfUploadInstance){this.fileProgressElement.childNodes[0].style.visibility=show?"visible":"hidden";if(swfUploadInstance){var fileID=this.fileProgressID;this.fileProgressElement.childNodes[0].onclick=function(){swfUploadInstance.cancelUpload(fileID);return false;};}};FileProgress.prototype.appear=function(){if(this.getTimer()!==null){clearTimeout(this.getTimer());this.setTimer(null);}
if(this.fileProgressWrapper.filters){try{this.fileProgressWrapper.filters.item("DXImageTransform.Microsoft.Alpha").opacity=100;}catch(e){this.fileProgressWrapper.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=100)";}}else{this.fileProgressWrapper.style.opacity=1;}
this.fileProgressWrapper.style.height="";this.height=this.fileProgressWrapper.offsetHeight;this.opacity=100;this.fileProgressWrapper.style.display="";};FileProgress.prototype.disappear=function(){this.fileProgressWrapper.style.display="none";return;var reduceOpacityBy=15;var reduceHeightBy=4;var rate=30;if(this.opacity>0){this.opacity-=reduceOpacityBy;if(this.opacity<0){this.opacity=0;}
if(this.fileProgressWrapper.filters){try{this.fileProgressWrapper.filters.item("DXImageTransform.Microsoft.Alpha").opacity=this.opacity;}catch(e){this.fileProgressWrapper.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity="+this.opacity+")";}}else{this.fileProgressWrapper.style.opacity=this.opacity/100;}}
if(this.height>0){this.height-=reduceHeightBy;if(this.height<0){this.height=0;}
this.fileProgressWrapper.style.height=this.height+"px";}
if(this.height>0||this.opacity>0){var oSelf=this;this.setTimer(setTimeout(function(){oSelf.disappear();},rate));}else{this.fileProgressWrapper.style.display="none";this.setTimer(null);}};;var progress,filesSelected,fileCounter=0;function fileQueued(file){try{if(!progress)progress=new FileProgress(file,target);progress.setStatus("Waiting...");progress.toggleCancel(true,this);}catch(ex){this.debug(ex);}}
function fileQueueError(file,errorCode,message){try{if(errorCode===SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED){alert("You have attempted to queue too many files.\n"+(message===0?"You have reached the upload limit.":"You may select "+(message>1?"up to "+message+" files.":"one file.")));return;}
var progress=new FileProgress(file,this.customSettings.progressTarget);progress.setError();progress.toggleCancel(false);switch(errorCode){case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:progress.setStatus("File is too big.");this.debug("Error Code: File too big, File name: "+file.name+", File size: "+file.size+", Message: "+message);break;case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:progress.setStatus("Cannot upload Zero Byte files.");this.debug("Error Code: Zero byte file, File name: "+file.name+", File size: "+file.size+", Message: "+message);break;case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:progress.setStatus("Invalid File Type.");this.debug("Error Code: Invalid File Type, File name: "+file.name+", File size: "+file.size+", Message: "+message);break;default:if(file!==null){progress.setStatus("Unhandled Error");}
this.debug("Error Code: "+errorCode+", File name: "+file.name+", File size: "+file.size+", Message: "+message);break;}}catch(ex){this.debug(ex);}}
function fileDialogComplete(numFilesSelected,numFilesQueued){try{document.getElementById("progressSuccess").style.display="none";document.getElementById("divStatus").innerHTML="";filesSelected=numFilesSelected;if(numFilesSelected>0){document.getElementById(this.customSettings.cancelButtonId).disabled=false;}
this.startUpload();}catch(ex){this.debug(ex);}}
function uploadStart(file){try{$("progressMainform").style.display="block";$("SWFUpload_0").style.width="1px";$("SWFUpload_0").style.height="1px";fileCounter++;performProgress(file,this.customSettings.progressTarget);progress.setStatus(fileCounter+" из "+filesSelected);progress.toggleCancel(true,this);}
catch(ex){}
return true;}
function uploadProgress(file,bytesLoaded,bytesTotal){try{var percent=Math.ceil((1/filesSelected)*((fileCounter-1)+(bytesLoaded/bytesTotal))*100);performProgress(file,this.customSettings.progressTarget);progress.setProgress(percent);progress.setStatusName("Загружается");progress.setStatus(fileCounter+" из "+filesSelected);}catch(ex){this.debug(ex);}}
function uploadSuccess(file,serverData){try{if(fileCounter==filesSelected){$("SWFUpload_0").style.width="120px";$("SWFUpload_0").style.height="35px";}
performProgress(file,this.customSettings.progressTarget);progress.setStatus("");progress.toggleCancel(false);}catch(ex){this.debug(ex);}}
function uploadError(file,errorCode,message){try{performProgress(file,this.customSettings.progressTarget);progress.setError();progress.toggleCancel(false);switch(errorCode){case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:progress.setStatus("Upload Error: "+message);this.debug("Error Code: HTTP Error, File name: "+file.name+", Message: "+message);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:progress.setStatus("Upload Failed.");this.debug("Error Code: Upload Failed, File name: "+file.name+", File size: "+file.size+", Message: "+message);break;case SWFUpload.UPLOAD_ERROR.IO_ERROR:progress.setStatus("Server (IO) Error");this.debug("Error Code: IO Error, File name: "+file.name+", Message: "+message);break;case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:progress.setStatus("Security Error");this.debug("Error Code: Security Error, File name: "+file.name+", Message: "+message);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:progress.setStatus("Upload limit exceeded.");this.debug("Error Code: Upload Limit Exceeded, File name: "+file.name+", File size: "+file.size+", Message: "+message);break;case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:progress.setStatus("Failed Validation.  Upload skipped.");this.debug("Error Code: File Validation Failed, File name: "+file.name+", File size: "+file.size+", Message: "+message);break;case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:if(this.getStats().files_queued===0){document.getElementById(this.customSettings.cancelButtonId).disabled=true;}
progress.setStatus("Cancelled");progress.setCancelled();break;case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:progress.setStatus("Stopped");break;default:progress.setStatus("Unhandled Error: "+errorCode);this.debug("Error Code: "+errorCode+", File name: "+file.name+", File size: "+file.size+", Message: "+message);break;}}catch(ex){this.debug(ex);}}
function uploadComplete(file){if(this.getStats().files_queued===0){document.getElementById(this.customSettings.cancelButtonId).disabled=true;progress.disappear();document.getElementById("progressSuccess").style.display="block";document.getElementById("progressMainform").style.display="none";}
else progress.disappear();}
function queueComplete(numFilesUploaded){fileCounter=0;}
function performProgress(file,target){progress=new FileProgress(file,target);};var slideMenu=function(){var sp,st,t,m,sa,l,w,sw,ot,cs,f,ls,tm;return{build:function(sm,sw,bw,mt,s,sl,h,evt){f=evt;sp=s;st=sw;t=mt;m=document.getElementById(sm);sa=m.getElementsByTagName('li');l=sa.length;w=bw;sw=w/l;ot=Math.floor((w-st)/(l-1));var i=0;ls=sa[0];for(i;i<l;i++){s=sa[i];if(!i)s.style.width=st+'px';this.timer(s)}
if(sl!=null){}},timer:function(s){s.onmouseover=function(){tm=true;slideMenu.performslide(s);slideMenu.clearregularslide();}},performslide:function(s){if(visStatus["maincontent"]!=1)return;if(rpath!="home")return;if(animations["mainSlides"]||tm){animations["mainMenuAnimation"]=false;slideMenu.clearregularslide();slideMenu.setregularslide(cs,slideInterval);clearInterval(m.timer);if(ls!=s)for(var i=0;i<l;i++)if(sa[i]==s)f(i);ls=s;m.timer=setInterval(function(){slideMenu.slide(s)},t);}
else{animations["mainMenuAnimation"]=true;slideMenu.clearregularslide();slideMenu.setregularslide(cs,700);cs=((cs-1)>-1)?(cs-1):(sa.length-1);}
tm=false;},slide:function(s){var cw=parseInt(s.style.width,'10');if(cw<st){var owt=0;var i=0;for(i;i<l;i++){if(sa[i]!=s){var o,ow;var oi=0;o=sa[i];if(!o){clearInterval(m.timer);return;}ow=parseInt(o.style.width,'10');if(ow>ot){oi=Math.floor((ow-ot)/sp);oi=(oi>0)?oi:1;o.style.width=(ow-oi)+'px'}
owt=owt+(ow-oi)}else{cs=i;}}
s.style.width=(w-owt)+'px';}else{clearInterval(m.timer);animations["mainMenuAnimation"]=true;}},setregularslide:function(startid,interval){clearInterval(this.regularslide);cs=startid;this.regularslide=setInterval(function(){slideMenu.setnextslide();},interval);},setnextslide:function(){slideMenu.performslide(sa[cs]);cs=sa[cs+1]?(cs+1):0;},clearregularslide:function(){clearInterval(this.regularslide);}};}();;function checkFeedBackForm(showErrors,src){var upFiles=new Array();if(cookieUploadedFiles=getCookie("uploadedFiles")){cookieUploadedFiles=cookieUploadedFiles.substr(1,cookieUploadedFiles.length-2);upFiles=cookieUploadedFiles.split('][');}
var upFiles=upFiles.join(',');fbError=new Array();fbName=$('feedBackName').value;fbMail=$('feedBackMail').value;fbMessage=$('feedBackMessage').value;fbPhone=$('feedBackPhone').value;if(fbName.length<3){changeStyle("feedBackName","contactInput fbErrorField");fbError.push("Name");}
else changeStyle("feedBackName","contactInput");if((/^([a-z0-9_\-]+\.)*[a-z0-9_\-]+@([a-z0-9][a-z0-9\-]*[a-z0-9]\.)+[a-z]{2,4}$/i).test(fbMail)&&fbMail)changeStyle("feedBackMail","contactInput");else{changeStyle("feedBackMail","contactInput fbErrorField");fbError.push("Mail");}
if(!fbMessage){fbError.push("Message");changeStyle("feedBackMessage","contactSendArea fbErrorField")}
else changeStyle("feedBackMessage","contactSendArea")
fbErrorMsg="";if(fbError.length)fbErrorMsg="Не все поля правильно заполнены";if(showErrors){if(fbErrorMsg)alert(fbErrorMsg);else{$('fbForm').setOpacity(0.5);if($('fbLoadBar'))$('fbLoadBar').style.display='block';var http=getXmlHttp()
var params="name="+fbName+"&mail="+fbMail+"&message="+fbMessage+"&filenames="+upFiles+"&phone="+fbPhone;http.open("POST","/mailer",true);http.setRequestHeader("Content-type","application/x-www-form-urlencoded");http.setRequestHeader("Content-length",params.length);http.setRequestHeader("Connection","close");http.onreadystatechange=function(){if(http.readyState==4&&http.status==200){if(http.responseText=='<p>true</p>'){if(typeof changeUrl=="function")changeUrl("/"+src);else window.location="/contact/requestsent/";}
else{alert("Извините, но сообщение не удалось отправить, попробуйте позже =(");}
$('fbForm').setOpacity(1);if($('fbLoadBar'))$('fbLoadBar').style.display="none";}}
http.send(params);}}}
function getXmlHttp(){var xmlhttp;try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(E){xmlhttp=false;}}
if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}
return xmlhttp;}
function changeStyle(objName,className){$(objName).className=className;}
function setCookie(name,value,expiredays,path,domain,secure){if(expiredays){var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);var expires=exdate.toGMTString();}
document.cookie=name+"="+escape(value)+
((expiredays)?"; expires="+expires:"")+
((path)?"; path="+path:"")+
((domain)?"; domain="+domain:"")+
((secure)?"; secure":"");}
function getCookie(name){var cookie=" "+document.cookie;var search=" "+name+"=";var setStr=null;var offset=0;var end=0;if(cookie.length>0){offset=cookie.indexOf(search);if(offset!=-1){offset+=search.length;end=cookie.indexOf(";",offset)
if(end==-1){end=cookie.length;}
setStr=unescape(cookie.substring(offset,end));}}
return setStr;}
function getScrollXY(){var scrOfX=0,scrOfY=0;if(typeof(window.pageYOffset)=='number'){scrOfY=window.pageYOffset;scrOfX=window.pageXOffset;}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){scrOfY=document.body.scrollTop;scrOfX=document.body.scrollLeft;}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){scrOfY=document.documentElement.scrollTop;scrOfX=document.documentElement.scrollLeft;}
return[scrOfX,scrOfY];};if(typeof Effect=='undefined')
throw("lightwindow.js requires including script.aculo.us' effects.js library!");try{document.execCommand("BackgroundImageCache",false,true);}catch(e){}
var lightwindow=Class.create();lightwindow.prototype={element:null,contentToFetch:null,windowActive:false,dataEffects:[],dimensions:{cruft:null,container:null,viewport:{height:null,width:null,offsetTop:null,offsetLeft:null}},pagePosition:{x:0,y:0},pageDimensions:{width:null,height:null},preloadImage:[],preloadedImage:[],galleries:[],resizeTo:{height:null,heightPercent:null,width:null,widthPercent:null,fixedTop:null,fixedLeft:null},scrollbarOffset:18,navigationObservers:{previous:null,next:null},containerChange:{height:0,width:0},activeGallery:false,galleryLocation:{current:0,total:0},firstInit:true,reinitialize:function(){this.galleries=new Array();this.gallery=new Array();this.initialize();},initialize:function(options){this.options=Object.extend({resizeSpeed:8,contentOffset:{height:10,width:10},dimensions:{image:{height:250,width:250},page:{height:250,width:250},inline:{height:250,width:250},media:{height:250,width:250},external:{height:250,width:250},titleHeight:40},classNames:{standard:'lightwindow',action:'lightwindow_action'},fileTypes:{page:['asp','aspx','cgi','cfm','htm','html','pl','php4','php3','php','php5','phtml','rhtml','shtml','txt','vbs','rb'],media:['aif','aiff','asf','avi','divx','m1v','m2a','m2v','m3u','mid','midi','mov','moov','movie','mp2','mp3','mpa','mpa','mpe','mpeg','mpg','mpg','mpga','pps','qt','rm','ram','swf','viv','vivo','wav'],image:['bmp','gif','jpg','png','tiff']},mimeTypes:{avi:'video/avi',aif:'audio/aiff',aiff:'audio/aiff',gif:'image/gif',bmp:'image/bmp',jpeg:'image/jpeg',m1v:'video/mpeg',m2a:'audio/mpeg',m2v:'video/mpeg',m3u:'audio/x-mpequrl',mid:'audio/x-midi',midi:'audio/x-midi',mjpg:'video/x-motion-jpeg',moov:'video/quicktime',mov:'video/quicktime',movie:'video/x-sgi-movie',mp2:'audio/mpeg',mp3:'audio/mpeg3',mpa:'audio/mpeg',mpa:'video/mpeg',mpe:'video/mpeg',mpeg:'video/mpeg',mpg:'audio/mpeg',mpg:'video/mpeg',mpga:'audio/mpeg',pdf:'application/pdf',png:'image/png',pps:'application/mspowerpoint',qt:'video/quicktime',ram:'audio/x-pn-realaudio-plugin',rm:'application/vnd.rn-realmedia',swf:'application/x-shockwave-flash',tiff:'image/tiff',viv:'video/vivo',vivo:'video/vivo',wav:'audio/wav',wmv:'application/x-mplayer2'},classids:{mov:'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',swf:'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000',wmv:'clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6'},codebases:{mov:'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0',swf:'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0',wmv:'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715'},viewportPadding:10,EOLASFix:'swf,wmv,fla,flv',overlay:{opacity:0.7,image:'mediafiles/images/lightwindow/black.png',presetImage:'mediafiles/images/lightwindow/black-70.png'},skin:{main:'<div id="lightwindow_container" >'+'<div id="lightwindow_title_bar" >'+'<div id="lightwindow_title_bar_inner" >'+'<span id="lightwindow_title_bar_title"></span>'+'<a id="lightwindow_title_bar_close_link" ><div></div></a>'+'</div>'+'</div>'+'<div id="lightwindow_stage" >'+'<div id="lightwindow_contents" >'+'</div>'+'<div id="lightwindow_navigation" >'+'<a href="#" id="lightwindow_previous" >'+'<span id="lightwindow_previous_title"></span>'+'</a>'+'<a href="#" id="lightwindow_next" >'+'<span id="lightwindow_next_title"></span>'+'</a>'+'<iframe name="lightwindow_navigation_shim" id="lightwindow_navigation_shim" src="javascript:false;" frameBorder="0" scrolling="no"></iframe>'+'</div>'+'<div id="lightwindow_galleries">'+'<div id="lightwindow_galleries_tab_container" >'+'<a href="#" id="lightwindow_galleries_tab" >'+'<span id="lightwindow_galleries_tab_span" class="up" >Galleries</span>'+'</a>'+'</div>'+'<div id="lightwindow_galleries_list" >'+'</div>'+'</div>'+'</div>'+'<div id="lightwindow_data_slide" >'+'<div id="lightwindow_data_slide_inner" >'+'<div id="lightwindow_data_details" >'+'<div id="lightwindow_data_gallery_container" >'+'<span id="lightwindow_data_gallery_current"></span>'+' of '+'<span id="lightwindow_data_gallery_total"></span>'+'</div>'+'<div id="lightwindow_data_author_container" >'+'by <span id="lightwindow_data_author"></span>'+'</div>'+'</div>'+'<div id="lightwindow_data_caption" >'+'</div>'+'</div>'+'</div>'+'</div>',loading:'<div id="lightwindow_loading" >'+'<div style="position:absolute; top:50%; width:100%; left:-10px; //left:auto;">'+'<span style="position:relative; display:block; top:-30px; width:100%; //text-align:center; padding:0px;">'+'<div style="margin:0 auto; width:160px; position:relative; text-align:center;">'+'<img src="/mediafiles/images/loading.gif" alt="loading">'+'<span class="lightwindow_cancelload"><a href="javascript: ritoriLightWindow.deactivate();">Отмена загрузки</a></span>'+'<iframe name="lightwindow_loading_shim" id="lightwindow_loading_shim" src="javascript:false;" frameBorder="0" scrolling="no"></iframe>'+'</div>'+'</span>'+'</div>'+'</div>',iframe:'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'+'<html xmlns="http://www.w3.org/1999/xhtml">'+'<body>'+'{body_replace}'+'</body>'+'</html>',gallery:{top:'<div class="lightwindow_galleries_list">'+'<h1>{gallery_title_replace}</h1>'+'<ul>',middle:'<li>'+'{gallery_link_replace}'+'</li>',bottom:'</ul>'+'</div>'}},formMethod:'get',hideFlash:false,hideGalleryTab:false,showTitleBar:true,animationHandler:false,navigationHandler:false,transitionHandler:false,finalAnimationHandler:false,formHandler:false,galleryAnimationHandler:false,showGalleryCount:true},options||{});this.duration=((11-this.options.resizeSpeed)*0.15);this._setupLinks();this._getScroll();this._getPageDimensions();this._browserDimensions();if(this.firstInit)this._addLightWindowMarkup(false);this._setupDimensions();this.buildGalleryList();this.firstInit=false;},activate:function(e,link){this._clearWindowContents(true);this._addLoadingWindowMarkup();this._setupWindowElements(link);this._getScroll();this._browserDimensions();this._setupDimensions();this._getPageDimensions();document.getElementById("lightwindow_overlay").setStyle({height:this.pageDimensions.height+'px'});this._toggleTroubleElements('hidden',false);this._displayLightWindow('block','hidden');this._setStatus(true);this._monitorKeyboard(true);this._prepareIE(true);this._loadWindow();},deactivate:function(){this.windowActive=false;this.activeGallery=false;if(!this.options.hideGalleryTab){this._handleGalleryAnimation(false);}
this.animating=false;this.element=null;this._displayLightWindow('none','visible');this._clearWindowContents(false);var queue=Effect.Queues.get('lightwindowAnimation').each(function(e){e.cancel();});this._prepareIE(false);this._setupDimensions();this._toggleTroubleElements('visible',false);this._monitorKeyboard(false);this._removeMouseScrolling();},_createMouseScrolling:function(){createEvent('lightwindow_overlay','mousemove',scrollLWimage);createEvent('lightwindow','mousemove',scrollLWimage);},_removeMouseScrolling:function(){removeEvent('lightwindow_overlay','mousemove',scrollLWimage);removeEvent('lightwindow','mousemove',scrollLWimage);},_updateWindowPosition:function(){if(Prototype.Browser.IE&&asual.util.Browser.getVersion()==6)moveY=(typeof getScrollXY=="function")?getScrollXY()[1]:0;else return;$("lightwindow").style.top=$("lightwindow_container").offsetHeight/2+(getHeight()-$("lightwindow_container").offsetHeight)/2+moveY+"px";},createWindow:function(element,attributes){this._processLink($(element));},activateWindow:function(options){this.element=Object.extend({href:null,title:null,author:null,caption:null,rel:null,top:null,left:null,type:null,showImages:null,height:null,width:null,loadingAnimation:null,iframeEmbed:null,form:null},options||{});this.contentToFetch=this.element.href;this.windowType=this.element.type?this.element.type:this._fileType(this.element.href);this._clearWindowContents(true);this._addLoadingWindowMarkup();this._getScroll();this._browserDimensions();this._setupDimensions();this._toggleTroubleElements('hidden',false);this._displayLightWindow('block','hidden');this._setStatus(true);this._monitorKeyboard(true);this._prepareIE(true);this._loadWindow();},submitForm:function(e){if(this.options.formHandler){this.options.formHandler(e);}else{this._defaultFormHandler(e);}},openWindow:function(element){this._removeMouseScrolling();this._updateWindowPosition();var element=$(element);this.windowActive=true;this._clearWindowContents(true);this._addLoadingWindowMarkup();this._setupWindowElements(element);this._setStatus(true);this._handleTransition();},navigateWindow:function(direction){this._handleNavigation(false);if(direction=='previous'){this.openWindow(this.navigationObservers.previous);}else if(direction=='next'){this.openWindow(this.navigationObservers.next);}},buildGalleryList:function(){var output='';var galleryLink;$('lightwindow_galleries_list').innerHTML="";for(i in this.galleries){if(typeof this.galleries[i]=='object'){output+=(this.options.skin.gallery.top).replace('{gallery_title_replace}',unescape(i));for(j in this.galleries[i]){if(typeof this.galleries[i][j]=='object'){galleryLink='<a href="#" id="lightwindow_gallery_'+i+'_'+j+'" >'+unescape(j)+'</a>';output+=(this.options.skin.gallery.middle).replace('{gallery_link_replace}',galleryLink);}}
output+=this.options.skin.gallery.bottom;}}
new Insertion.Top('lightwindow_galleries_list',output);for(i in this.galleries){if(typeof this.galleries[i]=='object'){for(j in this.galleries[i]){if(typeof this.galleries[i][j]=='object'){Event.observe($('lightwindow_gallery_'+i+'_'+j),'click',this.openWindow.bind(this,this.galleries[i][j][0]),false);$('lightwindow_gallery_'+i+'_'+j).onclick=function(){return false;};}}}}},_setupLinks:function(){var links=$$('.'+this.options.classNames.standard);links.each(function(link){this._processLink(link);}.bind(this));},_processLink:function(link){if((this._fileType(link.getAttribute('href'))=='image'||this._fileType(link.getAttribute('href'))=='media')){if(gallery=this._getGalleryInfo(link.rel)){if(!this.galleries[gallery[0]]){this.galleries[gallery[0]]=new Array();}
if(!this.galleries[gallery[0]][gallery[1]]){this.galleries[gallery[0]][gallery[1]]=new Array();}
this.galleries[gallery[0]][gallery[1]].push(link);}}
var url=link.getAttribute('href');if(url.indexOf('?')>-1){url=url.substring(0,url.indexOf('?'));}
var container=url.substring(url.indexOf('#')+1);if($(container)){$(container).setStyle({display:'none'});}
Event.stopObserving(link,'click');Event.observe(link,'click',this.activate.bindAsEventListener(this,link),false);link.onclick=function(){return false;};},_setupActions:function(){var links=$$('#lightwindow_container .'+this.options.classNames.action);links.each(function(link){Event.observe(link,'click',this[link.getAttribute('rel')].bindAsEventListener(this,link),false);link.onclick=function(){return false;};}.bind(this));},_addLightWindowMarkup:function(rebuild){var overlay=Element.extend(document.createElement('div'));overlay.setAttribute('id','lightwindow_overlay');if(Prototype.Browser.Gecko){overlay.setStyle({backgroundImage:'url('+this.options.overlay.presetImage+')',backgroundRepeat:'repeat',height:this.pageDimensions.height+'px'});}else{overlay.setStyle({opacity:this.options.overlay.opacity,backgroundImage:'url('+this.options.overlay.image+')',backgroundRepeat:'repeat',height:this.pageDimensions.height+'px'});}
var lw=document.createElement('div');lw.setAttribute('id','lightwindow');lw.innerHTML=this.options.skin.main;var body=document.getElementsByTagName('body')[0];body.appendChild(overlay);body.appendChild(lw);if($('lightwindow_title_bar_close_link')){Event.observe('lightwindow_title_bar_close_link','click',this.deactivate.bindAsEventListener(this));$('lightwindow_title_bar_close_link').onclick=function(){return false;};}
Event.observe($('lightwindow_previous'),'click',this.navigateWindow.bind(this,'previous'),false);$('lightwindow_previous').onclick=function(){return false;};Event.observe($('lightwindow_next'),'click',this.navigateWindow.bind(this,'next'),false);$('lightwindow_next').onclick=function(){return false;};if(!this.options.hideGalleryTab){Event.observe($('lightwindow_galleries_tab'),'click',this._handleGalleryAnimation.bind(this,true),false);$('lightwindow_galleries_tab').onclick=function(){return false;};}
if(Prototype.Browser.IE){Event.observe(document,'mousewheel',this._stopScrolling.bindAsEventListener(this),false);}else{Event.observe(window,'DOMMouseScroll',this._stopScrolling.bindAsEventListener(this),false);}
Event.observe(overlay,'click',this.deactivate.bindAsEventListener(this),false);overlay.onclick=function(){return false;};},_addLoadingWindowMarkup:function(){$('lightwindow_contents').innerHTML+=this.options.skin.loading;},_setupWindowElements:function(link){this.element=link;this.element.title=null?'':link.getAttribute('title');this.element.author=null?'':link.getAttribute('author');this.element.caption=null?'':link.getAttribute('caption');this.element.rel=null?'':link.getAttribute('rel');this.element.params=null?'':link.getAttribute('params');this.contentToFetch=this.element.href;this.windowType=this._getParameter('lightwindow_type')?this._getParameter('lightwindow_type'):this._fileType(this.contentToFetch);},_clearWindowContents:function(contents){if($('lightwindow_iframe')){Element.remove($('lightwindow_iframe'));}
if($('lightwindow_media_primary')){try{$('lightwindow_media_primary').Stop();}catch(e){}
Element.remove($('lightwindow_media_primary'));}
if($('lightwindow_media_secondary')){try{$('lightwindow_media_secondary').Stop();}catch(e){}
Element.remove($('lightwindow_media_secondary'));}
this.activeGallery=false;this._handleNavigation(this.activeGallery);if(contents){$('lightwindow_contents').innerHTML='';$('lightwindow_contents').setStyle({overflow:'hidden'});if(!this.windowActive){$('lightwindow_data_slide_inner').setStyle({display:'none'});$('lightwindow_title_bar_title').innerHTML='';}
$('lightwindow_data_slide').setStyle({height:'auto'});}
this.resizeTo.height=null;this.resizeTo.width=null;},_setStatus:function(status){this.animating=status;if(status){Element.show('lightwindow_loading');}
if(!(/MSIE 6./i.test(navigator.userAgent))){this._fixedWindow(status);}},_fixedWindow:function(status){if(status){if(this.windowActive){this._getScroll();$('lightwindow').setStyle({position:'absolute',top:parseFloat($('lightwindow').getStyle('top'))+this.pagePosition.y+'px',left:parseFloat($('lightwindow').getStyle('left'))+this.pagePosition.x+'px'});}else{$('lightwindow').setStyle({position:'absolute'});}}else{if(this.windowActive){this._getScroll();$('lightwindow').setStyle({position:'fixed',top:parseFloat($('lightwindow').getStyle('top'))-this.pagePosition.y+'px',left:parseFloat($('lightwindow').getStyle('left'))-this.pagePosition.x+'px'});}else{if($('lightwindow_iframe')){this._browserDimensions();}
$('lightwindow').setStyle({position:'fixed',top:(parseFloat(this._getParameter('lightwindow_top'))?parseFloat(this._getParameter('lightwindow_top'))+'px':this.dimensions.viewport.height/2+'px'),left:(parseFloat(this._getParameter('lightwindow_left'))?parseFloat(this._getParameter('lightwindow_left'))+'px':this.dimensions.viewport.width/2+'px')});}}},_prepareIE:function(setup){if(Prototype.Browser.IE){var height,overflowX,overflowY;if(setup){var height='100%';}else{var height='auto';}
var body=document.getElementsByTagName('body')[0];var html=document.getElementsByTagName('html')[0];}},_stopScrolling:function(e){if(this.animating){if(e.preventDefault){e.preventDefault();}
e.returnValue=false;}},_getScroll:function(){if(typeof(window.pageYOffset)=='number'){this.pagePosition.x=window.pageXOffset;this.pagePosition.y=window.pageYOffset;}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){this.pagePosition.x=document.body.scrollLeft;this.pagePosition.y=document.body.scrollTop;}else if(document.documentElement){this.pagePosition.x=document.documentElement.scrollLeft;this.pagePosition.y=document.documentElement.scrollTop;}},_setScroll:function(x,y){document.documentElement.scrollLeft=x;document.documentElement.scrollTop=y;},_toggleTroubleElements:function(visibility,content){if(content){var selects=$('lightwindow_contents').getElementsByTagName('select');}else{var selects=document.getElementsByTagName('select');}
for(var i=0;i<selects.length;i++){selects[i].style.visibility=visibility;}
if(!content){if(this.options.hideFlash){var objects=document.getElementsByTagName('object');for(i=0;i!=objects.length;i++){objects[i].style.visibility=visibility;}
var embeds=document.getElementsByTagName('embed');for(i=0;i!=embeds.length;i++){embeds[i].style.visibility=visibility;}}
var iframes=document.getElementsByTagName('iframe');for(i=0;i!=iframes.length;i++){iframes[i].style.visibility=visibility;}}},_getPageDimensions:function(){var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=document.body.scrollWidth;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
var windowWidth,windowHeight;if(self.innerHeight){windowWidth=self.innerWidth;windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
if(yScroll<windowHeight){this.pageDimensions.height=windowHeight;}else{this.pageDimensions.height=yScroll;}
if(xScroll<windowWidth){this.pageDimensions.width=windowWidth;}else{this.pageDimensions.width=xScroll;}},_displayLightWindow:function(display,visibility){$('lightwindow_overlay').style.display=$('lightwindow').style.display=$('lightwindow_container').style.display=display;$('lightwindow_overlay').style.visibility=$('lightwindow').style.visibility=$('lightwindow_container').style.visibility=visibility;},_setupDimensions:function(){var originalHeight,originalWidth;switch(this.windowType){case'page':originalHeight=this.options.dimensions.page.height;originalWidth=this.options.dimensions.page.width;break;case'image':originalHeight=this.options.dimensions.image.height;originalWidth=this.options.dimensions.image.width;break;case'media':originalHeight=this.options.dimensions.media.height;originalWidth=this.options.dimensions.media.width;break;case'external':originalHeight=this.options.dimensions.external.height;originalWidth=this.options.dimensions.external.width;break;case'inline':originalHeight=this.options.dimensions.inline.height;originalWidth=this.options.dimensions.inline.width;break;default:originalHeight=this.options.dimensions.page.height;originalWidth=this.options.dimensions.page.width;break;}
var offsetHeight=this._getParameter('lightwindow_top')?parseFloat(this._getParameter('lightwindow_top'))+this.pagePosition.y:this.dimensions.viewport.height/2+this.pagePosition.y;var offsetWidth=this._getParameter('lightwindow_left')?parseFloat(this._getParameter('lightwindow_left'))+this.pagePosition.x:this.dimensions.viewport.width/2+this.pagePosition.x;$('lightwindow').setStyle({top:offsetHeight+'px',left:offsetWidth+'px'});$('lightwindow_container').setStyle({height:originalHeight+'px',width:originalWidth+'px',left:-(originalWidth/2)+'px',top:-(originalHeight/2)+'px'});$('lightwindow_contents').setStyle({height:originalHeight+'px',width:originalWidth+'px'});},_fileType:function(url){var image=new RegExp("[^\.]\.("+this.options.fileTypes.image.join('|')+")\s*$","i");if(image.test(url))return'image';if(url.indexOf('#')>-1&&(document.domain==this._getDomain(url)))return'inline';if(url.indexOf('?')>-1)url=url.substring(0,url.indexOf('?'));var type='unknown';var page=new RegExp("[^\.]\.("+this.options.fileTypes.page.join('|')+")\s*$","i");var media=new RegExp("[^\.]\.("+this.options.fileTypes.media.join('|')+")\s*$","i");if(document.domain!=this._getDomain(url))type='external';if(media.test(url))type='media';if(type=='external'||type=='media')return type;if(page.test(url)||url.substr((url.length-1),url.length)=='/')type='page';return type;},_fileExtension:function(url){if(url.indexOf('?')>-1){url=url.substring(0,url.indexOf('?'));}
var extenstion='';for(var x=(url.length-1);x>-1;x--){if(url.charAt(x)=='.'){return extenstion;}
extenstion=url.charAt(x)+extenstion;}},_monitorKeyboard:function(status){if(status)document.onkeydown=this._eventKeypress.bind(this);else document.onkeydown='';},_eventKeypress:function(e){if(e==null){var keycode=event.keyCode;}else{var keycode=e.which;}
switch(keycode){case 27:this.deactivate();break;case 13:return;default:break;}
if(this.animating){return false;}
switch(String.fromCharCode(keycode).toLowerCase()){case'p':if(this.navigationObservers.previous){this.navigateWindow('previous');}
break;case'n':if(this.navigationObservers.next){this.navigateWindow('next');}
break;default:break;}},_getGalleryInfo:function(rel){if(!rel)return false;if(rel.indexOf('[')>-1){return new Array(escape(rel.substring(0,rel.indexOf('['))),escape(rel.substring(rel.indexOf('[')+1,rel.indexOf(']'))));}else{return false;}},_getDomain:function(url){var leadSlashes=url.indexOf('//');var domainStart=leadSlashes+2;var withoutResource=url.substring(domainStart,url.length);var nextSlash=withoutResource.indexOf('/');var domain=withoutResource.substring(0,nextSlash);if(domain.indexOf(':')>-1){var portColon=domain.indexOf(':');domain=domain.substring(0,portColon);}
return domain;},_getParameter:function(parameter,parameters){if(!this.element)return false;if(parameter=='lightwindow_top'&&this.element.top){return unescape(this.element.top);}else if(parameter=='lightwindow_left'&&this.element.left){return unescape(this.element.left);}else if(parameter=='lightwindow_type'&&this.element.type){return unescape(this.element.type);}else if(parameter=='lightwindow_show_images'&&this.element.showImages){return unescape(this.element.showImages);}else if(parameter=='lightwindow_height'&&this.element.height){return unescape(this.element.height);}else if(parameter=='lightwindow_width'&&this.element.width){return unescape(this.element.width);}else if(parameter=='lightwindow_loading_animation'&&this.element.loadingAnimation){return unescape(this.element.loadingAnimation);}else if(parameter=='lightwindow_iframe_embed'&&this.element.iframeEmbed){return unescape(this.element.iframeEmbed);}else if(parameter=='lightwindow_form'&&this.element.form){return unescape(this.element.form);}else{if(!parameters){if(this.element.params)parameters=this.element.params;else return;}
var value;var parameterArray=parameters.split(',');var compareString=parameter+'=';var compareLength=compareString.length;for(var i=0;i<parameterArray.length;i++){if(parameterArray[i].substr(0,compareLength)==compareString){var currentParameter=parameterArray[i].split('=');value=currentParameter[1];break;}}
if(!value)return false;else return unescape(value);}},_browserDimensions:function(){if(Prototype.Browser.IE){this.dimensions.viewport.height=document.documentElement.clientHeight;this.dimensions.viewport.width=document.documentElement.clientWidth;}else{this.dimensions.viewport.height=window.innerHeight;this.dimensions.viewport.width=document.width||document.body.offsetWidth;}},_getScrollerWidth:function(){var scrollDiv=Element.extend(document.createElement('div'));scrollDiv.setAttribute('id','lightwindow_scroll_div');scrollDiv.setStyle({position:'absolute',top:'-10000px',left:'-10000px',width:'100px',height:'100px',overflow:'hidden'});var contentDiv=Element.extend(document.createElement('div'));contentDiv.setAttribute('id','lightwindow_content_scroll_div');contentDiv.setStyle({width:'100%',height:'200px'});scrollDiv.appendChild(contentDiv);var body=document.getElementsByTagName('body')[0];body.appendChild(scrollDiv);var noScroll=$('lightwindow_content_scroll_div').offsetWidth;scrollDiv.style.overflow='auto';var withScroll=$('lightwindow_content_scroll_div').offsetWidth;Element.remove($('lightwindow_scroll_div'));this.scrollbarOffset=noScroll-withScroll;},_addParamToObject:function(name,value,object,id){var param=document.createElement('param');param.setAttribute('value',value);param.setAttribute('name',name);if(id){param.setAttribute('id',id);}
object.appendChild(param);return object;},_outerHTML:function(object){if(Prototype.Browser.IE){return object.outerHTML;}else{var clone=object.cloneNode(true);var cloneDiv=document.createElement('div');cloneDiv.appendChild(clone);return cloneDiv.innerHTML;}},_convertToMarkup:function(object,closeTag){var markup=this._outerHTML(object).replace('</'+closeTag+'>','');if(Prototype.Browser.IE){for(var i=0;i<object.childNodes.length;i++){markup+=this._outerHTML(object.childNodes[i]);}
markup+='</'+closeTag+'>';}
return markup;},_appendObject:function(object,closeTag,appendTo){if(Prototype.Browser.IE){appendTo.innerHTML+=this._convertToMarkup(object,closeTag);if(this.options.EOLASFix.indexOf(this._fileType(this.element.href))>-1){var objectElements=document.getElementsByTagName('object');for(var i=0;i<objectElements.length;i++){if(objectElements[i].getAttribute("data"))objectElements[i].removeAttribute('data');objectElements[i].outerHTML=objectElements[i].outerHTML;objectElements[i].style.visibility="visible";}}}else{appendTo.appendChild(object);}},_appendIframe:function(scroll){var iframe=document.createElement('iframe');iframe.setAttribute('id','lightwindow_iframe');iframe.setAttribute('name','lightwindow_iframe');iframe.setAttribute('src','about:blank');iframe.setAttribute('height','100%');iframe.setAttribute('width','100%');iframe.setAttribute('frameborder','0');iframe.setAttribute('marginwidth','0');iframe.setAttribute('marginheight','0');iframe.setAttribute('scrolling',scroll);this._appendObject(iframe,'iframe',$('lightwindow_contents'));},_writeToIframe:function(content){var template=this.options.skin.iframe;template=template.replace('{body_replace}',content);if($('lightwindow_iframe').contentWindow){$('lightwindow_iframe').contentWindow.document.open();$('lightwindow_iframe').contentWindow.document.write(template);$('lightwindow_iframe').contentWindow.document.close();}else{$('lightwindow_iframe').contentDocument.open();$('lightwindow_iframe').contentDocument.write(template);$('lightwindow_iframe').contentDocument.close();}},_loadWindow:function(){switch(this.windowType){case'image':var current=0;var images=[];this.checkImage=[];this.resizeTo.height=this.resizeTo.width=0;this.imageCount=this._getParameter('lightwindow_show_images')?parseInt(this._getParameter('lightwindow_show_images')):1;if(gallery=this._getGalleryInfo(this.element.rel)){for(current=0;current<this.galleries[gallery[0]][gallery[1]].length;current++){if(this.contentToFetch.indexOf(this.galleries[gallery[0]][gallery[1]][current].href)>-1){break;}}
if(this.galleries[gallery[0]][gallery[1]][current-this.imageCount]){this.navigationObservers.previous=this.galleries[gallery[0]][gallery[1]][current-this.imageCount];}else{this.navigationObservers.previous=false;}
if(this.galleries[gallery[0]][gallery[1]][current+this.imageCount]){this.navigationObservers.next=this.galleries[gallery[0]][gallery[1]][current+this.imageCount];}else{this.navigationObservers.next=false;}
this.activeGallery=true;}else{this.navigationObservers.previous=false;this.navigationObservers.next=false;this.activeGallery=false;}
for(var i=current;i<(current+this.imageCount);i++){if(gallery&&this.galleries[gallery[0]][gallery[1]][i]){this.contentToFetch=this.galleries[gallery[0]][gallery[1]][i].href;this.galleryLocation={current:(i+1)/this.imageCount,total:(this.galleries[gallery[0]][gallery[1]].length)/this.imageCount};if(!this.galleries[gallery[0]][gallery[1]][i+this.imageCount]){$('lightwindow_next').setStyle({display:'none'});}else{$('lightwindow_next').setStyle({display:'block'});$('lightwindow_next_title').innerHTML=this.galleries[gallery[0]][gallery[1]][i+this.imageCount].title;}
if(!this.galleries[gallery[0]][gallery[1]][i-this.imageCount]){$('lightwindow_previous').setStyle({display:'none'});}else{$('lightwindow_previous').setStyle({display:'block'});$('lightwindow_previous_title').innerHTML=this.galleries[gallery[0]][gallery[1]][i-this.imageCount].title;}}
images[i]=document.createElement('img');images[i].setAttribute('id','lightwindow_image_'+i);images[i].setAttribute('border','0');images[i].setAttribute('src',this.contentToFetch);$('lightwindow_contents').appendChild(images[i]);this.checkImage[i]=new PeriodicalExecuter(function(i){if(!(typeof $('lightwindow_image_'+i).naturalWidth!="undefined"&&$('lightwindow_image_'+i).naturalWidth==0)){this.checkImage[i].stop();var imageHeight=$('lightwindow_image_'+i).getHeight();if(imageHeight>this.resizeTo.height){this.resizeTo.height=imageHeight;}
this.resizeTo.width+=$('lightwindow_image_'+i).getWidth();this.imageCount--;$('lightwindow_image_'+i).setStyle({height:'100%'});if(this.imageCount==0){this._processWindow();}}}.bind(this,i),1);}
break;case'media':var current=0;this.resizeTo.height=this.resizeTo.width=0;if(gallery=this._getGalleryInfo(this.element.rel)){for(current=0;current<this.galleries[gallery[0]][gallery[1]].length;current++){if(this.contentToFetch.indexOf(this.galleries[gallery[0]][gallery[1]][current].href)>-1){break;}}
if(this.galleries[gallery[0]][gallery[1]][current-1]){this.navigationObservers.previous=this.galleries[gallery[0]][gallery[1]][current-1];}else{this.navigationObservers.previous=false;}
if(this.galleries[gallery[0]][gallery[1]][current+1]){this.navigationObservers.next=this.galleries[gallery[0]][gallery[1]][current+1];}else{this.navigationObservers.next=false;}
this.activeGallery=true;}else{this.navigationObservers.previous=false;this.navigationObservers.next=false;this.activeGallery=false;}
if(gallery&&this.galleries[gallery[0]][gallery[1]][current]){this.contentToFetch=this.galleries[gallery[0]][gallery[1]][current].href;this.galleryLocation={current:current+1,total:this.galleries[gallery[0]][gallery[1]].length};if(!this.galleries[gallery[0]][gallery[1]][current+1]){$('lightwindow_next').setStyle({display:'none'});}else{$('lightwindow_next').setStyle({display:'block'});$('lightwindow_next_title').innerHTML=this.galleries[gallery[0]][gallery[1]][current+1].title;}
if(!this.galleries[gallery[0]][gallery[1]][current-1]){$('lightwindow_previous').setStyle({display:'none'});}else{$('lightwindow_previous').setStyle({display:'block'});$('lightwindow_previous_title').innerHTML=this.galleries[gallery[0]][gallery[1]][current-1].title;}}
if(this._getParameter('hidenav')){this.activeGallery=0;}
if(this._getParameter('lightwindow_iframe_embed')){this.resizeTo.height=this.dimensions.viewport.height;this.resizeTo.width=this.dimensions.viewport.width;}else{this.resizeTo.height=this._getParameter('lightwindow_height');this.resizeTo.width=this._getParameter('lightwindow_width');}
this._processWindow();break;case'external':this._appendIframe('auto');this.resizeTo.height=this.dimensions.viewport.height;this.resizeTo.width=this.dimensions.viewport.width;this._processWindow();break;case'page':var newAJAX=new Ajax.Request(this.contentToFetch,{method:'get',parameters:'',onComplete:function(response){$('lightwindow_contents').innerHTML+=response.responseText;this.resizeTo.height=$('lightwindow_contents').scrollHeight+(this.options.contentOffset.height);this.resizeTo.width=$('lightwindow_contents').scrollWidth+(this.options.contentOffset.width);this._processWindow();}.bind(this)});break;case'inline':var content=this.contentToFetch;if(content.indexOf('?')>-1){content=content.substring(0,content.indexOf('?'));}
content=content.substring(content.indexOf('#')+1);new Insertion.Top($('lightwindow_contents'),$(content).innerHTML);this.resizeTo.height=$('lightwindow_contents').scrollHeight+(this.options.contentOffset.height);this.resizeTo.width=$('lightwindow_contents').scrollWidth+(this.options.contentOffset.width);this._toggleTroubleElements('hidden',true);this._processWindow();break;default:throw("Page Type could not be determined, please amend this lightwindow URL "+this.contentToFetch);break;}},_resizeWindowToFit:function(){if(this.resizeTo.height+this.dimensions.cruft.height>this.dimensions.viewport.height){var heightRatio=this.resizeTo.height/this.resizeTo.width;if(this.windowType=='image'||(this.windowType=='media'&&!this._getParameter('lightwindow_iframe_embed'))){$('lightwindow_data_slide_inner').setStyle({width:this.resizeTo.width+'px'});}}
if(this.resizeTo.width+this.dimensions.cruft.width>this.dimensions.viewport.width){var widthRatio=this.resizeTo.width/this.resizeTo.height;if(this.windowType=='image'||(this.windowType=='media'&&!this._getParameter('lightwindow_iframe_embed'))){$('lightwindow_data_slide_inner').setStyle({height:this.resizeTo.height+'px'});}}},_presetWindowSize:function(){if(this._getParameter('lightwindow_height')){this.resizeTo.height=parseFloat(this._getParameter('lightwindow_height'));}
if(this._getParameter('lightwindow_width')){this.resizeTo.width=parseFloat(this._getParameter('lightwindow_width'));}},_processWindow:function(){this.dimensions.dataEffects=[];if(this.element.caption||this.element.author||(this.activeGallery&&this.options.showGalleryCount)){if(this.element.caption){$('lightwindow_data_caption').innerHTML=this.element.caption;$('lightwindow_data_caption').setStyle({display:'block'});}else{$('lightwindow_data_caption').setStyle({display:'none'});}
if(this.element.author){$('lightwindow_data_author').innerHTML=this.element.author;$('lightwindow_data_author_container').setStyle({display:'block'});}else{$('lightwindow_data_author_container').setStyle({display:'none'});}
if(this.activeGallery&&this.options.showGalleryCount){$('lightwindow_data_gallery_current').innerHTML=this.galleryLocation.current;$('lightwindow_data_gallery_total').innerHTML=this.galleryLocation.total;$('lightwindow_data_gallery_container').setStyle({display:'block'});}else{$('lightwindow_data_gallery_container').setStyle({display:'none'});}
$('lightwindow_data_slide_inner').setStyle({width:this.resizeTo.width+'px',height:'auto',visibility:'visible',display:'block'});$('lightwindow_data_slide').setStyle({height:$('lightwindow_data_slide').getHeight()+'px',width:'1px',overflow:'hidden',display:'block'});}else{$('lightwindow_data_slide').setStyle({display:'none',width:'auto'});$('lightwindow_data_slide_inner').setStyle({display:'none',visibility:'hidden',width:this.resizeTo.width+'px',height:'0px'});}
if(this.element.title!='null'){$('lightwindow_title_bar_title').innerHTML=this.element.title;}else{$('lightwindow_title_bar_title').innerHTML='';}
var originalContainerDimensions={height:$('lightwindow_container').getHeight(),width:$('lightwindow_container').getWidth()};$('lightwindow_container').setStyle({height:'auto',width:$('lightwindow_container').getWidth()+this.options.contentOffset.width-(this.windowActive?this.options.contentOffset.width:0)+'px'});var newContainerDimensions={height:$('lightwindow_container').getHeight(),width:$('lightwindow_container').getWidth()};this.containerChange={height:originalContainerDimensions.height-newContainerDimensions.height,width:originalContainerDimensions.width-newContainerDimensions.width};this.dimensions.container={height:$('lightwindow_container').getHeight(),width:$('lightwindow_container').getWidth()};this.dimensions.cruft={height:this.dimensions.container.height-$('lightwindow_contents').getHeight()+this.options.contentOffset.height,width:this.dimensions.container.width-$('lightwindow_contents').getWidth()+this.options.contentOffset.width};this._presetWindowSize();this._resizeWindowToFit();if(!this.windowActive){$('lightwindow_container').setStyle({left:-(this.dimensions.container.width/2)+'px',top:-(this.dimensions.container.height/2)+'px'});}
$('lightwindow_container').setStyle({height:this.dimensions.container.height+'px',width:this.dimensions.container.width+'px'});this._displayLightWindow('block','visible');this._animateLightWindow();},_animateLightWindow:function(){if(this.options.animationHandler){this.options.animationHandler().bind(this);}else{this._defaultAnimationHandler();}},_handleNavigation:function(display){if(this.options.navigationHandler){this.options.navigationHandler().bind(this,display);}else{this._defaultDisplayNavigation(display);}},_handleTransition:function(){if(this.options.transitionHandler){this.options.transitionHandler().bind(this);}else{this._defaultTransitionHandler();}},_handleFinalWindowAnimation:function(delay){if(this.options.finalAnimationHandler){this.options.finalAnimationHandler().bind(this,delay);}else{this._defaultfinalWindowAnimationHandler(delay);}},_handleGalleryAnimation:function(list){if(this.options.galleryAnimationHandler){this.options.galleryAnimationHandler().bind(this,list);}else{this._defaultGalleryAnimationHandler(list);}},_defaultDisplayNavigation:function(display){if(display){$('lightwindow_navigation').setStyle({display:'block',height:$('lightwindow_contents').getHeight()+'px',width:'100%',marginTop:this.options.dimensions.titleHeight+'px'});}else{$('lightwindow_navigation').setStyle({display:'none',height:'auto',width:'auto'});}},_defaultAnimationHandler:function(){if(this.element.caption||this.element.author||(this.activeGallery&&this.options.showGalleryCount)){$('lightwindow_data_slide').setStyle({display:'none',width:'auto'});this.dimensions.dataEffects.push(new Effect.SlideDown('lightwindow_data_slide',{sync:true}),new Effect.Appear('lightwindow_data_slide',{sync:true,from:0.0,to:1.0}));}
$('lightwindow_title_bar_inner').setStyle({height:'0px',marginTop:this.options.dimensions.titleHeight+'px'});this.dimensions.dataEffects.push(new Effect.Morph('lightwindow_title_bar_inner',{sync:true,style:{height:this.options.dimensions.titleHeight+'px',marginTop:'0px'}}),new Effect.Appear('lightwindow_title_bar_inner',{sync:true,from:0.0,to:1.0}));if(!this.options.hideGalleryTab){this._handleGalleryAnimation(false);if($('lightwindow_galleries_tab_container').getHeight()==0){this.dimensions.dataEffects.push(new Effect.Morph('lightwindow_galleries_tab_container',{sync:true,style:{height:'20px',marginTop:'0px'}}));$('lightwindow_galleries').setStyle({width:'0px'});}}
var resized=false;var ratio=this.dimensions.container.width-$('lightwindow_contents').getWidth()+this.resizeTo.width+this.options.contentOffset.width;if(ratio!=$('lightwindow_container').getWidth()){new Effect.Parallel([new Effect.Scale('lightwindow_contents',100*(this.resizeTo.width/$('lightwindow_contents').getWidth()),{scaleFrom:100*($('lightwindow_contents').getWidth()/($('lightwindow_contents').getWidth()+(this.options.contentOffset.width))),sync:true,scaleY:false,scaleContent:false}),new Effect.Scale('lightwindow_container',100*(ratio/(this.dimensions.container.width)),{sync:true,scaleY:false,scaleFromCenter:true,scaleContent:false})],{duration:this.duration,delay:0.25,queue:{position:'end',scope:'lightwindowAnimation'}});}
ratio=this.dimensions.container.height-$('lightwindow_contents').getHeight()+this.resizeTo.height+this.options.contentOffset.height;if(ratio!=$('lightwindow_container').getHeight()){new Effect.Parallel([new Effect.Scale('lightwindow_contents',100*(this.resizeTo.height/$('lightwindow_contents').getHeight()),{scaleFrom:100*($('lightwindow_contents').getHeight()/($('lightwindow_contents').getHeight()+(this.options.contentOffset.height))),sync:true,scaleX:false,scaleContent:false}),new Effect.Scale('lightwindow_container',100*(ratio/(this.dimensions.container.height)),{sync:true,scaleX:false,scaleFromCenter:true,scaleContent:false})],{duration:this.duration,afterFinish:function(){if(this.dimensions.dataEffects.length>0){if(!this.options.hideGalleryTab){$('lightwindow_galleries').setStyle({width:this.resizeTo.width+'px'});}
new Effect.Parallel(this.dimensions.dataEffects,{duration:this.duration,afterFinish:function(){this._finishWindow();}.bind(this),queue:{position:'end',scope:'lightwindowAnimation'}});}}.bind(this),queue:{position:'end',scope:'lightwindowAnimation'}});resized=true;}
if(!resized&&this.dimensions.dataEffects.length>0){new Effect.Parallel(this.dimensions.dataEffects,{duration:this.duration,beforeStart:function(){if(!this.options.hideGalleryTab){$('lightwindow_galleries').setStyle({width:this.resizeTo.width+'px'});}
if(this.containerChange.height!=0||this.containerChange.width!=0){new Effect.MoveBy('lightwindow_container',this.containerChange.height,this.containerChange.width,{transition:Effect.Transitions.sinoidal});}}.bind(this),afterFinish:function(){this._finishWindow();}.bind(this),queue:{position:'end',scope:'lightwindowAnimation'}});}},_defaultfinalWindowAnimationHandler:function(delay){if(this.windowType=='media'||this._getParameter('lightwindow_loading_animation')){Element.hide('lightwindow_loading');this._handleNavigation(this.activeGallery);this._setStatus(false);}else{Effect.Fade('lightwindow_loading',{duration:0.75,delay:1.0,afterFinish:function(){if(this.windowType!='image'&&this.windowType!='media'&&this.windowType!='external'){$('lightwindow_contents').setStyle({overflow:'auto'});}
this._handleNavigation(this.activeGallery);this._defaultGalleryAnimationHandler();this._setStatus(false);if(parseInt(getHeight())<parseInt($("lightwindow_container").offsetHeight))this._createMouseScrolling();}.bind(this),queue:{position:'end',scope:'lightwindowAnimation'}});}},_defaultGalleryAnimationHandler:function(list){if(this.activeGallery){$('lightwindow_galleries').setStyle({display:'block',marginBottom:$('lightwindow_data_slide').getHeight()+this.options.contentOffset.height/2+'px'});$('lightwindow_navigation').setStyle({height:$('lightwindow_contents').getHeight()-20+'px'});}else{$('lightwindow_galleries').setStyle({display:'none'});$('lightwindow_galleries_tab_container').setStyle({height:'0px',marginTop:'20px'});$('lightwindow_galleries_list').setStyle({height:'0px'});return false;}
if(list){if($('lightwindow_galleries_list').getHeight()==0){var height=$('lightwindow_contents').getHeight()*0.80;$('lightwindow_galleries_tab_span').className='down';}else{var height=0;$('lightwindow_galleries_tab_span').className='up';}
new Effect.Morph('lightwindow_galleries_list',{duration:this.duration,transition:Effect.Transitions.sinoidal,style:{height:height+'px'},beforeStart:function(){$('lightwindow_galleries_list').setStyle({overflow:'hidden'});},afterFinish:function(){$('lightwindow_galleries_list').setStyle({overflow:'auto'});},queue:{position:'end',scope:'lightwindowAnimation'}});}},_defaultTransitionHandler:function(){this.dimensions.dataEffects=[];if($('lightwindow_data_slide').getStyle('display')!='none'){this.dimensions.dataEffects.push(new Effect.SlideUp('lightwindow_data_slide',{sync:true}),new Effect.Fade('lightwindow_data_slide',{sync:true,from:1.0,to:0.0}));}
if(!this.options.hideGalleryTab){if($('lightwindow_galleries').getHeight()!=0&&!this.options.hideGalleryTab){this.dimensions.dataEffects.push(new Effect.Morph('lightwindow_galleries_tab_container',{sync:true,style:{height:'0px',marginTop:'20px'}}));}
if($('lightwindow_galleries_list').getHeight()!=0){$('lightwindow_galleries_tab_span').className='up';this.dimensions.dataEffects.push(new Effect.Morph('lightwindow_galleries_list',{sync:true,style:{height:'0px'},transition:Effect.Transitions.sinoidal,beforeStart:function(){$('lightwindow_galleries_list').setStyle({overflow:'hidden'});},afterFinish:function(){$('lightwindow_galleries_list').setStyle({overflow:'auto'});}}));}}
this.dimensions.dataEffects.push(new Effect.Morph('lightwindow_title_bar_inner',{sync:true,style:{height:'0px',marginTop:this.options.dimensions.titleHeight+'px'}}),new Effect.Fade('lightwindow_title_bar_inner',{sync:true,from:1.0,to:0.0}));new Effect.Parallel(this.dimensions.dataEffects,{duration:this.duration,afterFinish:function(){this._loadWindow();}.bind(this),queue:{position:'end',scope:'lightwindowAnimation'}});},_defaultFormHandler:function(e){var element=Event.element(e).parentNode;var parameterString=Form.serialize(this._getParameter('lightwindow_form',element.getAttribute('params')));if(this.options.formMethod=='post'){var newAJAX=new Ajax.Request(element.href,{method:'post',postBody:parameterString,onComplete:this.openWindow.bind(this,element)});}else if(this.options.formMethod=='get'){var newAJAX=new Ajax.Request(element.href,{method:'get',parameters:parameterString,onComplete:this.openWindow.bind(this,element)});}},_finishWindow:function(){if(this.windowType=='external'){$('lightwindow_iframe').setAttribute('src',this.element.href);this._handleFinalWindowAnimation(1);}else if(this.windowType=='media'){var outerObject=document.createElement('object');outerObject.setAttribute('classid',this.options.classids[this._fileExtension(this.contentToFetch)]);outerObject.setAttribute('codebase',this.options.codebases[this._fileExtension(this.contentToFetch)]);outerObject.setAttribute('id','lightwindow_media_primary');outerObject.setAttribute('name','lightwindow_media_primary');outerObject.setAttribute('width',this.resizeTo.width);outerObject.setAttribute('height',this.resizeTo.height);outerObject=this._addParamToObject('movie',this.contentToFetch,outerObject);outerObject=this._addParamToObject('src',this.contentToFetch,outerObject);outerObject=this._addParamToObject('controller','true',outerObject);outerObject=this._addParamToObject('wmode','transparent',outerObject);outerObject=this._addParamToObject('cache','false',outerObject);outerObject=this._addParamToObject('quality','high',outerObject);outerObject=this._addParamToObject('allowfullscreen','true',outerObject);if(!Prototype.Browser.IE){var innerObject=document.createElement('object');innerObject.setAttribute('type',this.options.mimeTypes[this._fileExtension(this.contentToFetch)]);innerObject.setAttribute('data',this.contentToFetch);innerObject.setAttribute('id','lightwindow_media_secondary');innerObject.setAttribute('name','lightwindow_media_secondary');innerObject.setAttribute('width',this.resizeTo.width);innerObject.setAttribute('height',this.resizeTo.height);innerObject=this._addParamToObject('controller','true',innerObject);innerObject=this._addParamToObject('wmode','transparent',innerObject);innerObject=this._addParamToObject('cache','false',innerObject);innerObject=this._addParamToObject('quality','high',innerObject);innerObject=this._addParamToObject('allowfullscreen','true',innerObject);outerObject.appendChild(innerObject);}
if(this._getParameter('lightwindow_iframe_embed')){this._appendIframe('no');this._writeToIframe(this._convertToMarkup(outerObject,'object'));}else{this._appendObject(outerObject,'object',$('lightwindow_contents'));}
this._handleFinalWindowAnimation(0);}else{this._handleFinalWindowAnimation(0);}
this._setupActions();}}
Event.observe(window,'load',lightwindowInit,false);function lightwindowInit(){ritoriLightWindow=new lightwindow();};function Movie(){this.startSeek=function(){};this.stopSeek=function(){};this.showTile=function(){};this.hideTile=function(){};this.callFlashSn=function(){};this.loadVideo=function(){};this.changeVideoPos=function(){};this.createTile=function(){showContentIfLoaded();};};;var hideContent=function(){$('header').style.display="none";$('maincontent').style.display="none";$('submenu').style.display="none";$('bottomPanelLeft').remove();$('bottomPanelRight').remove();$('bottomPanelRightJs').style.display="none";$('we').innerHTML="<span>Наши</span>";$('works').innerHTML="<span>работы</span>";$('services').innerHTML="<span>продают</span>";$('contact').innerHTML="<span>Звоните</span>";}
function writelog(value){$('log').value=value+'\n'+$('log').value;}
visStatus=new Array();contentHeight=0;pgloaded=0;spyContentHeight=0;firstrun=1;headerselected=0;effects=new Array();effectsVals=new Array();contentload=0;percentpos=new Array();hidetile=0;fullpath="";rpath="";pathLength=0;lastpath="";pgContent=new Array();submenu="";lastsubmenu="";domloaded=0;eventparams=new Array();winHeight=0;var embedScript;pgHeader="";pgScript="";videoIsLoaded=false;params=new Array();var eventsContent;siteAddress='';var lBox;var overHideAccess=0;var scrollVideo=0;subMenuSelected=0;contentdivshow=0;flashActive=-1;oldBrowser=0;servicesScroll=0;cssto=null;flashMode=getCookie("flashMode")?getCookie("flashMode"):1;flashOnPage=0;flashDetected=swfobject.hasFlashPlayerVersion('9.0.45')?1:0;animations=new Array();ritoriLightWindow=null;var gmapLoaded=0;slideInterval=5000;serviceScrollInterval=8000;var movie;var mOverTimer=new Array();headersList={we:{nameOn:"Агентство",nameOff:"Наши"},works:{nameOn:"Портфолио",nameOff:"работы"},services:{nameOn:"Услуги",nameOff:"продают"},contact:{nameOn:"Связь с нами",nameOff:"Звоните"}};servicesSlides=["убеждают","развивают","показывают","обучают","раскрывают","продают","оживляют","говорят","заманивают","передают","увлекают","продают","изображают","бодрят","захватывают","продают"];servicesSlidesIndex=0;address=String(document.location);siteAddress=address.replace(/^(http\:\/\/||https\:\/\/)([^\/]+)[\/]*.*$/,"$1$2/");function embedFlash(){if(!parseInt(flashMode)){flashActive=0;return;}
if((asual.util.Browser.isOpera()&&parseFloat(asual.util.Browser.getVersion())<9.7)||(navigator.userAgent.indexOf('UNIX')!=-1&&!asual.util.Browser.isMozilla())){flashActive=0;flashDetected=0;oldBrowser=1;return;}
swfobject.embedSWF('/mediafiles/flash/index.swf','flashBack','100%','100%','9.0.45','/mediafiles/flash/expressinstall.swf',{},{bgcolor:'#000000',menu:'true',wmode:'opaque'},{id:'flashBack'},loadFlashFn);}
function spyForContentHeight(){spyContentHeight=1;var startdispfalse=0;if($('maincontent').style.display=="none"){startdispfalse=1;$('maincontent').style.opacity=0;$('maincontent').style.display="block"}
var newContentLoaded=0;cHeight=$('content').offsetHeight;var l=parseInt(cHeight)%35;if(this.rpath!="works")workslen=0;else workslen=35;if(cHeight!=this.contentHeight){$('bgcontent').style.height=((parseInt(cHeight)-l)+35)+"px";this.contentHeight=cHeight;newContentLoaded=1;$('bottomPanelJs').style.top=(parseInt(cHeight)-l)+280+workslen+"px";}
if($('bgcontent').style.height){curHeight=parseInt(getHeight());if(this.winHeight!=curHeight||newContentLoaded){actualSize=parseInt($('bgcontent').style.height)+315+workslen;if(curHeight>=actualSize){$('flashBack').style.height=curHeight+'px';}
else{$('flashBack').style.height=actualSize+'px';}
this.winHeight=curHeight;$('progressbar').style.marginLeft=parseInt($('header').offsetLeft)+315+"px";}}
if(startdispfalse){$('maincontent').style.display='none';}
spyContentHeight=0;}
document.observe('dom:loaded',whenDomLoaded);function loadFlashFn(event){if(event.success)flashActive=1;else flashActive=0;if(domloaded)launch();}
function whenDomLoaded(){domloaded=1;if(flashActive!=-1)launch();}
var nSWFChecks=12;var firstLaunch=1;var SWFChecksTimer;function launch(){if(firstLaunch==1){if(flashActive&&!flashReadyVar){SWFChecksTimer=window.setInterval(checkSWFIsOn,250);}else{realLaunch();}
firstLaunch=0;}}
function checkSWFIsOn(){if(flashReadyVar){window.clearInterval(SWFChecksTimer);realLaunch();}else{if(nSWFChecks<=0){window.clearInterval(SWFChecksTimer);flashActive=0;realLaunch();}}
nSWFChecks--;}
function realLaunch(){if(asual.util.Browser.isOpera()&&parseFloat(asual.util.Browser.getVersion())==9.8)$$("body")[0].className="opera10Body";if(oldBrowser)$$("#bottomPanelLeftJs div")[0].innerHTML="Это упрощенная версия сайта.<br>Рекомендуем скачать новую версию браузера.";SWFAddress.setTracker('pageTracker._trackPageview');movie=thisMovie("flashBack");if(!flashActive){flashOnPage=0;movie=new Movie();}
else flashOnPage=1;$('header').onHover(callbackOver.bindAsMouseEnter(null,'ON'),callbackOut.bindAsMouseLeave(null,'OFF'));if(flashActive&&!parseInt(flashMode))showhideflash();if(!flashActive)showHeader();}
function showhideflash(){if(flashActive){$('flashBack').style.visibility="hidden";movie=new Movie();flashActive=0;setFlashSwitchText();oHA=overHideAccess;overHideAccess=0;setCookie("flashMode",0);}
else{setCookie("flashMode",1);if(!flashOnPage){setCookie("flashMode",1);window.location.reload();return;}
$('flashBack').style.visibility="visible";movie=thisMovie("flashBack");flashActive=1;setFlashSwitchText();overHideAccess=oHA;}}
function setFlashSwitchText(){if(flashActive){$('bottomSwitchFlashText').innerHTML="Выключить эффекты";$('bottomPanelSwitchFlashText').setStyle({backgroundImage:"url(/mediafiles/images/buter.png)"});}
else{$('bottomSwitchFlashText').innerHTML="Включить эффекты";$('bottomPanelSwitchFlashText').setStyle({backgroundImage:"url(/mediafiles/images/cake.png)"});}}
Element.addMethods({onHover:function(element,callbackOver,callbackOut){return $(element).observe('mouseover',callbackOver).observe('mouseout',callbackOut);}});var callbackOver=function(event,msg){if(!overHideAccess)return;if(this.firstrun)return;createEvent('header','mousemove',mOver);this.headerselected=1;if(this.contentload)return;if(!this.pgloaded||this.visStatus["maincontent"]==0)return;hideSWF();hideSequence(Array("submenu"),0.5,function(){});hideSequence(Array("maincontent"),0.5,function(){this.scrollVideo=1;this.movie.startSeek();this.movie.hideTile();});};var callbackOut=function(event,msg){if(this.firstrun)return;scrollVideo=0;this.movie.stopSeek();if(this.hidetile){this.hidetile=0;this.movie.showTile();}
removeEvent('header','mousemove',mOver);this.headerselected=0;if(this.contentload)return;if(!this.pgloaded||this.visStatus["maincontent"]==1)return;if(this.rpath=="works"){showSequence(Array("submenu"),0.5,function(){});showSequence(Array("maincontent"),0.5,function(){whenContentShowed();});return;}
showSequence(Array("maincontent"),0.5,function(){whenContentShowed();});};function whenContentShowed(){showSWF();this.movie.showTile();}
function getHeight(){var h;if(document.innerHeight){h=document.innerHeight;}else if(document.documentElement.clientHeight){h=document.documentElement.clientHeight;}else if(document.body){h=document.body.clientHeight;}
if(self.innerHeight){h=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){h=document.documentElement.clientHeight;}else if(document.body){h=document.body.clientHeight;}
return h;}
function defPosition(event){var x=y=relx=rely=0;if(document.attachEvent!=null){relx=window.event.clientX;rely=window.event.clientY;x=relx+(document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft);y=rely+(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop);}else if(!document.attachEvent&&document.addEventListener){relx=event.clientX;rely=event.clientY;x=relx+window.scrollX;y=rely+window.scrollY;}else{}
return{x:x,y:y,relX:relx,relY:rely};}
var mOver=function(event,msg){if(this.firstrun)return;percentpos['maincontent']=(defPosition(event).x-$('header').offsetLeft)/($('header').offsetWidth);};(function(){var events=Prototype.Browser.IE?{"bindAsMouseEnter":"fromElement","bindAsMouseLeave":"toElement"}:{"bindAsMouseEnter":"relatedTarget","bindAsMouseLeave":"relatedTarget"};for(var eventName in events){(function(relTargetProperty){Function.prototype[eventName]=function(){var __method=this,args=$A(arguments),object=args.shift();return function(event){event=event||window.event;try{var relatedTarget=$(event[relTargetProperty]);if(relatedTarget&&relatedTarget!=this&&!relatedTarget.descendantOf(this)){__method.apply(object,[Event.extend(event)].concat(args));}}catch(e){}};};})(events[eventName]);}})();var jsReady=false;function isReady(){return jsReady;}
function pageInit(){jsReady=true;}
var flashReadyVar=false;function flashReady(){flashReadyVar=true;return true;}
function thisMovie(movieName){if(document[movieName])return document[movieName];else return window[movieName];if(navigator.appName.indexOf("Microsoft")!=-1){return window[movieName];}else{return document[movieName];}}
function callFlashFn(value){this.movie.callFlashFn(value);}
function setXY(value,value2){}
function showHeader(){if(!flashActive)overHideAccess=0;visStatus["header"]=-1;showSequence(Array("header"),1,function(){setSelectedStyle(SWFAddress.getPath());visStatus["header"]=1;showFirstContent();});}
function videoLoaded(){overHideAccess=1;oHA=1;videoIsLoaded=1;}
var firstContentShowed=false;function showFirstContent(){if(firstContentShowed)return;firstContentShowed=true;servicesScroll=1;serviceSlideElemsCreate();createServicesScrolling();animations["mainMenuAnimation"]=true;for(key in headersList){$(key).observe('mouseover',function(){if(effects['headCaptions'])clearTimeout(effects['headCaptions']);if(this.id=="contact"){setNewCaption(this.id,headersList[this.id].nameOn,"on",true);outHeaderElem('services');return;}
stopHeadSlides();for(v in headersList){if(v=="contact")continue;setNewCaption(v,headersList[v].nameOn,"on",((v==this.id)?true:false));}});$(key).observe('mouseout',function(){thiskey=this.id;if(thiskey!="contact")effects['headCaptions']=setTimeout('outHeaderElem(thiskey)',50);else outHeaderElem(thiskey);});}
showProgressBar();var ii=setInterval(function(){if(this.pgloaded){hideProgressBar();if(rpath=="works")showSequence(Array("submenu"),1,function(){visStatus["submenu"]=1;loadPageContentStart()});else loadPageContentStart();clearInterval(ii);}},100);}
function outHeaderElem(thiskey){if(thiskey=="contact"){setNewCaption(thiskey,headersList[thiskey].nameOff,"off");return;}
createServicesScrolling()
for(v in headersList){if(v=="contact")continue;if(v!="services")setNewCaption(v,headersList[v].nameOff,"off");else setNewCaption(v,(servicesSlides[servicesSlidesIndex-1]?servicesSlides[servicesSlidesIndex-1]:servicesSlides[servicesSlides.length-1]),"off");}}
function showContentIfLoaded(){hideProgressBar();this.contentdivshow=1;showSequence(Array("maincontent"),0.5,function(){this.contentdivshow=0;contentShowed();contentload=0;});}
function contentShowProcess(){if(this.contentdivshow==1)return true;else return false;}
function loadPageContentStart(){if(!this.visStatus["bottomPanelRightJs"]){$('bottomPanelJs').style.display="block";Effect.Appear("bottomPanelRightJs",{duration:0.5,from:0,to:1,afterFinish:function(){visStatus["bottomPanelRightJs"]=1;}});if(!flashDetected)Effect.Appear("bottomPanelLeftJs",{duration:0.5,from:0,to:1,afterFinish:function(){visStatus["bottomPanelLeftJs"]=1;}});if(flashDetected)Effect.Appear("bottomPanelSwitchFlash",{duration:0.5,from:0,to:1,afterFinish:function(){visStatus["bottomPanelSwitchFlash"]=1;}});setFlashSwitchText();}
showSequence(Array("maincontent"),1,function(){contentShowed();firstrun=0;tmp=movie;if(flashOnPage)movie=thisMovie("flashBack");movie.loadVideo();movie=tmp;});}
function rootContentChanged(){if(this.rpath==this.lastpath)return false;else return true;}
function contentShowed(){showSWF();if(this.galleryx.galleryObject)defaultGallerySettings();}
function showSequence(sequence,period,onCompleteFunction){if(!sequence.length)return;len=sequence.length;if(!period)period=1;var elem=sequence[0];sequence.splice(0,1);if(this.effects[elem])this.effects[elem].cancel();if(this.visStatus[elem]==1){if(onCompleteFunction&&len==1){onCompleteFunction()};showSequence(sequence,period,onCompleteFunction);return;}
this.visStatus[elem]=-1;this.effects[elem]=Effect.Appear(elem,{duration:period,afterFinish:function(){visStatus[elem]=1;if(onCompleteFunction&&len==1){onCompleteFunction()};showSequence(sequence,period,onCompleteFunction)}});}
function hideSequence(sequence,period,onCompleteFunction){if(!sequence.length)return;len=sequence.length;if(!period)period=1;var elem=sequence[0];sequence.splice(0,1);if(this.effects[elem])this.effects[elem].cancel();if(this.visStatus[elem]==0){if(onCompleteFunction&&len==1){onCompleteFunction()};hideSequence(sequence,period,onCompleteFunction);return;}
this.visStatus[elem]=-2;this.effects[elem]=Effect.Fade(elem,{duration:period,afterFinish:function(){visStatus[elem]=0;if(onCompleteFunction&&len==1){onCompleteFunction()};hideSequence(sequence,period,onCompleteFunction)}});}
function findPos(obj){var curleft=curtop=0;if(obj.offsetParent){curleft=obj.offsetLeft
curtop=obj.offsetTop
while(obj=obj.offsetParent){curleft+=obj.offsetLeft
curtop+=obj.offsetTop}}
return[curleft,curtop];}
function onHeadClick(object){if(this.firstrun||(flashActive&&!videoIsLoaded))return;p=findPos(object);p[0]+=object.offsetWidth/2;percent=(p[0]-$('header').offsetLeft)/($('header').offsetWidth);if(visStatus['maincontent']==1)this.movie.changeVideoPos(percent);}
function changeVideoPos(percent){}
function changeUrl(url){this.pgScript='';hideSWF();if(this.firstrun)return;this.galleryx.galleryObject=null;this.galleriesIndexes=new Array();isOpera=asual.util.Browser.isOpera();version=asual.util.Browser.getVersion();var myObj=new Object();myObj.path=url;if(isOpera&&parseFloat(version)<=9.27)handleChange(myObj);else SWFAddress.setValue(url);return true;}
function setParameters(url){pars=String(url);p=pars.replace(/^.*\?(.*)$/,"$1");this.params=new Array();if(!p||p==pars)p=null;else{p=p.split("&");for(var i=0;i<p.length;i++){par=p[i].split("=");this.params[par[0]]=par[1];}}}
function hideSWF(){var links=$$('object');for(var i=0;i<links.length;i++){if(links[i].id!="flashBack")$(links[i].id).style.visibility="hidden";}}
function showSWF(){var links=document.getElementsByTagName('object');for(var i=0;i<links.length;i++){if(links[i].id!="flashBack")$(links[i].id).style.visibility="visible";}}
function loadContent(){name=this.eventparams['path'];if(this.lastpath==name)return;if(scrollVideo==1){scrollVideo=0;this.movie.stopSeek();}
if(this.embedScript){this.embedScript.remove();this.embedScript=null;};setSelectedStyle(name);if(this.effects["maincontent"])this.effects["maincontent"].cancel();if(this.effects["submenu"])this.effects["submenu"].cancel();this.contentload=1;if(this.rpath=="works"){hideSequence(Array("maincontent"),0.5,function(){showSequence(Array("submenu"),0.5,function(){contentload=0;loadInitPage();});});return;}
hideSequence(Array("submenu"),0.5,function(){});hideSequence(Array("maincontent"),0.5,function(){contentload=0;loadInitPage();});}
function loadInitPage(){setSelectedStyle(SWFAddress.getPath());var cachepath;if(this.submenu&&this.rpath=="works"&&this.pathLength<3)cachepath=this.rpath;else cachepath=this.fullpath;if(pgContent[cachepath]){this.contentload=1;if(this.submenu&&this.rpath=="works"&&this.pathLength<3)pageParcing(pgContent[cachepath]);else $('content').innerHTML=getPageAttrs(pgContent[cachepath]);appear();}
else{var parameters='';pars=this.eventparams['parameters'];for(var p in pars){parameters+='&'+p+'='+pars[p];}
var xhr=getTransport();xhr.onreadystatechange=function(){updateChange(xhr);}
if(this.rpath=="works"&&this.pathLength<3)xhr.open('get',siteAddress+'worksxml'+parameters,true);else xhr.open('get',siteAddress+'xml'+this.eventparams['path']+parameters,true);xhr.setRequestHeader('Content-Type','application/x-swfaddress');if(!this.firstrun)showProgressBar();this.pgloaded=0;this.contentload=1;xhr.send('');}}
function showProgressBar(){if(this.rpath=="works")$('progressbar').style.marginTop='245px';else $('progressbar').style.marginTop='210px';$('progressbar').style.marginLeft=parseInt($('header').offsetLeft)+315+"px";$('progressbar').style.display="block";}
function hideProgressBar(){$('progressbar').style.display="none";}
function setSelectedStyle(path){if(path[path.length-1]!="/")path=path+"/";path=path.replace(/\/\//,"/");p=path;while(p!=(p=p.replace(/(\/[^\/]+)(\/||$)/,"o$2"))){}
this.pathLength=p.replace(/\//,"").length;this.fullpath=path;if(!this.rpath)this.rpath="home";this.lastpath=this.rpath;this.rpath=path;this.lastsubmenu=this.submenu;this.submenu=this.rpath.replace(/^\/[a-zA-Z0-9]*\/([a-zA-Z0-9]*)[\/]{0,1}.*$/,"$1");if(this.submenu=="/")this.submenu="";undermenu=this.rpath.replace(/^\/[a-zA-Z0-9]*\/[a-zA-Z0-9]*\/([a-zA-Z0-9]*)[\/]{0,1}.*$/,"$1");if(undermenu=="/")undermenu="";this.rpath=this.rpath.replace(/^\/([a-zA-Z0-9]*)[\/]{0,1}.*$/,"$1");if(!this.rpath)this.rpath="home";if(this.lastpath&&$(this.lastpath)){$(this.lastpath).className="menu_link";}
if(this.rpath&&$(this.rpath)){$(this.rpath).className="headerselected";}
if(this.rpath&&$(this.rpath)&&this.submenu){$(this.rpath).className="headeractive";}
if(this.submenu)subMenuSelected=1;if(this.rpath=="works"&&!this.submenu){this.submenu="favorites";subMenuSelected=0;}
if(this.lastsubmenu&&$(this.lastsubmenu))$(this.lastsubmenu).className="submenulnk";if(this.submenu&&$(this.submenu))$(this.submenu).className="sublnkselected";if(this.submenu&&$(this.submenu)&&undermenu)$(this.submenu).className="sublnkactive";}
function createEvent(elem,action,func){if($(elem).addEventListener){$(elem).addEventListener(action,func,true);}else{$(elem).attachEvent('on'+action,func);}}
function removeEvent(elem,action,func){if($(elem).removeEventListener){$(elem).removeEventListener(action,func,true);}else{$(elem).detachEvent('on'+action,func);}}
function getPointerPercent(){return this.percentpos['maincontent'];}
function chckSubMenuStyle(){}
var galleryx=new Array();var currentGalleryObject=new Array();function showPreview(gallery,elemid,curelement){if(!this.galleryx.galleryObject)return;var cGO=this.currentGalleryObject[gallery];if(currentGalleryObject[gallery]==elemid)return;if($('previewHref'+gallery+'_'+currentGalleryObject[gallery]))$('previewHref'+gallery+'_'+currentGalleryObject[gallery]).className="inactivelnk";if($('previewHref'+gallery+'_'+elemid))$('previewHref'+gallery+'_'+elemid).className="activelnk";element=this.galleryx.galleryObject[gallery].elements[elemid];currentGalleryObject[gallery]=elemid;if(elemid==this.galleryx.galleryObject[gallery].elements.length-1){$('moveforward'+gallery).style.display="none"}
else{$('moveforward'+gallery).style.display="block"}
if(elemid==0){$('moveback'+gallery).style.display="none"}
else{$('moveback'+gallery).style.display="block"}
curelement=element;$('galleryHider'+gallery).style.height=$('imgDiv'+gallery).offsetHeight+20+"px";if(cGO!=-1){showSequence(Array('galleryHider'+gallery),0.3,function(){insertGalleryObject(gallery,curelement)});}
else{$('navBarPreview'+gallery).style.display='none';insertGalleryObject(gallery,curelement,true);}}
function insertGalleryObject(gallery,element,noLoadSrc){if(!this.galleryx.galleryObject)return;if(noLoadSrc){if(element.type=="img"){$("navBarPreview"+gallery).style.display="block";$('navBarPreview'+gallery).style.height=$('previewImg'+gallery).getHeight()+'px';spyForContentHeight();}}else{$('imgDiv'+gallery).style.visibility='hidden';$('imgDiv'+gallery).style.display='block';if(element.type=="img"){if($('previewImg'+gallery)){swfobject.removeSWF("previewImg"+gallery);}
if($('imgHref'+gallery))$('imgHref'+gallery).remove();if(element.fileurl)src=element.fileurl;else src=element.fullImg;$('navBarPreview'+gallery).style.display='block';newImg=new Element('img',{id:'previewImg'+gallery,border:0});newImg.onload=function(){peImg=new PeriodicalExecuter(function(gallery){if($('previewImg'+gallery)){peImg.stop();appendGalleryPreview(gallery);}}.bind(this,gallery),0.1);};newImg.src=src;imgHref=new Element('span',{id:"imgHref"+gallery});imgHref.appendChild(newImg);$('previewImgContainer'+gallery).innerHTML="";$('previewImgContainer'+gallery).appendChild(imgHref);}
else if(element.type=="flash"){if($('imgHref'+gallery))$('imgHref'+gallery).remove();if($('previewImg'+gallery))$('previewImg'+gallery).remove();$('previewImgContainer'+gallery).innerHTML="";flashDiv=new Element("div",{id:"flashContainer"+gallery});$('previewImgContainer'+gallery).appendChild(flashDiv);if(element.fileurl)src=element.fileurl;else src=element.fullImg;$('navBarPreview'+gallery).style.display='none';var pars=new Array();var efp=element.flashpars.split(",");for(var i=0;i<efp.length;i++){var pp=efp[i].split(":");pn=pp[0];pv=pp[1];pars[pn]=pv;}
swfobject.embedSWF(src,'flashContainer'+gallery,element.width,element.height,'9.0.45','/mediafiles/flash/expressinstall.swf',pars,{allowFullScreen:"true",wmode:"opaque"},{id:'previewImg'+gallery});}
$('previewComment'+gallery).innerHTML="";if(element.comment)$('previewComment'+gallery).innerHTML=element.comment;}
var g=gallery;if(element.type=="flash")appendGalleryPreview(g);}
function appendGalleryPreview(gallery){spyForContentHeight();$('galleryHider'+gallery).style.height=$('imgDiv'+gallery).offsetHeight+20+"px";$('imgDiv'+gallery).style.visibility='visible';if($('previewImg'+gallery))$('navBarPreview'+gallery).style.height=$('previewImg'+gallery).getHeight()+'px';hideSequence(Array('galleryHider'+gallery),0.3,function(){});}
function measureLeft(oElement){var iLeft=oElement.offsetLeft;var oParent=oElement.offsetParent;while(oParent.nodeName!='BODY'&&oParent.nodeName!='HTML'){iLeft+=oParent.offsetLeft;oParent=oParent.offsetParent;}
return iLeft;}
function measureTop(oElement){var iTop=oElement.offsetTop;var oParent=oElement.offsetParent;while(oParent.nodeName!='BODY'&&oParent.nodeName!='HTML'){iTop+=oParent.offsetTop;oParent=oParent.offsetParent;}
return iTop;}
function moveFwd(gallery){showPreview(gallery,currentGalleryObject[gallery]+1);}
function moveBwd(gallery){showPreview(gallery,currentGalleryObject[gallery]-1);}
var galleriesIndexes=new Array();function addGalleries(gallery){galleriesIndexes.push(gallery);}
function defaultGallerySettings(){ritoriLightWindow.reinitialize();for(a=0;a<galleriesIndexes.length;a++){i=galleriesIndexes[a];this.currentGalleryObject[i]=-1;showPreview(i,0);if($('imgDiv'+i))$('imgDiv'+i).onHover(on.bindAsMouseEnter(null,i),off.bindAsMouseLeave(null,i));}}
var on=function(event,gallery){writelog("enter");$('navBarPreview'+gallery).style.visibility="";}
var off=function(event,gallery){writelog("leave");$('navBarPreview'+gallery).style.visibility="hidden";}
function changeEvent(index){if($('mainEvt').value==index)return;$('event'+$('mainEvt').value).className='mainEventsInactiveDate';$('event'+index).className='mainEventsActiveDate';$('mainEvt').value=index;hideSequence(Array("mainEventsContent"),0.3,function(){$('mainEventsContent').innerHTML=this.eventsContent[index];showSequence(Array("mainEventsContent"),0.3,function(){})});}
function changeView(type){if(type=='large')setCookie('viewType','large');if(type=='small')setCookie('viewType','small');}
function showHideDivEffect1(elem,minheight,maxheight,startEffectVal){if(this.effects[elem])this.effects[elem].cancel();var act;if(this.effectsVals[elem])act=this.effectsVals[elem]["action"];else this.effectsVals[elem]=new Array();if(startEffectVal==0||startEffectVal==1)act=startEffectVal;if(!act){this.effects[elem]=Effect.BlindDown(elem,{duration:0.5,scaleTo:maxheight,afterUpdate:function(){spyForContentHeight();}});this.effectsVals[elem]["action"]=1;}
else{this.effects[elem]=Effect.BlindUp(elem,{duration:0.5,scaleTo:minheight,afterUpdate:function(){spyForContentHeight();}});(elem,{duration:1.0});this.effectsVals[elem]["action"]=0;}}
function showhideMap(){if(gmapLoaded)showHideDivEffect1('contactMap',0,100);if(!gmapLoaded){showHideDivEffect1('contactMap',0,100,0);$('contactMap').src='/gmap/';gmapLoaded=1;}}
function setNewCaption(object,caption,onoff,selected){if(onoff=="on"&&selected){}
else caption="<span>"+caption+"</span>";$(object).innerHTML=caption;}
function createServicesScrolling(){servicesScroll=1;servicesSlidesIndex2=servicesSlides[servicesSlidesIndex-1]?(servicesSlidesIndex-1):(servicesSlides.length-1);setNewCaption("services",servicesSlides[servicesSlidesIndex2]);if(cssto)clearTimeout(cssto);cssto=setTimeout(function(){servicesScrolling();},3000);}
function setScrollRGB(){if($('services').className=='headerselected'){startRGB1=[255,255,255];finishRGB1=[60,178,51];startRGB2=[61,181,52];finishRGB2=[255,255,255];}
else{startRGB1=[48,48,48];finishRGB1=[255,255,255];startRGB2=[255,255,255];finishRGB2=[48,48,48];}
RGB1=[finishRGB1[0]-startRGB1[0],finishRGB1[1]-startRGB1[1],finishRGB1[2]-startRGB1[2]];RGB2=[finishRGB2[0]-startRGB2[0],finishRGB2[1]-startRGB2[1],finishRGB2[2]-startRGB2[2]];}
function servicesScrolling(){if(!servicesScroll)return;if(visStatus["maincontent"]!=1){refreshHeadTimeOut();return;}
if(animations["mainMenuAnimation"])animations["mainSlides"]=false;else{animations["mainSlides"]=true;refreshHeadTimeOut(700);return;}
if(this.effects["sctween"])this.effects["sctween"].cancel();if(this.effects["sc2tween"])this.effects["sc2tween"].cancel();$('services').innerHTML="";createTopScroll();createBottomScroll();setScrollRGB();if($('s_c2')){$('s_c2').style.color="rgb("+startRGB2[0]+","+startRGB2[1]+","+startRGB2[2]+")";$('s_c2').style.display="block";}
if($('s_c'))$('s_c').style.display="block";this.effects["sc2tween"]=new Effect.Tween('sc2t',0,1,{duration:2,transition:Effect.Transitions.spring},function(p){if(p==1)effects["sc2t"]=true;else effects["sc2t"]=false;visfactor=1-Math.abs(1-p);setScrollRGB();sc2top=46-23*p+"px";resRGB=[parseInt(startRGB2[0]+RGB2[0]*visfactor),parseInt(startRGB2[1]+RGB2[1]*visfactor),parseInt(startRGB2[2]+RGB2[2]*visfactor)];if($('s_c2')){$('s_c2').style.top=sc2top;$('s_c2').style.color="rgb("+resRGB[0]+","+resRGB[1]+","+resRGB[2]+")";}
if(effects["sc2t"]==true&&effects["sct"]==true)updateHeadSlides();});this.effects["sctween"]=new Effect.Tween('sct',0,1,{duration:0.2},function(p){if(p==1){effects["sct"]=true;if($('s_c'))$('s_c').style.display="none";}else effects["sct"]=false;sctop=23-23*p+"px";if($('s_c'))$('s_c').style.top=sctop;setScrollRGB();resRGB=[parseInt(startRGB1[0]+RGB1[0]*p),parseInt(startRGB1[1]+RGB1[1]*p),parseInt(startRGB1[2]+RGB1[2]*p)];if($('s_c'))$('s_c').style.color="rgb("+resRGB[0]+","+resRGB[1]+","+resRGB[2]+")";if(effects["sc2t"]==true&&effects["sct"]==true)updateHeadSlides();});}
function createTopScroll(){servicesSlidesIndex2=servicesSlides[servicesSlidesIndex-1]?(servicesSlidesIndex-1):(servicesSlides.length-1);scelem=new Element('div',{id:"s_c"});scelem.style.top="23px";scelem.style.display="none";scspan=new Element('span',{id:"services_caption1"});scspan.innerHTML=servicesSlides[servicesSlidesIndex2];scelem.appendChild(scspan);$('services').appendChild(scelem);}
function createBottomScroll(){newsc=new Element('div',{id:'s_c2'});newsc.style.top="45px";newsc.style.display="none";sc2span=new Element('span',{id:"services_caption2"});sc2span.innerHTML=servicesSlides[servicesSlidesIndex];newsc.appendChild(sc2span);$('services').appendChild(newsc);}
function updateHeadSlides(){if($('s_c'))$('s_c').remove();if($('s_c2'))$('s_c2').id="s_c";$('services_caption2').id="services_caption1";servicesSlidesIndex=servicesSlides[servicesSlidesIndex+1]?(servicesSlidesIndex+1):0;$('services').innerHTML='<span>'+$('services_caption1').innerHTML+'</span>';animations["mainSlides"]=true;refreshHeadTimeOut()}
function refreshHeadTimeOut(value){if(!value)value=serviceScrollInterval;if(cssto)clearTimeout(cssto);cssto=setTimeout(function(){servicesScrolling()},value);}
function stopHeadSlides(){servicesScroll=0;if(effects["sctween"])effects["sctween"].cancel();if(effects["sc2tween"])effects["sc2tween"].cancel();effects["sctween"]=null;effects["sc2tween"]=null;if($('s_c')){$('s_c').setOpacity(1);$('s_c').style.top="23px";$('s_c').style.display="none";$('s_c').style.background="none";}
if($('s_c2')){$('s_c2').setOpacity(0);$('s_c2').style.top="46px";$('s_c2').style.background="none";}}
function serviceSlideElemsCreate(){}
function controlTextBg(obj,over){if(over){obj.childNodes[0].style.visibility="hidden";}
else{obj.childNodes[0].style.visibility="visible";}}
function scrollLWimage(event){var wh=getHeight();var h=$("lightwindow_container").offsetHeight;mouseY=defPosition(event).relY;pc=mouseY/wh;$("lightwindow").style.top=h/2+20+(wh-h-20)*pc+"px";}
function cmph(title){if(effects['hidetitle'])effects['hidetitle'].cancel();effects['hidetitle']=Effect.Fade("mainPageHeader",{duration:0.3,to:0.01,afterFinish:function(){$('mainPageHeader').innerHTML=title;effects['hidetitle']=Effect.Appear("mainPageHeader",{duration:0.3});}});}
