function DivAlert(messageDiv){
this.messageDIV=messageDiv;
//创建提示框底层
this.bottomDIV = document.createElement("div");
//配置样式
this.bottomDIV.style.opacity="0.50";
this.bottomDIV.style.filter="Alpha(opacity=50);";
this.bottomDIV.style.backgroundColor="#000";
var height = document.body.scrollHeight;
if(height < document.body.clientHeight)
height = document.body.clientHeight;
if(height < document.documentElement.clientHeight)
height = document.documentElement.clientHeight;
if(height < document.documentElement.scrollHeight)
height = document.documentElement.scrollHeight;
this.bottomDIV.style.height=height+"px";
if(window.screen.width>document.body.scrollWidth)
{
this.bottomDIV.style.width=window.screen.width+"px";
}else
{
this.bottomDIV.style.width=document.body.scrollWidth+"px";
}
//获取body中间点
var x=this.bottomDIV.style.width.replace("px","")/2;
this.bottomDIV.style.marginTop="0px";
this.bottomDIV.style.marginLeft="0px";
this.bottomDIV.style.position="absolute";
this.bottomDIV.style.top="0px";
this.bottomDIV.style.left="0px";
this.bottomDIV.style.zIndex=100;
this.show = function(){
//显示提示框底层
document.body.appendChild(this.bottomDIV);
this.messageDIV.style.display='block';
//把messageDIV定位到body中间
this.messageDIV.style.position="absolute";
x=x-this.messageDIV.clientWidth/2;
this.messageDIV.style.left=x+"px";
this.messageDIV.style.top="50px";
this.messageDIV.style.zIndex=110;
}
this.hide = function(){
//移除提示框底层
document.body.removeChild(this.bottomDIV);
this.messageDIV.style.display='none';
}
}
var dc;
function showDialogDiv(divId){
//创建提示框内容部分
var d = document.getElementById(divId);
dc = new DivAlert(d);
//显示提示框
dc.show();
}
function hideDialogDiv(){
//移除对话框
dc.hide();
}
$(document).ready(function(){
$("#share_tr").hover(function(){
$(".share_img").attr("src","/images/new_index/music3-2.jpg");
$(".share_font").css("color","#e40080");
var x= ($(this).offset().top+25)+"px";
var y=($(this).offset().left-15)+"px";
$(".push_icon").css({top:x,left:y}).show();
},function(){
$(".share_img").attr("src","/images/new_index/music_s.png");
$(".share_font").css("color","#898989");
$(".push_icon").hide();
});
$(".push_icon").hover(function(){
$(".share_img").attr("src","/images/new_index/music3-2.jpg");
$(".share_font").css("color","#e40080");
$(this).show();
},function(){
$(".share_img").attr("src","/images/new_index/music_s.png");
$(".share_font").css("color","#898989");
$(this).hide();
});
//WEB單書頁加上二手書退貨說明
var offset=$(".snd_info h1").offset();
if(typeof(offset)!="undefined" && null!=offset){
var offsetTop=(offset.top+20)+"px";
var offsetLeft=(offset.left)+"px";
$(".snd_info h1").mousemove(function(){
$(".snd_info div").css({top:offsetTop,left:offsetLeft}).show();
} );
}
/*
*图书借阅
**/
if($.browser.mozilla){
$(".lend_books_info .title").css("line-height","20.6px");
}
var _lend_offset=$(".lend_books").offset();
if(typeof(_lend_offset)!="undefined" && null!=_lend_offset)
{
var _lend_offsetTop=(_lend_offset.top+30)+"px";
var _lend_offsetLeft=(_lend_offset.left-25)+"px";
$(".lend_books").hover(function(){
$(".lend_books .icon").css("background-position","-22px -1px");
$(".lend_books .title").css("color","#E2007D");
$(".lend_books_info").css({top:_lend_offsetTop,left:_lend_offsetLeft}).fadeIn("slow");
},function(){
$(".lend_books .icon").css("background-position","0 0");
$(".lend_books .title").css("color","#898989");
$(".lend_books_info").hide();
});
$(".lend_books_info").hover(function(){
$(this).show();
$(".lend_books .icon").css("background-position","-22px -1px");
$(".lend_books .title").css("color","#E2007D");
},function(){
$(".lend_books .icon").css("background-position","0 0");
$(".lend_books .title").css("color","#898989");
$(this).hide();
});
$(".lend_books_info .lend_books_info_a").hover(function(){
$(this).css("color","#E2007D");
$(this).css("text-decoration","underline");
},function(){
$(this).css("color","#313131");
$(this).css("text-decoration","underline");
});
$(".lend_books_info .icon").hover(function(){
$(this).css("color","#E2007D");
$(this).css("text-decoration","none");
},function(){
$(this).css("color","#313131");
$(this).css("text-decoration","none");
});
var isOpen=false;
$(".lend_books_info .icon").click(function(){
$(".lend_books_info .icon").unbind("mouseleave");
if(isOpen){
$(".lend_books_info .icon").css("color","#313131");
$(".lend_books_info .title").slideUp(500);
$(".lend_books_info .close .close_icon").slideUp(500,function(){
$(".lend_books_info a").css({
"padding-right":"0"
});
$(".lend_books_info").css({
"background":'url("/include/new_index/imgs/lend_books_icon2.png")  no-repeat',
"width":"130px",
"height":"125px"
});
});
isOpen=false;
}else{
$(".lend_books_info .icon").css("color","#E2007D");
$(".lend_books_info").css({
"background":'url("/include/new_index/imgs/lend_books_icon3.png")',
"width":"213px",
"height":"360px"
});
$(".lend_books_info a").css({
"padding-right":"85px"
});
$(".lend_books_info .title").slideDown(500);;
$(".lend_books_info .close .close_icon").slideDown(500);;
isOpen=true;
}
//当鼠标移回去的时候，重新绑定mouseleave事件，否则移开div的时候，就不隐藏
$(".lend_books_info .icon").mouseenter(function(){
$(this).bind("mouseleave", function(){
$(this).css("color","#313131");
$(this).css("text-decoration","none");
});
});
});
$(".close_icon").hover(function(){
$(this).css("background-position","0 -50px");
},function(){
$(this).css("background-position","0 -23px");
});
$(".close_icon").click(function(){
//解除lend_books_info离开的时候隐藏的事件，否则当缩回去的时候会隐藏
$(".lend_books_info").unbind("mouseleave");
$(".lend_books_info .title").slideUp(500);
$(".lend_books_info .close .close_icon").slideUp(500,function(){
$(".lend_books_info a").css({
"padding-right":"0"
});
$(".lend_books_info").css({
"background":'url("/include/new_index/imgs/lend_books_icon2.png") no-repeat',
"width":"130px",
"height":"125px"
});
});
isOpen=false;
//当鼠标移回去的时候，重新绑定mouseleave事件，否则移开div的时候，就不隐藏
$(".lend_books_info").mouseenter(function(){
$(this).bind("mouseleave", function(){
$(".lend_books .icon").css("background-position","0 0");
$(".lend_books .title").css("color","#D0D0D0");
$(this).hide();
});
});
});
}
//鼠标移上去后，显示发生变化
$(".i_sell_icon").hover(function(){
$(".i_sell_icon .icon").css("background-image","url('/include/default/imgs/icon2.png')");
$(".i_sell_icon .title").css("color","#E3007F");
var x= ($(this).offset().top+25)+"px";
var y=($(this).offset().left-35)+"px";
$(".i_sell_dialog").css({top:x,left:y}).fadeIn("normal");
},function(){
$(".i_sell_icon .icon").css("background-image","url('/include/default/imgs/icon1.png')");
$(".i_sell_icon .title").css("color","#898989");
$(".i_sell_dialog").hide();
});
$(".i_sell_dialog").hover(function(){
$(".i_sell_icon .icon").css("background-image","url('/include/default/imgs/icon2.png')");
$(".i_sell_icon .title").css("color","#E3007F");
$(this).show();
},function(){
// $(".i_sell_icon .icon").css("background-image","url('/include/default/imgs/icon1.png')");
// $(".i_sell_icon .title").css("color","#898989");
// $(this).hide();
});
$(".i_sell_dialog .btn_cancel").click(function(){
$(".i_sell_icon .icon").css("background-image","url('/include/default/imgs/icon1.png')");
$(".i_sell_icon .title").css("color","#898989");
$(".i_sell_dialog").fadeOut("normal");
});
//确认
$(".i_sell_dialog .btn_confirm").click(function(){
if($('#second_salePrice').val()=='')
{
alert('請輸入售價!');
window.setTimeout(function(){$('#second_salePrice').focus();}, 0);
return;
}
var prodPank=$('#prodRank').val();
var prodMark=$('#prodMark').val();
if(prodPank==""){
alert('請選擇書況!');
$(".i_sell_dialog").show();
$(".btn_confirm").attr("disabled","disabled");
return;
}else if(prodMark==""){
alert('請選擇備註!');
$(".i_sell_dialog").show();
$(".btn_confirm").attr("disabled","disabled");
return;
}
var listPrice = parseInt($('#list_price').val()*0.9);
var salePrice = parseInt($('#second_salePrice').val());
if(salePrice > listPrice)
{
alert('售價不得大於定價的90%!');
window.setTimeout(function(){$('#second_salePrice').focus();}, 0);
window.setTimeout(function(){$('#second_salePrice').select();}, 0);
return ;
}else if(salePrice < 25)
{
alert('售價不得小於25元!');
window.setTimeout(function(){$('#second_salePrice').focus();}, 0);
window.setTimeout(function(){$('#second_salePrice').select();}, 0);
return;
}
var orid=$('#org_prod_id').val();
var otherMark=$('#second_mark').val();
var flg=true;
//判断此目店内码是否已经添加过二手书资料
$.get("/getSecondBookNum.html",{"orid":orid},function(data,status){
if(status=="success" && data>0){
if(window.confirm("您已拍賣本商品"+data+"筆！確定要再新增一筆？")){
$(".i_sell_dialog").show();
$.get('/saveProdUsed.html',{'prodPank':prodPank,'prodMark':prodMark,'orid':orid,'otherMark':otherMark,'salePrice':salePrice,'flg':true},function(msg,status){
if(status=="success" ){
$('#prodRank').val("");
$('#prodMark').val("");
$('#second_salePrice').val("");
$('#income').text("");
alert('已加入二手書上架申請清單!');
$(".i_sell_dialog").hide();
}else{
alert("操作失敗！");
}
});
}else{//继续显示本窗体
$(".i_sell_dialog").show();
}
} else{//继续显示本窗体
$(".i_sell_dialog").show();
$.get('/saveProdUsed.html',{'prodPank':prodPank,'prodMark':prodMark,'orid':orid,'otherMark':otherMark,'salePrice':salePrice,'flg':true},function(msg,status){
if(status=="success"){
$('#prodRank').val("");
$('#prodMark').val("");
$('#second_salePrice').val("");
$('#income').text("");
alert('已加入二手書上架申請清單!');
$(".i_sell_dialog").hide();
}else{
alert("操作失敗！");
}
});
}
});
});
//计算卖家所得
$("#second_salePrice").keyup(function(){
if (this.value.search("^-?\\d+$") != 0) {
this.value="";
$('#income').text("只允許數字！");
return ;
}
try{
var listPrice = parseInt($('#list_price').val()*0.9);
var salePrice =this.value;
if(salePrice > listPrice )
{
$('#income').text("不能大於定價！");
$(".btn_confirm").attr("disabled","disabled");
return ;
}else if(salePrice < 25){
$('#income').text("不能小於25圓！");
$(".btn_confirm").attr("disabled","disabled");
return ;
}else
{
$(".btn_confirm").removeAttr("disabled");
$('#income').text(parseInt(salePrice*0.65));
}
}catch(e){
$(".btn_confirm").attr("disabled","disabled");
$('#income').text("error!");
}
});
/*会员没有登陆*/
if($.browser.mozilla){
$(".i_sell_icon_info .title").css("line-height","20.6px");
}
$(".i_sell_icon").click(function(){
$.post('checkMemberLogin.html',{}, function (msg) {
if (msg=='true_and_sso')
{
openMemberSsoLogin();
}
else
{
openMemberLogin();
}
});
});
//我要卖
var _selloffset=$(".i_sell_icon").offset();
if(typeof(_selloffset)!="undefined" && null!=_selloffset)
{
var _offsetTop=(_selloffset.top+30)+"px";
var _offsetLeft=(_selloffset.left-25)+"px";
$(".i_sell_icon").hover(function(){
//$(".i_sell_icon .icon").css("background-position","-22px -1px");
$(".i_sell_icon .title").css("color","#E2007D");
$(".i_sell_icon_info").css({top:_offsetTop,left:_offsetLeft}).fadeIn("slow");
},function(){
//$(".i_sell_icon .icon").css("background-position","0 0");
$(".i_sell_icon .title").css("color","#898989");
$(".i_sell_icon_info").hide();
});
$(".i_sell_icon_info").hover(function(){
$(this).show();
$(".i_sell_icon .icon").css("background-image","url('/include/default/imgs/icon2.png')");
$(".i_sell_icon .title").css("color","#E2007D");
},function(){
$(".i_sell_icon .icon").css("background-image","url('/include/default/imgs/icon1.png')");
$(".i_sell_icon .title").css("color","#898989");
$(this).hide();
});
$(".i_sell_icon_info .i_sell_icon_info_a").hover(function(){
$(this).css("color","#E2007D");
$(this).css("text-decoration","underline");
},function(){
$(this).css("color","#313131");
$(this).css("text-decoration","underline");
});
$(".i_sell_icon_info .icon").hover(function(){
$(this).css("color","#E2007D");
$(this).css("text-decoration","none");
},function(){
$(this).css("color","#313131");
$(this).css("text-decoration","none");
});
var isOpen=false;
$(".i_sell_icon_info .icon").click(function(){
$(".i_sell_icon_info .icon").unbind("mouseleave");
if(isOpen){
$(".i_sell_icon_info .close").css("display","none");
$(".i_sell_icon_info .icon").css("color","#313131");
$(".i_sell_icon_info .title").slideUp(500);
$(".i_sell_icon_info .close .close_icon").slideUp(500,function(){
$(".i_sell_icon_info a").css({
"padding-right":"0"
});
$(".i_sell_icon_info").css({
"background-position":"-46px -2px",
"width":"130px",
"height":"70px"
});
});
isOpen=false;
}else{
$(".i_sell_icon_info .close").css("display","block");
$(".i_sell_icon_info .icon").css("color","#E2007D");
var h=178;
if($.browser.mozilla){
h=h-8;
}
$(".i_sell_icon_info").css({
"background-position":"-2px -88px",
"width":"213px",
"height":""+h+"px"
});
$(".i_sell_icon_info a").css({
"padding-right":"85px"
});
$(".i_sell_icon_info .title").slideDown(500);;
$(".i_sell_icon_info .close .close_icon").slideDown(500);;
isOpen=true;
}
//当鼠标移回去的时候，重新绑定mouseleave事件，否则移开div的时候，就不隐藏
$(".i_sell_icon_info .icon").mouseenter(function(){
$(this).bind("mouseleave", function(){
$(this).css("color","#313131");
$(this).css("text-decoration","none");
// $(".i_sell_icon_info .close").css("display","none");
});
});
});
$(".close_icon").hover(function(){
$(this).css("background-position","0 -50px");
},function(){
$(this).css("background-position","0 -23px");
});
$(".close_icon").click(function(){
//解除i_sell_icon_info离开的时候隐藏的事件，否则当缩回去的时候会隐藏
$(".i_sell_icon_info .close").css("display","none");
$(".i_sell_icon_info").unbind("mouseleave");
$(".i_sell_icon_info .title").slideUp(500);
$(".i_sell_icon_info .close .close_icon").slideUp(500,function(){
$(".i_sell_icon_info a").css({
"padding-right":"0"
});
$(".i_sell_icon_info").css({
"background-position":"-46px -2px",
"width":"130px",
"height":"70px"
});
});
isOpen=false;
//当鼠标移回去的时候，重新绑定mouseleave事件，否则移开div的时候，就不隐藏
$(".i_sell_icon_info").mouseenter(function(){
$(this).bind("mouseleave", function(){
$(".i_sell_icon .icon").css("background-image","url('/include/default/imgs/icon1.png')");
$(".i_sell_icon .title").css("color","#898989");
$(this).hide();
});
});
});
}
/**行销分红*/
if($.browser.mozilla){
$(".show_ap_info .title").css("line-height","20.6px");
}
var _show_ap_offset=$(".show_ap_icon").offset();
if(typeof(_show_ap_offset)!="undefined" && null!=_show_ap_offset)
{
var _show_ap_offsetTop=(_show_ap_offset.top+18)+"px";
var _show_ap__offsetLeft=(_show_ap_offset.left-25)+"px";
$(".show_ap_icon ,.show_ap_title").hover(function(){
$(".show_ap_icon").css("background-image","url('/include/new_index/imgs/money2.png')");
$(".show_ap_title").css("color","#E2007D");
$(".show_ap_info").css({top:_show_ap_offsetTop,left:_show_ap__offsetLeft}).fadeIn("slow");
},function(){
$(".show_ap_icon").css("background-image","url('/include/new_index/imgs/money1.png')");
$(".show_ap_title").css("color","#898989");
$(".show_ap_info").hide();
});
$(".show_ap_icon ,.show_ap_title").click(function(){
var gen_url=$("#show_app_gen_url").val();
var flg=$("#show_app_flg").val();
showAp(gen_url,flg);
});
$(".show_ap_info").hover(function(){
$(".show_ap_icon").css("background-image","url('/include/new_index/imgs/money2.png')");
$(".show_ap_title").css("color","#E2007D");
$(this).show();
},function(){
$(".show_ap_icon").css("background-image","url('/include/new_index/imgs/money1.png')");
$(".show_ap_title").css("color","#898989");
$(this).hide();
});
$(".show_ap_info .show_ap_info_a").hover(function(){
$(this).css("color","#E2007D");
$(this).css("text-decoration","underline");
},function(){
$(this).css("color","#313131");
$(this).css("text-decoration","underline");
});
$(".show_ap_info .icon").hover(function(){
$(this).css("color","#E2007D");
$(this).css("text-decoration","none");
},function(){
$(this).css("color","#313131");
$(this).css("text-decoration","none");
});
var isOpen=false;
$(".show_ap_info .icon").click(function(){
$(".show_ap_info .icon").unbind("mouseleave");
if(isOpen){
$(".show_ap_info .icon").css("color","#313131");
$(".show_ap_info .title").slideUp(500);
$(".show_ap_info .close .close_icon").slideUp(500,function(){
$(".show_ap_info a").css({
"padding-right":"0"
});
$(".show_ap_info").css({
"background-position":"-46px -2px",
"width":"130px",
"height":"70px"
});
});
$(".show_ap_info .close").css("display","none");
isOpen=false;
}else{
$(".show_ap_info .icon").css("color","#E2007D");
var h=158;
if($.browser.mozilla){
h=h-8;
}
$(".show_ap_info").css({
"background-position":"-2px -88px",
"width":"213px",
"height":""+h+"px"
});
$(".show_ap_info a").css({
"padding-right":"85px"
});
$(".show_ap_info .title").slideDown(500);;
$(".show_ap_info .close .close_icon").slideDown(500);
$(".show_ap_info .close").css("display","block");
isOpen=true;
}
//当鼠标移回去的时候，重新绑定mouseleave事件，否则移开div的时候，就不隐藏
$(".show_ap_info .icon").mouseenter(function(){
//$(".show_ap_info .close").css("display","none");
$(this).bind("mouseleave", function(){
$(this).css("color","#313131");
$(this).css("text-decoration","none");
});
});
});
$(".close_icon").hover(function(){
$(this).css("background-position","0 -50px");
},function(){
$(this).css("background-position","0 -23px");
});
$(".close_icon").click(function(){
//解除show_ap_info离开的时候隐藏的事件，否则当缩回去的时候会隐藏
$(".show_ap_info .close").css("display","none");
$(".show_ap_info").unbind("mouseleave");
$(".show_ap_info .title").slideUp(500);
$(".show_ap_info .close .close_icon").slideUp(500,function(){
$(".show_ap_info a").css({
"padding-right":"0"
});
$(".show_ap_info").css({
"background-position":"-46px -2px",
"width":"130px",
"height":"70px"
});
});
isOpen=false;
//当鼠标移回去的时候，重新绑定mouseleave事件，否则移开div的时候，就不隐藏
$(".show_ap_info").mouseenter(function(){
$(".show_ap_info .close").css("display","none");
$(this).bind("mouseleave", function(){
$(".show_ap_icon").css("background-image","url('/include/new_index/imgs/money1.png')");
$(".show_ap_title").css("color","#898989");
$(this).hide();
});
});
});
}
/* 特效结束**/
});
function snd_info_close(){
$(".snd_info div").hide();
};

