<!-- Begin
function toggle_hwy() {
  // determine the browser type
  isNS4 = (document.layers) ? true : false;
  isIE4 = (document.all && !document.getElementById) ? true : false;
  isIE5 = (document.all && document.getElementById) ? true : false;
  isNS6 = (!document.all && document.getElementById) ? true : false;
  // assign elements to variables based on browser type
  if (isNS6) {
    img_hwy = document.getElementById("img_hwy");
    img_chk = document.getElementById("img_chk");
  }
  // initialization
  if (img_hwy.style.visibility == "") {
    img_hwy.style.visibility="visible";
  } 
  // toggle to visible
  if (img_hwy.style.visibility == "hidden") {
    img_hwy.style.visibility="visible";
    img_chk.style.visibility="visible";
    return true;
  }
  // toggle to hidden
  if (img_hwy.style.visibility == "visible"  ) {
    img_hwy.style.visibility = "hidden";
    img_chk.style.visibility = "hidden";
    return true;
  } 
  return true;
}

function toggle_hwy_img(elem,folder,hwy,prov,lang) {
  var img = document.getElementById("prov-image");
  img.src = (hwy) ? folder+prov+"_nohwy_"+lang+".gif" : folder+prov+"_hwy_"+lang+".gif";
  hwy = (hwy) ? false : true;
  elem.onclick = function() {toggle_hwy_img(this,folder,hwy,prov,lang);};
}

function get_province_map(id) {
  var form = document.forms['frmNewDate'];
  var timeframe = form.elements['timeframe'].value;
  var page = ( window.location.pathname.match('_e') ) ? '_e.html' : '_f.html';
  var Year = form.elements['Year'].value;
  var Month = form.elements['Month'].value;
  var Day = form.elements['Day'].value;
  var queryString = '?timeframe='+timeframe+'&Prov='+id+'&Year='+Year+'&Month='+Month+'&Day='+Day;

  window.location = 'http://'+window.location.host+'/climateData/menu'+page+queryString;
  
  return false;
}

function form_submission(id) {
  var form = document.forms['frmNewDate'];
  var timeframe = form.elements['timeframe'].value;
  var chartTypes = ['canada', 'hourlydata', 'dailydata', 'monthlydata', 'almanac'];
  var extension = ( window.location.pathname.match('_e') ) ? '_e.html' : '_f.html';
  var Year = form.elements['Year'].value;
  var Month = form.elements['Month'].value;
  var Day = form.elements['Day'].value;
  var queryString = '?timeframe='+timeframe+'&Prov=XX&StationID='+id+'&Year='+Year+'&Month='+Month+'&Day='+Day;

  window.location = 'http://'+window.location.host+'/climateData/'+chartTypes[timeframe]+extension+queryString;
  // form.elements['StationID'].value = id;
  // form.submit();
}

function form_submissions(id) {
	var form = document.forms['frmNewDate'];
	var timeframe = form.elements['timeframe'].value;
	var chartTypes = ['canada', 'hourlydata', 'dailydata', 'monthlydata', 'almanac', 'StationResults'];
	var extension = (window.location.pathname.match('_e')) ? '_e.html' : '_f.html';
	var Year = form.elements['Year'].value;
	var Month = form.elements['Month'].value;
	var Day = form.elements['Day'].value;
	var queryString = '?timeframe='+timeframe+'&Prov=XX&StationID='+id+'&Year='+Year+'&Month='+Month+'&Day='+Day;
	
	//if (id == 6157 && (timeframe == 2 || timeframe == 3 || timeframe == 4)) {
	//	window.location = 'http://'+window.location.host+'/climateData/'+chartTypes[timeframe]+extension+queryString;
	//} else if ((id == 47707 || id == 631) && timeframe == 3) {
	//	window.location = 'http://'+window.location.host+'/climateData/'+chartTypes[timeframe]+extension+queryString;
	//} else {
		window.location = 'http://'+window.location.host+'/climateData/'+chartTypes[5]+extension+queryString;
	//}
}

function target_window(page_name) {
  window.open(page_name, "", "height=386, width=449, toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,status=no");
}
// End -->

