function preview_prod_img(t, img, id){
	if(document.getElementById('prev_img')){
		document.getElementById('prev_img').src=t.src.replace(/\/s1_/, '/s4_');
		document.getElementById('prev_img').alt=t.alt;
		document.getElementById('prev_img').title=t.alt;
		document.getElementById('prev_img').onclick=function(){
			show_big_foto(img, document.getElementById('prev_img').alt, id);
		};
	}
}

var rate=new Object;
rate.act_src='/images/yellow_r_star.gif';
rate.norm_src='/images/blue_star.gif';
rate.init=false;

var old_values=new Array();

function activate_rate(){
	if(!rate.init){
		init_rate(arguments[0]);
	}
	rate.isact=true;
	for(var i=0; i<5; i++){
		rate[i].onmouseover=function(){ act_rate(this); }
		rate[i].onmouseout=function(){ stop_rate(); }
		//rate[i].onclick=function(){ do_rate(this); }
	}
	
}

function init_rate(t){
	var images=t.getElementsByTagName('img');
	for(var i=0; i<5; i++){
		old_values[i]=new String(images[i].src);
		rate[i]=images[i];
		rate[i].id=i;
		
	}
	rate.init=true;
}

function stop_rate(){
	if(rate.isact){
		rate.isact=false;
		setTimeout("deactivate_rate();", 100);
	}
}

function deactivate_rate(){
	if(!rate.isact){
		for(var i=0; i<5; i++){
			rate[i].src=old_values[i];
			rate[i].onmouseover=null;
			//rate[i].onclick=null;
		}
	}
}

function act_rate(t){
	if(!rate.isact){
		activate_rate();
	}
	rate.isact=true;
	for(var i=0; i<5; i++){
		rate[i].src=((t.id>=i)?rate.act_src:rate.norm_src);//root_url+
	}
}

function do_rate(t){
	//location.href='?vote='+(Math.abs(t.id)+1);
	//alert('?vote='+(Math.abs(t.id)+1));
}

function show_big_foto(img, title, id){
	window.open(root_url+'show_photo.php?img='+img+'&amp;title='+title, 'galery_foto_'+id, 'width=120, height=100, top=10, left=10');
}
///////////////////////////////////////////////////////////



