﻿function makeDoubleDelegate(function1, function2)
{
    return function() {
        if (function1)
            function1();
        if (function2)
            function2();
    }
}



function Scaler()
{
	var MastheadHeight = parseInt(document.getElementById("PageMasthead").offsetHeight);
	var SubMastheadHeight = parseInt(document.getElementById("PageSubMasthead").offsetHeight);
	var NavigationHeight = parseInt(document.getElementById("Navigation").offsetHeight);
	var DocumentContentHeight = parseInt(document.getElementById("ContentRight").offsetHeight);
	var DocumentClientHeight = document.body.clientHeight;
	var DocumentScrollHeight = document.body.scrollHeight;
	
	if (DocumentClientHeight < DocumentScrollHeight){
		DocumentHeight = DocumentClientHeight
	}else{
		if (DocumentContentHeight < DocumentScrollHeight){
			DocumentHeight = DocumentClientHeight
		}else{
			DocumentHeight = DocumentScrollHeight
		}
	}
	
	if (document.all){
		WidthAmount = 191
		Subtractor = 0
	}else{
		WidthAmount = 192
		Subtractor = 300
	}
	if ((MastheadHeight + SubMastheadHeight + NavigationHeight) < DocumentHeight){
		document.getElementById("ContentLeftHeightScaler").style.height = DocumentHeight - MastheadHeight - SubMastheadHeight - NavigationHeight - 1;
		document.getElementById("SubMastheadRightWidthScaler").style.width = parseInt(document.getElementById("PageMasthead").offsetWidth) - WidthAmount;
		document.getElementById("MastheadRightWidthScaler").style.width = parseInt(document.getElementById("PageMasthead").offsetWidth) - WidthAmount;
	}
	if (!document.all){
		document.getElementById("ContentRight").style.width = document.getElementById("SubMastheadRightWidthScaler").width;
		document.getElementById("ContentRight").style.height = document.getElementById("ContentLeftHeightScaler").height - Subtractor;
	}	
}