//alert('Загрузилось');
var gb = (((navigator.appName == "Netscape") && 
         (parseInt(navigator.appVersion) >= 3 )) || 
         ((navigator.appName == "Microsoft Internet Explorer") && 
         (parseInt(navigator.appVersion) >= 4 )) || 
         ((navigator.appName == "Opera") && 
         (parseInt(navigator.appVersion) >= 4 ))); 
var layers=new Array('Countries', 'Tours', 'Info', 'Services', 'cBeach', 'cSki', 'cInfo', 'cServices');
var sh=0;
var submenu=0;
var Timer;
var TimerSub;

function preload(img) {
	var a = new Image();
	a.src = img;
	return (a);
}

if (gb) {
	li = preload("img/li.gif");
	lion = preload("img/lion.gif");
}

function fix() { if (gb) {clearTimeout(Timer);}}
function set() {if (gb) {if (submenu==0) Timer=setTimeout('if (sh==1) HideLayers()', 500);}}
function fixSub(LName)
{	if (gb)
	{//	alert(LName);
		eval("clearTimeout(Timer"+LName+")");
	}
}
function setSub(LayerName)
{	if (gb)
	{
		eval("Timer"+LayerName+"=setTimeout('if ("+LayerName+"_vis==0) unView(\""+LayerName+"\")', 100);");
	}
}

function unView(LayerName) {
	if (gb) document.getElementById(LayerName).style.visibility='hidden';
}

function View(LayerName) {
	if (gb) {
		clearTimeout(Timer);
		document.getElementById(LayerName).style.visibility='visible';
	}
}

function HideLayers() {
        if (gb) {
                for (i=0; i<layers.length; i++) 
                        if (document.getElementById(layers[i]))
                                document.getElementById(layers[i]).style.visibility='hidden';
                sh=0;
        }
}

function Show(LayerName) {
        if (gb) {
                clearTimeout(Timer);
                HideLayers();
                document.getElementById(LayerName).style.visibility='visible';
                sh=1;
        }
}

var chvis=0;
function ch_vis(lname) {
    if (document.getElementById(lname).style.visibility=='hidden') {document.getElementById(lname).style.visibility='visible'; chvis=1;}
    else {document.getElementById(lname).style.visibility='hidden'; chvis=0;}
}

var pdt='';
function pd(id) {
    if (document.getElementById(pdt)) {document.getElementById(pdt).style.visibility='hidden';}
    if (pdt!=id) {document.getElementById(id).style.visibility='visible'; pdt=id;} else { pdt='';}
}

function choose(id,num) {
    id.value=num.name;
    document.getElementById(pdt).style.visibility='hidden';
    pdt='';
}

function ba(days) {
    document.f1.ba1.value=days;
    document.f1.ba2.value=days;
    document.f1.ba3.value=days;
    document.f1.ba4.value=days;
    document.f1.ba5.value=days;
    document.f1.ba6.value=days;

    document.f1.ba11.value=days*324;
    document.f1.ba12.value=days*324*1.4;
    document.f1.ba13.value=days*324*0.8;
    document.f1.ba14.value=days*324*0.5;

    days=days*1.25;
    document.f1.ba21.value=days*324;
    document.f1.ba22.value=days*324*1.4;
    document.f1.ba23.value=days*324*0.8;
    document.f1.ba24.value=days*324*0.5;

    days=days*0.9;
    document.f1.ba31.value=days*324;
    document.f1.ba32.value=days*324*1.4;
    document.f1.ba33.value=days*324*0.8;
    document.f1.ba34.value=days*324*0.5;

    days=days*1.25;
    document.f1.ba41.value=days*324;
    document.f1.ba42.value=days*324*1.4;
    document.f1.ba43.value=days*324*0.8;
    document.f1.ba44.value=days*324*0.5;

    days=days*1.1;
    document.f1.ba51.value=days*324;
    document.f1.ba52.value=days*324*1.4;
    document.f1.ba53.value=days*324*0.8;
    document.f1.ba54.value=days*324*0.5;

    days=days*1.25;
    document.f1.ba61.value=days*324;
    document.f1.ba62.value=days*324*1.4;
    document.f1.ba63.value=days*324*0.8;
    document.f1.ba64.value=days*324*0.5;
}


function hide_b(ln) {
    document.getElementById(ln+"s").style.display='none';
}

function g_show_b(ln) {
    if (document.getElementById(ln+"h").style.display == 'none') { document.getElementById(ln+"s").style.display='block'; }
}

function show_b(LayerName)
{
	clearTimeout(Timer);
	if (document.getElementById(LayerName).style.display == 'block')
	{	document.getElementById(LayerName).style.display='none';
		if (LayerName=="NewsList")
		{	document.cookie='nnn=0';
			ch_vis('Arr');
		}
	}
	else
	{	document.getElementById(LayerName).style.display='block';
		if (LayerName=="NewsList")
		{	document.cookie='nnn=1';
			ch_vis('Arr');
		}
	}
}

function show_CM(ln) {
    if (document.getElementById(ln+"s").style.display == 'none') {
//        document.all[ln].style.display='none';
        document.getElementById(ln+"s").style.display='block';
        document.getElementById(ln+"h").style.display='none';
    }
    else {
//        document.all[ln].style.display='block';
        document.getElementById(ln+"s").style.display='none';
        document.getElementById(ln+"h").style.display='block';
    }
}

function changeall(ii) {
    if (document.getElementById('dbl'+ii)) {document.getElementById('dbl'+ii).style.display = 'none';}
    if (document.getElementById('sgl'+ii)) {document.getElementById('sgl'+ii).style.display = 'none';}
    if (document.getElementById('trpl'+ii)) {document.getElementById('trpl'+ii).style.display = 'none';}
    if (document.getElementById('chld'+ii)) {document.getElementById('chld'+ii).style.display = 'none';}
}

function changeblock(b,i) {
    if (document.getElementById(b+i).style.display == 'block') { document.getElementById(b+i).style.display = 'none';}
    else if (document.getElementById(b+i).style.display == 'none') {
        document.getElementById(b+i).style.display = 'block';
    }
}

function oncloseLB(){
    document.getElementById('closeLB').style.visibility = 'visible';
}
function plus(LayerName) {
    if (document.getElementById(LayerName).style.display == 'block') {return 'url(/img/lim.gif)';}
    else {return 'url(/img/lip.gif)';}
}

var MapWin;
function OpenMap(url, width, height) {
        if (MapWin) { MapWin.close(); }
        MapWin=window.open ("", "Photos", "width="+width+",height="+height+",resizable=0");
        MapWin.document.open();
        MapWin.document.writeln("<HTML><head><title>Фотографии</title></head><BODY leftmargin=0 topmargin=0 oncontextmenu='return false' ondragstart='return false'><img src="+url+" width="+width+" height="+height+" border=0></BODY></HTML>");
        MapWin.document.close();
        MapWin.focus();
}

function OpenRec(url, width, height) {
        if (MapWin) { MapWin.close(); }
        var widthWin=width+20;
        MapWin=window.open ("", "Photos", "width="+widthWin+",height=600,resizable=0,scrollbars=1");
        MapWin.document.open();
        MapWin.document.writeln("<HTML><head><title>Фотографии</title></head><BODY leftmargin=0 topmargin=0 oncontextmenu='return false' ondragstart='return false'><img src="+url+" width="+width+" height="+height+" border=0></BODY></HTML>");
        MapWin.document.close();
        MapWin.focus();
}

var BookWin;
function OpenWin(url, width, height) {
	if (BookWin) { BookWin.close();}
	BookWin=window.open (url, "Book", "width="+width+",height="+height+",resizable=1,scrollbars=1");
	BookWin.focus();
}


 function ShowHide(node)
 {
//  var v0 = node.parentNode;
//  var v1 = v0.nextSibling;
  var v1 = node.nextSibling;
  
  if(v1.nodeName != 'DIV')
  {
   var obj;
   v2 = v1.nextSibling;
   obj = v2;
    if(v2.nodeName != 'DIV')
    {
     v3 = v2.nextSibling;
     obj = v3;
    }
  }
  var oldHeight = obj.style.height;
  if(oldHeight != '')
  obj.style.height='';
  else 
  obj.style.height='70px';
 }
