function put_smile(s){ var smilebar = document.getElementById("textz"); if (smilebar.value.length == 0) smilebar.value=s+' '; else smilebar.value = smilebar.value+' '+s+' '; smilebar.focus(); return;}
function insert(start, end) {element = document.getElementById('textz');if (document.selection) {element.focus();sel = document.selection.createRange();sel.text = start + sel.text + end;} else if (element.selectionStart || element.selectionStart == '0') {element.focus();var startPos = element.selectionStart;var endPos = element.selectionEnd;element.value = element.value.substring(0, startPos) + start + element.value.substring(startPos, endPos) + end + element.value.substring(endPos, element.value.length);} else {element.value += start + end;}}
function getsize (num) {if (num>0&&num<8){insert('[size='+num+']','[/size]');document.getElementById('commentsize').selectedIndex = 0;}else {return false;}}
function getColorTable() {
var perline = 8;
var colors = Array('#000000|Black','#A0522D|Sienna','#556B2F|DarkOliveGreen','#006400|DarkGreen','#483D8B|DarkSlateBlue','#000080|Navy','#4B0082|Indigo','#2F4F4F|DarkSlateGray','#8B0000|DarkRed','#FF8C00|DarkOrange','#808000|Olive','#008000|Green','#008080|Teal','#0000FF|Blue','#708090|SlateGray','#696969|DimGray','#FF0000|Red','#F4A460|SandyBrown','#9ACD32|YellowGreen','#2E8B57|SeaGreen','#48D1CC|MediumTurquoise','#4169E1|RoyalBlue','#800080|Purple','#808080|Gray',' #FF00FF|Magenta','#FFA500|Orange','#FFFF00|Yellow','#00FF00|Lime','#00FFFF|Cyan','#00BFFF|DeepSkyBlue','#9932CC|DarkOrchid','#C0C0C0|Silver','#FFC0CB|Pink','#F5DEB3|Wheat','#FFFACD|LemonChiffon','#98FB98|PaleGreen','#AFEEEE|PaleTurquoise','#ADD8E6|LightBlue','#DDA0DD|Plum','#FFFFFF|White');
var tableCode = '';
tableCode += '
';
for (i = 0; i < colors.length; i++) {
if (i % perline == 0) { tableCode += ''; }
spscolor=colors[i].split('|');
tableCode += ' ';
if (i % perline == perline - 1) { tableCode += ' '; }
}
if (i % perline != 0) { tableCode += ''; }
tableCode += '
';
return tableCode;
}
function showhide(id){
var e=document.getElementById(id);
var IE='\v'=='v';if(IE) {e.style.left=5+'px';}
e.style.top = 20 + 'px';
if( e ) e.style.display = e.style.display ? "" : "none";
}
document.onclick=commenthide;function commenthide() {document.getElementById('colorpicz').style.display='none';}
function autosize(textarea){
var heightLimit = 720;
var dif = parseInt(textarea.scrollHeight) - parseInt(textarea.clientHeight);
if (dif>0){
if (isNaN(parseInt(textarea.style.height))){
textareaHeight = textarea.scrollHeight*1 + 8;
}else{
textareaHeight = parseInt(textarea.style.height) + parseInt(dif)+8;
}
if (textareaHeight>heightLimit){
if (parseInt(textarea.clientHeight)0)textarea.style.height = parseInt(textarea.style.height) + parseInt(dif)+8+ "px";
}
}
function add_link() {var link=window.prompt('URL:');if (link) {insert('[url='+link+']','[/url]');}}
function add_pic() { var link=window.prompt('URL:'); if (link) {insert('[img='+link+']','');}}
function send_message() {
var oldid=document.getElementById('oldid').value;
makeRequestpost('/medcomments/func.php',oldid)
}
function makeRequestpost(url,oldid) {
var http_request = false;
var str1 = document.getElementById("nick").value;
var str2 = document.getElementById("textz").value;
var testmail = document.getElementById("usmail").value;
var pattern = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (testmail !="")
{if (!pattern.test(testmail)){
alert(' ');
return false;}
}
if ((str1 == "")||(str1.search(/[^\s]+/)==-1)) {
alert(', ');
return false;
}
if ((str2 == "")||(str2.search(/[^\s]+/)==-1)) {
alert(', ');
return false;
}
if (str2.length > 5000) {
alert(' 5000');
return false;
}
if (window.XMLHttpRequest) {http_request = new XMLHttpRequest();if (http_request.overrideMimeType) {http_request.overrideMimeType('text/xml');}} else if (window.ActiveXObject) {try {http_request = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) {try {http_request = new ActiveXObject("Microsoft.XMLHTTP");} catch (e) {}}}if (!http_request) {alert(' XMLHTTP');return false;}
http_request.onreadystatechange = function() { alertContents(http_request,oldid); };
http_request.open('POST', url, true);
http_request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
var textz2 = encodeURIComponent(document.getElementById("textz").value);
var nick2 = document.getElementById("nick").value;
var keystring2 = document.getElementById("keystringz").value;
var urls2 = encodeURIComponent(document.getElementById("urls").value);
var forms2 = document.getElementById("forms").value;
var usmail2 = document.getElementById("usmail").value;
var idcomm2 = document.getElementById("idcomnow").value;
var xmlString = "namenew="+nick2+"&comment="+textz2+"&url="+urls2+"&addcomment="+forms2+"&keystring="+keystring2+"&usmail="+usmail2+"&idcomnow="+idcomm2;
http_request.send(xmlString);
document.getElementById('tableDiv').style.display='';
document.getElementById('miniload').style.display='';
if (document.getElementById('enter')) {document.getElementById('enter').disabled=true;}
}
///////////Listing
function makeRequest(url,iddiv,oldid) {
var http_request = false;if (window.XMLHttpRequest) {http_request = new XMLHttpRequest();if (http_request.overrideMimeType) {http_request.overrideMimeType('text/xml');}} else if (window.ActiveXObject) {try {http_request = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) {try {http_request = new ActiveXObject("Microsoft.XMLHTTP");} catch (e) {}}}if (!http_request) {alert(' XMLHTTP');return false;}
http_request.onreadystatechange = function() { alertContents2(http_request,iddiv); };
http_request.open('GET', url, true);
http_request.send(null);
document.getElementById('tableDiv').style.display='';
if (document.getElementById('enter')) {document.getElementById('enter').disabled=true;}
if (document.getElementById('oldid').value != 'addfomz') {
document.getElementById('addfomz').innerHTML=document.getElementById(oldid).innerHTML;
document.getElementById('addfomz').style.display='';
document.getElementById('oldid').value='addfomz';
document.getElementById(oldid).innerHTML="";
}
}
///////
function alertContents(http_request,oldid) {
var newcapt = document.getElementById("capt").src;
var olddiv = document.getElementById('oldid').value;
if (http_request.readyState == 4) {
if (http_request.status == 200) {
if (document.getElementById('oldid').value != 'addfomz') {
document.getElementById('addfomz').style.display='';
document.getElementById('oldid').value='addfomz';
document.getElementById('addfomz').innerHTML=document.getElementById(olddiv).innerHTML;
}
document.getElementById('ok').innerHTML = http_request.responseText;
} else {alert(' .');}
document.getElementById('tableDiv').style.display='none';
document.getElementById('miniload').style.display='none';
if (document.getElementById('enter')) {document.getElementById('enter').disabled=false;}
if (document.getElementById('errorcamp').value=="0"){
document.getElementById('addfomz').innerHTML = ' ';
}
else
{
if (document.getElementById('capt')) {document.getElementById('capt').src= newcapt+'&'+Math.random();}
if (document.getElementById('commentvis')) {if (document.getElementById('commentvis').value='1') {document.getElementById('addfomz').style.display='none';}}
}
}
}
function alertContents2(http_request,iddiv) {
if (http_request.readyState == 4) {
if (http_request.status == 200) {
document.getElementById(iddiv).innerHTML = http_request.responseText;
} else {
alert(' .');
}
document.getElementById('tableDiv').style.display='none';
if (document.getElementById('enter')) {document.getElementById('enter').disabled=false;}
}}
function refcapt() {
var newcapt = document.getElementById("capt").src;
document.getElementById('capt').src= newcapt+'&'+Math.random();
}
function otvet(idcomment,iddiv) {
specspan='span-'+idcomment;
repl='repl-'+idcomment;
oldrepl=iddiv.replace('comment','repl');
oldspan=iddiv.replace('comment','span');
document.getElementById(specspan).style.display='none';
document.getElementById(repl).style.display='';
if (document.getElementById(oldspan)) {
document.getElementById(oldspan).style.display='';
document.getElementById(oldrepl).style.display='none';
}
document.getElementById('idcomnow').value=idcomment;
idcomment='comment-'+idcomment;
document.getElementById(idcomment).innerHTML=document.getElementById(iddiv).innerHTML;
document.getElementById(iddiv).innerHTML='';
document.getElementById('oldid').value=idcomment;
}
function resetrepl(newdiv,olddiv)
{
oldspan=olddiv.replace('comment','span');
oldrepl=olddiv.replace('comment','repl');
document.getElementById(oldspan).style.display='';
document.getElementById(oldrepl).style.display='none';
document.getElementById('addfomz').style.display='';
document.getElementById('oldid').value='addfomz';
document.getElementById('addfomz').innerHTML=document.getElementById(olddiv).innerHTML;
document.getElementById(olddiv).innerHTML="";
document.getElementById('idcomnow').value='0';
}
© 2017 Syktuo.ru - Информационная справочно-поисковая система по медицине.
При копировании материалов указание прямой гиперссылки на syktuo.ru обязательно.
Информация, представленная на данном сайте, не должна использоваться для самостоятельной диагностики,
лечения и не может служить заменой очной консультации врача.