/*   common javascript functions

	these functions are in 3 places:
	1. kl_sitetemplate1.php (for the main site)
	2. header_include (for the forums)
	3. tpl_header (for the store)
*/

var win = null;
function NewWindow(mypage,myname,w,h,center,scroll)
{
	// center, scroll are passed as 0/1. omitting them is the same as sending 0
	
	if (center == 1){
		LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
		TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	}else{
		LeftPosition = 40;
		TopPosition = 40;
	}
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable=0,status=0,location=0,directories=0';
	win = window.open(mypage,myname,settings);
}

function LaunchKLMediaPlayer(fileUrl,center)
{
	NewWindow(fileUrl,'KarmaLabMediaPlayer',958,633,center);
}

function LaunchPCAMediaPlayer(fileUrl,center)
{
	NewWindow(fileUrl,'PCAMediaPlayer',958,633,center);
}

function PolicyWindow(fileUrl,center)
{
	NewWindow(fileUrl,'Policies',560,600,center);
}

function FileUtilitiesWindow()
{
	NewWindow('/utils.html','FileUtilities',400,200,0);
}

function M3VGUIWindow()
{
	NewWindow('/m3/gui/m3vgui2.html','m3vgui',583,594,0);
}

function M50VGUIWindow()
{
	NewWindow('/m50/gui/m50vgui2-notyet.html','m50vgui',583,594,0);
}

function OASYSVGUIWindow()
{
	NewWindow('/oasys/gui/OASYS_Virtual_GUI2.html','oasysvgui',672,666,0);
}

function PaymentOptionsWindow()
{
	NewWindow('/Order/PaymentOptions_nt.html','PaymentOptions',580,400,0);
}

function RegisterSerialNumber(fileUrl)
{
	NewWindow(fileUrl,'RegisterSerialNumber',580,450,0);
}

function RegisterChallengeCode(fileUrl)
{
	NewWindow(fileUrl,'RegisterChallengeCode',786,570,0);
}

function RegisterChallengeCodeSmall(fileUrl)
{
	NewWindow(fileUrl,'RegisterChallengeCode',600,570,0);
}