var printWin;
var disclaimerWin;
var mapWin;

function closePrintWin()
{
	if(printWin)
	{
		$('dummyContent').parentNode.removeChild($('dummyContent'));
		createCSS('#print_logo','display: none','screen');
		createCSS('#print_url','display: none','screen');
		createCSS('#print_content','width: 100%','screen');
		createCSS('#gototop','display: block','screen');
		printWin.destroy();
	}
}

function openPrintWin(element_id,width,height)
{
	// Print the page first if IE
	if(document.all)
	{
		window.print();
	}

	// Setting defaults
	//var width	= ( !width ? parseInt(getStyle($(element_id),'width')) + 50 : width );
	var width	= 735;
	var height	= ( !height ? parseInt(getStyle($(element_id),'height')) + 200 : height );
	

	// Insert dummy content height to avoid the footer getting dragged upwards
	if(document.all) // if IE
	{
		//var width	= $(element_id).offsetWidth;
		var height	= $(element_id).offsetHeight + 120;
		if(navigator.appVersion.indexOf("6.0") != -1) // if IE 6.0
		{
			var footerH	= $(element_id).offsetHeight + 43;
		}
		else
		{
			var footerH	= $(element_id).offsetHeight + 23;
		}
	}
	else
	{
		var footerH	= $(element_id).offsetHeight + 46;	
	}
	var arrCol	= getElementsByClassName('column_middle');
	arrCol[0].innerHTML += '<div id="dummyContent" style="height: '+ footerH +'px; background-color: #FFFFFF;"></div>';

	// Open win
	printWin = new Window({
						className: "printwin",
						zIndex: 2000,
						maximizable: false,
						resizable: false,
						draggable: false,
						hideEffect: Element.hide,
						showEffect: Element.show,
						minWidth: width,
						minHeight: height,
						destroyOnClose: true});
	printWin.setContent(element_id,false,true);
	printWin.show();
	//printWin.showCenter(false,50);
	printWin.setCloseCallback(closePrintWin);
	printWin.setDestroyOnClose();

	// Resize height
	if(!height) // IE return NaN
	{
		var arr_size	= printWin.getSize();
		printWin.setSize(arr_size['width'],arr_size['height'] + 200);
	}

	// Show misc. content in new win
	createCSS('#print_logo','display: block','screen');
	createCSS('#print_url','display: block','screen');
	createCSS('#print_content','width: 425px','screen');
	createCSS('#gototop','display: none','all');

	// Print the page last if anything else but IE
	if(!document.all)
	{
		window.print();
	}
}

function openDisclaimerWin(urlDisclamer)
{
	// If firefox on mac, we use a more basic approach because of an bug in FF mac
	if(navigator.platform.indexOf("Mac") != -1 && navigator.userAgent.indexOf("Firefox") != -1)
	{
		$('disclaimer').style.display	= 'block';
	}
	else
	{
		disclaimerWin = new Window({
							className: "disclaimerwin",
							maximizable: false,
							resizable: false,
							draggable: true,
							hideEffect: Element.hide,
							showEffect: Element.show,
							minWidth: 870,
							minHeight: 392,
							destroyOnClose: true });
		disclaimerWin.setURL(urlDisclamer);
		disclaimerWin.setZIndex(800000);
		disclaimerWin.showCenter(false,50);
		disclaimerWin.setDestroyOnClose();
		disclaimerWin.show();
	} // END__ all other browsers
}

function closeDisclaimerWin()
{
	$('disclaimer').style.display	= 'none';
}

function openMapWin(urlDisclamer)
{
	if(document.all)
	{
		mapWin = new Window({
							className: "mapwin",
							maximizable: false,
							resizable: false,
							draggable: true,
							hideEffect: Element.hide,
							showEffect: Element.show,
							minWidth: 921,
							minHeight: 400,
							maxHeight: 400,
							destroyOnClose: true });
		mapWin.setURL(urlDisclamer);
		mapWin.setZIndex(800000);
		mapWin.showCenter(false,65);
		mapWin.setDestroyOnClose();
		mapWin.show();
		mapWin.updateHeight();
	}
	else
	{
		$('iframeMap').src	= urlDisclamer;
		$('map').style.display	= 'block';
		window.scrollTo(0,1);
	}
/*
	// If firefox OR mac, we use a more basic approach because of an bug in FF mac
	if(navigator.platform.indexOf("Mac") != -1 || navigator.userAgent.indexOf("Firefox") != -1)
	{
		$('map').style.display	= 'block';
		$('iframeMap').src	= urlDisclamer;
	}
	else
	{
		mapWin = new Window({
							className: "mapwin",
							maximizable: false,
							resizable: false,
							draggable: true,
							hideEffect: Element.hide,
							showEffect: Element.show,
							minWidth: 921,
							minHeight: 400,
							maxHeight: 400,
							destroyOnClose: true });
		mapWin.setURL(urlDisclamer);
		mapWin.setZIndex(800000);
		mapWin.showCenter(false,50);
		mapWin.setDestroyOnClose();
		mapWin.show();
		mapWin.updateHeight();

	} // END__ all other browsers
*/
}

function closeMapWin()
{
	if(mapWin)
	{
		mapWin.destroy();
	}
	$('map').style.display	= 'none';
}