//s/<img\b[^>]*//g
var prev_node = 0;
var prev_sub_menu = 0;
var banners=new Array();
var prior_array = new Array();
var last_baner = 0;

function imageLoaded(img)
{
if(img.offsetWidth < 176 ) img.style.marginLeft = (176 - img.offsetWidth) / 2 + 'px';
if(img.offsetHeight < 162 ) img.style.marginTop = (162 - img.offsetHeight) / 2 + 'px';
}

function collapse(id,parent) {

	
submenu = document.getElementById(id);
if ( prev_sub_menu && prev_sub_menu != submenu)
	prev_sub_menu.style.display = 'none';
	
if ( prev_node && prev_node != parent )
{
prev_node.style.fontWeight = 'normal';
prev_node.style.borderBottom = '4px solid white';
prev_node.style.color = '#333333';
prev_node.style.paddingRight = '0';
}	

prev_node = parent;
prev_sub_menu = submenu;

 submenu.style.display = ( submenu.style.display == 'none' )?'block':'none';
if ( submenu.style.display == 'none' )
{
parent.style.fontWeight = 'normal';
parent.style.borderBottom = '4px solid white';
parent.style.color = '#333333';
parent.style.paddingRight = '0';
} else {
parent.style.fontWeight = 'bold';
parent.style.borderBottom = '4px solid #ff6600';
parent.style.color = '#ff6600';
parent.style.paddingRight = '10px';
}


}

function compareImageLoaded(img)
{

if (img.offsetWidth > 51 ) img.style.width = 51 + 'px';
if (img.offsetHeight > 47 ) img.style.height = 47 + 'px';
if(img.offsetWidth < 51 ) img.style.marginLeft = (51 - img.offsetWidth) / 2 + 'px';
if(img.offsetHeight < 47 ) img.style.marginTop = (47 - img.offsetHeight) / 2 + 'px';
img.style.visibility = 'visible';
}

function cartImageLoaded(img)
{

if (img.offsetWidth > 87 ) img.style.width = 87 + 'px';
if (img.offsetHeight > 80 ) img.style.height = 80 + 'px';
if(img.offsetWidth < 87 ) img.style.marginLeft = (87 - img.offsetWidth) / 4 + 'px';
if(img.offsetHeight < 80 ) img.style.marginTop = (80 - img.offsetHeight) / 4 + 'px';
img.style.visibility = 'visible';
}


function miestas_in(block)
{

block.style.color = '#ff6600';
document.getElementById(block.id+'_tooltip').style.display = 'block';
}

function miestas_out(block)
{
block.style.color = '#333333';
document.getElementById(block.id+'_tooltip').style.display = 'none';
}


function createBaner(html_text, showing_time,index)
{
this.text = html_text;
this.stime = showing_time;
banners[index]= this;
document.getElementById('banner_block').innerHTML += '<div id="b'+index+'" style="display:none;">'+html_text+'</div>';
//tmp_index = prior_array.length;

//	prior_array[tmp_index] = index;
	


}

function showBanner() {

//var rand_index = Math.ceil(Math.random()*100000)%prior_array.length;
if ( last_baner == banners.length) last_baner = 0;
var rand_index = last_baner;
var prev_index = last_baner - 1;
if ( prev_index < 0) prev_index = banners.length - 1;
//alert(rand_no);

//alert(prior_array.length);
//document.getElementById('banner_block').innerHTML = banners[rand_index].text;
document.getElementById('b'+prev_index).style.display = 'none';
document.getElementById('b'+rand_index).style.display = 'block';
//alert("ttt")
setTimeout('showBanner()', banners[rand_index].stime*1000);

last_baner++;

}

function showBanner2() {
var rand_index = Math.ceil(Math.random()*100000)%prior_array.length;
//alert(rand_no);

//alert(prior_array.length);
document.getElementById('banner_block').innerHTML = banners[prior_array[rand_index]].text;
//alert("ttt")

}