﻿function getMsgWindow(Msg)
{
    var MsgWindow = "";
    MsgWindow += "<div>";
    MsgWindow += "<div onclick=\"hideLoader(100);\" style=\"text-align:right;border-bottom:1px #ccc solid;cursor:pointer;cursor:hand;\">[close]</div>";
    MsgWindow += "<div style=\"padding:15px;\">";
    MsgWindow += Msg;
    MsgWindow += "</div>";
    MsgWindow += "</div>";
    return MsgWindow;
}
function showLoaderMsg(Msg)
{
    if (google) google.setOnLoadCallback(new function(){
        jQuery.blockUI({ message:getMsgWindow(Msg) ,overlayCSS:{backgroundColor:'#fff'},css: { 
            border: '1px solid #ccc', 
            padding: '3px', 
            backgroundColor: '#efefef', 
            '-webkit-border-radius': '10px', 
            '-moz-border-radius': '10px', 
            opacity: '1', 
            color: '#444',
            'cursor':'text'
        }});        
        hideLoader(3000);
    });
}
function showLoader()
{
    try
    {       
        jQuery.blockUI({
            message:'<img src="http://www.ihaoke.com/web/img/ajax-loader.gif" alt="loading img">',
            overlayCSS:{backgroundColor:'#fff'},
            css: {border:'none', padding:'0px', backgroundColor: '#fff', '-webkit-border-radius': '10px','-moz-border-radius': '10px',opacity: '0.5'}
        });
        return true;
    }
    catch(e){self.status=e.message;}
}

function hideLoader(sec)
{
    try
    {
        if (!sec) sec= 2000;
        setTimeout(jQuery.unblockUI, sec); 
    }
    catch(e){self.status=e.message;}
} 

function autoShowLoader()
{
    try
    {
        if (isAutoShow) showLoader();//setTimeout("showLoader();",300);
    }
    catch(e){self.status=e.message;}
}

function showElementLoaderMsg(id,msg)
{
    try
    {       
        jQuery(id).block({
            message:msg,
            overlayCSS:{backgroundColor:'#fff'},
            css: {border:'none', padding:'0px', backgroundColor: '#ccc', '-webkit-border-radius': '10px','-moz-border-radius': '10px',opacity: '0.5'}
        });
        return true;
    }
    catch(e){self.status=e.message;}
}

function showElementLoader(id)
{
    try
    {       
        jQuery(id).block({
            message:'<img src="http://www.ihaoke.com/web/img/ajax-loader.gif" alt="loading img">',
            overlayCSS:{backgroundColor:'#ccc'},
            css: {border:'none', padding:'0px', backgroundColor: '#ccc', '-webkit-border-radius': '10px','-moz-border-radius': '10px',opacity: '0.5'}
        });
        return true;
    }
    catch(e){self.status=e.message;}
}

function hideElementLoader(id,sec)
{
    try
    {
        if (!sec) sec= 2000;
        setTimeout(function(){jQuery(id).unblock();}, sec);
    }
    catch(e){self.status=e.message;}
} 