/*
2010-07-19 BN [1] Functies t.b.v. Editortekst naar showmedia.js verplaatst
									OpenPopupWindow(link), MultimediaTonenWindow(id, titel, w, h) en ThumbnailTonenWindow(href, titel, w, h, taal) 
*/
function grijs(onoff) {
	if (onoff) {
		document.body.style.filter='progid:DXImageTransform.Microsoft.BasicImage(grayScale=1)';
	} else {
		document.body.style.filter='';
	}
}

function doemodalwindowVin(url,arg,mwidth,mheight) {
	if (document.all && window.print)
	{
		grijs(true);
		var res = window.showModalDialog(url,arg,'status:0;scroll:0;help:0;resizable:0;dialogWidth:'+mwidth+'px;dialogHeight:'+mheight+'px');
		grijs(false);
		return res;
	}
}	

function doemodalwindowVinResizable(url,arg,mwidth,mheight) {
	if (document.all && window.print) {
		grijs(true);
		var res = window.showModalDialog(url,arg,'status:0;scroll:0;help:0;resizable:1;dialogWidth:'+mwidth+'px;dialogHeight:'+mheight+'px');
		grijs(false);
		return res;
	}
}

function ShowModalVin(url,arg,w,h)  {	
	return doemodalwindowVin('/generiek/messages/MessageFrameVin.aspx?context='+escape(url),arg,w,h);
}

function ShowModalVinTitle(url,title,arg,w,h)  {	
	var frurl = '/generiek/messages/MessageFrameVin.aspx?context='+escape(url) + '&title=' + escape(title);
	return doemodalwindowVin(frurl,arg,w,h);
}

function ShowModalVinResizable(url,arg,w,h)  {	
	return doemodalwindowVinResizable('/generiek/messages/MessageFrameVin.aspx?context='+escape(url),arg,w,h);
}

function doemodalwindow(url,arg,mwidth,mheight){
	if (document.all&&window.print) {
		grijs(true);
		var res = window.showModalDialog(url,arg,'status:0;help:0;resizable:0;dialogWidth:'+mwidth+'px;dialogHeight:'+mheight+'px')
		grijs(false);
		return res;
	}
}	

function NewWindow(url,naam,width,height,scroll){
	var LeftPosition = event.x;
	var TopPosition = event.y + 150;
	settings='width='+width+',height='+height+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win=window.open(url,naam,settings);
}

function NewWindow2(url,naam,width,height,scroll){
	LeftPosition=(screen.width)?(screen.width-width)/2:100;
	TopPosition=(screen.height)?(screen.height-height)/2:100;
	settings='width='+width+',height='+height+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win=window.open(url,naam,settings);
}

function ShowModal(url,arg,w,h)  {	
	return doemodalwindow('/generiek/messages/MessageFrame.asp?context='+escape(url)+'&h='+h+'&w='+w,arg,w,h)
}

function MsgBox(s,aantalbuttons,titel,height,width)  {  // toon een modal window met 1 of 2 buttons 
	if (titel == null ) titel = '';
	if (height==null) height = 150;
	if (width==null) width = 300;
	
	s = doemodalwindow('/generiek/messages/confirm.asp?button='+aantalbuttons+'&txt='+s+'&titel='+titel,'',width,height); 
	if (s==undefined) s=false;
	return s;
}		 

function YesNo(melding,titel) {
	melding = '?txt=' + escape(melding);
	titel = '&titel=' + escape(titel);
	var s = '/generiek';
	if (typeof(siteUrl) != 'undefined') s = siteUrl;
	s += '/messages/yesno.asp'+melding+titel;
	var res = ShowModalVin(s,'',400,250); 
	if ((typeof(res)!='undefined') && (res!=null))
		return res;
	else
		return false;
}

function OKCheckbox(melding, titel) {
	melding = '?txt=' + escape(melding);
	titel = '&titel=' + escape(titel);
	var s = '/generiek';
	if (typeof(siteUrl) != 'undefined') s = siteUrl;
	s += '/messages/ok_checkbox.asp'+melding+titel;
//	alert(s);
	var res = ShowModalVin(s,'',400,250); 
	if ((typeof(res)!='undefined') && (res!=null))
		return res;
	else
		return false;
}

function TextBox(tekst,naam)  {	//toon een modal window om tekst te wijzigen

	if (naam==undefined) naam = '';
	var v = naam;
	var s = '/generiek';
	if (typeof(siteUrl) != 'undefined') s = siteUrl;
	s += '/messages/edit_text.asp?txt='+tekst+'&naam='+naam;
//	alert(s);
	naam = doemodalwindow(s ,'',300,150);	
	if (naam==undefined) naam=v;
	return naam;
}			

function ShowModalVin(url,arg,w,h)  {	
	return doemodalwindowVin('/generiek/messages/MessageFrameVin.aspx?context='+escape(url),arg,w,h)
}
		
function ShowModalVinResizable(url,arg,w,h)  {	
	return doemodalwindowVinResizable('/generiek/messages/MessageFrameVin.aspx?context='+escape(url),arg,w,h)
}
		
var vAnswer = ""
//er zijn drie soorten messagebox: confirm -> OK of Annuleren
																 //prompt  -> met inputveld
																 //alert   -> melding (alleen OK-button)		
function Message(soort,txt,waarde)  {   // soort is "c","p" of "a"
	switch (soort) {
		case "c":
			if (confirm(txt))  {
				return true;
			}
			else  {
				return false;
			}
			break;
		case "p":
			vAnswer = prompt(txt,waarde)
			if (vAnswer != undefined && vAnswer.length>0)  {
				return true;
			}
			else  {
				vAnswer = ""
				return false;
			}	
			break;
		case "a":
			alert(txt);
			return true;
			break;
		default:
			alert("De functie Message(soort,txt) wordt niet goed aangeroepen!")
			break;	
	}			
}	

function OpenBBG(link){
if (link.substr(0,3)=="pcn")
	{var url="http://www.fontys.nl/home/medewerker_popup.asp?"+link;}
else
	{var url="http://www.fontys.nl/home/medewerker_popup.asp?id="+link;}
	
	var window_settings='toolbar=no,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=500,height=225';
	var win=window.open(url,'link',window_settings);
}


var gDebugWindow = null;

function debug(msg) {
	if (arguments.length>1) {
		for(var i=1;i<arguments.length;i++)	
			msg += ' '+arguments[i];
	}
	if (gDebugWindow==null) openDebugWindow();
	var doc = null;
	try {
		doc = gDebugWindow.document;
	} catch(e) {
		openDebugWindow();	
		doc = gDebugWindow.document;
	}
	if (doc!=null) {
	/*
		var div = doc.all('debug');
		var obj = doc.createElement("DIV");
		obj.innerHTML = msg;
		div.insertBefore(obj);
		obj.scrollIntoView(false);
		*/
		doc.write(msg);
	}
}

function openDebugWindow() {
	gDebugWindow = window.open("about:blank","_debug"+document.body.uniqueID, "", "");
	//"height=600,width=400,menubar=no,status=no,toolbar=no,scroll=1,top=0,left=0","");
	gDebugWindow.document.title="DEBUG";
	gDebugWindow.document.body.style.margin = "2px 2px 2px 2px";
	gDebugWindow.document.body.innerHTML='<DIV id=debug style="font-family:verdana;font-size:x-small"></DIV>';
}


