﻿$(function(){
	$("a.twit").click(function(){

	var word = $(this).attr("title");
	if(!word) return false;

	var num = $(this).attr("num");
	if(!num) return false;

	$.ajax({
		beforeSend: function(){
			$("#result"+num).html('<img src="../img/loader2.gif">');
		},

		type: "GET",
		url: "http://www.twiword.net/s/twitter.php",
		data: "word=" + word,
		async: true,
		success: function(data){
			if(data) {
				$("#result"+num).html(data);
				}
		},
		error: function(){ alert("AJAX ERROR!") ;}
	});
	return false;
	});
});

$(function(){
	$("a.out").click(function(){
	var num = $(this).attr("num");
	if(!num) return false;
	$("#result"+num).html("");
	return false;
	});
});


$(function(){
	$("a.follow").click(function(){

	var username = $(this).attr("username");
	if(!username) return false;

	var statuses = $(this).attr("statuses");
	if(!statuses) return false;

	$.ajax({
		beforeSend: function(){
			$("#follower").html('<img src="../img/loader2.gif">');
		},

		type: "GET",
		url: "http://www.twiword.net/user/twitter.php",
		data: "username=" + username + "&statuses=" + statuses,
		async: true,
		success: function(data){
			if(data) {
				$("#follower").html(data);
				}
		},
		error: function(){ alert("AJAX ERROR!") ;}
	});
	return false;
	});
});

$(function(){
	$("a.out").click(function(){
	var username = $(this).attr("username");
	if(!username) return false;
	$("#follower").html("");
	return false;
	});
});



$(function(){
	$("a").click(function(){
	var username = param["username"];
	var graph_width = param["graph_width"];
	var graph_height = param["graph_height"];
	var color = param["color"];
	var txt = param["txt"];

	$.ajax({
		beforeSend: function(){
			$("#PartsGraph").html('<img src="../img/loader2.gif">');
		},

		type: "GET",
		url: "http://www.twiword.net/graph/index.php",
		data: "username=" + username + "&graph_width=" + graph_width + "&graph_height=" + graph_height + "&color=" + color + "&txt=" + txt,
		async: true,
		success: function(data){
			if(data) {
				$("#PartsGraph").html(data);
				}
		},
		error: function(){ alert("AJAX ERROR!") ;}
	});
	return false;
	});
});

