function add_comment(sob_id,id,pgid)
{
	dojo.io.bind({
   	url: "../ajax_respons.php?event=add_comment&news_id="+sob_id+"&parent_id="+id+"&pg="+pgid,
   	load: function(type, data, evt){
    		document.getElementById('add_comment_'+id).innerHTML=data;
   	},
   	error: function(type, error){
   		alert('error!!!');
   	},
   	mimetype: "text/html"
	});
}

function close_comment(id)
{
	document.getElementById('add_comment_'+id).innerHTML='';
}

function save_comment(sob_id,id,pgid)
{
	comm_name = document.getElementById('name_comment').value;


	comm_text = document.getElementById('text_comment').value;


	comm_cifri= document.getElementById('cifri_comment').value;


	dojo.io.bind({
   	url: "../ajax_respons.php",
   	method: "post",
   	content: {
   	 event: "save_comment",
   	 news_id: sob_id,
   	 parent_id: id,
   	 name_com: comm_name,
   	 text_com: comm_text,
   	 cifri_com: comm_cifri,
   	 pg: pgid
   	},
   	load: function(type, data, evt){
//   		alert(data);
    		document.getElementById('add_comment_'+id).innerHTML='';
		draw_comment(sob_id,pgid,0);
   	},
   	error: function(type, error){
   		alert('error!!!');
   	},
   	mimetype: "text/html"
	});
}

function draw_comment(id,pgid,page_no)
{
	dojo.io.bind({
   	url: "../ajax_respons.php?event=draw_comment&news_id="+id+"&pg="+pgid+"&page_no="+page_no,
   	load: function(type, data, evt){
    		document.getElementById('comment_content').innerHTML=data;
   	},
   	error: function(type, error){
   		alert('error!!!');
   	},
   	mimetype: "text/html"
	});
}

function fotka_gallery(gallery_id,foto_id)
{
	if(kol_fotka_all<foto_id){
		foto_id=kol_fotka_all;
	}
	if(1>foto_id){
		foto_id=1;
	}

	dojo.io.bind({
   	url: "../ajax_respons.php?event=fotka_gallery&gallery_id="+gallery_id+"&foto_id="+foto_id,
   	load: function(type, data, evt){
   		if(foto_id==1){
			document.getElementById('gallery_M').style.display='none';
			document.getElementById('gallery_M2').style.display='none';
		}
		else{
			document.getElementById('gallery_M').style.display='';
			document.getElementById('gallery_M2').style.display='';
		}
		if(foto_id==kol_fotka_all){
			document.getElementById('gallery_P').style.display='none';
			document.getElementById('gallery_P2').style.display='none';
		}
		else{
			document.getElementById('gallery_P').style.display='';
			document.getElementById('gallery_P2').style.display='';
		}
    		document.getElementById('gallery_content').innerHTML=data;
    		document.getElementById('now_fotka_id').innerHTML=foto_id;
    		document.getElementById('now_fotka_id2').innerHTML=foto_id;
	    	now_fotka_kol=foto_id;
   	},
   	error: function(type, error){
   		alert('error!!!');
   	},
   	mimetype: "text/html"
	});
}

function change_catpcha()
{
	document.getElementById('div_captcha').innerHTML='';
	dojo.io.bind({
   	url: "../ajax_respons.php?event=ch_captcha",
   	load: function(type, data, evt){
//   	alert(data);
		document.getElementById('div_captcha').innerHTML=data;
   	},
   	error: function(type, error){
   		alert('error!!!');
   	},
   	mimetype: "text/html"
	});
}
