// JavaScript Document

function ajax_(url_,data_,success,loading){
	$.ajax({
		type:"POST",
		url:url_,
		data:data_,		
		beforeSend: function (){
			$(success).html(loading);
		},	
		success:function(html){	
			$(success).html(html);
		}	
	 });	
}

function clock(){
		var date = new Date();
		var strtime="<b style='color:#F58224; font-size:12px'>"+date.toLocaleTimeString( ) +"</b> "+date.toLocaleDateString( )
		$(".time_clock").html(strtime);
	}

$(document).ready(function(){
						   
	window.setInterval("clock();", 1000);	
	
	function displayTweet(){
	var i= 0;
	var limit = $("#twitter-results").size();
	var myInterval = window.setInterval(function () {
	var element =  $("#twitter-results div:last-child");
	$("#twitter-results").prepend(element);
	element.fadeIn("slow");
	i++;
	if(i==limit){
		 window.setTimeout(function () {
		 clearInterval(myInterval);
		 });
		}
		
	},2000);
  }
 	
	$("#twitterq").keyup(function(e){
			
			data = "keyword=" + $(this).attr("value");
			ajax_("module/search_auto.php",data,"#twitter-results","loading");	
			displayTweet();			
		
		return false;
	});
	

	$(".listlink h2").click(function(){
		$(this).next().slideToggle();
	})
	$("#source>ul").hide();
	//$("#support_online>div").hide();
	
	$("#new_category .category_parent .cat_content:first").show();
	$("#service_category .category_parent .cat_content:first").show();

	
})
