function load(div,action,value,silent)
{

   if(!silent){
      loader = $("#ajax-loader");
      container = $("#"+ge(div).id);
      off = $("#"+ge(div).id).offset();

      $("#ajax-loader").css("top",off.top);
      $("#ajax-loader").css("left",off.left);

      $("#ajax-loader img").css("top",(off.top + (container.height() / 2)) - off.top);

      loader.css("height",container.height());
      loader.css("line-height",container.height());
      loader.css("width",container.width());
      $("#ajax-loader").show();
    }


    var req = new JsHttpRequest();
    req.onreadystatechange = function() {
        if (req.readyState == 4) {

            if(!silent){
  	     $("#ajax-loader").hide();
	    }

            switch(action){
               case "chatsend":
                 ge("chat_message").value="";
                 ge(div).innerHTML = req.responseText;            
               break;
               case "edit_photos_list":

                ge(div).innerHTML = req.responseText;            

          	$(function() {
          		$(".my_photos").sortable();
          		$(".my_photos").disableSelection();
          	});

               break;
               default:
                 ge(div).innerHTML = req.responseText;            
           }
               

        }
    }    
    req.open(null, '/ajax.php', true);
    req.send( { q: value ,div: div, action:action} );
}

