/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
function utils(){
    this.strToObj=function(str){
    	//console.log(str)
        return eval('('+str+')')

    }

    this.waiter=function(){
        //console.log("waiting")
        if($("#grCache").length==0){
            $("body").append('<div class="ui-widget-overlay" id="grCache" style=" z-index: 1001;display:none"><img src="/new/media/img/icon/load_img.gif" style=" z-index: 1002;margin:auto;"/></div>');
        }
        this.centering($("#grCache img"),$(window))
        $("#grCache").fadeIn('fast')
        
    }

    this.dewaiter=function(){
        //console.log("dewaiting")
        $("#grCache").fadeOut('fast')
    }

    this.centering=function(elt,parent){
        var wi=$(elt).width()
        var he=$(elt).height()
        var pwi=$(parent).width()
        var phe=$(parent).height()
        if(arguments[2]=="width"){
            $(elt).css({
                position:"absolute",
                left:(pwi-wi)/2
            })
        }
        else if(arguments[2]=="height"){
            $(elt).css({
                position:"absolute",
                top:(phe-he)/2
            })

        }
        else{
            $(elt).css({
                position:"absolute",
                top:(phe-he)/2,
                left:(pwi-wi)/2
            })
        }
        
    }

}

utils=new utils()


