// kas funktsioon eksisteerib või ei
function isFunctionExists(myFunc) {
	if (window.a&&(typeof window.a==myFunc)) {
		return true;
	} 
	return false;
}

function prindi(url) {
	popupWin = window.open(url, 'popup', 'scrollbars=1,width=460,height=600')		
}

function openImagePopup(img, height, width) {
	var w = window.open ('', "win", "height="+height+",width="+width+"location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0,left=100");
	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>');	
}

function confirmAction(str) {
	if (confirm(str)) {
		return true;
	}
	return false;
}

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 popupGroupAddCourseToSemester(page_id,group_id,course_id,curriculum_id,action) {
	var aken = window.open('?id='+page_id+'&windowType=popup&group_id='+group_id+'&action='+action+'&course_id='+course_id+'&curriculum_id='+curriculum_id,'','left=50,top=84,width=420,height=240,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0');
	aken.focus();
}



function popupGroupAddCourse(page_id, group_id, action) {
	var aken = window.open('?id='+page_id+'&windowType=popup&group_id='+group_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 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, timetable_course_id) {
	var aken = window.open('?id='+page_id+'&windowType=popup&item_id='+item_id+'&schedule_id='+schedule_id+'&timetable_course_id='+timetable_course_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) {
  document.location = '?id='+page_id+'&reset_filter=1';
} 

function List_changeClass(rida, klass) {
	rida.className=klass;
}
function List_changeClass2(rida, klass) {
	if (rida.className=='list_selected_row') {
	}
	else {
	  rida.className=klass;
	}
}
