var $j = jQuery.noConflict();
$j(function() {
	$j('#gallery a.lightbox').lightBox({imageLoading:  '/public/images/lightbox/lightbox-ico-loading.gif',
							   imageBtnPrev:  '/public/images/lightbox/lightbox-btn-prev.gif',
							   imageBtnNext:  '/public/images/lightbox/lightbox-btn-next.gif',
							   imageBtnClose: '/public/images/lightbox/lightbox-btn-close.gif',
							   imageBlank:    '/public/images/lightbox/lightbox-blank.gif'});
});

var $kk = jQuery.noConflict();
$kk(document).ready(function() {
$kk('a.title_x').cluetip({splitTitle: '|'});
});

function roll_over(img_name, img_src)
   {
   document.getElementById(img_name).src = img_src;
   }
function default_cover()
{
	document.getElementById('movie_screenshot').src='{MOVIE_DEFAULT_COVER}'
}
function collapse(id, image_path) {
	if (document.getElementById(id).style.display == 'none') {
		document.getElementById(id).style.display = 'block';
		document.getElementById('img-'+id).src = image_path+'small_square_minus.gif';
	} else {
		document.getElementById(id).style.display = 'none';
		document.getElementById('img-'+id).src = image_path+'small_square_plus.gif';
	}
}

function collapse2(id, image_path) {
    if (document.getElementById(id).style.display == 'none') {
        document.getElementById(id).style.display = 'block';
        document.getElementById('img-'+id).src = image_path+'dropdown_arrow_minus.png';
    } else {
        document.getElementById(id).style.display = 'none';
        document.getElementById('img-'+id).src = image_path+'dropdown_arrow_plus.png';
    }
}


var atfXmlHttp;
	function add_to_favourites(movie_id, scene_id) {
		atfXmlHttp = atfGetXmlHttpObject();
		if (atfXmlHttp==null) {
			alert ("Your browser does not support AJAX!");
			return;
		}
		var url="/add_to_fav_ajax/";
		var params ="movie_id="+movie_id+"&scene_id="+scene_id;

		atfXmlHttp.open("POST",url,true);

		atfXmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		atfXmlHttp.setRequestHeader("Content-length", params.length);
		atfXmlHttp.setRequestHeader("Connection", "close");

		atfXmlHttp.onreadystatechange=atfStateChanged;
		atfXmlHttp.send(params);
	}

function atfStateChanged() {
if (atfXmlHttp.readyState==4) {
	document.getElementById("add-to-favourites").innerHTML = atfXmlHttp.responseText;
	}
}

function atfGetXmlHttpObject() {
	var xmlHttp=null;
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	} catch (e) {
		// Internet Explorer
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}
function display_frame_screenshot(frame_time,image_name)
{
	document.getElementById("frame_screenshot").src ='../../../var/tmp/'+image_name;
	document.getElementById("frame_time").value = frame_time;
	document.getElementById("image_name").value = image_name;
	document.getElementById("show_screenshot").style.display='block';
}
function toogle(id_elem)
{
	obj = document.getElementById(id_elem);
	if (obj.style.display == "block") {
		obj.style.display = "none"
	} else {
		obj.style.display = "block"
	}
}
