var canvas=new Object;var target=new Array();var targetCurrent=new targetParam();function coordsParam(a,b){this.x=a||0;this.y=b||0}function sceneParam(id,width,height,position,center,phispos){this.id=id;this.width=width||0;this.height=height||0;this.position=position||new coordsParam();this.center=center||new coordsParam(this.width/2,this.height/2);this.phispos=phispos||new coordsParam();this.engine=new engineParam();var collect_collection=new Array();this.add=function(collect_id){collect_collection=collect_collection.concat(collect_id)};this.collection=function(){var col_list=new Array();for(col_item in collect_collection){col_list=col_list.concat(collect_collection[col_item])}return col_list};this.ltcs=function(x,y){this.position.x=x||this.position.x;this.position.y=y||this.position.y;center_body_width=(self.innerWidth)?self.innerWidth/2:document.documentElement.clientWidth/2;center_body_height=document.getElementById("canvas").clientHeight/2;this.phispos.x=-this.center.x+center_body_width-this.position.x;this.phispos.y=-this.center.y+center_body_height-this.position.y};this.draw=function(){scene=document.getElementById(this.id);this.ltcs(this.position.x,this.position.y);if(IE){with(scene){style.top=this.phispos.y;style.left=this.phispos.x;style.width=this.width;style.height=this.height;style.display="block"}}else{css_style="top:     "+this.phispos.y+"px;";css_style+="left:    "+this.phispos.x+"px;";css_style+="width:   "+this.width+"px;";css_style+="height:  "+this.height+"px;";css_style+="display: block;";scene.setAttribute("style",css_style)}};this.setPosition=function(x,y){this.ltcs(x,y);this.draw()};this.setTarget=function(target_id){this.setPosition(target_id.position.x,target_id.position.y)};var sinus=0;var delta=1;var shift=new coordsParam();var step_c=new coordsParam();var step_d=new coordsParam();var step_min=new coordsParam();var start=new coordsParam();this.scroll=function(){start.x=targetCurrent.position.x;start.y=targetCurrent.position.y;this.scrollScene()};this.scrollScene=function(){this.transmission();sinus=Math.sin(Math.PI*delta/180);delta=delta+sinus*this.engine.speed;shift.x=delta/(180/this.engine.delta.x);shift.y=delta/(180/this.engine.delta.y);step_d.x=step_c.x-shift.x;step_c.x=shift.x;step_min.x=Math.round(Math.abs(step_d.x)+0.45);step_d.y=step_c.y-shift.y;step_c.y=shift.y;step_min.y=Math.round(Math.abs(step_d.y)+0.45);this.position.x=shift.x+start.x;this.position.y=shift.y+start.y;this.draw();if(0==step_min.x&&0==step_min.y){delta=1;start.x=this.position.x;start.y=this.position.y;shift=new coordsParam();target_id.collect_id.scene_id.engine.lock=false;event(1,target_id)}else{setTimeout(this.id+".scrollScene()",5)}};var start_time;var end_time;var time_delay=0;var cycle=0;var delta_delay=0;this.transmission=function(){if(this.engine.timelock){this.engine.timelock=false;start_time=new Date();start_time.setTime(start_time.getTime())}else{this.engine.timelock=true;end_time=new Date();time_delay=(end_time.getTime()-start_time.getTime());if(cycle<this.engine.repeats){delta_delay=delta_delay+time_delay;time_delay=0;cycle++}else{if(this.engine.cyclelock){this.engine.cyclelock=false;delta_delay=Math.round(delta_delay/this.engine.repeats);if(delta_delay<=15){this.engine.speed=7}if((delta_delay>=15)&&(delta_delay<45)){this.engine.speed=10}if((delta_delay>=45)&&(delta_delay<75)){this.engine.speed=15}if((delta_delay>=75)&&(delta_delay<105)){this.engine.speed=20}if((delta_delay>=105)&&(delta_delay<135)){this.engine.speed=45}if((delta_delay>=135)&&(delta_delay<165)){this.engine.speed=60}if(delta_delay>=165){this.engine.speed=70}}}}}}function engineParam(f,d,c,e,a,b){this.speed=d||5;this.lock=c||false;this.timelock=e||true;this.cyclelock=a||true;this.repeats=b||5;this.delta=f||new coordsParam()}function objectParam(id,collect_id,width,height,position,center,phispos,prefix){this.id=id;this.collect_id=collect_id;this.width=width||0;this.height=height||0;this.position=position||new coordsParam();this.center=center||new coordsParam(this.width/2,this.height/2);this.phispos=phispos||new coordsParam();this.prefix="obj_";this.display=display;this.ltco=function(x,y){this.position.x=x||this.position.x;this.position.y=y||this.position.y;this.phispos.x=this.collect_id.scene_id.center.x+this.position.x-this.center.x;this.phispos.y=this.collect_id.scene_id.center.y+this.position.y-this.center.y};scene_id=document.getElementById(this.collect_id.scene_id.id);object_div=document.createElement("div");object_div.id=this.id;proto_object=document.getElementById("prot_"+this.id);if(proto_object){object_div.innerHTML=proto_object.innerHTML;proto_object.style.display="none";proto_object.parentNode.removeChild(proto_object)}scene_id.appendChild(object_div);this.ltco(this.position.x,this.position.y);if(IE){with(object_div){style.top=this.phispos.y;style.left=this.phispos.x;style.width=this.width;style.height=this.height;style.display="block"}}else{css_style="top:     "+this.phispos.y+"px;";css_style+="left:    "+this.phispos.x+"px;";css_style+="width:   "+this.width+"px;";css_style+="height:  "+this.height+"px;";css_style+="display: block;";object_div.setAttribute("style",css_style)}this.setPosition=function(x,y){this.ltco(x,y)};this.collect_id.add(this)}function imageParam(id,collect_id,source,position,title,center,zoom,phispos,low_image_name,prefix){var tag_image="";var image=new Image();var low_image=new Image();this.id=id;this.collect_id=collect_id;this.source=source+"?"+Math.random()*10000;this.position=position||new coordsParam();this.zoom=zoom||100;this.title=title||"";this.center=center||new coordsParam();this.phispos=phispos||new coordsParam();this.prefix="img_";this.display=display;this.low_image_name=low_image_name||(this.source.lastIndexOf("/"))?this.low_image_name=this.source.slice(0,this.source.lastIndexOf("/")+1)+"pxs_"+this.source.slice(this.source.lastIndexOf("/")+1):this.low_image_name="pxs_"+this.source;this.ltco=function(x,y){this.position.x=x||this.position.x;this.position.y=y||this.position.y;this.phispos.x=this.collect_id.scene_id.center.x+this.position.x-this.center.x;this.phispos.y=this.collect_id.scene_id.center.y+this.position.y-this.center.y};this.setPosition=function(x,y){this.ltco(x,y)};this.setTagStyle=function(image_html){with(tag_image){src=image_html.src;width=(this.zoom/100)*image_html.width;height=(this.zoom/100)*image_html.height;alt=this.title}this.center.x=(this.zoom/100)*(image_html.width/2);this.center.y=(this.zoom/100)*(image_html.height/2);this.ltco(this.position.x,this.position.y);if(IE){with(tag_image){style.top=this.phispos.y;style.left=this.phispos.x;style.display="block"}}else{css_style="top:     "+this.phispos.y+"px;";css_style+="left:    "+this.phispos.x+"px;";css_style+="display: block;";tag_image.setAttribute("style",css_style)}};this.zooming=function(percent){image_tag=document.getElementById("img_"+this.id);if(image_tag){}};scene_id=document.getElementById(this.collect_id.scene_id.id);tag_image=document.createElement("img");with(tag_image){id="img_"+this.id}scene_id.appendChild(tag_image);low_image.rel=this;if(window.XMLHttpRequest){var request=new XMLHttpRequest()}else{if(window.ActiveXObject){var request=new ActiveXObject("Microsoft.XMLHTTP")}}if(request){function onStatusChange(){if(4==request.readyState){if(200==request.status){request=null;function onLoadLowImage(){low_image.rel.setTagStyle(low_image);function onLoadHighImage(){tag_image.src=image.src;image=low_image=new Image()}image.onload=onLoadHighImage;image.src=low_image.rel.source}low_image.onload=onLoadLowImage;low_image.src=low_image.rel.low_image_name}else{request=null;image.src=low_image.rel.source;function addLoadedImage(){low_image.rel.setTagStyle(image);image=low_image=new Image()}image.onload=addLoadedImage}}}request.onreadystatechange=onStatusChange;request.open("GET",this.low_image_name,true);request.send(null)}this.collect_id.add(this)}function targetParam(d,c,a,b){this.id=d;this.collect_id=c;this.position=a||new coordsParam();this.name=b||"";this.setPosition=function(e,f){this.position.x=e;this.position.y=f}}function legendParam(d,b,a,c){this.id=d;this.collect_id=b;this.position=a||new coordsParam();this.prefix="legnd_";this.display=display;proto_legend=document.getElementById("prot_"+this.id);if(proto_legend){legend_div=document.createElement("div");legend_div.id=this.id;legend_div.className="legend";legend_div.innerHTML=proto_legend.innerHTML;canvas.appendChild(legend_div);proto_legend.parentNode.removeChild(proto_legend)}this.collect_id.add(this)}function collectParam(a){var b=new Array();this.scene_id=a;this.add=function(c){b=b.concat(c)};this.instances=function(c){var d=new Array();for(obj_item in b){if(c){if(b[obj_item] instanceof c){d=d.concat(b[obj_item])}}else{d=d.concat(b[obj_item])}}return d};this.scene_id.add(this)}function display(a){object=document.getElementById(this.id);if(!object){return}switch(a){case"show":object.style.display="block";return;case"hide":object.style.display="none";return;default:return}}function attachEvents(d,a,b){if("object"==typeof(d)&&b){object_tag=document.getElementById("img_"+d.id);var c=a.split(/\s+/);for(events_item in c){if(IE){object_tag.attachEvent("on"+c[events_item],b)}else{object_tag.addEventListener(c[events_item],b,false)}}object_tag=null;return true}return false}mouseEventHandler=function(a){if(!a.target){a.target=a.srcElement||document}alert("type:"+a.type+" target:"+a.target.id)};function addScene(a){if("object"==typeof(a)){scene_div=document.createElement("div");scene_div.id=a.id;canvas.appendChild(scene_div);return a}return false}function moveToTarget(a){if(!target[a]){return false}if(!target[a].collect_id.scene_id.engine.lock){target_id=target[a];setCookie("referer",target_id.id,getExpDate(180,0,0));target_id.collect_id.scene_id.engine.lock=true;event(2,targetCurrent);target_id.collect_id.scene_id.engine.delta.x=target_id.position.x-targetCurrent.position.x;target_id.collect_id.scene_id.engine.delta.y=target_id.position.y-targetCurrent.position.y;target_id.collect_id.scene_id.scroll();targetCurrent=copyTarget(target_id)}return false}function event(b,a){switch(b){case 1:item_list=a.collect_id.instances();for(item_list_num in item_list){item_list[item_list_num].display("show")}return;case 2:col_list=a.collect_id.scene_id.collection();for(col_item in col_list){item_list=col_list[col_item].instances();for(item_list_num in item_list){item_list[item_list_num].display("hide")}}return;default:return}}function copyTarget(target_id){var new_target=new targetParam();with(new_target){id=target_id.id;collect_id=target_id.collect_id;position=target_id.position;name=target_id.name}return new_target}function movetLogo(){var a=document.getElementById("logotype");if(IE){a.style.marginTop=-document.body.clientHeight/25}else{a.setAttribute("style","margin-top: "+(-document.body.clientHeight/25)+"px;")}}function fixedLayout(){if(635>=document.body.offsetHeight){style="fixed_height"}else{style=""}if(1000>=document.body.offsetWidth){style+=" fixed_width"}else{style+=""}document.getElementById("screen").className=style;movetLogo()}function sceneSetup(a){fixedLayout();window.onresize=function(){fixedLayout();if("noBuildScene"==a){return}maxima.draw()};if("noBuildScene"==a){return}canvas=document.getElementById("canvas");maxima=addScene(new sceneParam("maxima",4100,4500,new coordsParam(18,-985)));col_main=new collectParam(maxima);col_articles=new collectParam(maxima);col_services=new collectParam(maxima);col_researches=new collectParam(maxima);col_clients=new collectParam(maxima);col_events=new collectParam(maxima);col_company=new collectParam(maxima);col_contacts=new collectParam(maxima);col_activity=new collectParam(maxima);new objectParam("obj_main",col_main,960,360,new coordsParam(48,-965));new objectParam("obj_company",col_company,440,310,new coordsParam(890,-150));new objectParam("obj_events",col_events,480,280,new coordsParam(290,62));new objectParam("obj_articles",col_articles,580,320,new coordsParam(-1600,170));new objectParam("obj_services",col_services,510,250,new coordsParam(-1446,600));new objectParam("obj_researches",col_researches,300,280,new coordsParam(-670,595));new objectParam("obj_researches_add",col_researches,400,170,new coordsParam(-231,777));new objectParam("obj_clients",col_clients,438,220,new coordsParam(-529,80));new objectParam("obj_clients_add",col_clients,220,120,new coordsParam(-639,340));new objectParam("obj_contacts",col_contacts,320,160,new coordsParam(870,-555));new legendParam("legend_main",col_main);new legendParam("legend_company",col_company);new legendParam("legend_events",col_events);new legendParam("legend_services",col_services);new legendParam("legend_researches",col_researches);new legendParam("legend_clients",col_clients);new legendParam("legend_articles",col_articles);new legendParam("legend_contacts",col_contacts);new imageParam("elephant",col_main,"/files/elephant.jpg",new coordsParam(18,20));target.main=new targetParam("main",col_main,new coordsParam(18,-985),"Главная");target.articles=new targetParam("articles",col_articles,new coordsParam(-1370,172),"Статьи");target.services=new targetParam("services",col_services,new coordsParam(-1150,650),"Услуги");target.clients=new targetParam("clients",col_clients,new coordsParam(-466,200),"Клиенты");target.events=new targetParam("events",col_events,new coordsParam(42,-30),"События");target.company=new targetParam("company",col_company,new coordsParam(650,-222),"О компании");target.contacts=new targetParam("contacts",col_contacts,new coordsParam(580,-430),"Контакты");target.researches=new targetParam("researches",col_researches,new coordsParam(-451,633),"Исследования");if(document.location.hash.substr(1)){anchor=document.location.hash.substr(1);targetCurrent=copyTarget(target[anchor]);event(2,targetCurrent)}else{targetCurrent=copyTarget(target.main)}setCookie("referer",targetCurrent.id,getExpDate(180,0,0));maxima.setTarget(targetCurrent);event(1,targetCurrent);maxima.draw()};
