// ********************************************************************************
// ********************************************************************************
// ***
// ***    Functions that can be used in every page that uses the pageTemplate 
// ***
// ********************************************************************************
// ********************************************************************************

// ==================
// = openNewWindow
// ==================
// will open a new Window
// use the string values 'yes'/'no' for the parameters scrollbars and resizable
// ==================

function openNewWindow(url,w,h,windowName,scrollbars,resizable) {
	var features="resizable="+resizable+", scrollbars="+scrollbars+", left="+(screen.width-w)/2+", top="+(screen.height-h)/2+", width="+w+", height="+h;
	var newWindow = window.open(url,windowName, features);

	var str= "<BODY CLASS='template'><TABLE WIDTH=100% HEIGHT=100%><TR><TD WIDTH=100% HEIGHT=100% align=center valign=middle>Loading <B>...</B></TD></TR></TABLE></BODY>"
	var showDocument = newWindow.document
	showDocument.open("text/html","replace")
	showDocument.write(str)
	showDocument.close()
	return newWindow
}

// ==================
// = shows a foto
// ==================
// will open a foto in a new window
// ==================


function showPhoto(url) {
                    var foto = new Image();
                    foto.src = url
                    var w = foto.width+20;
                    var h = foto.height+24;
                    var useRealSize=true;
                    if (w < 21 | h < 25) {
                        w = 850;
                        h = 650;
                        useRealSize = false;
                    }
                    var features="resizable=yes, left="+(screen.width-w)/2+", top="+(screen.height-h)/2+", width="+w+", height="+h;
                    if (useRealSize) features += ", scrollbars=no";
                    else features += ", scrollbars=yes";
                    var newWindow = window.open(url,"_blank", features);
}
