<div class="container">
    <div class="section">

      <div class="row" style="width:70%">
				
				<div class="row">
						<div class="col s12" id="thetopic" name="thetopic">
				
						</div>
						
				</div>
                

      </div>
      <div class="row">
        <div class="loader" id="theloaded" name="theloaded"></div>	 
      </div>
    </div>
</div>

<script type="text/javascript" language="javascript">
    $(document).ready(function() {
        $("#theloaded").hide();
        
        var id = getUrlParameterPlain("id");
        if(id == undefined || id == "")
        {
            id= "18003";
        }

        var url = "";

        var URL = "http://rosetaxis.dedicated.co.za:13085/gettopics/"+	id;
        	//var URL = "http://localhost:3085/login/"+$("#username").val()+"/"+$("#password").val();

        console.log(URL);
        $.ajax({
            url: URL,
            dataType: "jsonp",
            cache: false,
            timeout: 50000,
            jsonpCallback: "resultCall",
            success: function(data) {
               
                var _resultHtml = "";
                if(data.length > 0)
                {
                    for(i=0;i<data.length;i++)
                    {
                        var topic = data[i];
                        console.log(topic);
                        var url = "";
                        if(topic.title.indexOf("INDIA") < 0)
                        {
                            if(topic.youtube_id != null)
                            {
                                url = "<a  class='waves-effect waves-light btn'  href='?page=playvideo&video_id="+topic.youtube_id+"'>"+topic.title+"</a><br/><br/>";
                            }
                            else{
                                url = "<a  class='waves-effect waves-light btn'  href='?page=topics&id="+topic.pk+"'>"+topic.title+"</a><br/><br/>";
                            }
                        }
                        //var url = "<a  class='waves-effect waves-light btn'  href='?page=topics&id="+topic.pk+"'>"+topic.title+"</a><br/><br/>";
                        _resultHtml = _resultHtml + url;
                        //$("#result").html(steps);
                    }
                }
                else{
                    window.history.back();
                }
            
                console.log(_resultHtml);    
                $("#thetopic").html(_resultHtml);

           
                $("#theloaded").hide();        
                                
            },
            error: function(jqXHR, textStatus, errorThrown) {
                alert('error ' + textStatus + " " + errorThrown);
                //window.location = "clients";
            }
        });
    });


</script>