// JavaScript Document
$(document).ready(function() {
getNepaliTime();
$('#commentholder').hide();	
$('#wlocations').hide();
 // hides the slickbox as soon as the DOM is ready (a little sooner that page load)
getWeather(1, 'Kathmandu');

  $('#wlocations').hide();
  
  $('#showlocations').click(function() {
    $('#wlocations').slideToggle(600);
    return false;
  });
  $('#togglecomments').click(function() {
	var stt=document.getElementById("commentholder").style.display;
	$('#commentholder').slideToggle("slow");
	if(stt=="none")
	{
		$("#expandcollapse").empty();
	    $("#expandcollapse").html("-");
	}else{
		$("#expandcollapse").empty();
	    $("#expandcollapse").html("+");
	}
    return false;
  });
  
});
function getWeather(id,city)
{				
				$("#wlocations").hide();
				 $.ajax({
					   type: "POST",
					   url: "ajax/getweather.php",
					   data: "id="+id,
					 	beforeSend: function(){
						   $("#currentcity").html("<img src='images/loader.gif' align='absmiddle' width='20' height='8'>")
						   $("#temperatures").html("<img src='images/loader.gif' align='absmiddle' width='20' height='8'>")
					   },
					    success: function(msg){
						 
						 	$("#currentcity").html(city+", Nepal");
							$("#temperatures").html(msg);
						 }
 				});
	
}
function getNepaliTime()
{
	//$('#datetime').empty();
	$.ajax({
		   type:"POST",
		   url: "ajax/datetime.php",
		   success : function(msg){
			   $('#datetime').html(msg);
			}
    });
//	$('#datetime').load("ajax/datetime.php");
	setTimeout("getNepaliTime()",1000);
}
