function showEventPhotos(iEventId){
	var request_showEvtPhts = GetXmlHttpObject();
	
	var url = 'ajax_list_event_photos.php?eid=' +iEventId + '&rnd=' + Math.floor(Math.random()*1000000 );
	
	divname = 'event_photos';
	request_showEvtPhts.onreadystatechange = function() { load_to_div(request_showEvtPhts); };
	
	request_showEvtPhts.open( "GET", url, true );
	request_showEvtPhts.send( null );
}

// Send comment
function edit_eventphoto_comment(eid)
{
	
	if(actionLock())
	{
		var aFields = Array(
							Array('comment_text','error_comment_empty')
							);
			aFields['error_func'] = display_popup_error;
			
		if ( checkData(aFields) )
		{
			var sComment = document.getElementById('comment_text').value;
			
			funcVariable = function()
			{
				display_info(info_comment_updated);
				rec_id = document.getElementById('rec_id').value;
				show_dhtml_popup('delete');
				if(eid||false) {
					show_event_photo_comments(1,rec_id,uID,eid);
				} 
			};
			
			//show_comments_small( friend_id, false,sData,success );
		    
                var uID = gid('uID').value;
                var iCOMMENTID = gid('iCOMMENTID').value;
                var friendID = gid('friendID').value;
                var rec_id = gid('rec_id').value;
                var url = 'ajax_edit_event_photo_comment.php';
				if(eid||false) {
	                var params = 'iCOMMENTID=' + iCOMMENTID + '&text=' + sComment + '&uid=' + uID +'&submit=true'+'&eid='+ eid + '&rnd=' + Math.floor(Math.random()*1000000 );
				} else {
	                var params = 'iCOMMENTID=' + iCOMMENTID + '&text=' + sComment + '&uid=' + uID +'&submit=true' + '&rnd=' + Math.floor(Math.random()*1000000 );
				}
				
                request = GetXmlHttpObject();
				request.onreadystatechange = function(){ onload_start_func();};

                request.open( "POST", url, true );
                request.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=utf8");
                request.send( params );
		
		//display_info(edit_review);
		
		    	//show_dhtml_popup('delete');
				//show_profile_photo(rec_id,friendID);	
			


		}
		else
		{
			actionUnlock();
		}
	}
}

function show_event_photo_comments(page,rec_id,uid,eid)
{
		var request_album_phComments = GetXmlHttpObject();

        var url = 'ajax_page_comment.php?rnd=' + Math.floor(Math.random()*1000000 )+'&page='+page+'&rec_id='+rec_id+'&uid='+uid+'&eid='+eid;

        divname = 'profile_photo_comments';
        request_album_phComments.onreadystatechange = function(){ load_to_div(request_album_phComments)}
        request_album_phComments.open( "GET", url, true );
        request_album_phComments.send( null );
}

function showDelPopup(obj,comment_id)
{
	var pop_up_obj_width = 360;
	var adjustment = 0;
	var obj_l= getposOffset(obj,'left');
	var obj_t= getposOffset(obj,'top');
	document.getElementById('comment_to_delete').value=comment_id;
	try{if (document.getElementById('alert').style.display == '')
	{
		document.getElementById('alert').style.display = 'none';
		adjustment = 61;
	}} catch(e){}
	document.getElementById('comment_baloonpopup').style.left = obj_l - pop_up_obj_width + 315;
	document.getElementById('comment_baloonpopup').style.top = obj_t + obj.scrollHeight - 4;
	document.getElementById('comment_baloonpopup').style.display = '';
}

function delete_event_comment_photo(uid,eid){

	if( !actionLock() ) {return false;}

	var comment_id = document.getElementById('comment_to_delete').value;
	var del_request = GetXmlHttpObject();
	if(eid||false){
		var url = 'ajax_delete_event_comments.php?del=' + comment_id+'&uid='+uid+'&eid='+eid+'&rnd='+ Math.floor(Math.random()*1000000 );
	}
	del_request.open( "GET", url, false );
    del_request.send( null );
	    try
        {
                status = del_request.status;
                state = del_request.readyState;
        }
        catch(e) {}

        if ( ( state == 4 || state == "complete" ) && ( status == 200 ) )
        {
               var xmldoc = del_request.responseXML;
        }
		
	var elements = parceXML(xmldoc,"\success");
	if (elements[0][0]=='0') {
		
    	display_info(photo_comment_del);
	}else{
		display_error(photo_comment_del_error);
	}
	document.getElementById('comment_baloonpopup').style.display='none';
	if(eid||false){
		show_event_photo_comments(document.getElementById('page_number').value,document.getElementById('photo_rec_id').value,uid,eid);
	}

}

function openSlide() {
	//window.open("/slideshow/popup/slideshow.php?id="+event_id,"mywindow","menubar=0,toolbar=0,location=0,resizable=1,width=650,height=750");

	$("div#overlay").css("display","block");
	gid('slidepp_main_sec').style.display='';
	
	var sw = document.body.scrollWidth;
	var mlv = (sw-565)/2;
	$("div#slidepp_main_sec").css("left",mlv+"px");
	$("div#slidepp_main_sec").css("top","60px");
	var sh = document.body.scrollHeight;
	
	$("div#overlay").css("height",sh+"px");
	$("div#overlay").css("width",sw+"px");

	loadPage();
	loadThumbImage();
	startAfterLoad();
}
