/* Javascript Show hide Used By Breaking news */

$(document).ready(function()
{
  var no = $("em").attr("title");
  //var no = $("span").val();
  //$("div").text(title);
  //alert(getBNACookie('show_message'));
  if(readCookie('show_message')!=no)
  {
     // var pos=parseInt($(window).scrollTop())+parseInt($(window).height());
     // $('#breakingnews-alert-w').css("top",pos-26+"px");
      $('#breakingnews-alert-w').show(); //display the message box
   
      //scroll the message box to the top offset of browser's scrool bar
	 /* $(window).scroll(function()
	  {
  	     var pos=parseInt($(window).scrollTop())+parseInt($(window).height());
        $('#breakingnews-alert-w').animate({top:pos-26+"px" },{queue: false, duration: 500});  
	  }); */
    }
   //when the close button at right corner of the message box is clicked 
	$('#breakingnews-alert-close').click(function()
	{
  		//the messagebox gets scrool down with top property and gets hidden with zero opacity 
		//$('#breakingnews-alert-w').animate({ top:"-=15px",opacity:0 }, "slow");
		//Added which removed the breaking news in slow motion
		$('#breakingnews-alert-w').hide("slow");
        setCookie('show_message',no,1); //cookies is set to no value
	});
});

////function to set the cookie name, values and expiry time in hours 
//function setBNACookie(c_name,value,expireHours)
//{
//  var exhour=new Date(); //create the current date object
//  exhour.setHours(exhour.getHours()+1);
//  document.cookie=c_name+ "=" +escape(value)+
//  ((expireHours==null) ? "" : ";expires="+exhour.toGMTString());
//}

////function to get the value from cookie name
//function getBNACookie(c_name)
//{
//  if (document.cookie.length>0)
//  {
//    c_start=document.cookie.indexOf(c_name + "=");
//    if (c_start!=-1)
//    { 
//      c_start=c_start + c_name.length+1; 
//      c_end=document.cookie.indexOf(";",c_start);
//      if (c_end==-1) c_end=document.cookie.length;
//        return unescape(document.cookie.substring(c_start,c_end));
//    } 
//  }
//  return "";
//}
