
var imgPath = '/static/img/';
var imgArray = ['intro_banner01', 'intro_banner01_on',
				'intro_banner02', 'intro_banner02_on',
				'intro_banner03', 'intro_banner03_on',
				'intro_banner04', 'intro_banner04_on'];

function preloadHomeImages() {
	var img;

	for (i = 0; i < imgArray.length; i++) {
		img = new Image();
		img.src = imgPath + imgArray[i] + ".jpg"
	}
}

function handleImage(i, a) {
	i.src = imgPath + i.id + a + ".jpg";
}

function updateSubHeader (h) {
	var pt = document.getElementById('propType');
	
	if (pt) {
		pt.innerHTML = h;	
	}	
}

function showMap(m) {
	m.style.display = 'block';
}

function hideMap(m) {
	m.style.display = 'none';
}

function setContent(s) {
	var t = document.getElementById('notice');	
	var src = document.getElementById(s);
	
	if (t) {
		t.innerHTML = src.innerHTML;
		showMap(t);
	}
}

function updateMainImage(s) {
	var tg = document.getElementById('largeImage');	
	
	if (tg) {
		tg.src = s;
	}
}

function goBack() {
	history.back();	
}

function goPrint(t, tid, id) {
	var w = window.open("/comercial_properties_info_print.php?type=" + t + "&typeid=" + tid + "&id=" + id, "PRINT", "WIDTH=800,HEIGHT=550,SCROLLBARS=1");
	if (w) {
		w.focus();	
	}
}

var hexR = 255;
var hexG = 255;
var hexB = 255;

var finishedRGB = false;

function startFade() {
	setTimeout("fadetext()",150); 
}

function fadetext() { 
	if (hexR > 0) { hexR -= 2; } else { finishedRGB = true; }
	if (hexG > 82) { hexG -= 2; } 
	if (hexB > 158) { hexB -= 2; }
	
	document.getElementById("mainHeader").style.color="rgb(" + hexR + "," + hexG + "," + hexB + ")";
	document.getElementById("subMainHeader").style.color="rgb(" + hexR + "," + hexG + "," + hexB + ")";
	
	if (!finishedRGB) {
		setTimeout("fadetext()",5); 
	}
}

