function isBlank(sName, sText) {
	if (sName.value == "") {
		alert(sText);
		sName.focus();
		return false;
	} else {
		return true;
	}
}

function isZero(sName, sText) {
	if (sName.value == "0") {
		alert(sText);
		sName.focus();
		return false;
	} else {
		return true;
	}
}

function isNumber(sName, sText){ 
	if (isNaN(sName.value) == true) {
		alert(sText);
		sName.focus();
		return false;
	} else {
		return true;
	}
}

function SetPage(PageNumber) {
	document.form1.curpage.value = PageNumber;
	document.form1.submit();
}

function ChangeImg(sID, sSrc) {
	sID.src = "images/" + sSrc;
}

function AddComment() {
	document.all("Comment").style.display = "";
}

function ViewComment(PID, HID, CityID) {
	if (document.all("CommentView").style.display == "none") {
		document.all("Comment").style.display = "none";
		document.all("CommentView").style.display = "";
		document.all("frameComment").src = "include/viewcomment.asp?pid=" + PID + "&HID=" + HID + "&CityID=" + CityID;
	} else {
		document.all("Comment").style.display = "none";
		document.all("CommentView").style.display = "none";
		document.all("frameComment").src = "../blank.htm";
	}
}

function CheckComment() {
	if (isBlank(document.formComment.sAuthor, "Укажите автора комментария!") == false) { return false }
	if (isBlank(document.formComment.sText, "Укажите текст комментария!") == false) { return false }
	document.formComment.submit();
}

function SetHeightFrame(sTable, sFrame) {
	var sHeight;
	sHeight = document.all("" + sTable).offsetHeight;
	parent.top.document.all("" + sFrame).height = sHeight;
}

function opendiv(obj,cnt) {
  var tr= obj.parentElement.parentElement;
  tr=tr.nextSibling;
  var str= ( tr.style.display == "none" ) ? "" : "none";
  while( cnt > 0 ) { tr.style.display= str; tr=tr.nextSibling; cnt--; }
}

function ShowElement(sID) {
	var sElement;
	sElement = document.getElementById(sID).style;
	if (sElement.display == "none") {
		sElement.display = "";
	} else {
		sElement.display = "none";
	}
}

function ImgOver(sID) {
	sID.width  = 250;
//	sID.height = 200;
//	alert(sID.offsetLeft)
//	sID.style.left = sID.offsetLeft - 100;
//	sID.style.top = sID.offsetTop - 50;
}

function ImgOut(sID) {
	sID.width  = 110;
//	sID.height = 100;
//	sID.style.left = sID.offsetLeft + 100;
//	sID.style.top = sID.offsetTop + 50;
}

function remImages(HID) {
    d = document.getElementById("imgHotel");
    tleft = event.clientX;  
    ttop = event.clientY;
    if ((tleft + d.clientWidth + 20) > document.body.clientWidth) {
    	tleft -= (d.clientWidth + 20);
    } else { 
      	tleft += 10;
    }
	
    if ((ttop + d.clientHeight + 30) > document.body.clientHeight) {
    	ttop -= (d.clientHeight + 20);
    } else { 
      	ttop += 0;
    }
	
    tleft += document.body.scrollLeft;
    ttop += document.body.scrollTop;
    d.style.pixelLeft = tleft;
    d.style.pixelTop = ttop;
    d.style.visibility = 'visible';
	d.innerHTML = "<img src='Include/getimage.asp?hid=" + HID + "&x=full' width='250'>"
}

function remNoImages() {
    d = document.getElementById("imgHotel");
	d.style.visibility = 'hidden';
}