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='blue';
elm.style.color='white';
elm.style.padding='2px';
elm.innerHTML='Connecting server ...';
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';
}
}
// Flash embedding for validation
// -----------------------------------------------------------------
function printFlash(source, width, height, id, bg_color) {
document.write('');
}
// for clearing and replacing text in form input fields and textareas
// -----------------------------------------------------------------
function clearText(thefield) {
if (thefield.defaultValue==thefield.value) { thefield.value = "" }
}
function replaceText(thefield) {
if (thefield.value=="") { thefield.value = thefield.defaultValue }
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i0)
if (t==1){ //fromto
ma=a[i+1].split('_');if(isNaN(v)||v ma[1]/1){err=true}
} else if (t==2){
rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-zA-Z]{2,4}$");if(!rx.test(v))err=true;
} else if (t==3){ // date
ma=a[i+1].split("#");at=v.match(ma[0]);
if(at){
cd=(at[ma[1]])?at[ma[1]]:1;cm=at[ma[2]]-1;cy=at[ma[3]];
dte=new Date(cy,cm,cd);
if(dte.getFullYear()!=cy||dte.getDate()!=cd||dte.getMonth()!=cm){err=true};
}else{err=true}
} else if (t==4){ // time
ma=a[i+1].split("#");at=v.match(ma[0]);if(!at){err=true}
} else if (t==5){ // check this 2
if(o1.length)o1=o1[a[i+1].replace(/(.*\[)|(\].*)/ig,"")];
if(!o1.checked){err=true}
} else if (t==6){ // the same
if(v!=MM_findObj(a[i+1]).value){err=true}
}
} else
if (!o.type&&o.length>0&&o[0].type=='radio'){
at = a[i].match(/(.*)\[(\d+)\].*/i);
o2=(o.length>1)?o[at[2]]:o;
if (t==1&&o2&&o2.checked&&o1&&o1.value.length/1==0){err=true}
if (t==2){
oo=false;
for(j=0;j