featuredCircle = {};




featuredCircle.removeCircle = function(circleId,circleTitle){


		var dialogDiv = document.createElement("div");
		dialogDiv.id = "dialog_"+circleId;
		dialogDiv.className='flora';
		htmlStr = "<div id='dialogMessage' style='margin-bottom: 10px;'>Are you sure that you want to remove  "+unescape(circleTitle)+" from the front page? </div>";
		
		
		$(dialogDiv).html(htmlStr);		
	
		$("#bodyRight").append(dialogDiv);
		
		var finished = document.createElement("div");
		finished.id = "finished_"+circleId;
		finished.className='flora';
		var finishedStr = "<div id='finishedMessage' style='margin-bottom: 10px;'>"+unescape(circleTitle)+" has been removed from the front page.</div>"
		
		$(finished).html(finishedStr);
		
		var cs = document.getElementById("content");
		cs.appendChild(dialogDiv);
		
		//$("#dialogContent").load("/api/featured.php?c=getCircle&circleId="+circleId);		
		
		$("#dialog_"+circleId).dialog(
			{
			width: 300,
			height: 200,
			buttons: { 
      		  "Ok": function() { 
      	      	
      	  //     var optionalText = $('#optionalText').val();      	      	
      	      	url = "/api/featured.php?c=removeCircle&circleId="+circleId;
      	      	
      	      	var dialogFoo = $(this);
      	        	      	
      	      	$.getJSON(url, function(response){
      	      		 
      	      		 
      	      		 $(dialogFoo).dialog("close");
		      	   	 $(dialogFoo).remove();
		      	   	 $("#bodyRight").append(finished);
		      	   	 $(finished).dialog({buttons: {"Ok": function(){
		      	   	 	$(finished).dialog("close");
		      	   	 	$(finished).remove();
		      	   	 	 window.location="/";
		      	   	 }
		      	   	 }});
		      	     
      	      	});
      	      	
      	      	
      	      	
       		   }, 
       		 "Cancel": function() { 
          	  $(this).dialog("close"); 
          	  $(this).remove();
        	} 
  	  		}});

		



}

featuredCircle.featuredCircle = function(circleId,circleType){


		var dialogDiv = document.createElement("div");
		dialogDiv.id = "dialog_"+circleId;
		dialogDiv.className="flora";

		htmlStr = "<div id='dialogMessage' style='margin-bottom: 10px;'>This is a preview of what the card will look like. Click OK to accept</div>";
		htmlStr += "<div id='dialogContent' style='width: 200px; margin-bottom: 10px;'></div>";
		
		
		var scr = document.createElement("script");
			$(scr).attr("type","text/javascript");
			

		
		txtStr = "$('#optionalText').keyup(function(){$('.featuredUserTxt').text($('#optionalText').val());});";
		$(scr).text(txtStr);		
	
		$(dialogDiv).html(htmlStr);
		
		dialogDiv.appendChild(scr);
		
		var cs = document.getElementById("content");

		cs.appendChild(dialogDiv);
		

		
		
		$("#dialogContent").load("/api/featured.php?c=getCircle&circleId="+circleId);		
		
		
		
		$("#dialog_"+circleId).dialog(
			{
			width: 600,
			height: 500,
			buttons: { 
      		  "Ok": function() { 
      	      	
      	  //     var optionalText = $('#optionalText').val();
      	       
      	       
      	      	
      	      	url = "/api/featured.php?c=setCircle&circleId="+circleId+"&circleType="+circleType;
      	      	
      	      	var dialogFoo = $(this);
      	        	      	
      	      	$.getJSON(url, function(response){
      	      		 $(dialogFoo).dialog("close");
		      	      $(dialogFoo).remove();
		      	      window.location="/";
      	      	});
      	      	
      	      	
      	      	
       		   }, 
       		 "Cancel": function() { 
          	  $(this).dialog("close"); 
          	  $(this).remove();
        	} 
  	  		}});

		



}