function template_printpage(page_id, popup_width) {
	var intWidth = parseInt(popup_width);
	var intHeight = 600;
	var intLeft = (screen.availWidth - intWidth - 10) / 2;
	var intTop  = (screen.availHeight - intHeight - 29) / 2;
	objWin = window.open("/includes/pages/module_print.asp?page_id=" + page_id, 'ViewPopup', 'left=' + intLeft + ',top=' + intTop + ',width=' + intWidth + ',height=' + intHeight + ',menubar=no,toolbar=no,location=no,status=yes,scrollbars=no,resizable=no');
}

function lightbox_maxwidth() {
	return document.documentElement.clientWidth;
}
function lightbox_maxheight() {
	return document.documentElement.clientHeight;
}
function lightbox_pictures()
{
	var elm_container = document.getElementById("t04_template_contentarea");
	if(elm_container) {
		var arr_elements = elm_container.getElementsByTagName("a");
		for(var i=0; i<arr_elements.length; i++){
			current_elm = arr_elements[i];
			current_rel = current_elm.getAttribute("rel");
			if(current_rel != null) {
				if(current_rel.indexOf("lightbox") == 0) {
					var this_id = current_elm.getAttribute("id");
					var this_img = "/includes/pages/module_gallery_getimg.asp?u=" + this_id + "&w=" + (lightbox_maxwidth()-200) + "&h=" + (lightbox_maxheight()-200)
					document.getElementById(this_id).href = this_img;
				}
			}
		}
	}
}

function getXMLHTTP() {
    var http_request = false;

    if  (window.XMLHttpRequest) { // Mozilla, Safari, IE7.0+  ...
        http_request = new XMLHttpRequest();
    }
    else if (window.ActiveXObject)  { // IE 6.0-
        try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                alert("Microsoft.XMLHTTP")
                http_request = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e) {
            }
        }
    }
    return http_request;
}
