

function comments_page(current_page, clip_id, owner_mid)
{
	
	dir_value = ".";
	page_name_value ="page_name_value";

	var url = dir_value+"/video_view_comment_list.php";
	var pars = 'dir_page='+dir_value+'&page_name_page='+page_name_value+'&clip_id='+clip_id+'&current_page='+current_page+'&owner_mid='+owner_mid;
		
	var myAjax = new Ajax.Updater( 'comments_list', url, { method: 'get',  parameters: pars });

}


function show_add_comments(clip_id, owner_mid)
{
	
	dir_value = ".";
	page_name_value ="page_name_value";

	var url = dir_value+"/video_add_comment.php";
	var pars = 'dir_page='+dir_value+'&page_name_page='+page_name_value+'&clip_id='+clip_id+'&owner_mid='+owner_mid;
		
	var myAjax = new Ajax.Updater( 'add_comments', url, { method: 'get',  parameters: pars });


}

//==============================================================================================================================
//SET ACTION ADD CLIP COMMENT
//==============================================================================================================================

function set_action_add_comment(dir_value, page_name_value)
{
	
	var url = dir_value+"/video_add_comment_db.php";
	
	var action_list = "video_add_comment";

	var clip_id = $F("clip_id");
	var owner_mid = $F("owner_mid");

	var comment_text = $F("comment_text");

	
	

	var pars = "dir_page="+dir_value+"&page_name_page="+page_name_value+"&action_list="+action_list+"&comment_text="+comment_text+"&clip_id="+clip_id+"&owner_mid="+owner_mid;


	var myAjax = new Ajax.Request( url,

										{ method: 'get',
										  parameters: pars,
										  onComplete: set_action_add_comment_from_server
										}

									 );
	
}

//=================================================================================================================

function set_action_add_comment_from_server(originalRequest)
{
	Try.these(
		function () {
			var xml = originalRequest.responseXML;//we have the xml object	
			
			respNode = xml.getElementsByTagName("response")[0];		
			items = respNode.getElementsByTagName("item");

					
			name_action = items[0].getElementsByTagName("name")[0].firstChild.nodeValue;
			value_action = items[0].getElementsByTagName("value")[0].firstChild.nodeValue;	


			name_error = items[1].getElementsByTagName("name")[0].firstChild.nodeValue;
			value_error = items[1].getElementsByTagName("value")[0].firstChild.nodeValue;


			dir_value = items[2].getElementsByTagName("name")[0].firstChild.nodeValue;
			page_name_value = items[2].getElementsByTagName("value")[0].firstChild.nodeValue;	

			

			clip_name = items[3].getElementsByTagName("name")[0].firstChild.nodeValue;
			clip_id_val = items[3].getElementsByTagName("value")[0].firstChild.nodeValue;	

			
			clip_name_no = items[4].getElementsByTagName("name")[0].firstChild.nodeValue;
			comm_no = items[4].getElementsByTagName("value")[0].firstChild.nodeValue;	

			var div_errors_page = $("added_comments");

			div_errors_page.innerHTML = "<span class='dark_blue_link_2'>"+value_error+"</span>";

			

			if(value_action=="add_comment_ok")
			{

				comments_page(0, clip_id_val);
				
				var comments_no = $("comments_no");

				comments_no.innerHTML = "<b>"+comm_no+" Comentarii<a name='comentarii_start'></a></b>";
			}
			

		}

	);//end try

}
function check_clip_propose(frm)
{

    if(frm.clip_name.value.length<3)
    {
        alert("Completeaza titlul clipului!");
        return false;
    }

    if(frm.categorie_id.selectedIndex==0)
    {
        alert("Alege categoria!");
        return false;
    }

    if(frm.clip_code.value.length<3)
    {
        alert("Introdu codul clipului!");
        return false;
    }

    return true;
}