// 月影社区 http://wf66.com/ ver8.3.6 //
//商城产品选择
function select_shop(json,xmlstr,guige){
var html="";
var xml = $.parseXML(xmlstr);
//写入所有商品规格
for(var i=0;i<$(xml).find("a").length;i++){
html+=""
}
$(".guiges").html(html);
nub(json,xml,0);
//选择分类
$(".guige").click(function(){
var _id=$(this).val();
$(".danjia").text($(xml).find("b").eq(_id).text());
$(".shengyu").text($(xml).find("c").eq(_id).text());
nub(json,xml,0);})
$("#_nub").blur(function(){nub(json,xml,0);})
$("span.nubjia").click(function(){nub(json,xml,1);})
$("span.nubjian").click(function(){nub(json,xml,-1);})
$(".s_add").click(function(){nub(json,xml,0);})
}
//根据地区选择不同运费模版
function nub(json,xml,_nub){
var mon2=json.mon2;
var basic=json.basic;
var zhekoutxt="";
var diqu = $.parseXML(""+json.diqu+"");
var selectadd=$(".s_add:checked").attr("add");
var _id=$(".guige:checked").val();
$(".danjia").text($(xml).find("b").eq(_id).text());
$(".shengyu").text($(xml).find("c").eq(_id).text());
var zhekou=$(xml).find("d").eq(_id).text()
if(zhekou>-1&&zhekou<100&&json.us_admin>2){
$(".lizhekou").css("display","block");
$(".zhekou").text(zhekou);
}else{$(".lizhekou").css("display","");}
if(json.diqu.indexOf(selectadd)>-1&&selectadd!=""){
for(var i=0;i<$(diqu).find("add").length;i++){
if($(diqu).find("add").eq(i).text()==selectadd){
basic=Number($(diqu).find("basic").eq(i).text())
mon2=Number($(diqu).find("next").eq(i).text())
}
}
}
var yf=0;
var danjia=Number($(".danjia").text());
var shengyu=Number($(".shengyu").text());
var _nub=Number($("#_nub").val())+_nub;
if (_nub>shengyu){_nub=shengyu}
if (_nub<1){_nub=1}
$("#_nub").val(_nub);
if(json.lei>0){ yf=_nub*mon2-mon2+basic}
if(json.lei==1&&_nub>=json.nums){yf=0}
if(json.lei==2&&_nub*danjia*zhekou/100>=json.mon){yf=0}
var zkj=_nub*danjia-_nub*danjia*zhekou/100
if(zhekou!=100){zhekoutxt=" VIP会员折扣"+zkj.toFixed(2)+"元"}
$(".jine").text((_nub*danjia*zhekou/100+yf).toFixed(2)+'元 其中运费:'+yf+'元'+zhekoutxt+'');
}
//缩略图替换 注意内容class应为content
function showpic(c,str){
$(c).find("img").click(function(){
fullScreen();
var oldtop=$(document).scrollTop();
window.scrollTo(0,0);
$("body").css("overflow","hidden").append("
");
$("#show").before("");
var img=$(c).find("img");
if(img.length==1){$("#show").children("dl.bian2").remove()}
if(img.length>1){
for(var i=0;i100){$("#show").children("dl").children("dt").append("");}
}
$("#show").children("dl").find("img").hover(function(){
$("#show").children("div").children("img").attr("src",this.src.toLowerCase().replace(str,""));
},function(){})
}
$("#show").children("div").click(function(){exitshowpic(oldtop)})
});
$(c).find("img").attr("alt","戳我试试").attr("title","戳我试试");
}
function exitshowpic(oldtop){$("#show").remove();$(".show").remove();$("body").css("overflow","auto");window.scrollTo(0,oldtop);exitFullScreen();}
/*自适应菜单*/
function tsetwidth(minwidth){
$("img.nav2button").remove();
$("h1.nav2title").remove();
var w=$("body").width();
if (w");
$("#menu").prepend("
网站导航
");
$("img.nav2button").click(function(){$("ul.nav2").css({"display":"block"})});
}else{
$("#menu").removeClass().addClass("nav");
}
$("#menu").find("li").click(function(){
if ($(this).find("ul").length>0){
var s=$(this).children("a").eq(0).attr("href");
var _s=$(this).children("a").eq(0).attr("_href")
if (w$(this).width()){
var isTouchDevice="ontouchstart"in window||navigator.msMaxTouchPoints;
if(isTouchDevice)
{$(this).children("dd").attr("style","").stop().delay(4000).animate({"opacity":"0","top":"-80px"},"800");}
else
{var text=$(this).children("dd").css("display","none").text();$(this).find("[name]").attr("title",text);$(this).find("span").attr("title",text);}
}else
{$(this).children("dd").attr("style","");}
})
}
/*根据宽度,在指定最大与最小范围内,元素按100%宽显示,如超出则按限定宽度显示.最小值允许是100%.自适应宽度:样式名称,最大宽度,最小宽度*/
function autowidth(name,minwidth,maxwidth){$(document).ready(function(){$(name).width("100%");var pwidth=$("body").width();if(pwidth>maxwidth){$(name).width(maxwidth)}if(pwidthminwidth){$(name1).css("display","block");$(name2).css("display","none");}else{$(name1).css("display","none");$(name2).css("display","block");}
$(window).resize(function(e){$(this).unbind(e);autoswap(name1,name2,minwidth);})
})}
window.onload = function() {
var host=window.location.host.substring(0, 3);
if("|127|10.|192|t.8|".indexOf(host)==-1){if (location.href.indexOf("admin")==-1){$("head").append("");}}
if(document.getElementById('Link')) {var moonMenu;moonMenu = new SetInfo('Link','s1');} if(document.getElementById('my_menu')) {var myMenu;myMenu = new SDMenu('my_menu');myMenu.init();}
};
//定时转向
function r(urls,times){jQuery(document).ready(function(){setTimeout('window.location = \"'+urls+'\";', times);});}
//根据需求加载qr库
function qr(id,json){
$.getScript("css/jq/jquery.qrcode.min.js").done(function(){$(id).addClass("qr bian").css({"padding":"5px","background":"#FFFFFF","width":json.width,"height":json.height});jQuery(id).qrcode(json)})
}
//根据需求加载chart库
function chart(id,option){
$.getScript("css/chart.js").done(function(){echarts.init(document.getElementById(id)).setOption(option);})
}
//cookies操作
function getcookie(sName){
var cookie = "" + document.cookie;
var start = cookie.indexOf(sName);
if (cookie == "" || start == -1)
return "";
var end = cookie.indexOf(';',start);
if (end == -1)
end = cookie.length;
return decodeURI(cookie.substring(start+sName.length + 1,end));
}
function setcookie(sName, value) {
var date=new Date();
date.setTime(date.getTime()+60*60*1000);
document.cookie = sName + "=" + encodeURI(value) + ";path=/;";
}
/*设置cookie有效期,值为分钟,负数为删除*/
function setcookietime(sName,time) {
var date=new Date();
date.setTime(date.getTime()+time*60*1000);
document.cookie = sName + "=" + encodeURI(getcookie(sName)) + ";path=/;expires="+date.toUTCString()+";";
}
//全屏模式
function fullScreen() {
var el = document.documentElement,
rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullScreen,
wscript;
if(typeof rfs != "undefined" && rfs) {
rfs.call(el);
return;
}
if(typeof window.ActiveXObject != "undefined") {
wscript = new ActiveXObject("WScript.Shell");
if(wscript) {
wscript.SendKeys("{F11}");
}
}
}
//退出全屏
function exitFullScreen() {
var el = document,
cfs = el.cancelFullScreen || el.webkitCancelFullScreen || el.mozCancelFullScreen || el.exitFullScreen,
wscript;
if (typeof cfs != "undefined" && cfs) {
cfs.call(el);
return;
}
if (typeof window.ActiveXObject != "undefined") {
wscript = new ActiveXObject("WScript.Shell");
if (wscript != null) {
wscript.SendKeys("{F11}");
}
}
}
//新闻排列
function news(name,str,topage,url,list){
var ii=0;
if (topage<1){topage=1}
topage++
if($(name).attr("load")==undefined){for (var i=0;i");}}
var div_widtth=($(name).width()-1)/str;
var _w=div_widtth/$(name).width()*100;
var cp=$("#news_data").eq(0).children("li");
if(cp.length>0){
for (var i=0;i"+cp.eq(i).html()+"");
$(name).children("div").eq(ii).css({"width":_w+"%","left":ii*_w+"%"});
cp.eq(i).remove();
ii++;
}
$(name).children("div").css("min-height","100%");
$(name).children("div").eq(0).css("border-left",0);
}
for (var i=0;i
信息提示
"+content+"
")}
else
{clearTimeout($(".error3").attr("timer"));$(".error3").children("div").html(content);}
$(".error3").children("h1").click(function(){clearTimeout(timer);$(".error3").remove();});
var top=$(document).scrollTop()+($(window).height()-$(".error3").height())/2;
$(".error3").css("left",($(window).width()-$(".error3").width())/2).css("top",top);
if (times>0){
$(".error3").children("h1").children("span").text(times);
times=times-1;
var timer=setTimeout("error3('"+content+"',"+times+")",1000);
$(".error3").attr("timer",timer);
}else{clearTimeout(timer);$(".error3").remove();}
}
//地区选择
function diqu(str){
var shuzu= new Array();
shuzu="北京,上海,广东,辽宁,广西,海南,湖南,甘肃,河北,湖北,江西,江苏,西藏,山东,浙江,安徽,福建,吉林,黑龙江,山西,云南,贵州,四川,陕西,重庆,天津,河南,青海,宁夏,新疆,台湾,香港,澳门,其它地区".split(",");
for(var i=0;i"+shuzu[i]+"");}
}
function base(){var base=window.location.href.split("/");return window.location.href.replace(base[base.length-1],"");}
//ALT
function getEvent(evt){evt=evt?evt:(window.event?window.event:null);return evt}
function getElement(evt){evt=getEvent(evt);return evt.target||evt.srcElement}
document.onmousemove=function (evt){
if($("#alttxt").length==0){$("body").append("")};
var alttxt=document.getElementById("alttxt");
var o=getElement(evt);
if(o.alt!=null&&o.alt!=""){o.dypop=o.alt;o.alt=""}
if(o.title!=null&&o.title!=""){o.dypop=o.title;o.title=""}
if(o.dypop!=null){
alttxt.style.display="block";
alttxt.innerHTML=o.dypop;
evt=getEvent(evt);
var x=evt.clientX;
var y=evt.clientY;
var scrollTop=document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop;
popWidth=alttxt.clientWidth;
popHeight=alttxt.clientHeight;
if(x+12+popWidth>document.body.clientWidth){popLeftAdjust=-popWidth-24}else{popLeftAdjust=0}
if(y+12+popHeight>document.body.clientHeight){popTopAdjust=-popHeight-24}else{popTopAdjust=0}
alttxt.style.left=x+12+document.body.scrollLeft+popLeftAdjust+'px';alttxt.style.top=y+12+scrollTop+popTopAdjust+'px';
}else{alttxt.style.display="none";}
}
//确认框
function checkclick(msg){if(confirm(msg)){event.returnValue=true;}else{event.returnValue=false;}}
//加载js
function loaddata(url){var script = document.createElement("script");script.type = "text/javascript";script.charset = "utf-8";document.getElementsByTagName("head")[0].appendChild(script);script.src = url;}
if(/MSIE ([^;]+)/.test(navigator.userAgent)){var banben=parseFloat(RegExp["$1"]);
//alert(banben);
//IE9以下HTML5元素兼容
(function(){var e="abbr,article,aside,audio,canvas,datalist,details,dialog,eventsource,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,time,video".split(","),t=e.length;while(t--)document.createElement(e[t])})();}
function isMouseLeaveOrEnter(e, handler) {if (e.type != 'mouseout' && e.type != 'mouseover') return false;var reltg = e.relatedTarget ? e.relatedTarget : e.type == 'mouseout' ? e.toElement : e.fromElement;while (reltg && reltg != handler)reltg = reltg.parentNode;return (reltg != handler);}
//li.hover
function infohover(ById,TagName,classNames){try{var o=document.getElementById(ById);var obj=o.getElementsByTagName(TagName);obj[0].className=classNames;
var ii=-obj[0].offsetWidth;for(var i=0;i0)obj[i].className="";obj[i].onmouseover=function(){for (var ii=0;ii0 && str2==false){allText[i].disabled = "";
}
if(i>0 && str2==true){allText[i].disabled = "disabled";allText[i].checked="checked";}}}
//链接选择记忆selectlink(ID名,变换样式名)
function selectlink(str,str2){ var a=document.getElementById(str);var b=a.getElementsByTagName("a");var c=a.getElementsByTagName("li");for(var i = 0; i < b.length; i++){if(decodeURI(b[i].href)==decodeURI(window.location.href)){c[i].className=str2;}}}
//Showbox
function showbox(str){document.getElementById("wf66com_flash").innerHTML="