function checkrefinput(f, fld)
{
	var val = parseInt(f[fld].value);
	if ( isNaN(val) || val == 0 ) f[fld].value = "";
}

function echo_str(str, url) {
	document.write('<a href="'+url+'" style="color:#000">' + str + '</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;')
}

var cursur_location = 0;

function ChangePic(index)
{
	cursur_location = index;
	gete('thumb').src = images[index].src;
	gete('thumb').width = images[index].width;
	gete('thumb').height = images[index].height;
}

function gete(id)
{
	return document.getElementById(id);
}

function FocusOpener()
{
	var o = window.opener;
	if (o && ! o.closed) {
		o.focus();
	}
}
function ReloadOpener()
{
	var o = window.opener;
	if (o && ! o.closed) {
		o.location.reload();
		o.focus();
	}
}


function openwindow(URL, WinName, width, height, external){

	if(height=='' || !height)
	height=screen.height/2
	height_factor = ((screen.height/100)*90)
	if(height>=height_factor)
	height=height_factor;

	if(width=='' || !width)
	width=screen.width/2
	width_factor = ((screen.width/100)*98)
	if(width>=width_factor)
	width=width_factor;

	var top=((screen.height-height)/2)-(screen.height/20);
	if(top<1) top=1;

	var left=(screen.width - width) / 2 ;
	if(left<1) left=1;

	win=window.open(URL, WinName, 'dependent=yes,toolbar=no,location=no,directories=no,status=0,menubar=no,scrollbars=1,resizable=no,copyhistory=no,width='+width+',height='+height+',top='+top+',left='+left+'');
	if(!external)
	{
		win.resizeTo(width, height);
		win.moveTo(left, top);
	}

	win.focus();

	return win;

}

