// the currently displayed region. For simple tracking of 5 swap images.
var region_lock = -1;
var cur_region = '1';

// region config names. 
var regionAry = new Array();
	regionAry [4] = '4';
	regionAry [2] = '2';
	regionAry [1] = '1';
	regionAry [0] = '0';
	regionAry [3] = '3';
	
var regionEmailAry = new Array();
	regionEmailAry [0] = new Array();
	regionEmailAry [0][0] 	= 'jthorston@sld-usa.com';
	regionEmailAry [0][1]	= 'jthorston@sld-usa.com';
	
	regionEmailAry [1] = new Array();
	regionEmailAry [1][0] 	= 'dmoore@sld-usa.com';
	regionEmailAry [1][1]	= 'jthorston@sld-usa.com';
	
	regionEmailAry [2] = new Array();
	regionEmailAry [2][0] 	= 'sriedl@sld-usa.com';
	regionEmailAry [2][1]	= 'sriedl@sld-usa.com';
	
	regionEmailAry [3] = new Array();
	regionEmailAry [3][0] 	= 'cmichaelis@sld-usa.com';
	regionEmailAry [3][1]	= 'sriedl@sld-usa.com';
	
	regionEmailAry [4] = new Array();
	regionEmailAry [4][0] 	= 'mlamb@sld-usa.com';
	regionEmailAry [4][1]	= 'mlamb@sld-usa.com';
	

// y difference between images in the bg image.
var Voffset = 365;

// contact objects on poster
var mgr_obj		= document.getElementById('contact_manager');
var sls_obj		= document.getElementById('contact_sales');
var map_obj		= document.getElementById('contact_map');

// function to toggle regions of the map. 
function show_region(region) {

	if (region_lock > 0) {return;}
	
	var offset = (region * Voffset * -1); // amount to move the bg image. 
	map_obj.style.backgroundPosition = '0px '+ offset + 'px';

	// show the new contacts
	
	mgr_obj.style.backgroundImage = "url(img/lockstars/"+regionAry[region]+"_regional_mgr.gif)";
	sls_obj.style.backgroundImage = "url(img/lockstars/"+regionAry[region]+"_inside_sls.gif)";
	
	// set the current region.
	cur_region = region;

}

function set_mailto(contact) { // contact = 0 = mgr, anything else = sales. 
	
	// opens an eamil to the currently configured region.
	
	document.location = "mailto:" +  regionEmailAry[cur_region][contact];
	
	
}

function region_click(region) {
	
	if (region_lock > 0) {region_lock *= -1; show_region(region);}
	else { show_region(region); region_lock *= -1;}
	
}