
var screenWidth = screen.availWidth;
var screenHeight = screen.availHeight;
var halfScreenWidth = screenWidth / 2;
var halfScreenHeight = screenHeight / 2;
var width = 350;
var height = 150;

function popup(url, id) {


	var xPos = 0;
	if (screenWidth == null) {
		xPos = 50;
	} else if (width > screenWidth) {
		width = screenWidth - 20;
		xPos = 5;
	} else {
		xPos = halfScreenWidth - ( width / 2 );
	}

	var yPos = 0;
	if (screenHeight == null) {
		yPos = 50;
	} else if (height > screenHeight) {
		height = screenHeight - 40;
		yPos = 5;
	} else {
		yPos = halfScreenHeight - ( height / 2 );
	}

	var tempWin = window.open(url + id ,"Upload" , "width=" + width + " ,height=" + height + " ,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=yes,resizable=no,left=" + xPos + ",top=" + yPos);
	tempWin.focus();
}

function popupimage(url, id) {

 width = 176;
 height = 200;

	var xPos = 0;
	if (screenWidth == null) {
		xPos = 50;
	} else if (width > screenWidth) {
		width = screenWidth - 20;
		xPos = 5;
	} else {
		xPos = halfScreenWidth - ( width / 2 );
	}

	var yPos = 0;
	if (screenHeight == null) {
		yPos = 50;
	} else if (height > screenHeight) {
		height = screenHeight - 40;
		yPos = 5;
	} else {
		yPos = halfScreenHeight - ( height / 2 );
	}

	var tempWin = window.open(url + id ,"Upload" , "width=" + width + " ,height=" + height + " ,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=yes,resizable=no,left=" + xPos + ",top=" + yPos);
	tempWin.focus();
}

function checkKey(evt) {
    var keyCode;
    if (!evt) {evt=window.event;}
    if (evt.keyCode)
        keyCode=evt.keyCode
    else
        keyCode=evt.which;


  if ((keyCode < 48) || (keyCode > 57))
{
return false;
} else
{

return true;}

}

function popupRegion(url) {

 width = 400;
 height = 350;

	var xPos = 0;
	if (screenWidth == null) {
		xPos = 50;
	} else if (width > screenWidth) {
		width = screenWidth - 20;
		xPos = 5;
	} else {
		xPos = halfScreenWidth - ( width / 2 );
	}

	var yPos = 0;
	if (screenHeight == null) {
		yPos = 50;
	} else if (height > screenHeight) {
		height = screenHeight - 40;
		yPos = 5;
	} else {
		yPos = halfScreenHeight - ( height / 2 );
	}

	var tempWin = window.open(url ,"ECPAT" , "width=" + width + " ,height=" + height + " ,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=yes,resizable=no,left=" + xPos + ",top=" + yPos);
	tempWin.focus();
}