function show_repertoriu(id) {
	var obj = document.getElementById(id);
	var disp = obj.style.display;
	if (disp == "none") {
		disp = "block";
	} else {
		disp = "none";
	}
	obj.style.display = disp;
}

function show_info_edit(id, id_cat) {
	var nr = 13;
	var id1 = "info_div_" + id_cat + "_" + id + "_1";
	var id2 = "info_div_" + id_cat + "_" + id + "_21";
	
	var obj = document.getElementById(id1);
	var disp = obj.style.display;
	var disp1 = "";
	if (disp == "none") {
		disp = "block";
		disp1 = "none";
	} else {
		disp = "none";
		disp1 = "block";
	}
	obj.style.display = disp;
	document.getElementById(id2).style.display = disp1;
	
	for (var i = 2; i<=nr; i++) {
		id1 = "info_div_" + id_cat + "_" + id + "_" + i;
		id2 = "info_div_" + id_cat + "_" + id + "_2" + i;
		document.getElementById(id1).style.display = disp;
		document.getElementById(id2).style.display = disp1;
	}
}

function show_repertoriu_edit(id, len) {
	var id1 = "" + id + "_00";
	var id2 = "";
	var id3 = "";
	var id4 = "";
	
	show_repertoriu(id1);
	
	for (var i = 0; i<len; i++) {
		id1 = "" + id + "_" + i + "_1";
		id2 = "" + id + "_" + i + "_2";
		id3 = "" + id + "_" + i + "_3";
		id4 = "" + id + "_" + i + "_4";
		
		show_repertoriu(id1);
		show_repertoriu(id2);
		show_repertoriu(id3);
		show_repertoriu(id4);
	}
}

function new_entry(id, extra1, extra2) {
	var new_id  = "repertoriu" + extra2 + "_new" + id +"_11";
	var new_obj = document.getElementById(new_id);
	var disp = new_obj.style.display;
	if (disp == "none") {
		disp = "block";
		new_obj.innerHTML += "<br/>Autor / Titlu / Durata<br/><br/>";
		new_obj.style.display = disp;
	}
	
	var hid_cnt_obj = document.getElementById("new_" + extra2 + "_" + id);	
	var cnt = 1 + parseInt(hid_cnt_obj.value);
	
	new_obj.innerHTML += "<input type='text' name='autor_new_" + cnt + "' id='autor_new_" + cnt + "' style='width:150px;'/>&nbsp;";
	new_obj.innerHTML += "<input type='text' name='titlu_new_" + cnt + "' id='titlu_new_" + cnt + "' style='width:250px;'/>&nbsp;";
	new_obj.innerHTML += "<input type='text' name='durata_new_" + cnt + "' id='durata_new_" + cnt + "' style='width:50px;'/><br/>";
	
	hid_cnt_obj.value = cnt;
	
}

function postForm() {
	f = document.forms[0];
	f.password.value = hex_md5(f.password.value);
	f.submit();
}

function confirm_link(url) {
	if (confirm("Are you sure?")) {
		document.location=url;
	}
}

function edit_link(id) {
	document.getElementById("name_txt_"+id).style.display = "none";
	document.getElementById("name_"+id).style.display = "block";
	document.getElementById("url_txt_"+id).style.display = "none";
	document.getElementById("url_"+id).style.display = "block";
	document.getElementById("span_submit_"+id).style.display = "block";
	
	document.getElementById("link_"+id).href = "javascript:dont_edit_link("+id+")";
	document.getElementById("link_"+id).innerHTML = "Don't Edit";
}

function dont_edit_link(id) {
	document.getElementById("name_txt_"+id).style.display = "block";
	document.getElementById("name_"+id).style.display = "none";
	document.getElementById("url_txt_"+id).style.display = "block";
	document.getElementById("url_"+id).style.display = "none";
	document.getElementById("span_submit_"+id).style.display = "none";
	
	document.getElementById("link_"+id).href = "javascript:edit_link("+id+")";
	document.getElementById("link_"+id).innerHTML = "Edit";
}

function edit_news_categ(id) {
	document.getElementById("name_txt_"+id).style.display = "none";
	document.getElementById("name_"+id).style.display = "block";
	document.getElementById("span_submit_"+id).style.display = "block";
	
	document.getElementById("link_"+id).href = "javascript:dont_edit_categ("+id+")";
	document.getElementById("link_"+id).innerHTML = "Don't Edit";
}

function dont_edit_categ(id) {
	document.getElementById("name_txt_"+id).style.display = "block";
	document.getElementById("name_"+id).style.display = "none";
	document.getElementById("span_submit_"+id).style.display = "none";
	
	document.getElementById("link_"+id).href = "javascript:edit_news_categ("+id+")";
	document.getElementById("link_"+id).innerHTML = "Edit";
}

function edit_video(id) {
	document.getElementById("title_"+id).style.display = "none";
	document.getElementById("title_txt_"+id).style.display = "block";
	document.getElementById("img_"+id).style.display = "none";
	document.getElementById("img_txt_"+id).style.display = "block";
	document.getElementById("code_txt_"+id).style.display = "block";
	document.getElementById("span_submit_"+id).style.display = "block";
	
	document.getElementById("link_"+id).href = "javascript:dont_edit_video("+id+")";
	document.getElementById("link_"+id).innerHTML = "Don't Edit";
}

function dont_edit_video(id) {
	document.getElementById("title_"+id).style.display = "block";
	document.getElementById("title_txt_"+id).style.display = "none";
	document.getElementById("img_"+id).style.display = "block";
	document.getElementById("img_txt_"+id).style.display = "none";
	document.getElementById("code_txt_"+id).style.display = "none";
	document.getElementById("span_submit_"+id).style.display = "none";
	
	document.getElementById("link_"+id).href = "javascript:edit_video("+id+")";
	document.getElementById("link_"+id).innerHTML = "Edit";
}

function modContent() {
	var sel = document.getElementById("sel_content");
	id = sel.options[sel.selectedIndex].value;
	document.location="add_content.php?action=edit&id="+id;
}

function checkAll(c) {
	$j("#tbl" + c + " INPUT[type='checkbox']").attr('checked', true);
}
function checkNone(c) {
	$j("#tbl" + c + " INPUT[type='checkbox']").attr('checked', false);
}
function showCommentForm(id) {
	var o = $("comment_"+id);
	if (o.visible()) {
		o.hide();
	} else {
		o.show();
	}
}
function showC(id) {
	var o = $(id);
	if (o.visible()) {
		o.hide();
	} else {
		o.show();
	}
}