var search_string;

function checkDisclaimer(start)
{
	var start = start;
	var result = get_cookie('agree');
	
	if (result == 'yes')
	{	
		if (start == 'static')
		{
			history.back(-1);
			var newWindow = window.open('http://www.co.shasta.ca.us/html/GIS/static_maps.htm','_self');
			newWindow.focus();
		}
		else if (start == 'interactive')
		{
			history.back(-1);
			var newWindow = window.open('http://www.shastagis.co.shasta.ca.us/mapguide1','_blank');
			newWindow.focus();
		}
		else if (start == 'data')
		{
			history.back(-1);
			var newWindow = window.open('http://www.shastagis.co.shasta.ca.us/gissearch/search_new.aspx','_self');
			newWindow.focus();
		}
		else
		{
			return false;
		}
	}
	else
	{
		history.back(-1);
		var url = 'http://www.co.shasta.ca.us/html/GIS/gis_disclaimer.htm?start=' + start;
		var newWindow = window.open(url,'_self');
		newWindow.focus();
	}
}

//Set cookie routine
function set_cookie()
{
	var query = window.location.search.substring(1);
	var parms = query.split('=');
	var start = parms[1];
	
	var date = new Date();
	date.setTime(date.getTime()+(7*24*60*60*1000));
	var expires = "; expires="+date.toGMTString();
	
	document.cookie = 'agree=yes'+expires+'; path=/';
	
	if (start == 'static')
	{
		history.back(-1);
		var newWindow = window.open('http://www.co.shasta.ca.us/html/GIS/static_maps.htm','_self');
		newWindow.focus();
	}
	else if (start == 'interactive')
	{
		history.back(-1);
		var newWindow = window.open('http://www.shastagis.co.shasta.ca.us/mapguide1','_blank');
		newWindow.focus();
	}
	else if (start == 'data')
	{
		history.back(-1);
		var newWindow = window.open('http://www.shastagis.co.shasta.ca.us/gissearch/search_new.aspx','_self');
		newWindow.focus();
	}
	else
	{
		return false;
	}
}

//Get cookie routine
function get_cookie(Name)
{
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    // if cookie exists
    if (offset != -1) { 
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset);
      // set index of end of cookie value
      if (end == -1) end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}