﻿function CreateAjax(){
var xmlhttp;
if(!xmlhttp && typeof XMLHttpRequest != 'undefined'){
	try {
	  xmlhttp = new XMLHttpRequest();
	} catch (e) {
		alert("Your browser is not supporting XMLHTTPRequest");
		xmlhttp = false;
	}
}else{
	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
return xmlhttp;
}
function CallServer(mthd,www,str,func){
	request.open(mthd,www,true); 
	if(mthd=='POST'){
		request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset:UTF-8');
		}
	request.onreadystatechange=function(){
		if(request.readyState == 1){
			func(0);
			AjaxLoading(true);
			}
		if(request.readyState == 4){
			var answer = request.responseText;
			func(answer);
			AjaxLoading(false);
		}
	};
	request.send(str);
}

function CTxt(par){
par=par.replace(/\"/g,'');
par=par.replace(/:\|:/g,'\'');
return par
}

var request = CreateAjax();
function AjaxLoading(bl){
	var elm;
	if(document.getElementById('AjaxLoadingLbl'))
		{
		elm=document.getElementById('AjaxLoadingLbl');
		}
	else
		{
		elm=document.createElement("span");
		
		elm.id='AjaxLoadingLbl';
		elm.style.position='absolute';
		//elm.style.background='green';
		//elm.style.color='white';
		elm.style.padding='2px';
		//elm.innerHTML='<font style="font: 7pt">Connecting server ...</font>';
		document.body.appendChild(elm);
		}
	elm.style.top=0 + document.body.scrollTop;
	elm.style.left=screen.width/2 - 100 - document.body.scrollLeft;
if(bl){
	elm.style.display='block';
}else{
	elm.style.display='none';
}
}



function PoPUpWin(page,a,b){
X=(screen.width-a)/2;
Y=(screen.height-b)/2;
var winO=window.open(page,'popup','scrollbars=2,addressbar=1,resizable=1,width='+a+',height='+b+',left='+X+',top='+Y);winO.focus();
}
