function OpenWindow(sUrl, fitToSize)
{
	var settings;
	if(fitToSize==1)
		settings = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,titlebar=no,width=800,height=600,left=' + (screen.availWidth-800)/2 + ',top=' + (screen.availHeight-600)/2;
	else
		settings = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,titlebar=no,width='+(screen.availWidth-8)+',height='+(screen.availHeight-8)+',left=0,top=0';
	window.open(sUrl,'Preview',settings);
}

function OpenSlideWindow(sUrl, width, height)
{
	var settings;
	settings = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,titlebar=no,width=' + width + ',height=' + height + ',left=' + (screen.availWidth-width)/2 + ',top=' + (screen.availHeight-height)/2;
	window.open(sUrl,'SlidePreview',settings);
}

function OpenLearnWindow(sUrl, fullscreen)
{
	var settings;
	if(fullscreen==1) {
		settings = 'fullscreen=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no';
		sUrl = 'Learning.htm?' + sUrl;
	} else {
		settings = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,titlebar=no';
	}
	window.open(sUrl,'Learning',settings);
}

function OpenEditWindow(sUrl)
{
	var left, top, width, height;
	width = screen.availWidth-100;
	height = screen.availHeight-100;
	left = (screen.availWidth-width)/2;
	top = (screen.availHeight-height)/2;
	w = window.open(sUrl,'editElement','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=' + width + ',height=' + height + ',left=' + left + ',top=' + top);
	if(w)
		w.focus();
}

function OpenPositionWindow(sUrl, width, height)
{
	var left, top;
	left = (screen.availWidth-width)/2;
	top = (screen.availHeight-height)/2;
	w = window.open(sUrl,'setPostion','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=' + width + ',height=' + height + ',left=' + left + ',top=' + top);
	if(w)
		w.focus();
}

function OpenFixedSizeWindow(sUrl, name, width, height)
{
	var left, top;
	left = (screen.availWidth-width)/2;
	top = (screen.availHeight-height)/2;
	w = window.open(sUrl, name,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=' + width + ',height=' + height + ',left=' + left + ',top=' + top);
	if(w)
		w.focus();
}

function OpenResizableWindow(sUrl, name, width, height)
{
	var left, top;
	left = (screen.availWidth-width)/2;
	top = (screen.availHeight-height)/2;
	w = window.open(sUrl, name,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=' + width + ',height=' + height + ',left=' + left + ',top=' + top);
	if(w)
		w.focus();
}
function OpenFullScreenWindow(sUrl, name)
{
	var settings;
	settings = 'fullscreen=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no';
	window.open(sUrl,name,settings);
}

function OpenCustomWindow(sUrl, name, settings)
{
	window.open(sUrl,name,settings);
}

function OpenModalDialog(url, title, width, height)
{
	var oldcursor = document.body.style.cursor;
	document.body.style.cursor = "wait";
	
	url = "DialogHolder.htm?" + url;
	
	var params = new Array(2);
	params[0] = window;
	params[1] = title;
	
	if(window.event) {
		window.event.cancelBubble = true;
		window.event.returnValue = false;	
	}
	
	var refreshOpener = window.showModalDialog(url, params, "status:no; center:yes; help:no; minimize:no; maximize:no; scroll:no; border:thin; statusbar:no; dialogWidth:" + width + "px; dialogHeight:" + height + "px");
	if(refreshOpener)
		window.location.replace(window.location.href);		
		
	document.body.style.cursor = oldcursor;
}
