function custwindow(wname,loc,wx,wy,px,py,opt){

//THO-JANB MOD		
	redirectaction = 'viewDocument.do?document='

/*	Author: Sean Mollitt
	Custom version for THO - Uses var <redirectaction>

	wname = name for window (>>>> no spaces <<<<<)
	loc   = url OR string of html
	wx    = width of window
	wy    = height of window
	px    = position x
	py    = position y

	opt   = string of characters enables options for window
		r = enable resize on window
		c = center window
		s = enable scrollbar
		t = enable status bar
		v = dont use viewdocument.do
		no opts = use default window specs

	Examples:
	custwindow('PowerPoint','/education/AuCoeurDuDebat/397491/slides.ppt',640,480,0,0,'cst') <-- will use viewdocument
	custwindow('Text_Message','<p style="font-family:verdana;">This is some html text to open in a <b>window</b></p>',300,300,0,0,'cst')<-- <-- will NOT use viewdocument
	custwindow('/education/AuCoeurDuDebat/397491/slides.ppt') <-- this will work also AND use viewdocument
*/
	var scrol='no';var resiz=0;var cent=0;var stat=0;
	if(!px || !py){px=10;py=10}
	if(opt){
		if(opt.indexOf('r')!=-1){resiz=1}
		if(opt.indexOf('c')!=-1){cent=1}
		if(opt.indexOf('s')!=-1){scrol=1}
		if(opt.indexOf('t')!=-1){stat=1}
	}
	else{opt=''}

	if(cent){
		var ww=screen.availWidth
		var wh=screen.availHeight
		px = Math.round((ww/2)-(wx/2))
		py = Math.round((wh/2)-(wy/2))
	}

	if(!loc){loc=wname;wname='New_window'}
	var isfile=true
	if(loc.indexOf(' ')!=-1){isfile=false}
	if(loc.indexOf('<')!=-1 && loc.indexOf('>')!=-1){isfile=false}

	if(!wx || !wy){winwh=''}else{winwh='width='+wx+',height='+wy+','}

	windowstr = '"toolbar=no,'+winwh+'directories=no,status='+stat+',scrollbars='+scrol+',center='+cent+',resizable='+resiz+',menubar=no,screenX='+px+',screenY='+py+',left='+px+',top='+py+'"'
	if(wname=='New_window' || !opt || opt=='v'){windowstr=winwh.substring(0,winwh.length-1)}
	if(!wname){wname='New_window'}
	
	if(isfile){
		if(loc.indexOf(redirectaction)==-1 && opt.indexOf('v')==-1){loc=redirectaction+loc}
		eval(wname+'= window.open(loc,wname,windowstr)');
	}
	else{
		eval(wname+'= window.open("",wname,windowstr)');
		eval(wname+'.document.write(loc)')
		eval(wname+'.document.close()')
	}
	eval(wname+'.focus()')
}