//jQuery global function

 function populateElement(selector, defvalue) {
    if($.trim($(selector).val()) == "") {
        $(selector).val(defvalue);
    }
  
    $(selector).focus(function() {
        if($(selector).val() == defvalue) {
            $(selector).val("");
        }
    });
    
    $(selector).blur(function() {
        if($.trim($(selector).val()) == "") {
            $(selector).val(defvalue);
        }
    });
 }

function refreshActivity(timestamp){
	var remoteUrl = base_url+'feed/processRefresh';
	var functiondiv = "#functional-container";
	var upatediv = "#activity-latest";
	
	$(functiondiv).load(base_url+"feed/processRefreshButton", {}, function(){
	 });
 
	$.ajax({
	
		type: "post",
		url: remoteUrl,
		data: "frame="+timestamp,
		
		beforeSend: function(){
			$(functiondiv).html('<img src="/assets/mago/images/loading.gif" alt="updating" />');
			
		}, //show loading just when link is clicked 
		complete: function(){
			//$(functiondiv).html('<a href="javascript:void(0)" onclick="refreshActivity();return false;">refresh</a>');
			
		}, //stop showing loading when the process is complete 
		success: function(html){ //so, if data is retrieved, store it in html 
			//$(updatediv).html(html); //show the html inside .content div
			$(upatediv).prepend(html);
			$(upatediv).find('li').filter('[class=new-'+timestamp+']').effect("highlight", {}, 2000);

		}
	});
}


// init 

 // jquery.pngfix for IE6
 $(document).ready(function() {
  if ($.browser.msie && $.browser.version == '6.0') {
    jQuery(function($) {
	    $("img[@src$=png]").pngfix();
	});
  }
});