/*
	Various scripts for the 350Z Club of Florida website
*/
/*
	Iframe page Globals
*/

/*
	This is the most bizarre set of "call-backs" ever. Since masterIFframe
	completes its load before the masterBody (think about it), it needs to
	ask for info. I haven't found a way to address masterBody's variables
	except via methods, nor have I been able to reference masterIFrame from
	masterBody (which would make it so much simpler). I'm so confused.
*/
function iFrameLoad() {
	var picIntervalId = window.setInterval('changePic()', top.getPicTime());
	changePic();
	setAd();
}

function changePic() {
	setKeyVisual(top.getPicNum());
	return;
}

function setKeyVisual(picNum) {
	var kv = document.getElementById('key_visual');
	if (kv.style.backgroundImage != 'url(resources/pagePics/pic' + picNum + '.png)') {
		kv.style.backgroundImage = 'url(resources/pagePics/pic' + picNum + '.png)';
	}
	return;
}

function setAd() {
// set the ad to the appropriate HTML. Check back every five seconds for ad expiration
	getAd(top.getAdHTML());
	var adCheckTimeOutId = window.setTimeout('setAd()', 5000);
	return;
}

function getAd(adHTML) {
	var headerAS = document.getElementById('headerAdSpace');
// this check keeps ad from blinking every five seconds on slow speed connections
	if (headerAS.innerHTML != adHTML) {
		headerAS.innerHTML = adHTML;
	}
	return;
}

function setTheMovie(theSrc) {
	document.moviePlayer.SetURL(theSrc);
	return
}

function setLargePic(theSrc, theWidth){
	var bodyLP = document.getElementById('largePic');
	bodyLP.src=theSrc;
	bodyLP.style.width=theWidth;
	}
