

	function insertSmile(smile) {		var ncta = document.getElementById("new_comment_ta");
		ncta.focus();
		newCommentTA_fgot();

		smile = " "+smile+" ";
		if (document.selection) {
			ncta.focus();
			sel = document.selection.createRange();
			sel.text = smile;
		} else if (ncta.selectionStart || ncta.selectionStart == '0') {
			var startPos = ncta.selectionStart;
			var endPos = ncta.selectionEnd;
			ncta.value = ncta.value.substring(0, startPos)+ smile+ ncta.value.substring(endPos, ncta.value.length);
		} else {
			ncta.value += smile;
		}
	}
	function insertSmileResponse(smile) {
		var ncta = document.getElementById("resp_text");
		ncta.focus();

		smile = " "+smile+" ";
		if (document.selection) {
			ncta.focus();
			sel = document.selection.createRange();
			sel.text = smile;
		} else if (ncta.selectionStart || ncta.selectionStart == '0') {
			var startPos = ncta.selectionStart;
			var endPos = ncta.selectionEnd;
			ncta.value = ncta.value.substring(0, startPos)+ smile+ ncta.value.substring(endPos, ncta.value.length);
		} else {
			ncta.value += smile;
		}
	}
	function insertSmileMail(smile) {
		var ncta = document.getElementById("msg");
		ncta.focus();

		smile = " "+smile+" ";
		if (document.selection) {
			ncta.focus();
			sel = document.selection.createRange();
			sel.text = smile;
		} else if (ncta.selectionStart || ncta.selectionStart == '0') {
			var startPos = ncta.selectionStart;
			var endPos = ncta.selectionEnd;
			ncta.value = ncta.value.substring(0, startPos)+ smile+ ncta.value.substring(endPos, ncta.value.length);
		} else {
			ncta.value += smile;
		}
	}

	function newCommentTA_fgot() {		var ncta = document.getElementById("new_comment_ta");
		if (ncta.innerText == "Добавить комментарий ..." || ncta.value == "Добавить комментарий ...") {			ncta.innerText = "";
		}
	}

	function newCommentTA_flost() {
		var ncta = document.getElementById("new_comment_ta");
		if (ncta.innerText == "" || ncta.value == "") {
			ncta.innerText = "Добавить комментарий ...";
		}
	}

	function ChangeView(name) {		var chk = document.getElementById("pub_"+name);
		var img = document.getElementById("pub_im_"+name);
		if (chk.value == 1) {			 chk.value = 0;
			 img.src = "/i/share_off.png";		} else {			 chk.value = 1;
			 img.src = "/i/share_on.png";
		}

	}

	function CheckPrivDataForm() {
  		var unm_val = document.getElementById("priv_data_uname").value;
		if (unm_val == "") { var bok = false; } else { var bok = true; }

  		if (bok == false) { alert("Заполните поле Имя"); }
  		return bok;	}

	function CheckPassForm() {

  		var ps1_val = document.getElementById("new_pass").value;
  		var ps2_val = document.getElementById("new_pass_check").value;
		if (ps1_val == "" || ps1_val != ps2_val) { var bok = false; } else { var bok = true; }

  		if (bok == false) { alert("Заполните поле Пароль"); }
  		return bok;
	}

	function MyPhotoSaveName(g,p) {		window.open("my_photo.php?action=save_photo_name&g="+g+"&p="+p+"&name="+document.getElementById("photo_name_"+p).value, "frm_loader");
	}

	function setTextBgChanged(txt) {		txt.style.backgroundColor = "#FFD9D9";
	}



	function ShowMyRates(g,p) {		var rdiv = document.getElementById('underblock_'+p);
		var cdiv = document.getElementById('underblock_ct_'+p);		if (rdiv.style.display != "block" || cdiv.value != "rate") {			window.open("my_photo.php?action=show_rates&g="+g+"&p="+p, "frm_loader");
			cdiv.value = "rate";
		} else  {			rdiv.style.display = "none";
		}
	}
	function ShowMyComments(g,p) {
		var rdiv = document.getElementById('underblock_'+p);
		var cdiv = document.getElementById('underblock_ct_'+p);
		if (rdiv.style.display != "block" || cdiv.value != "cmnt") {
			window.open("my_photo.php?action=show_comments&g="+g+"&p="+p, "frm_loader");
			cdiv.value = "cmnt";
		} else {
			rdiv.style.display = "none";
		}
	}

	function ShowMyVRates(v) {
		var rdiv = document.getElementById('underblock_'+v);
		var cdiv = document.getElementById('underblock_ct_'+v);
		if (rdiv.style.display != "block" || cdiv.value != "rate") {
			window.open("my_video.php?action=show_rates&v="+v, "frm_loader");
			cdiv.value = "rate";
		} else  {
			rdiv.style.display = "none";
		}
	}
	function ShowMyVComments(v) {
		var rdiv = document.getElementById('underblock_'+v);
		var cdiv = document.getElementById('underblock_ct_'+v);
		if (rdiv.style.display != "block" || cdiv.value != "cmnt") {
			window.open("my_video.php?action=show_comments&v="+v, "frm_loader");
			cdiv.value = "cmnt";
		} else {
			rdiv.style.display = "none";
		}
	}

	var bCountryChanging = 0;

	function ChangeCountry(country, city, hotel, excursion) {		bCountryChanging = 1;

		var icountry = country.options[country.selectedIndex].value;
		document.getElementById(city).enabled = 0;
		document.getElementById(city).selectedIndex = 0;
		document.getElementById(city).options.length = 1;
		if (icountry > 0) {			window.open("bk.php?action=city_list&country="+icountry+"&cmb_city="+city+"&cmb_excursion="+excursion+"&excursion_list=1", "frm_loader");
		} else {			document.getElementById(city).enabled = 1;
		}
		bCountryChanging = 0;
	}

	function ChangeCity(city, hotel, excursion) {		if (bCountryChanging == 0) {
			var icity = city.options[city.selectedIndex].value;
			document.getElementById(hotel).enabled = 0;
			document.getElementById(hotel).selectedIndex = 0;
			document.getElementById(hotel).options.length = 1;
			if (icity > 0) {
				window.open("bk.php?action=hotel_list&city="+icity+"&cmb_hotel="+hotel+"&cmb_excursion="+excursion+"&excursion_list=1", "frm_loader");
			} else {
				document.getElementById(hotel).enabled = 1;
			}
		}
	}

	function SelectRate(rate) {		document.getElementById("rate").value = rate;
		for (i=1;i<=5;i++){ document.getElementById("my_rate_"+i).src = "/i/"+i+"_22.png"; }
		document.getElementById("my_rate_"+rate).src = "/i/"+rate+"h_22.png";	}

	function toBlackList(user_id) {
		window.open("mail.php?action=black_list_add&user_id="+user_id, "frm_loader");
	}
	function fromBlackList(user_id) {
		window.open("mail.php?action=black_list_remove&user_id="+user_id, "frm_loader");
	}


