
/*****************************   Adjust the styles   *****************************/

var heightFactor = 0;
var widthFactor = 0;
var contentHeightFactor;
var overflowTrue = false;

function dynamicLayout() {
    frameDim();

	contentHeight = document.getElementById("content").clientHeight;
	bodyHeight = document.body.clientHeight;
	offsetHeightContent = document.getElementById("content").offsetHeight;
			
	if (is_ie) {
		heightFactor = 50;
		widthFactor = 176;
		contentHeightFactor = 340;
		}
		
	if (is_fx) {
		heightFactor = 35;
		widthFactor = 178;
		contentHeightFactor = 360;
		}
		
	contentHeight = frameHeight - contentHeightFactor;

    /**************************   Adjust the styles in IE   **************************/
    if (document.all) {
        ssNum = document.styleSheets.length - 1;
		
        var topLeftHeight = "height:" + Math.floor(frameHeight - 10) + "px";
        var topRightWidth = "width:" + Math.floor(frameWidth - widthFactor) + "px";
        var footerTop = "top:" + Math.floor(frameHeight - heightFactor) + "px";
        var footerRightWidth = "width:" + Math.floor(frameWidth - widthFactor) + "px";
        var contentWidth = "width:" + Math.floor(frameWidth - 200) + "px";
        var contentStyleHeight = "height:" + Math.floor(contentHeight) + "px";       

        document.styleSheets[ssNum].addRule(".topLeft", topLeftHeight);
        document.styleSheets[ssNum].addRule(".topRight", topRightWidth);
        document.styleSheets[ssNum].addRule(".footerLeft",  footerTop);
        document.styleSheets[ssNum].addRule(".footerRight",  footerTop);
        document.styleSheets[ssNum].addRule("#content",  contentWidth);	
        document.styleSheets[ssNum].addRule("#content",  contentStyleHeight);	
        }
		
    /*********************************************************************************/ 
    /************************   Adjust the styles in FireFox   ***********************/
    if (is_fx || is_mac) { // taken from the browser sniffer I use

        SS = document.styleSheets.item(0)['cssRules'];
        var topLeftHeight = Math.floor(frameHeight - 10) + "px";
        var topRightWidth = Math.floor(frameWidth - widthFactor) + "px";
        var footerTop = Math.floor(frameHeight - heightFactor) + "px";
        //var footerRightWidth = Math.floor(frameWidth - widthFactor) + "px";
        var contentWidth = Math.floor(frameWidth - 200) + "px";
        var contentStyleHeight = Math.floor(contentHeight) + "px";

        for (i = 0; i < SS.length; i++) {
			if (SS.item(i).selectorText == ".topLeft") {
				//typeSize1 = Math.floor(frameWidth * .012) + "pt";
	        	SS.item(i).style.height = topLeftHeight;
				}
			
			if (SS.item(i).selectorText == ".topRight") {
	        	SS.item(i).style.width = topRightWidth;
				}

			if (SS.item(i).selectorText == ".footerLeft") {
				//typeSize2 = Math.floor(frameWidth * .009) + "pt";
	        	//SS.item(i).style.top = footerTop;
				}

            
            if (SS.item(i).selectorText == ".footerRight") {
                //SS.item(i).style.top = footerTop;
                //SS.item(i).style.width = footerRightWidth;
                }			
            
            if (SS.item(i).selectorText == "#content") {
                SS.item(i).style.width = contentWidth;
                SS.item(i).style.height = contentStyleHeight;
                
                }

    /*********************************************************************************/
            }
        }
    }

