/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
function newsNext(update_date,cont_id)
{
    //alert(document.getElementById('next_news_image').title)
    //var msg_loading = "Loading...<br/><img src=\"img/loading/loading.gif\" width=\"100px\" height=\"20px\" border=\"0\" />";
    // $("#latest_news1").html(msg_loading);
  
    //alert('news/latest_news.jsp?cont_id=' + cont_id+'&update_date=' + update_date)
//alert(update_date)
//alert(cont_id)
    if(document.getElementById('next_news_image').title=='Next News')
    {
        var msg_loading = "Loading...<br/><img src=\"img/loading/loading.gif\" width=\"100px\" height=\"20px\" border=\"0\" />";
        $("#latest_news1").html(msg_loading);
        $("#latest_news1").load('news/latest_news.jsp?cont_id=' + cont_id+'&update_date=' + update_date, function(response, status, xhr) {
            if (status == "success") {
                //alert(response);
                var msg = response;
                $("#latest_news1").html(msg);
                $("#latest_news1").html(msg);
                $("#previous_news_image").attr({
                    src: "news/previous.gif",
                    title: "Previous News"

                });
                if(document.getElementById('curNewsNext_date').innerHTML=='0')
                {
                    //alert('next end');
                    $("#next_news_image").attr({
                        src: "news/next_dim.gif",
                        title: "End of  News"

                    });
                }
            }
            else if (status == "error") {
                var msg = "Sorry Internal System Error has Occurred  ";
                $("#latest_news1").html(msg);
            }
        });
    }
 

}
function newsPrev(update_date,cont_id)
{
    //alert(update_date)
    //var msg_loading = "Loading...<br/><img src=\"img/loading/loading.gif\" width=\"100px\" height=\"20px\" border=\"0\" />";
    // $("#latest_news1").html(msg_loading);
   
    //alert('news/latest_news.jsp?cont_id=' + cont_id+'&update_date=' + update_date)
    if(document.getElementById('previous_news_image').title=='Previous News')
    {
        var msg_loading = "Loading...<br/><img src=\"img/loading/loading.gif\" width=\"100px\" height=\"20px\" border=\"0\" />";
        $("#latest_news1").html(msg_loading);
        $("#latest_news1").load('news/latest_news_previous.jsp?cont_id=' + cont_id+'&update_date=' + update_date, function(response, status, xhr) {
            if (status == "success") {
                // alert(response);
                var msg = response;
                $("#latest_news1").html(msg);
                $("#next_news_image").attr({
                    src: "news/next.gif",
                    title: "Next News"

                });
                if(document.getElementById('curNewsPrev_date').innerHTML=='0')
                {
                    //alert('prev end');
                    $("#previous_news_image").attr({
                        src: "news/previous_dim.gif",
                        title: "End of  News"

                    });
                }
            }
            else if (status == "error") {
                var msg = "Sorry Internal System Error has Occurred  ";
                $("#latest_news1").html(msg);
            }
        });
    }
   


}
function showHotDetail(cont_id,title)
{
    //alert(cont_id + "from show detail");
    //alert(123);
    if (window.XMLHttpRequest)
    {
        xmlhttp_hot_news=new XMLHttpRequest();
    }
    else
    {
        xmlhttp_hot_news=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp_hot_news.onreadystatechange=function()
    {
        
        if (xmlhttp_hot_news.readyState==4 && xmlhttp_hot_news.status==200)
        {//alert(xmlhttp.responseText);
            document.getElementById("div1").innerHTML=xmlhttp_hot_news.responseText;
        }
    }
    //xmlhttp.open("get","news/hotnews.jsp?cont_id=CTC01",true);
    xmlhttp_hot_news.open("get","news/hotnews.jsp?cont_id=" + cont_id+ "&news="+ title,true);

    xmlhttp_hot_news.send();
}


function newsNextold(newsid)
{
    //var msg_loading = "Loading...<br/><img src=\"img/loading/loading.gif\" width=\"100px\" height=\"20px\" border=\"0\" />";
    // $("#latest_news1").html(msg_loading);
    $.ajax({
        type: "GET",
        url: "news/nextNews.jsp",
        data: "newsId=" + newsid ,
        success:   function(msg){
            var result=$.trim(msg);
            if(result=='no record')
            {
                //alert(result);

                $("#next_news_image").attr({
                    src: "news/next_dim.gif",
                    title: "End  of News",
                    alt: "End of News"
                    
                });
            // $("#latest_news1").html("End of Records Go back to see the previous News");
           

            }
            else
            {
                $("#latest_news1").html(result);
                
                $("#previous_news_image").attr({
                    src: "news/previous.gif",
                    title: "Previous News"
                    
                });
            }
     

        }

    });
 

}
function newsPrevold(newsid)
{
    // var msg_loading = "Loading...<br/><img src=\"img/loading/loading.gif\" width=\"100px\" height=\"20px\" border=\"0\" />";
    // $("#latest_news1").html(msg_loading);
    $.ajax({
        type: "GET",
        url: "news/previousNews.jsp",
        data: "newsId=" + newsid ,
        success:   function(msg){
            var result=$.trim(msg);
            if(result=='no record')
            {
                // alert(result);
                $("#previous_news_image").attr({
                    src: "news/previous_dim.gif",
                    title: "Start of News",
                    alt: "Start of News"
                });
            // $("#latest_news1").html("End of Records Go back to see the previous News");
            }
            else
            {
                $("#latest_news1").html(result);
              
                $("#next_news_image").attr({
                    src: "news/next.gif",
                    title: "Next News"
                    
                });
            }

        }
    });


}
