/* CODE */

function mapin(city) {
	document.getElementById(city).style.color = '#00F';
	document.getElementById(city).style.border = '1px dashed #BBB';
	document.getElementById(city).style.backgroundColor = '#F6F6F6';
}

function mapout(city) {
	document.getElementById(city).style.color = '#000'
	document.getElementById(city).style.border = '0px solid #000';
	document.getElementById(city).style.backgroundColor = '#FFF';
}

function cityIn(city) {
	var classes = document.getElementsByClassName(city);
	for(i=0; i<classes.length; i++) 
		classes[i].style.backgroundColor = '#CCF';
}

function cityOut(city) {
	var classes = document.getElementsByClassName(city);
	for(i=0; i<classes.length; i++) 
		classes[i].style.backgroundColor = '#FFF';
}

function imgPreload() {
	var x=820, y=400;
	pic1 = new Image(x,y);
	pic1.src="template/scroll/Ashlar_Gateway.jpg";
	pic2 = new Image(x,y);
	pic2.src="template/scroll/Castle_Job.jpg";
	pic3 = new Image(x,y);
	pic3.src="template/scroll/KwikFit_Wasatch.jpg";
	pic4 = new Image(x,y);
	pic4.src="template/scroll/MtnLedge_YubaValley.jpg";
	pic5 = new Image(x,y);
	pic5.src="template/scroll/OlympusLedge_Leather.jpg";
	pic6 = new Image(x,y);
	pic6.src="template/scroll/Rubble_Chard.jpg";
	pic7 = new Image(x,y);
	pic7.src="template/scroll/Rubble_Leather.jpg";
	pic8 = new Image(x,y);
	pic8.src="template/scroll/RubbleStack_Champagne.jpg";
	pic9 = new Image(x,y);
	pic9.src="template/scroll/Sandstone_DesertSand.jpg";
	pic10 = new Image(x,y);
	pic10.src="template/scroll/Sandstone_LS.jpg";
}

function imgScroller(seconds) {
	seconds *= 1000;
	setTimeout('changeImg("template/scroll/Castle_Job.jpg","Castle - Arizona")', seconds * 1);
	setTimeout('changeImg("template/scroll/KwikFit_Wasatch.jpg","Kwik Fit - Wasatch")', seconds * 2);
	setTimeout('changeImg("template/scroll/MtnLedge_YubaValley.jpg","Mountain Ledge - Yuba Valley")', seconds * 3);
	setTimeout('changeImg("template/scroll/OlympusLedge_Leather.jpg","Olympus Ledge - Leather")', seconds * 4);
	setTimeout('changeImg("template/scroll/Rubble_Chard.jpg","Rubble - Chardonnay")', seconds * 5);
	setTimeout('changeImg("template/scroll/Rubble_Leather.jpg","Rubble - Leather")', seconds * 6);
	setTimeout('changeImg("template/scroll/RubbleStack_Champagne.jpg","Rubble Stack - Champagne")', seconds * 7);
	setTimeout('changeImg("template/scroll/Sandstone_DesertSand.jpg","Sandstone - Desert Sand")', seconds * 8);
	setTimeout('changeImg("template/scroll/Sandstone_LS.jpg","Sandstone - Little Sahara")', seconds * 9);
	setTimeout('changeImg("template/scroll/Ashlar_Gateway.jpg","Ashlar - Gateway")', seconds * 10);
	setTimeout('imgScroller(6)', seconds * 11);
}

function changeImg(image, text) {
	document.getElementById("scroller").src = image;
	document.getElementById("scrText").innerHTML = text;
}

//http://www.digimantra.com/tutorials/sleep-or-wait-function-in-javascript/
function sleep(ms) {
	var dt = new Date();
	dt.setTime(dt.getTime() + ms);
	while (new Date().getTime() < dt.getTime());
	
}

function tabChange(x) {
	document.getElementById("folder").setAttribute("class", x);
}

function inspect(x) {
	var url = "gallery_Inspect.html?" + x;
	window.open(url,'inspect','width=880,height=480,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no');
	//1080px width for swatches
}
