﻿function addLoadEvent(func)
{var oldonload=window.onload;if(typeof window.onload!='function')
{window.onload=func;}else
{window.onload=function()
{if(oldonload)
{oldonload();}
func();}}}
var timer;var interval=15;function ScrollTop()
{timer=setInterval("document.getElementById('gallery_old').scrollTop -= 10",interval);}
function ScrollBottom()
{timer=setInterval("document.getElementById('gallery_old').scrollTop += 10",interval);var e=document.getElementById('gallery_old');images=e.getElementsByTagName('img');images[images.length-1].style.marginBottom=0;images[images.length-2].style.marginBottom=0;images[images.length-3].style.marginBottom=0;}
function ScrollTop2(a){timer=setInterval("document.getElementById('"+a+"').scrollTop -= 10",interval);}
function ScrollBottom2(a){timer=setInterval("document.getElementById('"+a+"').scrollTop += 10",interval);}
function getOffsetRect(elem){var box=elem.getBoundingClientRect()
var body=document.body
var docElem=document.documentElement
var scrollTop=window.pageYOffset||docElem.scrollTop||body.scrollTop
var scrollLeft=window.pageXOffset||docElem.scrollLeft||body.scrollLeft
var clientTop=docElem.clientTop||body.clientTop||0
var clientLeft=docElem.clientLeft||body.clientLeft||0
var top=box.top+scrollTop-clientTop
var left=box.left+scrollLeft-clientLeft
return{top:Math.round(top),left:Math.round(left)}}
function getOffsetSum(elem){var top=0,left=0
while(elem){top=top+parseInt(elem.offsetTop)
left=left+parseInt(elem.offsetLeft)
elem=elem.offsetParent}
return{top:top,left:left}}
function getOffset(elem){if(elem.getBoundingClientRect){return getOffsetRect(elem)}else{return getOffsetSum(elem)}}
function getCurrentPosition(e)
{var currentHeight=e.offsetHeight;var currentWidth=e.offsetWidth;var o=getOffset(e);return{left:o.left,top:o.top,width:currentWidth,height:currentHeight};}
function getClientWidth(){return $('body').width();}
function getClientHeight(){return $('body').height();}
function ieSelectFix()
{if(document.all&&!window.opera)
{var iframe=document.createElement('iframe');iframe.setAttribute('frameborder','0');iframe.id='iframe';document.body.appendChild(iframe);}}
function ShowSubmenu(e,z)
{var current=getCurrentPosition(e);var submenu=$("#"+z);var docWidth=getClientWidth();submenu.css({right:docWidth-(current.left+current.width)+"px",top:(current.top+current.height)-3+"px"});submenu.show();}
function ShowSubmenuAgency(e,z)
{var current=getCurrentPosition(e);var submenu=$("#"+z);var docWidth=getClientWidth();submenu.css({left:current.left+"px",top:(current.top+current.height)-1+"px"});submenu.show();}

function prepareLinks(){var foodconcept=document.getElementById('foodconcept');if(foodconcept)
{var links=foodconcept.getElementsByTagName('a');for(i=0;i<links.length;i++)
{links[i].onclick=function()
{showInfo();}}}}
function showInfo(mealid){$("#divBack").html('<div onclick="hideAllPopups()" style="position:absolute;z-index:1; width:'+(getClientWidth()-20)+'px; height:'+getDocumentHeight()+'px; left:0; top:0"></div>');$("#infoblock_"+mealid).css({display:"block"});return;}
function showServInfo(id){$("#divBack").html('<div onclick="hideAllPopups()" style="position:absolute;z-index:1; width:'+(getClientWidth()-20)+'px; height:'+getDocumentHeight()+'px; left:0; top:0"></div>');$("#serv_infoblock_"+id).css({display:"block"});return;}
function hideSubmenu(e)
{if(a=document.getElementById('iframe'))(a.style.display='none');document.getElementById(e).style.display='none';}
function show(e)
{if(a=document.getElementById('iframe'))(a.style.display='block');e.style.display='block';}
function hide(e)
{if(a=document.getElementById('iframe'))(a.style.display='none');e.style.display='none';}
var ua=navigator.userAgent.toLowerCase();var isOpera=(ua.indexOf('opera')>-1);var isIE=(!isOpera&&ua.indexOf('msie')>-1);function getDocumentHeight(){return Math.max(document.compatMode!='CSS1Compat'?document.body.scrollHeight:document.documentElement.scrollHeight,getViewportHeight());}
function getViewportHeight(){return((document.compatMode||isIE)&&!isOpera)?(document.compatMode=='CSS1Compat')?document.documentElement.clientHeight:document.body.clientHeight:(document.parentWindow||document.defaultView).innerHeight;}
function hideAllPopups(){$('div.infoblock').hide();$("#divBack").html('');}
function hide2(e){$("#divBack").html('');$("#"+e).css({display:"none"});}
function ShowSubmenuUa(e,z)
{var current=getCurrentPosition(e);var submenu=$("#"+z);var docWidth=getClientWidth();submenu.css({right:docWidth-(current.left+current.width)+"px",top:(current.top+current.height)-3+"px"});submenu.show();}
function ShowSubmenuUaAgency(e,z)
{var current=getCurrentPosition(e);var submenu=$("#"+z);var docWidth=getClientWidth();submenu.css({right:docWidth-(current.left+current.width+110)+"px",top:(current.top+current.height)-3+"px"});submenu.show();}

function hideSubmenuUa(e)
{if(a=document.getElementById('iframe'))(a.style.display='none');document.getElementById(e).style.display='none';}
function showUa(e)
{if(a=document.getElementById('iframe'))(a.style.display='block');e.style.display='block';}
function hideUa(e)
{if(a=document.getElementById('iframe'))(a.style.display='none');e.style.display='none';}
function ShowSubmenuonline(e,z)
{var current=getCurrentPosition(e);var submenu=$("#"+z);var docWidth=getClientWidth();submenu.css({right:docWidth-(current.left+current.width)+"px",top:(current.top+current.height)-3+"px"});submenu.show();}
function hideSubmenuonline(e)
{if(a=document.getElementById('iframe'))(a.style.display='none');document.getElementById(e).style.display='none';}
function showonline(e)
{if(a=document.getElementById('iframe'))(a.style.display='block');e.style.display='block';}
function hideonline(e)
{if(a=document.getElementById('iframe'))(a.style.display='none');e.style.display='none';}
function ShowSubmenusocial(e,z)
{var current=getCurrentPosition(e);var submenu=$("#"+z);var docWidth=getClientWidth();submenu.css({right:docWidth-(current.left+current.width)+"px",top:(current.top+current.height)-3+"px"});document.getElementById('social').style.display='block';}
function hideSubmenusocial(e)
{document.getElementById(e).style.display='none';}
function showsocial(e)
{document.getElementById('social').style.display='block';}
function hidesocial(e)
{document.getElementById('social').style.display='none';}
function searchOver(e)
{e.parentNode.parentNode.style.background="url(/img/search_200.png) left -22px no-repeat";if(e.value=='Поиск по сайту')(e.value='');}
function searchOut(e)
{e.parentNode.parentNode.style.background="url(/img/search_200.png) left 2px no-repeat";if(e.value=='')(e.value='Поиск по сайту');}
function infobar2Hover(e)
{var infobar2=document.getElementById('infobar2');if(infobar2)
{var links=infobar2.getElementsByTagName('a');for(i=0;i<links.length;i++)
{links[i].onmouseover=function()
{this.getElementsByTagName('img')[0].style.marginTop=-27}
links[i].onmouseout=function()
{this.getElementsByTagName('img')[0].style.marginTop=0}}}}
addLoadEvent(infobar2Hover);addLoadEvent(ieSelectFix);function openadr()
{document.getElementById("showadr").style.display="block";}
function closeadr()
{document.getElementById("showadr").style.display="none";}
function showform()
{var tmpDiv=document.getElementById("oscript");if(tmpDiv&&(tmpDiv.childNodes.length==0)){var tmpframe=document.createElement('iframe');tmpframe.src='/onlinescript/';tmpframe.noresize=true;tmpframe.setAttribute('scrolling',false);tmpframe.frameBorder=0;tmpframe.marginWidth=0;tmpframe.marginHeight=0;tmpframe.style.width='100%';tmpframe.style.height='120px';tmpframe.style.overflow='hidden';tmpDiv.appendChild(tmpframe);}
document.getElementById("show").style.display="block";}
function hideform()
{document.getElementById("show").style.display="none";}
var id_menu=new Array('sub_menu_1','sub_menu_2','sub_menu_3','sub_menu_7','sub_menu_8','sub_menu_9');function allclose()
{for(i=0;i<id_menu.length;i++)
{document.getElementById(id_menu[i]).style.display="none";}}
function openMenu(id)
{for(i=0;i<id_menu.length;i++)
{if(id!=id_menu[i])
{document.getElementById(id_menu[i]).style.display="none";}}
if(document.getElementById(id).style.display=="block")
{document.getElementById(id).style.display="none";}else
{document.getElementById(id).style.display="block";}}
function roundNumber(rnum,rlength){var newnumber=Math.round(rnum*Math.pow(10,rlength))/Math.pow(10,rlength);return newnumber;}
function SelectCurrency(name,newVal,oldValElementId,SelCurId,className,a1,a2){var oldVal=parseFloat(document.getElementById(oldValElementId).value);for(j=0;document.getElementById(className+""+j)!=null;j++){var obj=document.getElementById(className+""+j);var val=document.getElementById("hid"+className+""+j);var tVal=parseFloat(val.value);var eVal=tVal*oldVal/parseFloat(newVal);val.value=eVal;obj.innerHTML="от "+roundNumber(eVal,0);var objCur=document.getElementById("r"+className+""+j);var txtData=objCur.innerHTML.replace(document.getElementById(a1).innerHTML,name);objCur.innerHTML=txtData;var objUrl=document.getElementById("url"+className+j);var idOldSelectedCurrence=document.getElementById(a2).value;objUrl.innerHTML=objUrl.innerHTML.replace("CURRENCY="+idOldSelectedCurrence,"CURRENCY="+SelCurId);}
document.getElementById(oldValElementId).value=newVal;document.getElementById(a2).value=SelCurId;document.getElementById(a1).innerHTML=name;return false;}
function showBanner(selectedItemIndex){img=document.getElementById('megaImg_'+selectedItemIndex);if(img!=null)
{if(img.loaded==true){for(i=1;i<maxHeaderlineCount;i++){if(i!=selectedItemIndex){document.getElementById('HeaderTable_'+i).style.display='none';document.getElementById('HeaderOK_'+i).style.display='none';document.getElementById('img_'+i).style.border='1px solid #0175dc';}
else{document.getElementById('HeaderTable_'+i).style.display='block';document.getElementById('HeaderOK_'+i).style.display='none';document.getElementById('img_'+i).style.border='1px solid white';}}}}}
function ShowArticle(selectedItemIndex){stopTimer();showBanner(selectedItemIndex);}
function timerStart(conterNum){if(conterNum!=-1)
conter=conterNum;if(conter>=maxHeaderlineCount)conter=1;showBanner(conter);conter=conter+1;timerCount=setTimeout('timerStart(-1)',4000);}
function stopTimer(){clearTimeout(timerCount);}
function loadNextImg(a){a=a+1;if(a<7){img=document.getElementById('megaImg_'+a);if(img!=null)
{if(img.loaded!=true){img.src=eval('banner'+a);img.onload=function(){loadNextImg(a);this.loaded=true;}
img.onerror=function(){loadNextImg(a);}}}}}
function loadImg(a){img=document.getElementById('megaImg_'+a);if(img!=null)
{if(img.loaded!=true)img.src=eval('banner'+a);img.onload=function(){this.loaded=true;};img.onerror=function(){alert('!');};}}
function vshowBanner(vselectedItemIndex){vimg=document.getElementById('megaImgV_'+vselectedItemIndex);if(vimg!=null)
{if(vimg.loaded==true){for(vi=1;vi<vmaxHeaderlineCount;vi++){if(vi!=vselectedItemIndex){document.getElementById('HeaderTableV_'+vi).style.display='none';document.getElementById('HeaderOKV_'+vi).style.display='none';document.getElementById('imgV_'+vi).style.border='0px solid #0175dc';}
else{document.getElementById('HeaderTableV_'+vi).style.display='block';document.getElementById('HeaderOKV_'+vi).style.display='none';document.getElementById('imgV_'+vi).style.border='0px solid white';}}}}}
function vShowArticle(vselectedItemIndex){vstopTimer();vshowBanner(vselectedItemIndex);}
function vtimerStart(vconterNum){if(vconterNum!=-1)
vconter=vconterNum;if(vconter>=vmaxHeaderlineCount)vconter=1;vshowBanner(vconter);vconter=vconter+1;vtimerCount=setTimeout('vtimerStart(-1)',4000);}
function vstopTimer(){clearTimeout(vtimerCount);}
function vloadNextImg(va){va=va+1;if(va<7){vimg=document.getElementById('megaImgV_'+va);if(vimg!=null)
{if(vimg.loaded!=true){vimg.src=eval('banner_'+va);vimg.onload=function(){vloadNextImg(va);this.loaded=true;}
vimg.onerror=function(){vloadNextImg(va);}}}}}
function vloadImg(va){vimg=document.getElementById('megaImgV_'+va);if(vimg!=null)
{if(vimg.loaded!=true)vimg.src=eval('banner_'+va);vimg.onload=function(){this.loaded=true;};vimg.onerror=function(){alert('!');};}}
function menuStart(){var parent=jQuery("#sub_menuparent",document);jQuery(".country",parent).click(function(){var _this=jQuery(this);var pid=_this.attr("id");var sub=jQuery("#sub_"+pid,parent);if(sub.css("display")=="none"){_this.removeClass("right");_this.addClass("expanded");}
else{_this.removeClass("expanded");_this.addClass("right");}
sub.slideToggle("slow");return false;});jQuery(".notcountry",parent).click(function(){var _this=jQuery(this);var pid=_this.attr("id");var sub=jQuery("#sub_"+pid,parent);if(sub.css("display")=="none"){_this.removeClass("right");_this.addClass("expanded");}
else{_this.removeClass("expanded");_this.addClass("right");}
sub.slideToggle("slow");return false;});}
function openTab(a){a.style.display="";}
function initCountriesBlock(){var width=550;if(tabcols>0){$(function(){var tabContainers=$('div.tabs > div');tabContainers.hide().filter(':first').show();$('ul.tabNavigation a').click(function(){tabContainers.hide();tabContainers.filter(this.hash).show();$('ul.tabNavigation a').removeClass('selected');$(this).addClass('selected');return false;}).filter(':first').click();});var ww=Math.ceil(width/tabcols);if(ww<100){var t1=Math.ceil(tabcols/2);var t2=tabcols-t1;var w1=Math.ceil(width/t1)-1;var w2=Math.ceil(width/t2)-1;for(i=0;i<t1;i++){$(tabs[i]).width(w1);}
for(i=0;i<t2;i++){$(tabs[t1+i]).width(w2);}}}
else{$("#countriesBlock").hide();}}
function right_nav(item){obj=document.getElementById(item);if(obj!=null)
{visible=(obj.style.display!="none")
key=document.getElementById("x"+item);if(visible){obj.style.display="none";key.innerHTML="<img src='/img/arrow_state_blue_right.png' width='16' height='16' vspace='2' vspace='0' border='0'>";}else{obj.style.display="block";key.innerHTML="<img src='/img/arrow_state_blue_expanded.png' width='16' height='16' vspace='2' vspace='0' border='0'>";}}}
function belarus_flag_over(imgname){imgname.src="/img/belarus02.gif"}
function belarus_flag_out(imgname){imgname.src="/img/belarus01.gif"}
function spain_nav(item){obj1=document.getElementById("costa_brava");obj2=document.getElementById("costa_daurada");obj3=document.getElementById("costa_del_sol");obj4=document.getElementById("mallorca");visible1=(obj1.style.display!="none")
visible2=(obj2.style.display!="none")
visible3=(obj3.style.display!="none")
visible4=(obj4.style.display!="none")
switch(item){case"costa_brava":if(visible1){obj1.style.display="none";obj2.style.display="none";obj3.style.display="none";obj4.style.display="none";}else{obj1.style.display="block";obj2.style.display="none";obj3.style.display="none";obj4.style.display="none";}
break
case"costa_daurada":if(visible2){obj1.style.display="none";obj2.style.display="none";obj3.style.display="none";obj4.style.display="none";}else{obj1.style.display="none";obj2.style.display="block";obj3.style.display="none";obj4.style.display="none";}
break
case"costa_del_sol":if(visible3){obj1.style.display="none";obj2.style.display="none";obj3.style.display="none";obj4.style.display="none";}else{obj1.style.display="none";obj2.style.display="none";obj3.style.display="block";obj4.style.display="none";}
break
case"mallorca":if(visible4){obj1.style.display="none";obj2.style.display="none";obj3.style.display="none";obj4.style.display="none";}else{obj1.style.display="none";obj2.style.display="none";obj3.style.display="none";obj4.style.display="block";}
break
default:obj1.style.display="none";obj2.style.display="none";obj3.style.display="none";obj4.style.display="none";}}

function getChat(url)
{
    mywindow = window.open(url, "mywindow", "toolbar=0; location=0; menubar=0,status=0,scrollbars=1,  width=750,height=650");
    mywindow.moveTo(50, 50);
}
function showReservInfo() { $("#divBack").html('<div onclick="hideAllPopups()" style="position:absolute;z-index:1; width:' + (getClientWidth() - 20) + 'px; height:' + getDocumentHeight() + 'px; left:0; top:0"></div>'); $("#reservPopup").css({ display: "block" }); return; }
function reservation(claimID) {
    var claim = claimID.split(",");
    $("#reservForm").attr("src", "/ReservationForm.aspx?CLAIM=" + claim[0] + "&hotelINC=" + claim[1] + "&TOWNFROMINC=" + claim[2]);
    showReservInfo();
}
function ShowWhereBuy(e,z)
{var current=getCurrentPosition(e);var submenu=$("#"+z);var docWidth=getClientWidth();submenu.css({right:docWidth-(current.left+current.width)-150+"px",top:(current.top+current.height)-3+"px"});submenu.show();}
function HideWhereBuy(e)
{if(a=document.getElementById('iframe'))(a.style.display='none');document.getElementById(e).style.display='none';}
