function getXmlHttp(){
  var xmlhttp;
  try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
    try {
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (E) {
      xmlhttp = false;
    }
  }
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
    xmlhttp = new XMLHttpRequest();
  }
  return xmlhttp;
}



function modajax(file,id,more)
{
	var req = getXmlHttp();
    	var statusElem = document.getElementById(id);
	url = '/index.php?mod='+ file + more;
	req.open('GET', url, true);
	req.send(null);
	req.onreadystatechange = function() {  
        if (req.readyState == 4) { 
            if(req.status == 200) { 
		statusElem.innerHTML = req.responseText;
            }
	    else
            {
		alert('err modfile: ' + file);
            }
        }
     }
}

function delcom(id,vopros)
{
if(confirm(vopros))
  {
	var req = getXmlHttp();
    	var statusElem = document.getElementById('idcom' + id);
	url = '/index.php?mod=delcom&id=' + id;
	req.open('GET', url, true);
	req.send(null);
	req.onreadystatechange = function() {  
        if (req.readyState == 4) { 
            if(req.status == 200) { 
		statusElem.innerHTML = req.responseText;
		document.getElementById('idcom' + id).style.display = "none";
            }
	    else
            {
		alert('err modfile: ' + file);
            }
        }
     }
  }
}


function pubcom(id)
{
	var req = getXmlHttp();
    	var statusElem = document.getElementById(id);
	newid = id.replace('pubcom', ''); 
	//alert(newid);
    	var statushtml = document.getElementById(newid);
	if (statusElem.checked){
	onoff = '1';
	}else{
	onoff = '0';
	}
	//alert(onoff);

	url = '/index.php?mod=pubcom&id=' + newid + '&onoff=' + onoff;
	req.open('GET', url, true);
	req.send(null);
	req.onreadystatechange = function() {  
        if (req.readyState == 4) { 
            if(req.status == 200) { 
		//statushtml.innerHTML = req.responseText;
		//document.getElementById(newid).style.background="FFFEA2";
            }
	    else
            {
		alert('err modfile: ' + file);
            }
        }
     }
}


function addsmile(code)
{
	mystr=' :'+ code +': ';
	var bf = parent.add_comment.comment;
	bf.focus();
	bf.value=bf.value+mystr;
}

function errform(id)
{
	document.getElementById(id).style.display = "block";
	document.getElementById(id).style.background="FFFEA2";
	document.getElementById(id).style.color="000000";
}

function fnone(id){
document.getElementById(id).style.display='none';
}

function showhide(n) {
	var name = "someid" + n;
	if ( document.getElementById(name).style.display == "block" )
	document.getElementById(name).style.display = "none";
	else
	document.getElementById(name).style.display = "block";
}



function openwjs(url,width,height,idwin) {
var url,width,height,alt,NewWin;
 	NewWin=window.open(url,idwin,'width=' + width + ',height=' + height + ',top=70,left=70,scrollbars=yes,resizable=yes,menubar=no,location=no');
}


function riprint(title,content,text)
{
   var title,content;
	head = '<html><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type" />';
	width = 640;
	height = 480;
   NewWin=window.open('','riweb','width=' + width + ',height=' + height + ',top=20,left=50,scrollbars=yes,resizable=yes,menubar=no,location=no');
   NewWin.document.open(); 
   NewWin.document.write(head + '<title>' + title +'</title><style type="text/css">*{margin:0; padding:0;}A:link { color : #2b255f; text-decoration : underline; } A:visited { color : #2b255f; } A:hover, A:active { text-decoration : none; }</style></head><body><br /><p />' + content + '<br />\n<a onclick="self.print();" href="#">' + text + '</a></p></body></html>'); 
   NewWin.document.close(); 
   NewWin.focus();
}

function admin(lang,id)
{
window.open('/admin/rimain.php?rimain=content&editor=html&id='+id+'&lang='+ lang +'','', 'scrollbars=yes,resizable=yes,menubar=no,location=no');
}

/*

function ycom(){
if(add_comment.comment.value != ""){
        document.getElementById('comment').style.background="FFFFFF";
          }else{
        document.getElementById('comment').style.background="FFE0E0";
	}
}
setInterval("ycom();",2);

*/
