
function doIframe(){
	o = document.getElementsByTagName('iframe');
	for(i=0;i<o.length;i++){
		if (/\bautoHeight\b/.test(o[i].className)){
			setHeight(o[i]);
			addEvent(o[i],'load', doIframe);
		}
	}
}

function setHeight(e){
	if(e.contentDocument){
		e.height = e.contentDocument.body.offsetHeight + 35;
	} else {
		e.height = e.contentWindow.document.body.scrollHeight;
	}
}

function addEvent(obj, evType, fn){
	if(obj.addEventListener)
	{
	obj.addEventListener(evType, fn,false);
	return true;
	} else if (obj.attachEvent){
	var r = obj.attachEvent("on"+evType, fn);
	return r;
	} else {
	return false;
	}
}

if (document.getElementById && document.createTextNode){
 addEvent(window,'load', doIframe);
}



function rand(min, max){
	return Math.floor(Math.random() * (max + 1 - min)) + min;
};

function show_flash(id) {
	document.getElementById(id).outerHTML = document.getElementById(id).outerHTML;
}

$(document).ready(function(){
	$("img").each( function(){if($(this).attr('alt') && !$(this).attr('title')) $(this).attr("title",$(this).attr('alt') );});

	var selCountry = $("#select-country-div");
	selCountry.load('/page-strany.html #index-bar .w-60 .p2 p',function(){
		var result = "<option value=''>Выберите страну отдыха</option>";
		$("p", selCountry).each(function(i,e){
			var el = $(e);
			if(!el.hasClass("navpath")){
				if(i=1 && el.children("strong").length){
					result += "<optgroup label='"+el.text()+"'>"
				} else {
					if(el.children("strong").length){
						result += "</optgroup><optgroup label='"+el.text()+"'>";
					} else {
						result += "<option value='"+el.children("a").attr("href")+"'>"+el.text()+"</option>";
					}
				}
			}
		});
		result += "</optgroup>";
		$("#select-country").html(result).show().bind("change",function(){
			if($("#select-country").val()) window.location.href = $("#select-country").val();
		});

	});

	try{ SetupShowcase(); } catch(e) { /* alert(e.name) */ }
});

