// JavaScript for Joy Voice template

	function setMeasurement() {

		var browserName=navigator.appName;

		if ( browserName=="Microsoft Internet Explorer" ) { // check for the browser type, IE browser or non-IE browsers
			if (screen.width == 1280) {
				document.getElementById('container').style.left = 30 + '%';
			} else if (screen.width == 1024) {
				document.getElementById('container').style.left = 15 + '%';
			} else {
				document.getElementById('container').style.left = 0 + 'px';
			}
		} else {
			if (window.innerWidth == 1280) {
				document.getElementById('container').style.left = 30 + '%';
			} else if (window.innerWidth == 1024) {
				document.getElementById('container').style.left = 15 + '%';
			} else {
				document.getElementById('container').style.left = 0 + 'px';
			}
		}

// left column settings
		var leftComponentContentHeight = document.getElementById('left_component_content').offsetHeight;
		var demoPanelHeight = document.getElementById('demo_content').offsetHeight - 35;
		var contactUsContentHeight = document.getElementById('contact_us_content').offsetHeight - 3;
		var borderHeight = demoPanelHeight;
		var contactUsBorderHeight = contactUsContentHeight;

		if(leftComponentContentHeight < 15) {
			document.getElementById('left_component').style.visibility = 'hidden';
			leftComponentContentHeight = -15;
		}
		
		if(demoPanelHeight < 15) {
			document.getElementById('demo_panel').style.visibility = 'hidden';
			demoPanelHeight = -35;
			borderHeight = 0;
		}
		
		if(contactUsContentHeight < 15) {
			document.getElementById('contact_us_panel').style.visibility = 'hidden';
			contactUsContentHeight = -35;
			contactUsBorderHeight = 0;
		}

		document.getElementById('demo_panel_footer').style.top = demoPanelHeight + 24 + 'px';
		document.getElementById('border_left').style.height = borderHeight + 5 + 'px';
		document.getElementById('border_right').style.height = borderHeight + 12 + 'px';
		document.getElementById('contact_us_panel').style.top = demoPanelHeight + 24 + 5 + 'px';
		document.getElementById('contact_us_panel_footer').style.top = contactUsContentHeight + 24 + 2 + 'px';
		document.getElementById('contact_us_border_left').style.height = contactUsBorderHeight - 3 + 'px';
		document.getElementById('contact_us_border_right').style.height = contactUsBorderHeight + 7 + 'px';
		document.getElementById('left_col').style.top = leftComponentContentHeight + 243 + 29 + 'px';
		document.getElementById('left_col').style.height = demoPanelHeight + 24 + contactUsContentHeight + 24 + 40 - 10 + 'px';
		document.getElementById('left_col_footer').style.top = demoPanelHeight + 24 + contactUsContentHeight + 24 + 25 - 10 + 'px';

// main column settings

// right column settings
		var rightColHeight = document.getElementById('right_col_content').offsetHeight;

// misc settings		

// look for the tallest column
		var leftColHeight = leftComponentContentHeight + 19 + demoPanelHeight + 24 + contactUsContentHeight + 24;
		var mainColHeight = document.getElementById('main_content').offsetHeight;
//		var rightColHeight = document.getElementById('right_col_content').offsetHeight;
		
		var newHeight = Math.max(leftColHeight, rightColHeight);
		newHeight = Math.max(newHeight, mainColHeight);

		if(leftColHeight == newHeight) {

		}
		
		if(mainColHeight == newHeight) {
			
		}
		
		if(rightColHeight == newHeight) {
			
		}

		document.getElementById('background_color').style.height = newHeight + 243 + 29 + 30 + 30 + 'px';
		document.getElementById('container').style.height = newHeight + 50 + 243 + 29 + 30 + 'px';
		document.getElementById('footer').style.top = newHeight + 243 + 50 + 29 + 30 + 'px';

	}
		
	window.onload = function() {
		setMeasurement();
	}
	
	window.onresize = function() {
		location.reload();
	}