function HandleEndSession(sonum)
{
	alert(sonum);
	document.location = "index.php?id=10&logout=1";
}

function changeMenuPicture(img_id,rollover_img)
{
	document.getElementById(img_id).src=rollover_img;
}

function flashPopup(url,width,height)
{	
	top_n = (screen.height/2 - height/2);
	left_n = (screen.width/2 - width/2);
	newwindow = window.open(url,'datasheetPopup','height='+height+',width='+width+', left='+left_n+',top='+top_n+',scrollbars=1');	
	if (window.focus) 
	{
			newwindow.focus()
	}
	return false;
}

function infoPopup(msg,width,height)
{	
	newwindow = window.open('','infoPopup','height='+height+',width='+width+', left=10,top=10,scrollbars=1');	
	if (window.focus) 
	{
			newwindow.focus()
	}
	var tmp = newwindow.document;
	tmp.write("<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8' /><title>Info</title></head><body style='font-family:arial;font-size:11px;line-height:22x'>"+msg+"</body></html>")
	//tmp.write(msg)
	return false;
}

function datasheetPopup(url,width,height)
{	
	newwindow = window.open(url,'datasheetPopup','height='+height+',width='+width+', left=10,top=10,scrollbars=1');	
	if (window.focus) 
	{
			newwindow.focus()
	}
	return false;
}

function openNewWindow(url)
{
	if (url)
	{
		popupWin = window.open(url, 'newPopupWindow', '');
		popupWin.focus();
	}
}

function openGalleryInPopup(url, width, height)
{
	top_n = (screen.height/2 - height/2);
	left_n = (screen.width/2 - width/2);
	top_n = 50;
	height = height+20;
	popupWin = window.open(url, 'galleryInPopup', 'scrollbars=0,width='+width+',height='+height+', left='+left_n+',top='+top_n);
	popupWin.focus();
}

function giveFeedback(url)
{
  feedbackWin = window.open(url, 'feedbackWin', 'left=200;top=100,scrollbars=1,width=560,height=400');
	feedbackWin.focus();
}
function prindi(url) {
	popupWin = window.open(url, 'popup', 'top=20,scrollbars=1,width=560,height=600')		
	popupWin.focus();
}

function printPage(url,width,height) 
{
	top_n = (screen.height/2 - height/2);
	left_n = (screen.width/2 - width/2);
	top_n = 50;
	height = height+20;
	popupWin = window.open(url, 'popup', 'left='+left_n+',top='+top_n+',scrollbars=1,width='+width+',height='+height)		
	popupWin.focus();
}

function printPageArctic(url,width,height) {
	popupWin = window.open(url, 'popup', 'top=20,scrollbars=1,width='+width+',height='+height)		
	popupWin.focus();
}

function sendToFriend(url, width, height) 
{
	left = (screen.width / 2 - width / 2);
	popupWin = window.open(url, 'sendToFriend', 'left='+left+',top=200,scrollbars=1,width='+width+',height='+height)	
	popupWin.focus();
}

var w;
function openImagePopup(img, height, width) 
{
	if (w) 
	{
		w.close();
	}
	top_n = (screen.height/2 - height/2);
	left_n = (screen.width/2 - width/2);
	w = window.open ('', "win", "height="+height+",width="+width+"location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0,left="+left_n+",top="+top_n);
	w.document.write('<html><head><title></title></head><body topmargin="0" leftmargin="0">');
	w.document.write('<a href="javascript:self.close();"><img src="'+img+'" border=0></a>');
	w.document.write('</body></html>');
	w.focus();
}

function confirmAction(str) {
	if (confirm(str)) {
		return true;
	}
	return false;
}

function setActiveStyle(myStyle, activeStyleID)
{		
	setActiveStyleSheet(myStyle, 1);		
	document.getElementById(activeStyleID).src = 'index.php?activeStyle='+myStyle;
}

function popupImage(popup_id, file, url, width, height, left, top) {
	var w = window.open ('', "winPicture_"+popup_id, "height="+height+",width="+width+"location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0,left="+left+",top="+top);
	target="";
	onclick="";
	if (url=="") {
		url = "#";
	}
	else {
		target = " target=\"_blank\"";
		onclick="self.close()";
	}
	w.document.write('<html><head><title></title></head><body topmargin="0" leftmargin="0">');	
	w.document.write('<a href="'+url+'" onclick="'+onclick+'" '+target+'><img src="'+file+'" border=0></a>');
	w.document.write('</body></html>');
	w.focus();	
}

function popupFlash(popup_id, file, url, width, height, left, top) {	
	var w = window.open ('', "winFlash_"+popup_id, "height="+height+",width="+width+"location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0,left="+left+",top="+top);
	w.document.write('<html><head><title></title></head><body topmargin="0" leftmargin="0">');	
	w.document.write('<object><embed src="'+file+'" width="'+width+'" height="'+height+'"></embed></object>');
	w.document.write('</body></html>');	
	w.focus();
}

function popupCalendar(field, form) {
	var w = window.open ('popupCalendar.php?form='+form+'&field='+field, "calendar", "width=193,height=184,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0");
	w.focus();
}

function popupCourseSearch(page_id) {
	var aken = window.open('?id='+page_id+'&windowType=popup','','width=400,height=400,location=0,menubar=0,resizable=0,scrollbars=1,status=1,toolbar=0');
	aken.focus();
}
function popupTeacherSearch(page_id) {
	var aken = window.open('?id='+page_id+'&windowType=popup','','width=400,height=400,location=0,menubar=0,resizable=0,scrollbars=1,status=1,toolbar=0');
	aken.focus();
}
function popupCompetitionUserSearch(page_id) {
	var aken = window.open('?id='+page_id+'&windowType=popup','','width=400,height=400,location=0,menubar=0,resizable=0,scrollbars=1,status=1,toolbar=0');
	aken.focus();
}

function popupManorMap(url) {
	width = 571
	height = 450
	var w = window.open (url, "manor_map", "width="+width+",height="+height+",left=100,top=60,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0");
	w.focus();
}


function popupProgramme(page_id, programme_id, course_id, action) {
	var aken = window.open('?id='+page_id+'&windowType=popup&course_id='+course_id+'&programme_id='+programme_id+'&action='+action,'','left=50,top=84,width=420,height=240,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0');
	aken.focus(); 
}

function popupScheduleItem(page_id, item_id, schedule_id, action) {
	var aken = window.open('?id='+page_id+'&windowType=popup&item_id='+item_id+'&schedule_id='+schedule_id+'&action='+action,'','left=50,top=84,width=420,height=440,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0');
	aken.focus(); 
}

function popup(url) {
  var aken = window.open(url,'','width=400,height=400,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0');
	aken.focus();
}

function List_resetFilter(page_id, windowTypeStr) 
{
	url = '?id='+page_id+'&reset_filter=1&windowType='+windowTypeStr;	
  document.location = url;
} 

function List_changeClass(rida, klass) {
	rida.className=klass;
}
function List_changeClass2(rida, klass) {
	if (rida.className=='list_selected_row') {
	}
	else {
	  rida.className=klass;
	}
}