/*
FRONT OFFICE SCRIPTS PAGE
*/

// COMMON METHODS

// On load event
Event.observe(window, 'load', OnPageLoad);

// Preload process status
function OnPageLoad() {
	// None
}

// Resize content block
function contBlockHeight(_minHeight) {
	// Get layer
	var _cont = $("pgContent");
	if (_cont != null) {
		var _height = parseInt(_cont.offsetHeight);
		// Resize layer
		if (_height < _minHeight) { _cont.style.height = _minHeight + 'px'; }
	}
}

// LOADER OPERATIONS

// Load HOME page flashes set
function loadFlashes(_items, _timeOut) {
	// Set load flashes timeOut
	setTimeout('loadShow(1,' + _items + ',' + _timeOut + ')', _timeOut);
}
// Load HOME page flash item
function loadShow(_item, _items, _timeOut) {
	// Get flash place layer
	var _layer = $('openShow' + _item);
	// Check if layer exist
	if (_layer != null) {
		// Create flash object
		var _swf = new SWFObject('/Design/Flash/openFlash.swf', 'openShow', '180', '135', '8', '#000000');
		// Load flash
		_swf.write(_layer.id);
	}
	// Read next
	if (_item < _items) {
		// Forward flash counter
		_item++;
		// Set load flashes timeOut
		setTimeout('loadShow(' + _item + ',' + _items + ',' + _timeOut + ')', _timeOut);
	}
}

// PLAY VIDEO CLIPS

// Load home video clip
function homeVideoLoad() {
	// Check if video clip exists
	var _v0 = $('videoPlayer_0');
	var _v1 = $('videoPlayer_1');
	var _video = $('ytubVudeo');
	if ((_v0 != null) && (_v1 != null)) {
		// Load video clip
		_v0.style.display = 'none';
		_v1.style.display = 'block';
		// Create flash object
		var _swf = new SWFObject(_video.title, 'ytubVudeo', '320', '265', '8', '#000000');
		// Load flash
		_swf.write(_video.id);
	}
}
// Close home video clip
function homeVideoClose() {
	// Check if video clip exists
	var _v0 = $("videoPlayer_0");
	var _v1 = $("videoPlayer_1");
	if ((_v0 != null) && (_v1 != null)) {
		// Load video clip
		_v1.style.display = 'none';
		_v0.style.display = 'block';
	}
}
