
function createNamedWindow(page, name, w, h){
	remote=window.open(page,name,'width='+w+',height='+h+',screenX=50,screenY=50,top=50,left=50,scrollbars=1,toolbar=0,directories=0,status=0,menubar=0,resizable=1'); 	
	remote.focus();
	remote.opener = self;
}

function refreshParentWindow(status) {
	var dt = new Date();
	var dts = dt.getTime();
	var href = opener.location.href;
	var hash = "";
	
	// pull out the hash
	if (href.indexOf('#') != -1) {
		hash = href.substr(href.indexOf('#'));
		href = href.substr(0, href.indexOf('#'));
	}
	
	//check if the default document
	if (href.indexOf('.asp') == -1)
		href = href+'default.asp';
	
	//remove the status param
	if (href.indexOf('status=') != -1) {
		// check for additional params or anchor hash
		if (href.indexOf('&', href.indexOf('status=')) != -1)
			href = href.substr(0, href.indexOf('status=')) + href.substr(href.indexOf('&', href.indexOf('status='))+1);
		else
			href = href.substr(0, href.indexOf('status=')-1);
	}
	
	//add in the status
	if (status != '')
		if (href.indexOf('?') != -1)
			href = href + '&status=' + status;
		else
			href = href + '?status=' + status;
	
	//remove the dts param
	if (href.indexOf('dts=') != -1) {
		// check for additional params or anchor hash
		if (href.indexOf('&', href.indexOf('dts=')) != -1)
			href = href.substr(0, href.indexOf('dts=')) + href.substr(href.indexOf('&', href.indexOf('dts='))+1);
		else
			href = href.substr(0, href.indexOf('dts=')-1)
	}
	
	//add in the date time string
	if (href.indexOf('?') != -1)
		href = href + '&dts=' + dts;
	else
		href = href + '?dts=' + dts;
	
	opener.location.href = href + hash;
}

function closeWindow(status){
	window.close();
	refreshParentWindow(status);
	opener.focus();
}

function printCheck() {
	if (window.print)
		window.print();
	else
		alert('Your browser does not support automatic printing. Please select Print from the File Menu.');
	return void(0);
}

function confirmAction(text, href) {
	if (confirm(text))
		document.location.href=href;
}