﻿var selMenu=0;var fading=false;var sliding=false;var resMoveX,resMoveY;var resMoveX1,resMoveY1;var toMoveX=0,toMoveY=0;var moveMap=true;var minWidth=960;var minHeight=550;var srcoffpub;function ResizeMap(first,dontST){if(!first){resMoveX1=getWindowWidth();resMoveY1=getWindowHeight();}try{var ch=document.body.clientHeight;var cw=document.body.clientWidth;if(cw<minWidth){cw=minWidth;}if(ch<minHeight){ch=minHeight;}setStyleWidth(gi("header"),cw);setStyleWidth(gi("search"),cw);var offl=0;var srcw=360;var ew=cw;if(cw<960){srcw=300;ew=960;}else if(cw>1150){offl=(cw-1150)/2;ew=1150;}srcw=(ew-gi("rMenu").offsetWidth-gi("lMenu").offsetWidth-12)-40;if(srcw>360)srcw=360;srcoff=((ew-gi("rMenu").offsetWidth-gi("lMenu").offsetWidth-12)-srcw)/2+6+gi("lMenu").offsetWidth;srcoffpub=offl+srcoff;setStyleLeft(gi("lMenu"),offl+6);setStyleLeft(gi("rMenu"),offl+ew-gi("rMenu").offsetWidth-6);setStyleLeft(gi("srcframe"),offl+srcoff);setStyleWidth(gi("srcframe"),srcw);document.getElementById("srcframe").contentWindow.document.getElementById("tbsrc").style.width=(srcw-40)+"px";document.getElementById("srcframe").contentWindow.document.getElementById("srcw").style.width=srcw+"px";document.getElementById("srcframe").contentWindow.document.getElementById("srcw2").style.width=srcw+"px";var logol=(cw-728-160)/2;if(logol>10){setStyleLeft(gi("logo"),logol-10);setStyleLeft(gi("banertop"),logol+160);}else{setStyleLeft(gi("logo"),10);setStyleLeft(gi("banertop"),170);}header2.style.width=cw-380-175;header3.style.width=cw-380-180;gi("mapsh").style.width=cw-380-180;fmc.style.width=cw-375-7-48-180+10;setStyleLeft(sponzori,0);setStyleLeft(fmr,cw-375-7-19-180+5);try{SetCurrentForecast();}catch(ex){}try{SetWftSize();}catch(ex){}try{SetPolyLocTxt();}catch(ex){}setStyleLeft(gi("maptbicons"),cw-180-90);setStyleLeft(reklame,cw-180);mapContainer.style.width=cw-380-175-5;footer.style.width=cw-380-180;var t=134;setStyleLeft(copy,cw-180-copy.offsetWidth-1);setStyleTop(copy,ch-50);setStyleLeft(raz,cw-180-103);setStyleTop(raz,ch-50-20);setStyleTop(footer,ch-35);setStyleLeft(progress,(cw-380-160)/2-24+380);setStyleTop(progress,(ch-166-35)/2-24+166);mapContainer.style.height=ch-198;gi("mapsv").style.height=ch-199;lblock.style.height=ch-t+2;reklame.style.height=ch-t+2;if(isIe){rcontainer.style.height=ch-t+3-10;homepanel.style.height=ch-t+2-10;results.style.height=ch-t+2-10;routept.style.height=ch-t+2-10;routeoptions.style.height=ch-t+2-10;publictran.style.height=ch-t+2-10;}else{rcontainer.style.height=ch-t+1-10;homepanel.style.height=ch-t-10;results.style.height=ch-t-10;routept.style.height=ch-t-10;routeoptions.style.height=ch-t-10;publictran.style.height=ch-t-10;}SetSearchBoxesHeight();setStyleHeight(rrptbox,ch-t-10-72);setStyleHeight(rpbox,ch-t-10-44-22);setStyleHeight(routeoptbox,ch-t-10-60);setStyleHeight(ptranbox,ch-t-10-44-30-42);setStyleTop(ptranf,ch-t-10-30);if(rmcpin.style.display!="none"){RMCPosition();}if(gi("old1")!=null)gi("old1").style.height=ch;if(gi("old2")!=null){gi("old2").style.width=cw-380-180;gi("old2").style.height=163;}if(gi("old3")!=null){gi("old3").style.width=180;gi("old3").style.height=ch;gi("old3").style.left=cw-180;}if(gi("old4")!=null){gi("old4").style.width=cw-380-180;gi("old4").style.height=35;gi("old4").style.top=ch-35;}ReinitialiseOnResize();if(dontST!=12)setTimeout(ResizeMap(false,12),300);}catch(ex){}}function SetSearchBoxesHeight(){var h1=parseInt((getStyleHeight(results)-6)/3);var rsh=h1;var roh=h1*2;var rsbh=h1-44-10;var robh=h1*2-44-10;var rsot=h1+6;rsbox.style.display="";robox.style.display="";rsheader.style.display="";roheader.style.display="";sd(rstretch,1);sd(rostretch,1);rstretch.style.backgroundImage="url(Images/stretchup.gif)";rostretch.style.backgroundImage="url(Images/stretchup.gif)";rstretch.onclick=function(){setfixedsbratio(4);};rostretch.onclick=function(){setfixedsbratio(1);};if(arrUliceUkupno==0||arrObjektiUkupno==0){sd(rstretch,0);sd(rostretch,0);}sd(resinfo,0);if(sbratio==10){rsh=0;roh=h1*3+6;rsbh=0;robh=h1*3-40-10;rsot=0;rsbox.style.display="none";}else if(sbratio==-1){rsh=h1*3+7;roh=0;rsbh=h1*3-45+7-10;robh=0;rsot=0;robox.style.display="none";roheader.style.display="none";rsbox.style.display="none";rsheader.style.display="none";sd(rstretch,0);sd(rostretch,0);sd(resinfo,1);}else if(sbratio==1){rsh=0;roh=h1*3+7;rsbh=0;robh=h1*3-45+7-10;rsot=0;rsbox.style.display="none";rsheader.style.display="none";sd(rstretch,0);rostretch.style.backgroundImage="url(Images/stretchdown.gif)";rostretch.onclick=function(){setuserdefinedsbratio(1);};}else if(sbratio==4){rsh=h1*3+7;roh=0;rsbh=h1*3-45+7-10;robh=0;rsot=0;robox.style.display="none";roheader.style.display="none";sd(rostretch,0);rstretch.style.backgroundImage="url(Images/stretchdown.gif)";rstretch.onclick=function(){setuserdefinedsbratio(-1);};}else if(sbratio==3){rsh=h1*2;roh=h1;rsbh=h1*2-44-10;robh=h1-44-10;rsot=h1*2+6;}resstreet.style.height=rsh;resobject.style.height=roh;rsbox.style.height=rsbh;robox.style.height=robh;setStyleTop(resobject,rsot);}function CenterXCross(){setStyleTop(xcross,getStyleHeight(mapContainer)/2+-7);setStyleLeft(xcross,getStyleWidth(mapContainer)/2-7);}function Print(type){var mPP;var w=getStyleWidth(mapContainer);var h=getStyleHeight(mapContainer);var wadd=0;var left=getLeftInMeter()+wadd;var right=getLeftInMeter()+wadd+w*z.mPerPX;var top=getTopInMeter();var bottom=getTopInMeter()+h*z.mPerPX;var mPP1=(right-left)/w;var mPP2=(bottom-top)/h;if(mPP1>mPP2){mPP=mPP1}else{mPP=mPP2}if(z.zoom!=2){zoompr=13;if(mPP<1024){while(mPP<aZoom[zoompr][9]&&zoompr>1){zoompr--;}zoompr=zoompr+1;}}else zoompr=2;var X=Math.round(right-(right-left)/2)*3;var Y=Math.round(bottom-(bottom-top)/2)*3;var prloc="";prloc="Services/Print/Print.aspx?lang="+lang+"&e="+aZoom[zoompr][9]+"&a="+X+"&b="+Y+"&type="+type;if(gi("results").style.display!="none"&&(arrUlice.length>0||arrObjekti.length>0)){for(var i=1;i<=arrUlice.length;i++){var red=arrUlice[i-1];prloc+="&x"+i+"="+red.x+"&y"+i+"="+red.y+"&i"+i+"="+red.RB+"&t"+i+"="+"o";}for(var i=1;i<=arrObjekti.length;i++){var red=arrObjekti[i-1];var ind=i+arrUlice.length;prloc+="&x"+ind+"="+red.x+"&y"+ind+"="+red.y+"&i"+ind+"="+red.RB+"&t"+ind+"="+"b";}}else if(gi("routept").style.display!="none"&&pathpoints.length>1){for(var bi=1;bi<=pathpoints.length;bi++){var red=pathpoints[bi-1];var tip=3;if(bi==pathpoints.length)tip=4;prloc+="&p"+bi+"x="+red.x+"&p"+bi+"y="+red.y+"&p"+bi+"t="+tip+"&p"+bi+"c="+red.c;}if(carpathbeziers.length>0){var fastest=1;try{if(gi("crt2").checked)fastest=0;}catch(ex){}var tip=1;if(rttype==3)tip=5;else{if(gi("crsttoll").checked&&gi("crstpaved").checked)tip=1;else if(gi("crsttoll").checked&&!gi("crstpaved").checked)tip=2;else if(!gi("crsttoll").checked&&gi("crstpaved").checked)tip=3;else if(!gi("crsttoll").checked&&!gi("crstpaved").checked)tip=4;}prloc+="&ptype=1&o="+fastest+"&t="+tip;}else if(ptputevi.length>0)prloc+="&ptype=2&cp="+currentPtPath;}else if(gi("publictran").style.display!="none"&&prikazaneLinije.length>0){for(var i=1;i<=prikazaneLinije.length;i++){prloc+="&l"+i+"="+prikazaneLinije[i-1];}}printwindow=open(prloc,"_blank","scrollbars=yes,height=700,width=800,status=no,toolbar=no,menubar=no,location=no");}function ShareLink(){var w=getStyleWidth(mapContainer);var h=getStyleHeight(mapContainer);var wadd=0;var left=getLeftInMeter()+wadd;var right=getLeftInMeter()+wadd+w*z.mPerPX;var top=getTopInMeter();var bottom=getTopInMeter()+h*z.mPerPX;var X=Math.round(right-(right-left)/2)*3;var Y=Math.round(bottom-(bottom-top)/2)*3;var prloc="";prloc="Services/Print/Link.aspx?lang="+lang+"&z="+z.zoom+"&mx="+X+"&my="+Y;if(gi("results").style.display!="none"&&(arrUlice.length>0||arrObjekti.length>0)){prloc+="&act=srcstr&src="+searchstring;}else if(gi("routept").style.display!="none"&&pathpoints.length>1){prloc+="&act=nr";for(var bi=1;bi<=pathpoints.length;bi++){var red=pathpoints[bi-1];var tip=3;if(bi==pathpoints.length)tip=4;prloc+="&p"+bi+"x="+red.x+"&p"+bi+"y="+red.y+"&p"+bi+"t="+tip+"&p"+bi+"c="+red.c+"&p"+bi+"n="+escape(red.n);}if(carpathbeziers.length>0){var fastest=1;try{if(gi("crt2").checked)fastest=2;}catch(ex){}prloc+="&pf="+fastest+"&pt="+rttype;}else if(ptputevi.length>0)prloc+="&pf=1&pt="+rttype;}else if(gi("publictran").style.display!="none"&&prikazaneLinije.length>0){prloc+="&act=gs";for(var i=1;i<=prikazaneLinije.length;i++){prloc+="&l"+i+"="+prikazaneLinije[i-1];}}else prloc+="&setp=y";callFancyBoxEmail(prloc);}var scrSpCheck=false;function scrSpTimeout(s){if(scrSpCheck){scrSp(s);setTimeout("scrSpTimeout("+s+")",20);}}function scrSp(m){var wc=getStyleWidth(fmc);var w=getStyleWidth(sponzori);var l=getStyleLeft(sponzori);if(!isIe){l=sponzori.offsetLeft;}if(wc>w)return;if(m>0&&l-m+w<=wc)setStyleLeft(sponzori,wc-w);else if(m<0&&Math.abs(l)<=Math.abs(m))setStyleLeft(sponzori,0);else setStyleLeft(sponzori,l-m);}var isRMCDrag=false;var rsPoint;function RMCDrag(e){if(isRMCDrag==true){var newX=getMouseX(e)-rsPoint.x;var newY=getMouseY(e)-rsPoint.y;var bX=newX+87;var bY=newY+104;var mcX1=380;var mcX2=380+getStyleWidth(mapContainer);var mcY1=160;var mcY2=160+getStyleHeight(mapContainer);if(!(newX<mcX1||bX>mcX2||newY<mcY1||bY>mcY2)){setStyleLeft(rmcpin,newX);setStyleTop(rmcpin,newY);}}}function RMCStartDrag(e){sd(rmcback,0);isRMCDrag=true;rsPoint=new yPoint(getMouseX(e)-getStyleLeft(rmcpin),getMouseY(e)-getStyleTop(rmcpin));}function RMCEndDrag(e){isRMCDrag=false;SetRMCXY();RMCPosition();sd(rmcback,1);}function RMCPosition(){var folY=rmcY-(310*z.mPerPX-getStyleHeight(mapContainer)*z.mPerPX/2);changeZoomAndPosition(z.zoom,rmcX,folY);setStyleLeft(rmcpin,380+getStyleWidth(mapContainer)/2-44);setStyleTop(rmcpin,370);setStyleLeft(rmcback,getStyleLeft(rmcpin)-334);setStyleTop(rmcback,112);}function ChangeBaner(){var currentTime=(new Date()).valueOf();if(currentTime-previousZoomTime>3000){setTimeout('DelayedBanerChange()',2000);previousZoomTime=currentTime;}}function DelayedBanerChange(){gi("banertop").src="";gi("banertop").src="http://www.planplus.rs/baner.htm";gi("banerright").src="";gi("banerright").src="http://www.planplus.rs/banerr.htm";}
