/*
This file sends an ajax request the popup ajax request file

and populates the div id popup with the result

Note: Make sure you have a div id popup inside your overlay container
*/
$(document).ready(function()
{
	
	BAM_AD_hide();
	
}
);

function sendPopupRequest(popuptype,extra_field)
{
	//Note: extra_field is an optional parameter. If you need to send any additional information to your popup then you can use this field
	
	if(extra_field == undefined)
	{
		extra_field = ""
	}
	$.post(
				"/includes/php/ajax_response/popup_selector.php",
				{
				  popuptype:popuptype,extra_field: extra_field
				  
				 
				},
				sendPopupRequestResponse,
				"json"
				
				);
}
function sendPopupRequestResponse(data)
{
	$('#popup').html(data[0])
	
	/*
	if this is the add to favorites article and we only have one child we send the 
	request to have this article added to the child's profile without showing the 
	popup
	*/
	if(data[1] == "adding_child" && data[2] == "1")
	{
		var topic_id = $('#topic_id_box').attr("value");
	    var article_id = $('#article_id_box').attr("value");
		
		saveArticleToChild(article_id,topic_id,data[3])
		
		
	}
	
	BAM_AD_show();
	
	
}