/*
 * hipic.web.app
 * Copyright(c) 2010, FeiKan.
 * 
 * This code is licensed under BSD license. Use it as you wish, 
 * but keep this copyright intact.
 */


$(function()
{app.ui.loading2=function(elem)
{var em=elem.children('.ui-loading2');if(!em.length)
{elem.children().hide();em=$('<em class="ui-loading2"></em>').appendTo(elem);}
var setPos=function()
{var x=(elem.width()-em.width())/2;var y=(elem.height()-em.height())/2;em.css({left:x+'px',top:y+'px'});};var onResize=function()
{setPos();};elem.bind('holderresize',onResize);return{show:function()
{setPos();return this;},hide:function()
{em.remove();elem.unbind('holderresize',onResize).children().show();return this;},center:function()
{setPos();return this;}};}
$.extend(window,{UI_LOADING2:app.ui.loading2});});
