var dbArray = new Array();
var dbreport;
var recordcount;
var coloumcount;


var cp = new cpaint();
cp.set_debug(false);
cp.set_response_type('XML');


var dbLloaded=true;

function executeDB(sql){
	var processScriptUrl=baseurl+'ajax/myajaxphp.php';
	cp.call(processScriptUrl,'executeDB',return_value,sql);
}

function return_value(result){
	dbreport=result.getElementsByTagName('dbreport').item(0).firstChild.data;
	if (dbreport=='1'){
		recordcount=result.getElementsByTagName('recordcount').item(0).firstChild.data;
		coloumcount=result.getElementsByTagName('coloumcount').item(0).firstChild.data;
		for( i=0;i<recordcount;i++){
			dbArray[i]=new Array(recordcount);
			for( ii=0;ii<coloumcount;ii++){
				dbArray[i][ii]=result.getElementsByTagName('dbvalue'+i+ii).item(0).firstChild.data;
			}
		}
	}
	dbLoaded = false;
}

function insertInToTable(tblId, varRow, varCell, varData){
	try{
		var x=document.getElementById(tblId).rows[varRow].cells;
		x[varCell].innerHTML=varData;
		return false;
	}
	catch(Err){
		return false;
	}
}


function txtBoxValidation(myId,defaultColor,errColor){
	// # My property
	try{
		me=document.getElementById(myId);

		if(me.value==""){
			me.style.background=errColor;
			me.setFocus;
			return false;
		}
		else{
			me.style.background=defaultColor;
			me.setFocus;
			return true;
		}
	}
	catch(Err){
		return 'Err';
	}
}

function hideMe(myId){
	document.getElementById(myId).style.display="none";
}

function showMe(myId){
	document.getElementById(myId).style.display="block";
}

function directMyvalueto(myValue,thatId){
	document.getElementById(thatId).value=myValue;
}

