function replace_string(txt,cut_str,paste_str){ 
	var f=0;
	var ht='';
	ht = ht + txt;
	f=ht.indexOf(cut_str);
	while (f!=-1){ 
		//цикл для вырезания всех имеющихся подстрок 
		f=ht.indexOf(cut_str);
		if (f>0){
			ht = ht.substr(0,f) + paste_str + ht.substr(f+cut_str.length);
		};
	};
	return ht
};

function response(title,place) {
	myWindow = window.open('', 'newwin','menubar=0, toolbar=0, location=0, directories=0, status=0, scrollbars=0, resizable=0, width=358, height=340');
	
	title = replace_string(title,'№','#') ;
	
	myWindow.document.write("<html>");
	myWindow.document.write("<head>");
	myWindow.document.write("<title>Оставить отзыв</title>");
	myWindow.document.write("<meta http-equiv='Content-Type' content='text/html; charset=windows-1251'>");
	myWindow.document.write("<link href='css/surrogacy.css' type='text/css' rel='stylesheet'>");
	myWindow.document.write("</head>");
	myWindow.document.write("<body bottommargin='0' leftmargin='0' rightmargin='0' topmargin='0'>");
	myWindow.document.write("<table border='0' cellpadding='0' cellspacing='0' width='100%' height='100%' background='images/main_back.gif'>");
	myWindow.document.write("<tr>");
	myWindow.document.write("<td colspan='3' height='10'></td>");
	myWindow.document.write("</tr>");
	myWindow.document.write("<tr>");
	myWindow.document.write("<td width='10'><img src='images/px.gif' border='0' width='10' height='1'></td>");
	myWindow.document.write("<td>");
	myWindow.document.write("<table border='0' cellpadding='0' cellspacing='0' width='100%' height='100%'>");
	myWindow.document.write("<tr><td bgcolor='#238E1C' height='6'><img src='images/px.gif' border='0' width='338' height='6'></td></tr>");
	myWindow.document.write("<tr><td height='2'></td></tr>");
	myWindow.document.write("<tr><td bgcolor='#EAF9E9' height='100%' align='center' valign='top' class='text'>");
	myWindow.document.write("<h2>" + title + "</h2>");
	myWindow.document.write("<form method='post' action='php/response.php' class='response'>");
	myWindow.document.write("<table border='0' cellpadding='4' cellspacing='0'>");
	myWindow.document.write("<tr>");
	myWindow.document.write("<td></td>");
	myWindow.document.write("<td class='form_info' align='center'>Внимание! Отзывы перед размещением<br>проверяются администратором.</td>");
	myWindow.document.write("</tr>");
	myWindow.document.write("<tr>");
	myWindow.document.write("<td align='right'>Имя:</td>");
	myWindow.document.write("<td><input type='text' name='nam' class='textt_r' charset='windows-1251'></td>");
	myWindow.document.write("</tr>");
	myWindow.document.write("<tr>");
	myWindow.document.write("<td align='right'>E-mail:</td>");
	myWindow.document.write("<td><input type='text' name='email' class='textt_r' charset='windows-1251'></td>");
	myWindow.document.write("</tr>");
	myWindow.document.write("<tr>");
	myWindow.document.write("<td align='right' valign='top'>Отзыв:</td>");
	myWindow.document.write("<td><textarea name='response' rows='5' class='textt_r' charset='windows-1251'></textarea></td>");
	myWindow.document.write("<input type='hidden' name='title' value='" + title + "' charset='windows-1251'>");
	myWindow.document.write("<input type='hidden' name='place' value='" + place + "' charset='windows-1251'>");
	myWindow.document.write("</tr>");
	myWindow.document.write("<tr>");
	myWindow.document.write("<td align='right' colspan='2'><input type='submit' name='submit' class='submit' value='Отправить'></td>");
	myWindow.document.write("</tr>");
	myWindow.document.write("</table>");
	myWindow.document.write("</form>");
	myWindow.document.write("</td></tr>");
	myWindow.document.write("</table>");
	myWindow.document.write("</td>");
	myWindow.document.write("<td width='10'><img src='images/px.gif' border='0' width='10' height='1'></td>");
	myWindow.document.write("</tr>");
	myWindow.document.write("<tr>");
	myWindow.document.write("<td colspan='3' height='10'></td>");
	myWindow.document.write("</tr>");
	myWindow.document.write("</table>");
	myWindow.document.write("</body>");
	myWindow.document.write("</html>");
}
