//Выезд карты и зум в контейнере обвязки var cc_slide_height=356; var cc_started=0; var cc_objid=0; var cc_timeout_state = null; var cc_start_height=0; var cc_plus=10; var cc_direction=1; var cc_map_url="http://www.svali.ru/c_map/get_map_merc_image.php?city_code="+city_code+"&zoom=2&w=340&h=230&lon=1,2,3,4"; var cc_loaded=false; var cc_speed=1; var cc_map_img=0; var cc_tmp_img=null; function Slide() { cc_objid=document.getElementById("cc_map"); if (!cc_objid) return false; cc_map_img=document.getElementById("cc_map_src"); if (cc_started && cc_started!=cc_slide_height) return false; if (cc_started==cc_slide_height) cc_direction=0; else { if (!cc_loaded) { cc_tmp_img=new Image(); cc_tmp_img.onload=cc_image_loaded; cc_tmp_img.src = cc_map_url; document.getElementById("cc_map_starter").style.cursor="wait"; } cc_direction=1; document.getElementById("cc_map_starter").src="img/map_close.gif"; document.getElementById("cc_map_container").style.display="block"; } cc_timeout_state = setTimeout("DoSlide()", cc_speed); } function DoSlide() { if (!cc_loaded) { cc_timeout_state = setTimeout("DoSlide()", cc_speed); return false; } if (cc_direction==1) cc_started=cc_started+cc_plus; else cc_started=cc_started-cc_plus; cc_objid.style.left=(cc_start_height+cc_started-cc_slide_height)+"px"; if (cc_direction==1 && cc_started>=cc_slide_height) { clearTimeout(cc_timeout_state); cc_started=cc_slide_height; cc_map_img.onload=cc2_image_ready; } else { if (cc_direction==0 && cc_started<=0) { cc_started=0; document.getElementById("cc_map_container").style.display="none"; document.getElementById("cc_map_starter").src="img/map_open.gif"; clearTimeout(cc_timeout_state); } else cc_timeout_state = setTimeout("DoSlide()", cc_speed); } } function cc_image_loaded() { cc_map_img.src = cc_tmp_img.src; document.getElementById("cc_map_starter").style.cursor="pointer"; cc_loaded=true; } var zoom=2; var max_zoom=16; var min_zoom=-6; var layers="1,2,3,4"; var cc2_loading=false; var _isIE = -1; //Если 1, то IE, если 0 - то не IE function cc_isIE() { if (_isIE != -1) {return _isIE;} else { if (cc_map_img.style.opacity=="") _isIE = 0; else _isIE = 1; } return _isIE; } function image_loading() { cc2_loading=true; cc_map_img.style.cursor="wait"; if (cc_isIE()) cc_map_img.style.filter = "alpha(opacity=30)"; else cc_map_img.style.opacity = 0.3; document.getElementById("zoom_out").style.cursor="wait"; document.getElementById("zoom_in").style.cursor="wait"; } function cc2_image_ready() { cc2_loading=false; cc_map_img.style.cursor="default"; if (cc_isIE()) cc_map_img.style.filter = ""; else cc_map_img.style.opacity = 1; document.getElementById("zoom_out").style.cursor="pointer"; document.getElementById("zoom_in").style.cursor="pointer"; if (zoom>=max_zoom) { if (cc_isIE()) document.getElementById("zoom_in").style.filter = "alpha(opacity=30)"; else document.getElementById("zoom_in").style.opacity = 0.3; document.getElementById("zoom_in").style.cursor="default"; } else { if (cc_isIE()) document.getElementById("zoom_in").style.filter = ""; else document.getElementById("zoom_in").style.opacity = 1; document.getElementById("zoom_in").style.cursor="pointer"; } if (zoom<=min_zoom) { if (cc_isIE()) document.getElementById("zoom_out").style.filter = "alpha(opacity=30)"; else document.getElementById("zoom_out").style.opacity = 0.3; document.getElementById("zoom_out").style.cursor="default"; } else { if (cc_isIE()) document.getElementById("zoom_out").style.filter = ""; else document.getElementById("zoom_out").style.opacity = 1; document.getElementById("zoom_out").style.cursor="pointer"; } } var zoom_quant=4; function map_zoom(zoom_dir) { if (cc2_loading) return false; if (zoom_dir==2 && zoom=3) zoom_quant=4; else zoom_quant=1; zoom=zoom+zoom_quant; if (zoom==0) zoom++; if (zoom==1) zoom++; cc_map_img.src="http://www.svali.ru/c_map/get_map_merc_image.php?city_code="+city_code+"&w=340&h=230&zoom="+zoom+"&lon="+layers; } if (zoom_dir==1 && zoom>min_zoom) { image_loading(); if (zoom-zoom_quant<3) zoom_quant=1; else zoom_quant=4; zoom=zoom-zoom_quant; if (zoom==0) zoom--; if (zoom==-1) zoom--; cc_map_img.src="http://www.svali.ru/c_map/get_map_merc_image.php?city_code="+city_code+"&w=340&h=230&zoom="+zoom+"&lon="+layers; } return false; }