// This documentation is proprietary and is protected international
// copyright laws and trade secret laws. Copyright 2001 (unpublished)
// V.O.F. 4Worx Software Innovations, Utrecht
// All rights reserved. No part of this documentation may be reproduced, 
// copied, adapted, modified, distributed, transferred, translated, disclosed,
// displayed or otherwise used by anyone in any form or by any means without
// the express written authorization of V.O.F. 4Worx Software Innovations
// (www.4worx.nl)
//
//
// Project      : 4Worx library
// Filename     : windows.js
// 
// Description  : Functions for creating new windows
//
// 11-06-2001, JVD: Initial release
//

// --/ Include files /---------------------------------------------------------


// --/ Function definitions /--------------------------------------------------

// show_error
// shows an error message in an new popup window
//
// PRE :  string a_error_msg
// POST:  string
//
function show_error(a_error_msg)
{
	if (document.layers)
	{
		var width = 450;	
	}
	else if (document.all)
	{
		var width = 466;
	}
	else
	{
		var width = 450;
	}
	var url = "/include/pages/error.php?error="+a_error_msg; 
	var features = "toolbar=no,location=no,menubar=no,resizable=yes,status=no,scrollbars=yes,width=" + width + ",height=250";
	this.window.open(url,'Error',features);
}

// viewpic
// opens a windows with a picture
//
// PRE:		string 	directory
//			string 	filename
//			int		widht
//			int		height
// POST:
//
function viewpic(dir, file, width, height) 
{
	var url = "/include/pages/Pictureviewer.php?path=" + dir + "&filename=" + file;
	var props = "height=" + (eval(height)) + ",width=" + (eval(width));
	var newWindow = window.open(url, "Pictureviewer", props);
}

// ask_confirmation
// creates a confirm box with 'ok' and 'cancel'
//
// PRE:		string question
// POST:
//
function ask_confirmation(question) 
{
    return confirm(question);
}

//viewurl
//opens an window with an url
//PRE:	string url
//POST:
function viewurl(url)
{
	var newWindow = window.open(url, "Urlviewer", "");
}

//open_window
//opens a window with an url, title, width and height
//PRE:	string url
//		string title
//		int	width
//		int height
//POST:
function open_window(url, title, width, height)
{
	var top = (screen.availHeight - height)/2;
	var left = (screen.availWidth - width)/2;
	var features = "top=" + top + ",left=" + left + ",toolbar=no,location=no,menubar=no,resizable=yes,status=no,scrollbars=yes,width=" + width + ",height=" + height + "";
	this.window.open(url,title,features);
}

function openWindow(url, title, width, height)
{
	var top = 0;
	var left = 0;
	var features = "top=" + top + ",left=" + left + ",resizable=yes,status=no,scrollbars=yes,width=" + width + ",height=" + height + "";
	window.open(url,title,features);
}


// --/ End of file /-----------------------------------------------------------

