/*
var xmlhttp = false;
        
// If the user is using Mozilla/Firefox/Safari/etc
if (window.XMLHttpRequest) {
        //Intiate the object
        xmlhttp = new XMLHttpRequest();
        //Set the mime type
        xmlhttp.overrideMimeType('text/xml');
} else if (window.ActiveXObject) {
        //Intiate the object
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
*/

function resetDiv(){
	document.getElementById("doclist").innerHTML = "";
}

function setError(msg){
	switch(msg){
			case "101":
				alert("Mandatory fields must be filled in !!");
			break;
			case "102":
				alert("A duplicate sequence number detected.\\nPlease check !");
			break;
			case "103":
				alert("There was an error uploading the file, please try again!");
			break;
	}
}

function tnow(){
	var Days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
	var today = new Date();
	var Year = takeYear(today);
	var Month = leadingZero(today.getMonth()+1);
	var DayName = Days[today.getDay()];
	var Day = leadingZero(today.getDate());
	var Hours = leadingZero(today.getHours());
	var Minutes = leadingZero(today.getMinutes());
	var Seconds = leadingZero(today.getSeconds());
	return Year+Month+Day+Hours+Minutes+Seconds;
}

function takeYear(theDate)
{
	x = theDate.getFullYear();
	var y = x % 100;
	y += (y < 38) ? 2000 : 1900;
	return y;
}

function leadingZero(nr)
{
	if (nr < 10) nr = "0" + nr;
	return nr;
}

function setFieldValue(id,val){
	var fld = document.getElementById(id);
	fld.value = val;
}
/*
function preSearch() {
    //Put the form data into a variable
	var theQuery = document.getElementById('query').value;
	
    //If the form data is *not* blank, query the DB and return the results
	if(theQuery !== "") {
        //Change the content of the "result" DIV to "Searching..."
        //This gives our user confidence that the script is working if it takes a moment for the result to be returned. However the user will likely never see this...
		//document.getElementById('temp').innerHTML = "Searching...";
		setTemp(true);
		
        //This sets a variable with the URL (and query strings) to our PHP script
		var url = 'dbconn.php?q=' + theQuery;
        //Open the URL above "asynchronously" (that's what the "true" is for) using the GET method
  		sendRequest('GET',url,'result');
	}
}


function sendRequest(sendMethod,sURL,dispBlock){
	//Open the URL above "asynchronously" (that's what the "true" is for) using the GET method
	xmlhttp.open(sendMethod, sURL, true);
	//Check that the PHP script has finished sending us the result
	xmlhttp.onreadystatechange = function() {
		if(xmlhttp.readyState == 4) {
			if(xmlhttp.status == 200){
				//Replace the content of the "result" DIV with the result returned by the PHP script
				document.getElementById(dispBlock).style.background = '#FFCC00';
				setTemp(false);			
			}else{
				document.getElementById(dispBlock).innerHTML = "Data not found in Database";
				setTemp(true);
			}
		}else{
			//If the PHP script fails to send a response, or sends back an error, display a simple user-friendly notification
			setTemp(true);
		}
	};
	xmlhttp.send(null);
}
*/

function testcalljs(){
		alert("success");
}

function getpos(id){
	var pobj = document.getElementById(id);
	var pc = getPageCoords (pobj);
	var eheight = pobj.offsetHeight;
	var ewidth = pobj.offsetWidth;
	//
	//var l = pobj.offsetLeft;
	//var t = pobj.offsetTop;
	alert('left : '+pc.x+' top : '+pc.y+' height : '+eheight+' width : '+ewidth);
}