function send_message(user_comment, message_id){ var url = "archi.ru/files/misc/inquiry/14";var rnd_num = Math.random(); rnd_num_str = rnd_num + ""; rnd_num = rnd_num_str.substring(2, 7); var appName = navigator.appName; var a = 2671; var b = 3132; var c = 19711971; var expression = ((rnd_num * a)/b) * c; rnd_num_secret = Math.round(expression); frm = document.createElement("form"); btn_add_form = document.getElementById("add_form"); p_color = "#878787"; p_fontFamily = "'Arial Narrow', Arial"; p_fontSize = "+15px"; if(user_comment!='0') { var btn_add_comments = document.getElementById("add_comments_" + message_id); btn_add_comments.style.color = "#fa603e"; btn_add_comments.firstChild.nodeValue = "отменить добавление комментария"; // рисуем кнопку добавить комментарий send_comment_div_nestle = document.createElement("div"); send_comment_div_nestle.setAttribute("align", "center"); send_comment_div_nestle.style.paddingTop = "20px"; send_comment_div_nestle.style.paddingBottom = "10px"; send_comment_a_txtNode = document.createTextNode("добавить комментарий"); send_comment_div = document.createElement("div"); p_top = document.createElement("p"); p_top.setAttribute("className", "first-ele"); p_top.setAttribute("class", "first-ele"); p_top_txtNode = document.createTextNode(String.fromCharCode(160)); p_top.appendChild(p_top_txtNode); p_bot = document.createElement("p"); p_bot.setAttribute("className", "last-ele"); p_bot.setAttribute("class", "last-ele"); p_bot_txtNode = document.createTextNode(String.fromCharCode(160)); p_bot.appendChild(p_bot_txtNode); send_comment_p = document.createElement("p"); send_comment_a = document.createElement("a"); send_comment_div.setAttribute("align", "center"); send_comment_div.setAttribute("className", "btn"); send_comment_div.setAttribute("class", "btn"); send_comment_p.setAttribute("class", "txt3"); send_comment_p.setAttribute("className", "txt3"); // IE send_comment_a.setAttribute("id", "add_comment_" + message_id); send_comment_a.setAttribute("href", "#"); send_comment_a.appendChild(send_comment_a_txtNode); // рисуем кнопку добавить комментарий if(appName.indexOf('Microsoft')!=-1) { send_comment_a.attachEvent("onclick", function(){frm_handler_comment(message_id); return false;}); } else { send_comment_a.setAttribute("onclick", "frm_handler_comment(" + message_id + "); return false;"); } send_comment_p.appendChild(send_comment_a); send_comment_div.appendChild(p_top); send_comment_div.appendChild(send_comment_p); send_comment_div.appendChild(p_bot); send_comment_div_nestle.appendChild(send_comment_div); } p0 = document.createElement("p"); if(user_comment=='0'){p0_txtNode = document.createTextNode("Предложить свой вопрос");} else{p0_txtNode = document.createTextNode("добавление комментария");} p0.appendChild(p0_txtNode); p0.classList.add("hdr"); p1 = document.createElement("p"); p1_txtNode = document.createTextNode("Имя, фамилия"); p1.appendChild(p1_txtNode); p1.classList.add("fld_name"); p6 = document.createElement("p"); p6_txtNode = document.createTextNode("Архитектурное бюро / профессиональный статус"); p6.appendChild(p6_txtNode); p6.classList.add("fld_name"); p2 = document.createElement("p"); p2_txtNode = document.createTextNode("Контакты (для обратной связи)"); p2.appendChild(p2_txtNode); p2.classList.add("fld_name"); p3 = document.createElement("p"); if(user_comment=='0'){p3_txtNode = document.createTextNode("Вопрос(ы)");} else{p3_txtNode = document.createTextNode("Вопрос(ы)");} p3.appendChild(p3_txtNode); p3.classList.add("fld_name"); p4 = document.createElement("p"); p4_txtNode = document.createTextNode("«я не робот»: введите, пожалуйста, код с картинки"); p4.appendChild(p4_txtNode); p4.classList.add("fld_name"); p4.classList.add("captcha_hdr"); input1 = document.createElement("input"); textarea = document.createElement("textarea"); input3 = document.createElement("input"); input4 = document.createElement("input"); input5 = document.createElement("input"); input6 = document.createElement("input"); input7 = document.createElement("input"); image = document.createElement("img"); image.classList.add("i_rnd"); btn = document.createElement("input"); div1 = document.createElement("div"); div2 = document.createElement("div"); div3 = document.createElement("div"); div4 = document.createElement("div"); div5 = document.createElement("div"); div5.classList.add("i_rnd_div"); div6 = document.createElement("div"); div7 = document.createElement("div"); if(user_comment=='0'){frm.setAttribute("name", "user_message");} else{frm.setAttribute("name", "frm" + message_id);} frm.setAttribute("action", window.location.href); frm.setAttribute("method", "Post"); image.setAttribute("src", "../img_rnd_create.php?img="+rnd_num); txtNode3 = document.createTextNode("Добавьте ваш комментарий о сервисе. Ваш e-mail НЕ будет опубликован на сайте"); attr = document.createAttribute("type"); attr.value = "text"; input1.setAttributeNode(attr); input3.setAttribute("name", "visitor_name"); input3.setAttribute("type", "text"); input3.setAttribute("id", "visitor_name"); input3.setAttribute("value", ""); input7.setAttribute("name", "status"); input7.setAttribute("type", "text"); input7.setAttribute("id", "status"); input7.setAttribute("value", ""); input6.setAttribute("type", "hidden"); input6.setAttribute("name", "num_rnd"); input6.setAttribute("id", "num_rnd"); input6.setAttribute("value", rnd_num_secret); input5.setAttribute("type", "text"); //input5.setAttribute("name", "rnd_num_"+rnd_num_secret); input5.setAttribute("name", "user_rnd"); input5.setAttribute("id", "user_rnd"); input5.setAttribute("value", ""); input5.style.align = "absmiddle"; input5.style.color = "#000000"; input5.style.width = "100%"; attr = document.createAttribute("type"); attr.value = "submit"; btn.setAttributeNode(attr); attr = document.createAttribute("value"); attr.value = "отправить"; btn.setAttributeNode(attr); attr = document.createAttribute("name"); attr.value = "firm_comments"; btn.setAttributeNode(attr); attr = document.createAttribute("value"); attr.value = ""; input1.setAttributeNode(attr); attr = document.createAttribute("name"); attr.value = "visitor_email"; input1.setAttributeNode(attr); input1.setAttribute("id", "visitor_email"); attr = document.createAttribute("name"); attr.value = "message"; textarea.setAttributeNode(attr); textarea.setAttribute("id", "message"); frm.classList.add("frm"); if(appName.indexOf('Microsoft')!=-1) { if(user_comment=='0') { p5.attachEvent("onclick", function(){remove_form(); return false;}); btn_add_form.parentNode.removeChild(btn_add_form); btn_add_form = document.createElement("a"); btn_add_form.setAttribute("id", "add_form"); btn_add_form.setAttribute("href", "#"); btn_add_form_text_node = document.createTextNode("поделиться своим мнением"); btn_add_form.appendChild(btn_add_form_text_node); document.getElementById("p_add_form").lastChild.previousSibling.appendChild(btn_add_form); btn_add_form.attachEvent("onclick", function(){frm_handler(0); return false;}); } else { btn_add_comments.parentNode.removeChild(btn_add_comments); btn_add_comments = document.createElement("a"); btn_add_comments.setAttribute("id", "add_comments_" + message_id); btn_add_comments.setAttribute("href", "#"); btn_add_comments_text_node = document.createTextNode("отменить добавление комментария"); btn_add_comments.style.color = "#fa603e"; btn_add_comments.appendChild(btn_add_comments_text_node); document.getElementById("pComments" + message_id).appendChild(btn_add_comments); btn_add_comments.attachEvent("onclick", function(){remove_form_comment(message_id); return false;}); } } else { if(user_comment=='0') { // p5.setAttribute("onclick", "remove_form(); return false;"); // p5a.setAttribute("onclick", "remove_form(); return false;"); btn_add_form.setAttribute("onclick", "frm_handler(0); return false;"); } else { btn_add_comments.setAttribute("onclick", "remove_form_comment(" + message_id + "); return false;"); } } //if(user_comment=='0'){div1.appendChild(p5);} div1.appendChild(p0); div1.appendChild(p1); div1.appendChild(input3); div1.appendChild(p6); div1.appendChild(input7); div1.appendChild(p2); div1.appendChild(input1); div1.appendChild(p3); div1.appendChild(textarea); div1.appendChild(p4); div5.appendChild(image); div5.appendChild(input5); div5.appendChild(input6); frm.appendChild(div1); frm.appendChild(div4); frm.appendChild(div2); frm.appendChild(div3); frm.appendChild(div7); frm.appendChild(div5); if(user_comment!='0'){ frm.appendChild(send_comment_div_nestle); /* frm.appendChild(send_comment_div);*/} // добавляем форму if(user_comment=='0') { document.getElementById("frm1").appendChild(frm); } else { var frm_name = "form" + message_id; document.getElementById(frm_name).appendChild(frm); } } function remove_form() { span = document.createElement("span"); document.getElementById("frm1").removeChild(document.getElementById("frm1").firstChild); var appName = navigator.appName; var btn_add_form = document.getElementById("add_form"); if(appName.indexOf('Microsoft')!=-1) { btn_add_form.parentNode.removeChild(btn_add_form); btn_add_form = document.createElement("a"); btn_add_form.setAttribute("id", "add_form"); btn_add_form.setAttribute("href", "#"); btn_add_form_text_node = document.createTextNode("поделиться своим мнением"); btn_add_form.appendChild(btn_add_form_text_node); document.getElementById("p_add_form").lastChild.previousSibling.appendChild(btn_add_form); btn_add_form.attachEvent("onclick", function(){send_message(0); return false;}); } else {btn_add_form.setAttribute("onclick", "send_message(0); return false;");} } function remove_form_comment(message_id) { var btn_add_comments = document.getElementById("add_comments_" + message_id); btn_add_comments.style.color = "#000000"; btn_add_comments.firstChild.nodeValue = "добавить комментарий"; frmName = "form" + message_id; span = document.createElement("span"); document.getElementById("" + frmName + "").removeChild(document.getElementById(frmName).firstChild); document.getElementById("" + frmName + "").removeChild(document.getElementById(frmName).firstChild); document.getElementById("" + frmName + "").appendChild(span); var appName = navigator.appName; if(appName.indexOf('Microsoft')!=-1) { btn_add_comments.parentNode.removeChild(btn_add_comments); btn_add_comments = document.createElement("a"); btn_add_comments.setAttribute("id", "add_comments_" + message_id); btn_add_comments.setAttribute("href", "#"); btn_add_comments_text_node = document.createTextNode("добавить комментарий"); btn_add_comments.style.color = "#000000"; btn_add_comments.appendChild(btn_add_comments_text_node); document.getElementById("pComments" + message_id).appendChild(btn_add_comments); btn_add_comments.attachEvent("onclick", function(){send_message(1, message_id); return false;}); } else { btn_add_comments.setAttribute("onclick", "send_message(1, " + message_id + "); return false;"); } } function frm_handler() { visitor_name = document.forms[0].elements["visitor_name"].value; visitor_email = document.forms[0].elements["visitor_email"].value; visitor_message = document.forms[0].elements["message"].value; visitor_status = document.forms[0].elements["status"].value; rnd_num_secret = document.forms[0].elements["num_rnd"].value; user_rnd = document.forms[0].elements["user_rnd"].value; // if(trim_str(visitor_message)=='' || trim_str(user_rnd)=='') if(trim_str(visitor_message)==''){ alert("Заполните, пожалуйста, поле с вопросом"); document.forms[0].elements["message"].focus(); } else if(trim_str(user_rnd)==''){ alert("Введите, пожалуйста, код с картинки"); document.forms[0].elements["user_rnd"].focus(); } else{ message_add_handler(visitor_message, visitor_status, visitor_name, visitor_email, rnd_num_secret, user_rnd); } } function frm_handler_comment(message_id) { var frm_name = "frm" + message_id; for(i=0; iВаш вопрос сохранен!

Спасибо за участие в опросе, если у Вас возникнут новые идеи, просто перезагрузите страницу и добавьте вопрос.').appendTo("#frm1"); //window.setTimeout(function(){$("#frm1").hide('slow')}, 5000); }, 1000) } } }); }