// JavaScript Document

String.prototype.trim = function() {
    return this.replace(/^\s+|\s+$/g,"");
}

function checkNewMessages()
{
var auto_refresh = setInterval(function (){
	$j.post('processing/MEMBER.php',{act:'isMessage'},function(messages){
		//alert(data);
		if(messages>0)
		{
			$j('#messages-area').show();
			$j('#message-counter').html(messages);
		}
	});		//post isMessage
},3000);
}


function loadArea(loadingArea, act, dataID)		//dataID is ref ID of data
{
	//alert(loadingArea);
	$j('#'+loadingArea).html(loading());
	$j.post('ajax/content.php', {act: act,
						 areaid: loadingArea,
						 dataid: dataID},function(data){
			//alert(data);
			$j('#'+loadingArea).html(data);
	});
}

function hideArea(hideArea)
{
	$j('#'+hideArea).html('');
}

function saveData(process, act, tbl, f, v, areaID)
{
	$j('#'+areaID).html(loading());
	$j.post(process, {act: act,
								 tbl: tbl,
								 f: f,
								 v: v},function(data){
			alert(data);
			$j('#'+areaID).html(data);
	});
}

function toggleArea(areaid)
{
	$j('#'+areaid).slideToggle('');
}


function loadNotificationPage(area)
{
	//alert(area);
	$j.post('inc/v-notification.php',{},function(data){
			$j('#'+area).html(data);
			//alert(data);
	});
}



function loading()
{
	return '<img src="iconset/working.gif" />';
}


function popup(URL) 
{
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=600,left = 400,top = 400');");
}