//
function goToYahoo(title, link)
{
	document.location.href='ymsgr:im?+&msg='+title+' - '+link+' [-FILME-PORNO-MASS-] ';
	return;
}
//
function HomeBox_On()
{
//	document.getElementById('home_box_top').style.display=''
//	document.getElementById('home_box_top_c').style.display='none'
	$("#home_box_top").slideDown();
	$("#home_box_top_c").slideUp();
	setCookie('home_box_top', '');
	return;
}
//
function HomeBox_Off()
{
//	document.getElementById('home_box_top_c').style.display=''
//	document.getElementById('home_box_top').style.display='none'
	$("#home_box_top_c").slideDown();
	$("#home_box_top").slideUp();
	setCookie('home_box_top', 'HIDDEN');
	return;
}
//
function VotFilm_Afis()
{
	document.getElementById('vot_div_link').style.display='none'
	document.getElementById('vot_div_none').style.display=''
	return;
}
//
function VotFilm_Run()
{
	document.getElementById('vot_div_none').style.display='none'
	document.getElementById('vot_div_res').style.display=''
	return 1;
}
//
function ContVIP_Afis()
{
	document.getElementById('vip_get_box').style.display=''
	document.getElementById('vip_get_link').style.display='none'
	return;
}
//
function runUpload()
{
	document.getElementById('upd_stat').style.display=''
	document.getElementById('upd_form').style.display='none'
	return false;
}
//
function setCookie(name, value, expires, path, domain, secure) {
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}
//
function getCookie(name) {
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    } else {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}
//
var TBrun = false;
var tbdef = '';
var t = null;
$(document).ready(function(){
	//
	$('div.filmbox a').mouseenter(function() {
		var sel = $(this).find('img');
		var tb = sel.attr('src');
		tb = tb.replace('/storage/img/', '');
		tb = tb.replace('.jpg', '');
		tbdef = tb;
		TBrun = true;
		tbRotator(sel, tb, 0);
	});
	//
	$('div.filmbox a').mouseleave(function() {
		TBrun = false;
		clearTimeout(t);
		$(this).find('img').attr('src', '/storage/img/' + tbdef + '.jpg');
	});
	//
});
//
function tbRotator(sel, tb, id)
{
	if (TBrun == true) {
		//
		var img = '';
		//
		if (id == 0) {
			img = '/storage/img/' + tb + '.jpg';
		} else {
			img = '/storage/imgx/' + tb + '_' + id + '.jpg';
		}
		//
		sel.attr('src', img);
		//
		id = id + 1;
		if (id > 3) {id = 0;} else {}
		//
		t=setTimeout(function(){tbRotator(sel, tb, id);}, 600);
		//
	} else ;
}
//

