﻿$(document).ready(function() {
    $(".eb-dialog").boxy();
});
var ebBox = Boxy;
var ebDialog = {
	//loading  example   sDialog.loading("数据提交中。。。", 0, 300, 100);
    loading: function(msg, timeout, width, height, modal) {
        if (msg == '') { msg = '数据载入中，请稍候...'; }
        if (width=='undefined'||width==null) { width = 250; }
        var options = this._getOptions(width, height, modal);
		options = jQuery.extend(options, { closeDelay: 100000 });
        loadingBox = ebBox.loading(msg, options);
        return false;
    },
	//return options
    _getOptions: function(width, height, modal) {
        var options = {};
		options = jQuery.extend(options, { width: width});
        options = jQuery.extend(options, { height: height});
        options = jQuery.extend(options, { modal: modal});
        return options;
    },
	//hideLoading
    hideLoading: function() {
        try {
            loadingBox.hideAndUnload();
        } catch (e) { }
    },
    //domainBid Success
    domainBid:function(price,title,callback){
    var html='<p>' + title + '</p><div class="tip-d-grade">您的出价 ' + price + '</div>';
    return this.activeBox(html, 1800, '', callback, "tip-d");
    },
      //Guess Success
    guess:function(name,title,callback){
    var html='<p>' + title + '</p><div class="tip-d-grade">您的竞猜 ' + name + '</div>';
    return this.activeBox(html, 1000, '', callback, "tip-d");
    },
     //get div full content
    _getBox: function(objId, msg, cssName) {
        var html = $('<div></div>').attr("class", cssName).attr("id", "activeBox_" + objId).css({
            display: "none", position: "absolute",
            zIndex: ebDialog.getZIndex(), opacity: 1.0
        }).append(msg);
        return html;
    },
     getZIndex: function() {
        this.zIndex++;
        return this.zIndex;
    },
    zIndex: 2024,
    //close active msg
    activeClose: function(objId) {
        try {
            $('#activeBox_' + objId).stop().fadeOut("slow", function() { $('#activeBox_' + objId).remove(); });
        } catch (e) { }
    },
    //_close active
    _closeActive: function(objId, timeout, callback) {
        setTimeout(function() { ebDialog.activeClose(objId); }, timeout);
        if (callback) { callback(); }
    },
    //activeBox
    activeBox: function(msg, timeout, action, callback, cssName) {
        if (!cssName) { cssName = ''; }
        var html = this._getBox('', msg, cssName);
        var v = ebBox._viewport();
        html.appendTo(document.body);
        var left = v.left + (v.width) / 2 - html.width() / 2;
        var top = v.top + (v.height) / 2 - html.height() / 2;
        var tarTop = top - 120;
        if (tarTop < 0) { tarTop = 0; }
        html.css({ left: left, top: top }).stop().animate({
            top: tarTop, opacity: 'show'
        }, { duration: 900, complete: function() { ebDialog._closeActive('', timeout, callback); } });
        return false;
    }
};
   /*登录*/
    var login={
    show: function(userName)
        {
              ebDialog.loadIFrame("http://www.sodao.com/home/gift/giftwin?u=" + userName, "送礼", 630, 485,true);return false;
        }
    };
   
