var imgwait = new Image()
imgwait.src = 'Image/site_clock.gif';

function SetStringCount(StrCount) {
	document.form1.StringCount.value = StrCount;
	document.form1.Curpage.value 	 = 1;
	document.form1.submit();
}

function SetPage(PageNumber) {
	document.form1.Curpage.value = PageNumber;
	document.form1.submit();
}

function SetStatus(StatusID) {
	document.form1.StatusID.value = StatusID;
	document.form1.Curpage.value = 1;
	document.form1.submit();
}

function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}
 
function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
 
function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}
function isBlank1(sName, sText) {
alert("["+sName.value+"]");
	if (ltrim(rtrim(sName.value)) == "") {
//	if (sName.value == "") {
		alert(sText);
		sName.focus();
		return false;
	} else {
		return true;
	}
}

function isBlank(sName, sText) {

	if (ltrim(rtrim(sName.value)) == "") {
//	if (sName.value == "") {
		alert(sText);
		sName.focus();
		return false;
	} else {
		return true;
	}
}

function SetFilter() {
	document.form1.Curpage.value = 1;
	document.form1.submit();
}

function SetLanguage(LName) {
	document.FormVar.LangName.value = "" + LName + "";
	document.FormVar.submit();
}

function AllNews() {
	location.href="news.asp";
}
function AllArticles() {
	location.href="article.asp";
}
function ViewNews(nID) {
	location.href="news.asp?NewsID=" + nID;
}

function ViewArticle(aID) {
	location.href="article.asp?AID=" + aID;
}

function ImgOver(sID) {
	sID.width  = 200;
	sID.height = 200;
}

function ImgOut(sID) {
	sID.width  = 100;
	sID.height = 100;
}

function GetVitrina(HID) {
	document.form1.SearchHotel.value = HID;
	document.form1.submit();
}

function FillTable(sID, k) {
	oTab=document.getElementById(sID).getElementsByTagName('tr');
	for (i=k; i<oTab.length; i=i+2) {
		oTab[i].className = "fill";
	}
}

function openMap(sSource){
	sWidth  = screen.width  / 2 - 225;
	sHeight = screen.height / 2 - 275;
	city = window.open("map.asp?sID=" + sSource, "map","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=550,height=455,left=" + sWidth + ",top=" + sHeight);
}

function Printers() {
  window.document.all.btn.style.display="none";
  window.print()
  window.document.all.btn.style.display="block";
}

function DelivChange() {
	if (document.form1.sDeliv.value != "Нет") {
		document.form1.sDelivText.disabled = false;
	} else {
		document.form1.sDelivText.disabled = true;
	}
}

function BookCruise(sTitle, sText, sDay){
	sWidth  = screen.width  / 2 - 300;
	sHeight = screen.height / 2 - 250;
	city = window.open("book_cruise.asp?sTitle=" + sTitle + "&sText=" + sText + "&sDay=" + sDay, "bookCruise","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=600,height=500,left=" + sWidth + ",top=" + sHeight);
}

function mmWait() {
SetWait();
}

function mmSleep() {
SetWait();
}

function QueryM() {
SetWait();
}

function StopM() {
SetWait();
}

function SetWait() {
	sWidth  = screen.width  / 2 - 150;
	sHeight = screen.height / 2 - 300;
	

	sText = "<span id='Wait2' style='position:absolute;background-color:white;z-index:1;'>";
	sText += "<table height='150' style='width:300;border:1px solid #e5e5e5;'><tr><td align='center' style='font-size:90%;padding:1px 5px 1px 5px;'>";
	sText += "<img src=" + imgwait.src + " alt='' width='99' height='62' border='0'><br>";
	sText += "Выполнение запроса может занять до 30 секунд.<br>Подождите, пожалуйста...</td></tr></table></span>";	

	document.all("_Wait").innerHTML = sText;

	dd = document;
  	NS = (dd.layers)?1:0;
  	IE = (dd.all)?1:0
  	if(NS){
		obg = dd.layers['Wait2']
	} else {
    	obg = dd.getElementById('Wait2');obg=obg.style
  	}
	if(IE)vt=dd.body.scrollTop + 200; else vt=window.pageYOffset;
	obg.top=vt;
	document.all["Wait2"].style.left    = sWidth;
}
