/**
 * Hide/show game flash
 * 
 * @param action
 * @return
 */
function gameMenu(item) {
	var e = $('carousel-content').childNodes,
		m = $('gamemenu').childNodes,
		me = '';

	for(i = 0; i < m.length; i++) {
		me = $(m[i]).childNodes;

		for(j = 0; j < me.length; j++) {
			if(me[j].nodeName == "A" && me[j].rel != undefined) {
				if(me[j].rel == item.rel) {
					me[j].className = 'carousel-jumper carousel-selected';
				} else {
					me[j].className = 'carousel-jumper';
				}
			}
		}
	}

	for(i = 0; i < e.length; i++) {
		if(e[i].nodeName == "DIV" && e[i].id != undefined) {
			if( e[i].id == item.rel ) {
				$(e[i].id).style.display = '';
			} else {
				$(e[i].id).style.display = 'none';
			}
		}
	}
}

function addComment() {
	var pages = document.getElementById('pages');

	$('comments_list').fade({ duration: 0.5 });
	$('button_addcomment').fade({ duration: 0.5 });

	if( $('pages') ) {
		$('pages').fade({ duration: 0.5 });
	}

	setTimeout("showAddComment();",500);

	return false;
}

function showAddComment() {
	$('comment_add').appear({ duration: 0.5 });
	$('button_viewcomment').appear({ duration: 0.5 });

	if( $('button_sendcomment') ) {
		$('button_sendcomment').appear({ duration: 0.5 });
	}
}

function viewComment() {
	var pages = document.getElementById('pages');

	$('comment_add').fade({ duration: 0.5 });
	$('button_viewcomment').fade({ duration: 0.5 })
	
	if( $('button_sendcomment') ) {
		$('button_sendcomment').fade({ duration: 0.5 });
	}

	setTimeout("showViewComment();",500);

	return false;
}

function showViewComment() {
	$('comments_list').appear({ duration: 0.5 });
	$('button_addcomment').appear({ duration: 0.5 });

	if( $('pages') ) {
		$('pages').appear({ duration: 0.5 });
	}
}

function sendComment(lid) {
	var comment_chars = parseInt($('remaining').innerHTML),
		msg = "";

	if( comment_chars >= 0 ) {
		if( isValid(document.getElementById('frmComment')) ) {
			ajax('ajax/add_comment.php','','comment_add','post',null,"$('button_sendcomment').style.display = 'none';);",document.getElementById('frmComment'));
		}
	} else {
		switch(lid) {
			default :
			case 1:
				msg = "Você excedeu o número máximo de caracteres em seu comentário!";
			break;
			case 2:
				msg = "You have exceeded the maximum number of characters in your comment!";
			break;
		}

		modalAlert(msg);
	}

	return false;
}

function selectContent(id)
{
	document.getElementById(id).select();
}