var t;
var img_true_b   = '<img src="/shop/images/true01.gif" />';
var img_true_s   = '<img src="/shop/images/true02.gif" />';
var img_false_b  = '<img src="/shop/images/wrong2.gif" />';
var img_false_s  = '<img src="/shop/images/wrong.gif" />';
var img_notice_b = '<img src="/shop/images/error02c.gif" />';
var img_notice_s = '<img src="/shop/images/error02.gif" />';
if (typeof(pup)=='undefined') {
    var pup = function (page,tit,params,callback){
    	$("#Layer1").css({"display":"block","top":(document.documentElement.scrollTop+40)+"px"});
    	$("#ma").css({"display":"block","height":document.documentElement.scrollHeight+"px"});
    	$("#loadPup").text("");
    	$("#loadPup").load(page,params,callback);
    	$("#tit").text(tit);
    }
}
if (typeof(closeDiv) == 'undefined') {
    var closeDiv = function (){
    	$("#Layer1").hide();
    	$("#ma").hide();
    }
}
if (typeof(closeDivoks) == 'undefined') {
    var closeDivoks = function (){
    	$("#Layer1").hide();
    	$("#ma").hide();
    }
}
/* 确认对话框 */
function confirmDialog(info,title,yes_callback,no_callback){
	if (t) clearTimeout(t);
	pup('/shop/templates/newtheme/inc/confirm.html','','',function () {
		if (info) $('#confirm_info').html(info);
		if (title) $('#confirm_title').html(title);
		document.getElementById('confirm_yes').onclick = function () { closeDiv(); if (yes_callback) { yes_callback(); }; };
		var func = function () { closeDiv(); if (no_callback) { no_callback(); } };
		document.getElementById("confirm_no").onclick = func;
		document.getElementById("confirm_no_img").onclick = func;
	});
}
/* 提示对话框 */
function alertDialog(info,title,yes_callback){
	if (t) clearTimeout(t);
	pup('/shop/templates/newtheme/inc/alert.html','','',function () {
		if (info) $('#alert_info').html(info);
		if (title) $('#alert_title').html(title);
		var func = function () { closeDiv();if (t) clearTimeout(t); if (yes_callback) { yes_callback(); } };
		document.getElementById('alert_yes').onclick = func;
		document.getElementById('alert_no_img').onclick = func;
		t=setTimeout(func,5000);
	});
}

/*留言*/
function leaveAMessage() {
    var title = "留言";
    if ($.cookie('MEMBERID')==null) {
    	pup('/shop/templates/newtheme/inc/login.php?reqUrl='+window.location.href+'&r='+Math.random(),'400');
    	return false;
    }
    var p = 0;
    var m = $("#msgc").val();
    if(m == "" || m == "请在这里留言！") {
    	alertDialog("留言内容不能为空！",title);
   		return false;
    }
    document.getElementById('msgc_btn').onclick='';
	$.get("/shop/jqmsg.php", {m: m, p: p}, function(data) {
		if(data == "ok") {
			alertDialog("您的留言已经提交！",title,function () {
				$("#msgc").val('');
				$("#msgc").focus();
			});
		}
		else 
			alertDialog("系统繁忙，请重试！",title);
		document.getElementById('msgc_btn').onclick=leaveAMessage;
	});
}

$(document).ready(function () {
	try{
		$(".hzhb .cont ul li:last-child").css("border",0);
		$(".dt .cont div.clearfix:last-child").css("border-bottom",0);
		adjustImageWidth('cominfo_avator',200,200);
	} catch (E){alert(E)}
});

