// JavaScript Document


// Defined values for calculating
var left_edge = 10;
var right_edge = 10;
var top_edge = 0;
var bottom_edge=8;

var x_spacing=12;
var y_spacing=8;

// Values for each part.
var clock_width = 120;
var clock_height = 120;

var weather_width = 120;
var weather_height = 60;

var today_width = 120;
var today_height = 180;

var links_width = 300;
var links_height=600;

var contact_width = 300;
var contact_height = 200;


var header_height = 94;
var footer_height = 34;

var right_side_header_height=43;
var right_side_footer_height=63;



// Initialize Stuff
window.onresize = MyResize;
window.onload = MyResize;




// Allow resize to happen only once per trigger.
var varResize = 0;
function MyResize() 
	{ 
		ReDraw();
		return;
	if(varResize ==0) 
		{
		varResize = 1;
		ReDraw();
		}
	else 
		{
		varResize = 0;
		}
alert ("RZ");	
	} 



/// Redraw the screen based on the new screen size.
/// Always start top-left absolute.

function ReDraw()
	{
	// Get the size
	 height= GetHeight();
	 width= GetWidth() - left_edge;
	
	// Display in title bar as a debug.  Do NOT use document.write as it nukes the existing document and all javascript that goes with it.
//	document.title=width+' x '+height;

	////////////////////////////////////
	// Let's set the 'main' div size.
	////////////////////////////////////
	
	main_width = width - links_width - y_spacing - left_edge;
	document.getElementById('main_div').style.width = main_width+'px';
	document.getElementById('logo').style.width = main_width+'px';
	

	
	////////////////////////////////////
	// Let's set the 'clock' 
	////////////////////////////////////

//	document.getElementById('my_clock').style.left = (width - today_width - y_spacing - clock_width)+'px';
//	document.getElementById('weather').style.left = (width - today_width - y_spacing - weather_width)+'px';
//	document.getElementById('today').style.left = (width - today_width)+'px';
//	document.getElementById('links').style.left = (width - links_width - y_spacing)+'px';
//	document.getElementById('contact').style.left = (width - contact_width)+'px';
//	return;

 
	}


 

 

////////////////////////////////////////////
// Library Functions 
////////////////////////////////////////////
// Get the height of the window
function GetHeight()
	{
	 var viewportheight;
	 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
	 if (typeof window.innerHeight != 'undefined')
		 {
		 viewportheight = window.innerHeight;
		 }
	// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
	 else if (typeof document.documentElement != 'undefined'
		 && typeof document.documentElement.clientHeight !=
		 'undefined' && document.documentElement.clientHeight != 0)
		 {
		 viewportheight = document.documentElement.clientHeight;
		 }
	 // older versions of IE
	 else
		 {
		   viewportheight = document.getElementsByTagName('body')[0].clientHeight;
		 }
		return(viewportheight);
	}
	
	
// Get the width of the window
function GetWidth()
	{
	 var viewportwidth;
	 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
	 if (typeof window.innerWidth != 'undefined')
		 {
		  viewportwidth = window.innerWidth;
		 }
	// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
	 else if (typeof document.documentElement != 'undefined'
		 && typeof document.documentElement.clientWidth !=
		 'undefined' && document.documentElement.clientWidth != 0)
		 {
		   viewportwidth = document.documentElement.clientWidth;
		 }
	 // older versions of IE
	 else
		 {
		   viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
		 }
	return(viewportwidth);
	}
	
 
	
//
// Make an iframe expand.
//


// declare iframe ids here:
var iframeids = ["main_iframe"]; // Can have multiple "x","y","z"
//Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide = "yes"

var getFFVersion = navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight = parseFloat(getFFVersion) >= 0.1 ? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

function resizeCaller() {
    var dyniframe = new Array()
    for (i = 0; i < iframeids.length; i++) {
        if (document.getElementById) resizeIframe(iframeids[i])
        //reveal iframe for lower end browsers? (see var above):
        if ((document.all || document.getElementById) && iframehide == "no") {
            var tempobj = document.all ? document.all[iframeids[i]] : document.getElementById(iframeids[i])
            tempobj.style.display = "block"
        }
    }
}

function resizeIframe(frameid) {
    var currentfr = document.getElementById(frameid)
    if (currentfr && !window.opera) {
        currentfr.style.display = "block"
        if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
        currentfr.height = currentfr.contentDocument.body.offsetHeight + FFextraHeight;
        else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
        currentfr.height = currentfr.Document.body.scrollHeight;
        if (currentfr.addEventListener) currentfr.addEventListener("load", readjustIframe, false)
        else if (currentfr.attachEvent) {
            currentfr.detachEvent("onload", readjustIframe) // Bug fix line
            currentfr.attachEvent("onload", readjustIframe)
        }
    }
}

function readjustIframe(loadevt) {
    var crossevt = (window.event) ? event : loadevt
    var iframeroot = (crossevt.currentTarget) ? crossevt.currentTarget : crossevt.srcElement
    if (iframeroot) resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url) {
    if (document.getElementById) document.getElementById(iframeid).src = url
}

if (window.addEventListener) window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent) window.attachEvent("onload", resizeCaller)
else window.onload = resizeCaller

// EOF - BRN


