$(document).ready(function() {		
	$("a.showToolTip").ToolTip();
});

function execute(url,target1,target2)
{
	$("#tooltip_div").remove();
	$('#' + target2).html('');
	$('#' + target1).html('<img src="http://www.kapanlagi.com/v4/i/ajaxloading.gif" alt="" width="16" height="16" /> Mengambil data...');
	$('#' + target1).load(url);
	return false;
}

function execute_addfriends(url)
{	
	$.get(url, function(data){
		var r = data.split("||");
		alert(r[0]);
		window.location = r[1];
	});
	return false;
}

function klfbcmd(x,y,z) {
	$.post('/modules/share.php', {date:x, url:y, a:z}, function(data) {
		if (data == "ok") {
			$.post('/modules/share.php', {date:'load', url:'load', a:z}, function(data2) {
				$('#share'+z).html(data2);
			});
		}
	});
}

function send_shout() {
	var data = $.trim($('#shout').val());
	if (data != '') {
		//var tmp = $('.cshout').html();
		//$('.cshout').html('<img src="http://www.kapanlagi.com/i/v2/indicator_remembermilk_orange.gif"> sedang proses...');
		$.post('modules/shout_module.php', {messg: data, type: 'add'}, function(mess) {
			//$('.cshout').html(tmp);
			if (mess.match(/^success\|\|/g)) {
				mess = mess.replace(/^success\|\|/g, '');
				//$('#shout').val(mess);
				$('#formtoppost').after(mess);
			}
		});
	}
}

function show_shout(id, pages,ssid,sshow,placed) {
//	$("#shoutcomment").html('<img src="http://www.kapanlagi.com/i/v2/indicator_remembermilk_orange.gif"> mengambil data...');
	$.post('modules/shout_module.php', {uid: id, sid:ssid, page: pages, type: sshow}, function(mess) {
		$('#'+placed).html(mess);
//		window.location.href = '#topshout';
	});
}

function send_shout_comment(idshout) {
	var data = $.trim($('#sshout'+idshout).val());
	var ids = $.trim($('#tid'+idshout).val());
	if (data != '' && ids != '') {
//		var tmp = $('.toshout1').html();
//		$('.toshout1').html('<img src="http://www.kapanlagi.com/i/v2/indicator_remembermilk_orange.gif"> sedang proses...');
		$.post('modules/shout_module.php', {messg: data, idshout: ids, type: 'comment'}, function(mess) {
//			$('.toshout1').html(tmp);
			if (mess.match(/^success\|\|/g)) {
				mess = mess.replace(/^success\|\|/g, '');
				$('#toshout'+idshout).before(mess);
				$('#newcomment'+idshout).hide();
				$('#toshout'+idshout).hide(1000);
//				$('#idhrshout').hide();
				$('#newcomment'+idshout).show(1000);
			}
		});
	}
}

function addimport(n, c) {
	var curr = $('#idcon'+c).html();
	$('#idcon'+c).html('<br/><br/><br/><img src="http://www.kapanlagi.com/v4/i/ajaxloading.gif" alt="" title=""/>');
	$.post('modules/klupload_module.php', {p:n}, function (data) {
		$('#idcon'+c).html(curr);
		$('#info').html(data).addClass('ipmess').fadeIn('slow');
		$('#info').animate({opacity: 1.0}, 3000).fadeOut('slow', function() { $(this).html(''); $(this).removeClass('ipmess'); });
	});
}

function togel(c) {
	$('.ipcheckbox').each(function() {
		if (c) {
			$(this).attr('checked', 'checked');
		}
		else {
			$(this).removeAttr('checked');
		}
	});
}

function importall() {
	$('.ipcheckbox:checked').each(function() {
		var xt = $(this).attr('id').replace('idck', '');
		addimport($(this).val(), xt);
		$(this).removeAttr('checked');
	});
}

function removeshout(uuid, id, ssid, conid) {

	$.post('modules/shout_module.php', {uid:uuid, idshout: id, sid:ssid, type: 'del'}, function(mess) {
		if (mess == 'false')
		{
			alert('Gagal menghapus komentar, silahkan coba beberapa saat lagi.');
		}
		else
		{
			$('#'+conid + id).html(mess);
		}
	});
}

function removestat(id) {
	if (confirm('Anda yakin status ini dihapus?')) {
		$.post('modules/shout_module.php', {idshout: id, type: 'delstatus'}, function(mess) {
			if (mess == 'false')
			{
				alert('Gagal menghapus status Anda, silahkan coba beberapa saat lagi.');
			}
			else
			{
				document.location.href = 'http://face.kapanlagi.com/shout.php';
			}
		});
	}
}

function showhidecomm(conid) {
	if ($(conid).is(':hidden')) {
		$(conid).show("slow");
	}
	else {
		$(conid).hide("slow");
	}
}

function showcomm(conid,idm) {
	if ($(conid).is(':hidden')) {
		var id = conid.replace(/[^0-9]/g, '');
		$.post('modules/shout_module.php', {uid: idm, sid:id, page: 0, type: 'showall2'}, function(mess) {
			$(conid).html(mess);
			showhidecomm(conid);
		});
	}
	else	{
			showhidecomm(conid);
	}
}
/* end of file */