function GB_show(title,url,height,width,fun){
   var html = "<iframe id='GB_formTarget' name='GB_formTarget' frameborder='0' scrolling='no' style=\"width:"+width+"px;height:"+height+"px;\" src=''></iframe>";
    $.prompt(html, 
    {
        url:url,
        width:width,
        height:height
    });
    $("#GB_formTarget").attr("src",url);
    var winWidth = document.body.clientWidth;
    var winHeight = $(document).height();
    $(".jqititle").html(title);
    var _left = (winWidth - width)/2;
    var _top = (560 - height) / 2;
    $("div.jqi").css({ left: _left, top: _top,width:(width+30) });
    $("#jqiclose").hide();
    $("#jqifade").css({width:winWidth});
    if(fun)
        fun();
}

function GB_show_tip(title,url,height,width,fun){
   var html = "<iframe id='GB_formTarget' name='GB_formTarget' frameborder='0' scrolling='no' style=\"width:"+width+"px;height:"+height+"px;\" src=''></iframe>";
    $.prompt(html, 
    {
        url:url,
        width:width,
        height:height
    });
    $("#GB_formTarget").attr("src",url);
    var winWidth = document.body.clientWidth;
    var winHeight = $(document).height();
    $(".jqititle").html(title);
    var _left = (winWidth - width)/2;
    var _top = (560 - height) / 2;
    $("div.jqi").css({ left: _left, top: _top,width:(width+30) });
    $("div.jqiclose").unbind("click");
    
    $("div.jqiclose").click(function(){location.href="http://www.youhuiduo.net/RedLight.mvc/MyStore"});
   
    $("#jqifade").css({width:winWidth});
}

function GB_post(title,formID,height,width,fun){
    var html = "<iframe name='GB_formTarget' frameborder='0' scrolling='no' style=\"width:"+width+"px;height:"+height+"px;\" src=''></iframe>";
    $.prompt(html, 
    {
        url:"",
        width:width,
        height:height
    });
    var winWidth = document.body.clientWidth;
    var winHeight = $(document).height();
    $(".jqititle").html(title);
    var _left = (winWidth - width)/2;
    var _top = (560-height)/2;
    $("div.jqi").css({ left: _left, top: _top, width: (width + 30) });
    $("#jqifade").css({width:winWidth});
    setTimeout(
        function(){
            postCallbackFunction(formID,fun);
        }
    ,50);
}

function postCallbackFunction(formID,fun){
    $j("#"+formID).attr("target","GB_formTarget");
    $j("#"+formID).submit();
    if(fun)
        fun();
}

function GB_hide(fun){
    $(".jqiclose").click();
    if(fun)
        fun();
}

function GB_info(msg,fun,reWidth,reHeight){
    var width = 280;
    if (reWidth) {
        width = reWidth;
    }
    var height = 40;
    if (reHeight) {
        height = reHeight;
    }
    var html = '<div class="messageContent" style="height:'+height+'px;width:'+width+'px;">'+msg+'</div><div class="popusController"><input type="button" value="确定"/></div>';
    $.prompt(html, 
    {
        width:width,
        height:height
    });
    $(".jqititle").html("优惠多提示您");
    var winWidth = document.body.clientWidth;
    var winHeight = $(document).height();
    //$(".jqititle").html(title);
    var _left = (winWidth - width)/2;
    var _top = (560-height)/2;
    $("div.jqi").css({ left: _left, top: _top, width: (width + 30) });
    $(".popusController").bind("click",function(){
        GB_hide(fun);
    })
    $("#jqifade").css({width:winWidth});
}


function GB_Editor(html,editor){
    var winWidth = document.body.clientWidth;
    var winHeight = $(document).height();
	var width = 600;
	var height = 200;
    $.prompt(html,
    {
        width: width,
        height: height
    });
    var _left = (winWidth - width)/2;
    var _top = 10;
	$("#jqi").css({top:"10%"});
    $("div.jqi").css({left:_left,top:_top,background:"url()",display:"inline-block"});
	$("div.jqi .jqimessage").css({"min-width":width,"min-height":height,padding:10,top:0});
    $("#jqifade").css({width:winWidth});
    $(".jqititle").remove();
	editor.finish();
}

function GB_Html(title,html,width,height,fun){
    var winWidth = document.body.clientWidth;
    var winHeight = $(document).height();
	if(width == null)
	    width = 200;
	if(height == null)
	    height = 100;
    $.prompt(html,
    {
        width: width,
        height: height
    });
    var _left = (winWidth - width)/2;
    var _top = 10;
	$("#jqi").css({top:"10%"});
	$(".jqititle").html(title);
    $("div.jqi").css({left:_left,top:_top,background:"url()",display:"inline-block"});
	$("div.jqi .jqimessage").css({"min-width":width,"min-height":height,padding:10,top:0});
    $("#jqifade").css({width:winWidth});
    if(fun)
        fun();
}

function GB_img(url,alt,ImgWidth,ImgHeight){
    var img = new Image();
    img.src = url;
    var width = ImgWidth;
    if (!ImgWidth)
        width = img.width;
    var height = ImgHeight;
    if (!ImgHeight)
        height = img.height;
    if(!alt)
        alt = "点击图片返回";
    var html = '<img onclick="GB_hide();" src="'+url+'" alt="'+alt+'" style = "width:'+ImgWidth+'px;height:'+ImgHeight+'px" />';
    //alert(html);
    var winWidth = document.body.clientWidth;
    var winHeight = $(document).height();
    //$(".jqititle").html(title);
    $.prompt(html,
    {
        width: width,
        height: height
    });
    if(!width){
        width = 0;
    }
    if(!height)
        height = 0;
    var _left = (winWidth - width)/2;
    var _top = (560-height)/2;
    $("div.jqi").css({left:_left,top:_top,background:"url()"});
    $("#jqifade").css({width:winWidth});
    $(".jqititle").remove();
    
}
/**
function alert(str,fun){
	GB_info(str,fun);
}
**/

function GB_confirm(str,fun){
    var title = "是否继续操作";
    var html = "<center><br>"+str+"<br><br><br><input type=\"button\" id=\"OKBTN\" value=\"继续\"/> <input type=\"button\" onclick=\"GB_hide()\" value=\"取消\"/> </center>";
    GB_Html(title,html,300,100,function(){
        $("#OKBTN").click(function(){
            fun();
            GB_hide();
        });
    });
}

////专用，倒计时专用
function GB_timeSpan(fun){
    var html = '<span id="timeSpan"></span>';
        
        $.prompt(html,
        {
            width:100,
            height:190
        });
       
        var winWidth = document.body.clientWidth;
        var winHeight = $(document).height();
        var _left = (winWidth - 400)/2;
        var _top = (560-200)/2;
        $("div.jqi").css({left:_left,top:_top});
        $("#jqifade").css({width:winWidth});
        $(".jqititle").remove();
        //下面重新定义样式
        $("div .jqi").css({ background: "url(/Content/images/timeSpan.gif)", height: "92px", width: "434px" });
        $("#jqistates").css({ border: "none" });
        $("div .jqi .jqiclose").hide();

        if (fun != null) 
            fun();
}

function QuickTips(info, time, fun) {
	if(time==null)
		time = 1000;
	if(	$("#quickTipsContent").length==0){
		$(document.body).append("<div id=\"quickTipsContent\"><span></span><div id=\"close\"></div></div>");
		$("#quickTipsContent #close").click(
			function(){
				CloseQuickTipsStop = false;
				CloseQuickTips(fun);
			}
		);
		$("#quickTipsContent").hover(
			function(){
				CloseQuickTipsStop = true;
			},
			function(){
				CloseQuickTipsStop = false;
				setTimeout(function(){CloseQuickTips(fun);},time)
			}
		);
	}
	$("#quickTipsContent span").html(info);
	$("#quickTipsContent").css({ left: $("#member-tips").offset().left });
	$("#quickTipsContent").fadeIn(
		function(){
			setTimeout(function(){CloseQuickTips(fun);},time);
		}
	);
}
var CloseQuickTipsStop = false;
function CloseQuickTips(fun){
	if(CloseQuickTipsStop)
		return;
	//$("#quickTipsContent #close").hide();
	$("#quickTipsContent").fadeOut(fun);
}


//活动推荐弹出窗
function GB_AD(ADHtml, fun, reWidth, reHeight) {
    var width = 280;
    if (reWidth) {
        width = reWidth;
    }
    var height = 40;
    if (reHeight) {
        height = reHeight;
    }
    
    $.prompt(ADHtml,
    {
        width: width,
        height: height
    });
    $(".jqititle").html("优惠多向您推荐：");
    var winWidth = document.body.clientWidth;
    var winHeight = $(document).height();
    //$(".jqititle").html(title);
    var _left = (winWidth - width) / 2;
    var _top = (560 - height) / 2;
    $("div.jqi").css({ left: _left, top: _top, width: (width + 30) });
    $(".popusController").bind("click", function() {
        GB_hide(fun);
    })
    $("#jqifade").css({ width: winWidth });
}
