/* Screen Size Fix */

/*var root = 'http://www.fmr.co.nz/';*/
var root = 'http://ruralfirenetwork.co.nz/';

if (window.screen){
  var w = screen.width;
	/* set css sheet for either above or below 1024x768 */
  css_800 = root + '/helpers/style800x600.css';
  css_1024 = root + '/helpers/style1024x768.css';
  if(w<835){
    document.write("<link rel='stylesheet' href='" + css_800 + "' type='text/css'>");
  }
  if(w>=835){
    document.write("<link rel='stylesheet' href='" + css_1024 + "' type='text/css'>");
  }
}

window.onload = function()
{
	fitToScreen();
}

window.onresizeend = function(){
	fitToScreen();
}

function fitToScreen(){
	var footer = document.getElementById('footer');
	var cw = document.getElementById('contentwrapper');
	var screenHeight = document.body.clientHeight;
	var links = document.getElementById('links');
	if((footer) && (cw))
	{
		var y = cw.offsetHeight + 96;
		if(y < screenHeight - 40){
			var q = (screenHeight - 140);
			links.style.height = q + "px";
			y = cw.offsetHeight + 95;
		}
		footer.style.top = y + 'px';
		footer.style.display = 'inline';
	}
}

function lowerBernie()
{
	setTimeout('lower();',500);
}

function lower()
{
	var bernie = document.getElementById('bernie');
	if(bernie)
	{
		bernie.style.zIndex = '80';
	}
}

function raiseBernie()
{
	setTimeout('raise();',1000);
}

function raise()
{
	var bernie = document.getElementById('bernie');
	if(bernie)
	{
		bernie.style.zIndex = '110';
	}
}
  
// TopMenu Link MouseOver Effects //
function linkOver(srcID){
	var cell = document.getElementById(srcID);
	cell.style.border = '1px solid black';
	cell.style.backgroundColor = '#cbcbcb';
	window.status = '';
	return(0);
}

function linkOut(srcID){
	var cell = document.getElementById(srcID);
	cell.style.border = '1px solid #eaeaea';
	cell.style.backgroundColor = '#eaeaea';
	window.status = '';
	return(0);
}

function leftMenuOver(srcID){
	var cell = document.getElementById(srcID);
	cell.style.border = '1px solid #caab00';
	cell.style.backgroundColor = '#fbd70f';
	window.status = '';
	return(0);
}

function leftMenuOut(srcID){
	var cell = document.getElementById(srcID);
	cell.style.border = '1px solid #ffe23f';
	cell.style.backgroundColor = '#ffe23f';
	window.status = '';
	return(0);
}



function openMap(){
	if(screen.availHeight < 600)
	{
		var map = window.open(root + 'ZoneMap.aspx','','directories=no,menubar=no,scrollbars=yes,titlebar=no,location=no,left=10px,top=10px,height=500px,width=560px,resizable=no,status=no,toolbar=no');
	}
	else
	{
		var map = window.open(root + 'ZoneMap.aspx','','directories=no,menubar=no,scrollbars=no,titlebar=no,location=no,left=10px,top=10px,height=590px,width=540px,resizable=no,status=no,toolbar=no');
	}
}

var currentDistrict = 'districtInfo';

function displayDistrictInfo(dstr){
	var top = false;
	if(screen.availHeight < 600)
	{
		top = true;	
	}
	var hide = document.getElementById(currentDistrict);
	hide.style.display = 'none'
	if(dstr)
	{
		currentDistrict = dstr;
	}
	else
	{
		currentDistrict = 'districtInfo';
	}
	var show = document.getElementById(currentDistrict);
	show.style.display = 'inline';
}
