$.fn.maphilight.defaults = {
	fill: true,
	fillColor: 'ee3024',
	fillOpacity: 1,
	stroke: true,
	strokeColor: '000000',
	strokeOpacity: 1,
	strokeWidth: 1,
	fade: true,
	alwaysOn: false
}
$(function() {
	$('.map').maphilight();
});

function setCookie(c_name,value,expiredays) {
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+	((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function getCookie(c_name) {
	if (document.cookie.length>0) {
  	c_start=document.cookie.indexOf(c_name + "=");
  	if (c_start!=-1) {
	    c_start=c_start + c_name.length+1;
	    c_end=document.cookie.indexOf(";",c_start);
	    if (c_end==-1) c_end=document.cookie.length;
	    return unescape(document.cookie.substring(c_start,c_end));
  	}
	}
	return "";
}
if (getCookie('industry')=='') {
	setCookie('industry','button_re',1);
}

function button_change(curr_button) {
	var date = new Date();
	var expires = date.getTime()+(7*24*60*60*1000);
	setCookie('industry',curr_button,1);

	if (curr_button!='button_re') {
		document.getElementById('button_re').src='/img/button_real_estate.gif';
	}
	if (curr_button!='button_nh') {
		document.getElementById('button_nh').src='/img/button_new_homes.gif';
	}
	if (curr_button!='button_a') {
		document.getElementById('button_a').src='/img/button_appraisal.gif';
	}
	if (curr_button!='button_m') {
		document.getElementById('button_m').src='/img/button_mortgage.gif';
	}
}

function map_selection(state) {
	if (document.getElementById('map_industry').value != '') {
		this_ind = document.getElementById('map_industry').value;
		if (this_ind==3) {
			this_ind = 1;
		}
		document.location='/'+state+'-'+this_ind+'-classes';
	} else {
		alert ('Please select an industry.');
	}
}

function isdefined(variable) {
	return (typeof(window[variable]) == "undefined")?  false: true;
}

var myindustry = getCookie('industry');