function navigation_ie6() {
	//if(document.all&&document.getElementById) {
		navRoot = document.getElementById("root-navigation");
		for(i=0;i<navRoot.childNodes.length;i++) {
			node = navRoot.childNodes[i];
			
			if(node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over","");
				}
			}
		}
	//}
}


function ask(question, href) {
	if(confirm(question) == true) {
		window.location.href = href;
	}
}

function standard_popup(url) {
    var options = "toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0";
    var width = 500;
    var height = 700;
    window.open(url, 'PopUp', options + ',width=' + width + ',height=' + height);
}


function animate_rating(movie_id, rating_value) {
	var image;
	var i = 1;
	for (i=1 ; i<=5 ; i++) {
		image = document.getElementById('my_rating' + movie_id + '_id_' + i);
		if (image) {
			if (rating_value >= i) {
				image.style.backgroundPosition = '0px -34px';
			}
			else if (rating_value == 0) {
				image.style.backgroundPosition = '0px -17px';
			}
			else {
				image.style.backgroundPosition = '0px -17px';
			}
		}
	}
}

function animate_general_rating(movie_id, rating_value) {
	var image;
	var i = 1;
	for (i=1 ; i<=5 ; i++) {
		image = document.getElementById('my_rating' + movie_id + '_id_' + i);
		if (image) {
			if (rating_value >= i) {
				image.style.backgroundPosition = '0px 0px';
			}
			else if (rating_value == 0) {
				image.style.backgroundPosition = '0px -17px';
			}
			else {
				image.style.backgroundPosition = '0px -17px';
			}

		}
	}
}


function request_ajax_save_my_movie_rating(movie_id, rating_value, thanks_label) {
	new Ajax.Request(	'?action=ajax_save_my_movie_rating&movie_id=' + movie_id + 'rating_value=' + rating_value + '&rating=' + rating_value,
						{asynchronous: true, onComplete: insert_ajax_save_my_movie_rating}
					);
	
	function insert_ajax_save_my_movie_rating(request) {
		// show thanks (if element exists)
		if ($('my_rating_id_info')) {
			$('my_rating_id_info').innerHTML = thanks_label;
		}
		
		// do animate
		animate_rating(movie_id, rating_value);
		
		// set new mouseover and mouseout
		var i = 1;
		for (i = 1; i <= 5; i++) {
			document.getElementById('my_rating' + movie_id + '_id_' + i).onmouseover = function() { animate_rating(movie_id, rating_value); };
			document.getElementById('my_rating' + movie_id + '_id_' + i).onmouseout = function() { animate_rating(movie_id, rating_value); };
		}
	}
}

function toggle_sidebar(absolute_url, id_number) {
	if ($('sidebar_' + id_number + '_content').style.display == 'block') {
		new Ajax.Request(absolute_url + '/?action=ajax_save_sidebar&close=' + id_number);
		$('sidebar_' + id_number + '_content').style.display = 'none';
		$('sidebar_' + id_number + '_close').className = 'box-open';
	}
	else {
		new Ajax.Request(absolute_url + '/?action=ajax_save_sidebar&open=' + id_number);
		$('sidebar_' + id_number + '_content').style.display = 'block';
		$('sidebar_' + id_number + '_close').className = 'box-close';
	}
}



function toggle_movie_details(current, big) {
	for (i=1 ; i<=8 ; i++) {
		if ($('movie-details-description-navigation-' + i)) {
			$('movie-details-description-navigation-' + i).className = 'movie-details-description-navigation';
			$('movie-details-description-content-' + i).className = 'movie-details-description-content' + (big == true ? '-big' : '');
		}
	}
	$('movie-details-description-navigation-' + current).className = 'movie-details-description-navigation current';
	$('movie-details-description-content-' + current).className = 'movie-details-description-content' + (big == true ? '-big' : '') + ' current';
	
}





