
/********************************************/
var blocks_count = 10;

var oTimer = null;
var iUpdateInterval = 15 * 1000; //--- in milliseconds
var sImagesUrl = sHomeUrl + 'media/images/faq/';


//--- Start timers ---//
var oldHandler = window.onload;
if(typeof window.onload != 'function') {
	window.onload = startTimer;
}
else {
	window.onload = function() {
		if(oldHandler) oldHandler();
		startTimer();
	}
}

function startTimer()
{
	//getImage();
	//oTimer = window.setInterval('getImage()', iUpdateInterval);
}
 
function getImage()
{
	var oImageHolder = document.getElementById('middleRight');
	var iImageIndex = Math.floor(Math.random() * aImages.length);
	oImageHolder.firstChild.src = sImagesUrl + aImages[iImageIndex];
}

function AddPhotoBlock() {

	var counter = document.getElementById('photo_counter');
	var id = parseInt(counter.value); 
	var blocks_div = document.getElementById('photos_block');
	var src = document.getElementById('photo_div_phid_');
	counter.value = ++id;
	var new_block = document.createElement('DIV');
	new_block.id = 'photo_div'+id;
	new_block.innerHTML = src.innerHTML.replace(/_phid_/g, id);
	blocks_div.appendChild(new_block);
}
function RemoveLastPhotoBlock() {
	
	var blocks_div = document.getElementById('photos_block');
	if (blocks_div.lastChild.id == 'photo_div1') return;
	blocks_div.removeChild(blocks_div.lastChild);

  	var counter = document.getElementById('photo_counter');
	var id = parseInt(counter.value);
	if (id > 1)
	counter.value = --id;
}

function AddVideoBlock() {

	var counter = document.getElementById('video_counter');
	var id = parseInt(counter.value);
	var blocks_div = document.getElementById('videos_block');
	var src = document.getElementById('video_div_phid_');
	counter.value = ++id;
	var new_block = document.createElement('DIV');
	new_block.id = 'video_div'+id;
	new_block.innerHTML = src.innerHTML.replace(/_phid_/g, id);
	blocks_div.appendChild(new_block);
}

function RemoveLastVideoBlock() {
	
	var blocks_div = document.getElementById('videos_block');
	if (blocks_div.lastChild.id == 'video_div1') return;
	blocks_div.removeChild(blocks_div.lastChild);

  	var counter = document.getElementById('video_counter');
	var id = parseInt(counter.value);
	if (id > 1)
	counter.value = --id;
}
  
function changeVideoTo(sBase, vidThumb, vidFLV)
{
	
	getHtmlData( 'player_block', 'faq.php?base='+sBase+'&video='+vidFLV+'&thumb='+vidThumb+'&show_only=video');

}
 

