function OpenDialog(frm, name, opts) {
	if(opts != void(0) && opts != null) {
		DIALOG = window.open(frm, name, 'width=1, height=1, status=0, ' + opts);
	}
	else {
		DIALOG = window.open(frm, name, 'width=1, height=1, status=0');
	}
	
	if(DIALOG == null) {
		alert('Your browser appears to be blocking pop-up windows!');
	}
}

function ToggleOptions(ctrl, target) {
	var table = document.getElementById(target);
	if(table.style.display != 'none') {
		table.style.display = 'none';
	}
	else {
		table.style.display = 'block';
	}
	
	if(ctrl.innerHTML == '- Options') {
		ctrl.innerHTML = '+ Options';
	}
	else {
		ctrl.innerHTML = '- Options';
	}
}

function CenterDialog(dlg, dlgWidth, dlgHeight) {
	var leftOffset, topOffset;

	try {
		if(navigator.appMinorVersion.indexOf('SP2') > 0) {
			dlg.resizeTo(dlgWidth, dlgHeight + 25);
		}
		else {
			dlg.resizeTo(dlgWidth, dlgHeight);
		}
		
		leftOffset = (screen.width / 2) - (dlgWidth / 2);
		topOffset = (screen.height / 2) - (dlgHeight / 2);
	
		dlg.moveTo(leftOffset, topOffset);
	}
	catch (e) {
	}	
}

function GetPrintVersion(postBack) {
	var url = location.href;
	if(url.substring(url.length - 1, url.length) == "#") {
		url = url.substring(0, url.length - 1);
	}
	
	if(url.indexOf('?') < 0) {
		url += "?print=true";
	}
	else {
		url += "&print=true";
	}
	
	OpenDialog(url, "PRINT", 'menubar=yes, scrollbars=yes');
	CenterDialog(DIALOG, 640, 480);
}