var ADDA_PHOTO_ABUSE = 'Report Abuse';
var AjaxObject = {
handleSuccess_adda_photo_comment_abuse:function(o){
	var	comment_id = document.getElementById('comment_id').value;
	if(o.responseText == 701)
	    {
		document.getElementById('adda_success_title').innerHTML = '<h2>' + ADDA_PHOTO_ABUSE + '</h2>';
		success_message = 'This Adda Photo comment has been reported as abusive. It is currently under review.';
		document.getElementById('adda_success_message').innerHTML = success_message;
		document.getElementById('adda_photo_comment_abuse1').style.display = 'block';
		YAHOO.example.adda_photo_comment_abuse_container1.adda_photo_comment_abuse1.show();
		document.getElementById('abusecommentpopup_'+comment_id).innerHTML = 'Under Review';
	    }
	adda_photo_comment_abuse_hideAbusePopup();
    }
};


var callback_adda_photo_comment_abuse =
{
 success:AjaxObject.handleSuccess_adda_photo_comment_abuse,
    scope: AjaxObject
};

function adda_photo_comment_abuse_saveAbuse()
{
  var selected_types = '';
  var comma = '';   
  var select_action = false;  
  var abuse_types = document.adda_photo_comment_abuse_form.abuse_type;
  for(var i=0;i<6;i++)
    {
	if(abuse_types[i].value != '')
	    {
		if(abuse_types[i].checked)
		    {

			selected_types = selected_types + comma + abuse_types[i].value;			    
			comma = ',';	
			select_action = true;
		     }
	    }
	
    }
    if(select_action == false)
	{
	    document.getElementById('abuse_error_msg').innerHTML = 'Please select the reason of your complaint';
	}
    else
	{	 
	    var comment_id = document.getElementById('comment_id').value;
	    var comment_user_id = document.getElementById('comment_user_id').value;
	    var user_id = document.getElementById('user_id').value;
	    var postData ='abuse_types='+selected_types+'&comment_id='+comment_id+'&user_id='+user_id+'&comment_user_id='+comment_user_id;
	    YAHOO.util.Connect.asyncRequest('POST',system_base_url+'ajax/adda/_abuse_adda_photo_comment/', callback_adda_photo_comment_abuse, postData);
    if(env_value == 'Online')
	{
	    var url = system_base_url+'ajax/adda/_abuse_adda_photo_comment/';
	    pageTracker._trackPageview(url);
	}
    
   }
}



YAHOO.namespace("example.adda_photo_comment_abuse_container1");
function init_edit_adda_photo_comment() {
  // Instantiate the Dialog
  YAHOO.example.adda_photo_comment_abuse_container1.adda_photo_comment_abuse = new YAHOO.widget.Dialog("adda_photo_comment_abuse", 
									 { width : "50em",
									   context:["popup_context","tl","bl"],
									   visible : false,
									   modal:true,
									   constraintoviewport : false
                           });
	// Render the Dialog

  YAHOO.example.adda_photo_comment_abuse_container1.adda_photo_comment_abuse.render();
  YAHOO.example.adda_photo_comment_abuse_container1.adda_photo_comment_abuse.hide();
  YAHOO.example.adda_photo_comment_abuse_container1.manager = new YAHOO.widget.OverlayManager();
  YAHOO.example.adda_photo_comment_abuse_container1.manager.register([
								     YAHOO.example.adda_photo_comment_abuse_container1.adda_photo_comment_abuse
								      ]
								     );
 YAHOO.example.adda_photo_comment_abuse_container1.adda_photo_comment_abuse1 = new YAHOO.widget.Dialog("adda_photo_comment_abuse1", 
									 { width : "50em",
									   context:["popup_context","tl","bl"],
									   visible : false,
									   modal:true,
									   constraintoviewport : false
                           });
	// Render the Dialog

  YAHOO.example.adda_photo_comment_abuse_container1.adda_photo_comment_abuse1.render();
  YAHOO.example.adda_photo_comment_abuse_container1.adda_photo_comment_abuse1.hide();
  YAHOO.example.adda_photo_comment_abuse_container1.manager = new YAHOO.widget.OverlayManager();
  YAHOO.example.adda_photo_comment_abuse_container1.manager.register([
								     YAHOO.example.adda_photo_comment_abuse_container1.adda_photo_comment_abuse1
								      ]
								     );


}
YAHOO.util.Event.onDOMReady(init_edit_adda_photo_comment);
function comment_showReportAbusePopup(comment_id)
{  
  document.getElementById('comment_id').value = comment_id;
  document.getElementById('adda_photo_comment_abuse').style.display=''; 
  YAHOO.example.adda_photo_comment_abuse_container1.adda_photo_comment_abuse.show();
}
function adda_photo_comment_abuse_hideAbusePopup()
{
  YAHOO.example.adda_photo_comment_abuse_container1.adda_photo_comment_abuse.hide();
  document.getElementById('adda_photo_comment_abuse').style.display='none';
}
function closeAddaPhotoCommentPopup()
{
    YAHOO.example.adda_photo_comment_abuse_container1.adda_photo_comment_abuse1.hide();
}
