/****************************************************************************************************
program type:               Javascript include file
name: 			    popup.js
description:                this file contains the functions for creating and closing a popup window

copyright © 2004 by FIRMENPUNKT GmbH

client:                     -
documentation:              - 
date (dd/mm/yyyy):          07/10/2004
created by (with email):    fabian von derschatta <fvd@firmenpunkt.de>
last modified (dd/mm/yyyy): 12/10/2004
reason for modification:    problems with opening popup in opera => not solved!
modified by (with email):   fabian von derschatta <fvd@firmenpunkt.de>

function		|arguments          | return             |   description
------------------------------------------------------------------------------------------------------
ClosePopup      |-                  |-                   |   Closes the popup window
CreatePopup     |url, width, height | true or false      |   Creates a popup window

*****************************************************************************************************/


	var pop = null; // declare variable pop and set to null

	/**************************************************************************
	function:                   ClosePopup
	description:                Closes the open popup created with CreatePopup
	calling parameter:          -
	return:                     -
	templates used:             -
	date (dd/mm/yyyy):          07/10/2004
	created by:                 fabian von derschatta <fvd@firmenpunkt.de>
	last modified (dd/mm/yyyy): 
	reason of modification:     
	modified by:                
	**************************************************************************/
	function ClosePopup() {
		if (pop && !pop.closed) pop.close(); // if pop exists and not closed close the popup
	}
	
	/**************************************************************************
	function:                   CreatePopup
	description:                creates an popup window and load an url 
								within this popup
	calling parameter:          url, width, height
	return:                     true or false (true = continue without popup,
								false=continue with popup
	templates used:             -
	date (dd/mm/yyyy):          07/10/2004
	created by:                 fabian von derschatta <fvd@firmenpunkt.de>
	last modified (dd/mm/yyyy): 07/10/2004
	reason of modification:     insert comments
	modified by:                fabian von derschatta <fvd@firmenpunkt.de>
	**************************************************************************/	
	function CreatePopup(url,width,height) {
		if (!url) return true; //  If there is no URL  Return true and continue without popup
			
		if(width) width += 0; // if there exists a width add 20 pixels to the width
		else width = 500; // set width to 500 (standard width)

		if(height) height += 0; // if there exists a height add  25 pixels to the height
		else height = 400; // set height to 400 (standard height)
			
		// build argument string for window.open function
		var args = 'width='+width+',height='+height+',resizable=no,toolbar=no,status=no,location=no,menubar=no,scrollbars=no';
		
		ClosePopup(); // if there is already a popup open, close it
	
		pop = window.open(url,'win',args); // open the new popup windows

		if(pop) return false; //  if the creation of the popup was successful, return false => stop all other activities 
		else return true; // return true => continue without popup
	}