/**
 * @author Mojtaba Najafzadeh
 * @email mojtaba@cyberical.net
 * @project WebProcessor
 * @version 1.0
 * @copyright 2008
 */
 
<!--
var xmlHttp;
function createRequest(){
if(window.ActiveXObject){
	if(typeof ActiveXObject != "undefined"){
 xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
 } else {
  alert("This browser does not support Microsoft ActiveXObjects.")
	}
} else if(window.XMLHttpRequest){
 xmlHttp = new XMLHttpRequest();
}
}

// openurl
function openurl(url, tag, noResponse, oEditor, method){
	if(!method) method = "GET";
	if(!noResponse) noResponse = false;
createRequest();
xmlHttp.open(method, url, true); 
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8");
xmlHttp.onreadystatechange = function (){
 if(!noResponse){
	if(!oEditor){
		var loading = message['ajax_loading'];
		document.getElementById(tag).innerHTML = loading;
		} else {
		var loading = message['ajax_loading_txt'];
		oEditor.SetData(loading);
		}
	}
 if(xmlHttp.readyState == 4){
 if(xmlHttp.status == 200){
  if(!noResponse){
  	if(!oEditor){
  		document.getElementById(tag).innerHTML = xmlHttp.responseText;
  	} else {
		oEditor.SetData(xmlHttp.responseText);
	}
  	}
 } else {
 alert(message['ajax_error'])
 }
 }
};
xmlHttp.send(null); 
}
//-->

// title check
function checktitle(url){
createRequest();
xmlHttp.open("GET", url, true); 
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8");
xmlHttp.onreadystatechange = function (){
 document.getElementById('checkTitle').innerHTML = message['ajax_loading_txt'];
 if(xmlHttp.readyState == 4){
 if(xmlHttp.status== 200){
  document.getElementById('checkTitle').innerHTML = xmlHttp.responseText
 } else {
 alert(message['ajax_error'])
 }
 }
}; 
xmlHttp.send(null); 
}
//-->

// check field
function check(url, span){
createRequest();
xmlHttp.open("GET", url, true); 
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8");
xmlHttp.onreadystatechange = function (){
 document.getElementById(span).innerHTML = message['ajax_loading_txt'];
 if(xmlHttp.readyState == 4){
 if(xmlHttp.status== 200){
  document.getElementById(span).innerHTML = xmlHttp.responseText
 } else {
 alert(message['ajax_error'])
 }
 }
}; 
xmlHttp.send(null); 
}
//-->

// captcha
function resetCaptcha(url){
createRequest();
xmlHttp.open("GET", url, true); 
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8");
xmlHttp.onreadystatechange = function (){
 document.getElementById('captcha').src = message['ajax_loading_img'];
 if(xmlHttp.readyState == 4){
 if(xmlHttp.status== 200){
 	var reset = new Date().getTime();
  document.getElementById('captcha').src = url+'&'+reset;
 } else {
 alert(message['ajax_error'])
 }
 }
};
xmlHttp.send(null); 
}
//-->
