function killErrors(){ return true;} window.onerror=killErrors;
function AddFavorite(){
/*收藏当前页*/
var sTitle=document.title;
var sURL=document.location.href;
try{window.external.addFavorite(sURL, sTitle);}
catch (e){
try{window.sidebar.addPanel(sTitle, sURL, "");}
catch (e){alert("加入收藏失败，请使用Ctrl+D进行添加");}
}
}

$$(function(){

//下拉分类
if($$.browser.msie&&$$.browser.version==6){
$$('#hdNav> li').hover(function(){
	var $$slideDiv=$$(this).find('div.navp');
	if ($$slideDiv.length === 0) {
		return;
	}
	$$(this).children("a").addClass("hover");
	$$slideDiv.show();
},
	function(){
		var $$this=$$(this);
		var $$slideDiv=$$this.find('div.navp');
		if ($$slideDiv.length === 0) {
			return;
		}
		$$slideDiv.hide();
		$$this.children("a").removeClass('hover');
		});
	//修复IE6不缓存背景图
	try { document.execCommand('BackgroundImageCache', false, true); } catch(e) {}
	
}else{
	
$$("#hdNav> li").hover(function(){
	var $$slideDiv=$$(this).find('div.navp');
	if ($$slideDiv.length === 0) {
		return;
	}
	$$(this).children("a").addClass("hover");
	$$slideDiv.show();
}, function(){
	var $$this=$$(this);
	var $$slideDiv=$$this.find('div.navp');
	if ($$slideDiv.length === 0) {
		return;
	}
	$$slideDiv.hide();
	$$this.children("a").removeClass('hover');
});
}

//2012运程、本命佛查询下拉v2
$$("li.hdMy").hover(function(){
	$$(this).find("ul").show();
}, function(){
	$$(this).find("ul").hide();
});

//购物车下拉v2
$$("li.hdMy").hover(function(){
	$$(this).find(".shopbor").show();
	Ajaxokbmf('CartShop','/Action/SetMy.asp?action=SubCartshops')
}, function(){
	$$(this).find(".shopbor").hide();
});

//新导航结束

});


//产品详情页面选项卡
function settab_zzjsnet(name,cursel,n){
 for(i=1;i<=n;i++){
  var menu=document.getElementById(name+i);
  var zzjs=document.getElementById("zzjs_"+name+"_"+i);
  menu.className=i==cursel?"hover":"";
  zzjs.style.display=i==cursel?"block":"none";
 }
}
//套餐选项卡
function settab_taocannet(name,cursel,n){
 for(i=1;i<=n;i++){
  var menu=document.getElementById(name+i);
  var taocan=document.getElementById("taocan_"+name+"_"+i);
  menu.className=i==cursel?"hover":"";
  taocan.style.display=i==cursel?"block":"none";
 }
}







function $(i){return document.getElementById(i);}
function SetCookiesliulanshop(shop_id){Ajaxokbmf('','/Action/SetMy.asp?action=SubAddliulanshop&shop_id='+shop_id)}
function GetCookiesliulanshop(){Ajaxokbmf('Cookiesliulanshop','/Action/SetMy.asp?action=SubGetliulanshop')}
function DelCookiesliulanshop(){Ajaxokbmf('Cookiesliulanshop','/Action/SetMy.asp?action=SubDelliulanshop')}



/*********************************************************
 目的：    销售排行显示
 输入：    无
 返回：    无
/*********************************************************/
function SetFocus(name,no){
c=document.getElementById(name).getElementsByTagName("dl").length;
for(i=0;i<c;i++){
if(i==no){document.getElementById(name).getElementsByTagName("dl")[i].className=''}else{document.getElementById(name).getElementsByTagName("dl")[i].className='bg'}
}
}
/*********************************************************/




/*********************************************************
 目的：    显示与隐藏
 输入：    无
 返回：    无
/*********************************************************/
function SetDisplay(id){
if($(id).style.display==""){
$(id).style.display="none"
}else if($(id).style.display=="none"){
$(id).style.display=""
}
}
/*********************************************************/




/*********************************************************
 目的：    默认调用
 输入：    无
 返回：    无
/*********************************************************/
function SetViewmoney(){
	Ajaxokbmf('ViewMoney','/Action/SetView.asp?action=SubMoney&shop_id='+shop_id)   //读取价格
	Ajaxokbmf('ViewDuobao','/Action/SetView.asp?action=SubDuobao&shop_id='+shop_id) //读取多宝产品
	Ajaxokbmf('ViewCount','/Action/SetView.asp?action=SubCount&shop_id='+shop_id)   //读取库存提示
	Ajaxokbmf('ViewHits','/Action/SetView.asp?action=SubHits&shop_id='+shop_id)     //读取人气
	Ajaxokbmf('ViewGl','/Action/SetView.asp?action=SubGl&shop_id='+shop_id)         //关联产品
	Ajaxokbmf('ViewTcjj','/Action/SetView.asp?action=SubTcjj&shop_id='+shop_id)     //套餐减价
	//var read_money=function(){Ajaxokbmf('ViewMoney','/Action/SetView.asp?action=SubMoney&shop_id='+shop_id)}
	//setTimeout(read_money,500)//设置0.5秒延时读取
	}
/*********************************************************/

function SetToplogin(){Ajaxokbmf('TopLogin','/Action/SetMy.asp?action=Sublogin')}
function SetTopcart(){Ajaxokbmf('CartCount','/Action/SetMy.asp?action=SubCartcount')}
function SetViewprodpic(){Ajaxokbmf('prodpic','/Action/SetView.asp?action=SubPro&shop_id='+shop_id)}

/*********************************************************
 目的：    多宝盒产品
 输入：    无
 返回：    无
/*********************************************************/
dbshop=1
function SetSelectpic(no,id,num){
	if (id==""|| num==""){return false;}
	$('ViewId').value=id;
	$('id_bpic').src='http://www.okbmf.com/uploadpic/b_pic/'+num+'.jpg';
	$('ViewNum').innerHTML='圣品编号：'+num;
	Ajaxokbmf('ViewMoney','/Action/SetView.asp?action=SubMoney&shop_id='+id)
	Ajaxokbmf('ViewCount','/Action/SetView.asp?action=SubCount&shop_id='+id)
	var cat=no.toString(10);
	document.getElementById('dbid'+dbshop).className='';
	document.getElementById('dbid'+cat).className='tb-imgone2';
	$('ViewDuobao').style.borderColor='white'
	dbshop = cat;
	}
/*********************************************************




/*********************************************************
 目的：    关联产品
 输入：    无
 返回：    无
/*********************************************************/
glshop=1
function SetGlpic(no,id,num){
	if (id==""|| num==""){return false;}
	$('ViewId').value=id;
	$('id_bpic').src='http://www.okbmf.com/uploadpic/b_pic/'+num+'.jpg';
	$('ViewNum').innerHTML='圣品编号：'+num;
	Ajaxokbmf('ViewMoney','/Action/SetView.asp?action=SubMoney&shop_id='+id)
	var cat=no.toString(10);
	document.getElementById('glid'+glshop).className='';
	document.getElementById('glid'+cat).className='tb-imgone2';
	glshop = cat;
	}
/*********************************************************/



/*********************************************************
 目的：    目录导航
 输入：    无
 返回：    无
/*********************************************************/
function SetTnav(id){
	if($('tmenu').style.backgroundPosition=='-43px 0px'){
		$('tmenu').style.backgroundPosition='0px 0px';
		}else{
		$('tmenu').style.backgroundPosition='-43px 0px';
		}
	Ajaxokbmf('tnav','/Action/SetView.asp?action=SubMulu&id='+id);
}


/*********************************************************/






/*********************************************************
 目的：    统一调用函数
 输入：    无
 返回：    无
/*********************************************************/
function Ajaxokbmf(Aid,Aurl) {
   var xmlhttp;
   var url=Aurl;
   //$(Aid).innerHTML='<img src="/images/ico/ico_loading.gif" />login...';
   if(window.ActiveXObject) {
	   
       xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	   
   }else if(window.XMLHttpRequest)      {
       xmlhttp=new XMLHttpRequest();
   }
   
   if (xmlhttp) {
       xmlhttp.onreadystatechange=function() {
           if(4==xmlhttp.readyState) {
                if(200==xmlhttp.status){
					$(Aid).innerHTML=xmlhttp.responseText;
                }else {
                    alert("error")
                }          
           }
        }   
       xmlhttp.open("get",url,true);
       xmlhttp.send(null);
    }
}
/*********************************************************/



//==请购按扭==
function SetCoodiesbuy(no) {
	var ViewId=$('ViewId').value;
	if(ViewId==""){alert('请选择您要的款式');$('ViewDuobao').style.borderColor='#C30009';return false;}else{
		if(no==1){
		location.href='/Buy/?action=add&shop_id='+ViewId;	
		}else if(no==2){
   var xmlhttp;
   var url='/Buy/Addbuy.asp?id='+encodeURIComponent(ViewId);
   if(window.ActiveXObject) {
       xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
   }else if(window.XMLHttpRequest)      {
       xmlhttp=new XMLHttpRequest();
   }
   if (xmlhttp) {
       xmlhttp.onreadystatechange=function() {
           if(4==xmlhttp.readyState) {
                if(200==xmlhttp.status)  {
					document.getElementById("buyalt").style.display='';
					document.getElementById("buyshop").innerHTML=xmlhttp.responseText;
					SetTopcart();
                }else {
                     alert("error")
                }          
           }
        }   
       xmlhttp.open("get",url,true);
       xmlhttp.send(null);
    }
Ajaxokbmf('buytj','/Action/SetView.asp?action=SubBuytj&id='+ViewId);

}else{return false;}
}
}


var zd ="1";
var zds="10";
function Setpay(no){
var cat=no.toString(10);
document.getElementById('li'+zd).className='';
document.getElementById('li'+cat).className='focus';
document.getElementById('pay_div'+zd).style.display='none';
document.getElementById('pay_div'+cat).style.display='block';
zd = cat;
}

/******************************************
  功能：分页
  输入：无
  输出：无
/******************************************/
/*分页形式1*/
function SetPage(Page,PageCount,RecordCount,Url){
if(Page==1){strl=10;}if(Page==2){strl=9;}if(Page==3){strl=8;}if(Page==4){strl=7;}if(Page==5){strl=6;}if(Page>=6){strl=5;}
if(PageCount-Page==0){strr=10;}if(PageCount-Page==1){strr=9;}if(PageCount-Page==2){strr=8;}if(PageCount-Page==3){strr=7;}if(PageCount-Page==4){strr=6;}if(PageCount-Page>=5){strr=5;}
document.write("<span>"+Page+" / "+PageCount+" / "+RecordCount+"</span>")
if (Page>6){document.write("<a href='?"+Url+"page=1' class='first'>首页</a><span class='pagemore'>...</span>");}
if (Page>1){document.write("<a href='?"+Url+"page="+(Page-1)+"' title='上一页'>上页</a>");}
for (var i=1; i <= PageCount; i++) {
	if (i <= Page+strl && i >= Page-strr)	{
		if (Page==i){
		document.write("<span class='current'>"+i+"</span>");
		}else{
		document.write("<a href='?"+Url+"page="+i+"'>"+i+"</a>");
		}
	}
}
if (PageCount-Page>=1){document.write("<a href='?"+Url+"page="+(Page+1)+"' title='下一页'>下页</a>");}
if (PageCount-Page>=6){document.write("<span class='pagemore'>...</span><a href='?"+Url+"page="+PageCount+"'>尾页</a>")}
}
/******************************************/


function setp(wd1,wd2,no){
$("p"+no).src="http://www.okbmf.com/UploadPic/S_pic/"+wd1+".jpg";
$("a"+no).href="/So/?act=bmf&wd="+wd1;
$("aa"+no).href="/So/?act=bmf&wd="+wd1;
if(wd2=="属鼠"){$("t"+no).innerHTML="属鼠本命佛★千手观音菩萨";}
if(wd2=="属牛"){$("t"+no).innerHTML="属牛本命佛★虚空藏菩萨";}
if(wd2=="属虎"){$("t"+no).innerHTML="属虎本命佛★虚空藏菩萨";}
if(wd2=="属兔"){$("t"+no).innerHTML="属兔本命佛★文殊菩萨";}
if(wd2=="属龙"){$("t"+no).innerHTML="属龙本命佛★普贤菩萨";}
if(wd2=="属蛇"){$("t"+no).innerHTML="属蛇本命佛★普贤菩萨";}
if(wd2=="属马"){$("t"+no).innerHTML="属马本命佛★大势至菩萨";}
if(wd2=="属羊"){$("t"+no).innerHTML="属羊本命佛★大日如来";}
if(wd2=="属猴"){$("t"+no).innerHTML="属猴本命佛★大日如来";}
if(wd2=="属鸡"){$("t"+no).innerHTML="属鸡本命佛★不动尊菩萨";}
if(wd2=="属狗"){$("t"+no).innerHTML="属狗本命佛★阿弥陀佛";}
if(wd2=="属猪"){$("t"+no).innerHTML="属猪本命佛★阿弥陀佛";}
}

//==评论==
function checkplun(){
while(document.formask.plun_name.value.indexOf(" ")!=-1){
document.formask.plun_name.value=document.form1.plun_name.value.replace(" ","");
}
while(document.formask.plun_name.value.indexOf("	")!=-1){
document.formask.plun_name.value=document.form1.plun_name.value.replace("	","");
}
while(document.formask.plun_text.value.indexOf(" ")!=-1){
document.formask.plun_text.value=document.form1.plun_text.value.replace(" ","");
}
while(document.formask.plun_text.value.indexOf("	")!=-1){
document.formask.plun_text.value=document.form1.plun_text.value.replace("	","");
}
var plun_name=document.formask.plun_name.value;
var plun_text=document.formask.plun_text.value;
var plun_getcode=document.formask.plun_getcode.value;
if(plun_name==""||plun_name.length>16){
alert('昵称不能为空并且长度不能超过16个字符！')
document.formask.plun_name.focus()
return false
}
if(plun_getcode==""){
alert('验证码不能为空')
document.formask.plun_getcode.focus()
return false
}
if(plun_text==""||plun_text.length>300){
alert('提问内容不能为空且长度不能超过300个字符！')
document.formask.plun_text.focus()
return false
}
}

//禁止非数字输入
function IsDigit()
{
return ((event.keyCode >= 48) && (event.keyCode <= 57));
}
function inpute(tt)
{
tt.value = tt.value.replace("．",".")
tt.value = tt.value.replace("。",".")
tt.value = tt.value.replace("＠","@")
tt.value = tt.value.replace("—","-")
tt.value = tt.value.replace("０","0")
tt.value = tt.value.replace("１","1")
tt.value = tt.value.replace("２","2")
tt.value = tt.value.replace("３","3")
tt.value = tt.value.replace("４","4")
tt.value = tt.value.replace("５","5")
tt.value = tt.value.replace("６","6")
tt.value = tt.value.replace("７","7")
tt.value = tt.value.replace("８","8")
tt.value = tt.value.replace("９","9")
tt.value = tt.value.replace("Ａ","A")
tt.value = tt.value.replace("Ｂ","B")
tt.value = tt.value.replace("Ｃ","C")
tt.value = tt.value.replace("Ｄ","D")
tt.value = tt.value.replace("Ｅ","E")
tt.value = tt.value.replace("Ｆ","F")
tt.value = tt.value.replace("Ｇ","G")
tt.value = tt.value.replace("Ｈ","H")
tt.value = tt.value.replace("Ｉ","I")
tt.value = tt.value.replace("Ｊ","J")
tt.value = tt.value.replace("Ｋ","K")
tt.value = tt.value.replace("Ｌ","L")
tt.value = tt.value.replace("Ｍ","M")
tt.value = tt.value.replace("Ｎ","N")
tt.value = tt.value.replace("Ｏ","O")
tt.value = tt.value.replace("Ｐ","P")
tt.value = tt.value.replace("Ｑ","Q")
tt.value = tt.value.replace("Ｒ","R")
tt.value = tt.value.replace("Ｓ","S")
tt.value = tt.value.replace("Ｔ","T")
tt.value = tt.value.replace("Ｕ","U")
tt.value = tt.value.replace("Ｖ","V")
tt.value = tt.value.replace("Ｗ","W")
tt.value = tt.value.replace("Ｘ","X")
tt.value = tt.value.replace("Ｙ","Y")
tt.value = tt.value.replace("Ｚ","Z")
tt.value = tt.value.replace("ａ","a")
tt.value = tt.value.replace("ｂ","b")
tt.value = tt.value.replace("ｃ","c")
tt.value = tt.value.replace("ｄ","d")
tt.value = tt.value.replace("ｅ","e")
tt.value = tt.value.replace("ｆ","f")
tt.value = tt.value.replace("ｇ","g")
tt.value = tt.value.replace("ｈ","h")
tt.value = tt.value.replace("ｉ","i")
tt.value = tt.value.replace("ｊ","j")
tt.value = tt.value.replace("ｋ","k")
tt.value = tt.value.replace("ｌ","l")
tt.value = tt.value.replace("ｍ","m")
tt.value = tt.value.replace("ｎ","n")
tt.value = tt.value.replace("ｏ","o")
tt.value = tt.value.replace("ｐ","p")
tt.value = tt.value.replace("ｑ","q")
tt.value = tt.value.replace("ｒ","r")
tt.value = tt.value.replace("ｓ","s")
tt.value = tt.value.replace("ｔ","t")
tt.value = tt.value.replace("ｕ","u")
tt.value = tt.value.replace("ｖ","v")
tt.value = tt.value.replace("ｗ","w")
tt.value = tt.value.replace("ｘ","x")
tt.value = tt.value.replace("ｙ","y")
tt.value = tt.value.replace("ｚ","z")
}
function inputm(tt)
{
tt.value = tt.value.replace("．",".")
tt.value = tt.value.replace("。",".")
tt.value = tt.value.replace("０","0")
tt.value = tt.value.replace("１","1")
tt.value = tt.value.replace("２","2")
tt.value = tt.value.replace("３","3")
tt.value = tt.value.replace("４","4")
tt.value = tt.value.replace("５","5")
tt.value = tt.value.replace("６","6")
tt.value = tt.value.replace("７","7")
tt.value = tt.value.replace("８","8")
tt.value = tt.value.replace("９","9")
tt.value = tt.value.replace("—","-")
tt.value = tt.value.replace("s","")
tt.value = tt.value.replace("l","")
tt.value = tt.value.replace("S","")
tt.value = tt.value.replace("L","")
}
function input(tt)
{
tt.value = tt.value.replace("．",".")
tt.value = tt.value.replace("。",".")
tt.value = tt.value.replace("０","0")
tt.value = tt.value.replace("１","1")
tt.value = tt.value.replace("２","2")
tt.value = tt.value.replace("３","3")
tt.value = tt.value.replace("４","4")
tt.value = tt.value.replace("５","5")
tt.value = tt.value.replace("６","6")
tt.value = tt.value.replace("７","7")
tt.value = tt.value.replace("８","8")
tt.value = tt.value.replace("９","9")
tt.value = tt.value.replace("s","")
tt.value = tt.value.replace("l","")
tt.value = tt.value.replace("S","")
tt.value = tt.value.replace("L","")
tt.value = tt.value.replace(/[^\d\.\-]/g,"").replace(/([^^])\-/g,"$1").replace(/(\.\d{0,2}).*$/,"$1");
}


//==算命框日期类型==
function SetXuan(no){
if(no=='0'){
$('RenYue').style.display='none';
$('renyue1').style.display='none';
}
else{
$('RenYue').style.display='';
$('renyue1').style.display='';
}
}


//==返回顶部==
function ToTop(){
var w = 230;
var h = 80;
var str = "";
var obj = document.getElementById("divStayTopLeft");
if (obj)str = obj.innerHTML;
if( typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat'){
document.writeln('<DIV  style="z-index:9;right:0;bottom:0;height:'+h+'px;width:'+w+'px;overflow:hidden;POSITION:fixed;_position:absolute; _margin-top:expression(document.documentElement.clientHeight-this.style.pixelHeight+document.documentElement.scrollTop);">');
}
else {
document.writeln('<DIV  style="z-index:9;right:0;bottom:0;height:'+h+'px;width:'+w+'px;overflow:hidden;POSITION:fixed;*position:absolute; *top:expression(eval(document.body.scrollTop)+eval(document.body.clientHeight)-this.style.pixelHeight);">');
}
document.writeln('<div style="clear:both;margin:auto;height:63px;overflow:hidden;text-align:left;"><a href="javascript:scroll(0,0)" hidefocus="true"><img src="/images/ico/totop.png" /></a></div> ');
document.write('<div style="clear:both;margin:auto;overflow:hidden;text-align:left;">'+str+'</div>');
document.writeln('</DIV>');
}


//==搜索后表单保存条件==
function gowd(fromwd){$('wd').value=fromwd}
function goact(fromact){
for(var i=0;i<$('act').options.length;i++){
if(fromact==$('act').options[i].value){
$('act').options[i].selected = true;
return;
}
}
}

//=点击展开关闭效果=
function open_bazi(oSourceObj,oTargetObj){
var sourceObj = typeof oSourceObj == "string" ? document.getElementById(oSourceObj) : oSourceObj;
var targetObj = typeof oTargetObj == "string" ? document.getElementById(oTargetObj) : oTargetObj;
if(targetObj.style.display!="none"){targetObj.style.display="none";document.getElementById('xx').className='bazi_an1'}else {targetObj.style.display="block";document.getElementById('xx').className='bazi_an2'}
}

//==搜索页表单判断==
function setsoso1(){
f_w=document.formsoso1.wd.value;
f_1=document.formsoso1.str_m.value;
f_2=document.formsoso1.end_m.value;
if(f_w==""&&(f_1==""||f_2=="")){
alert('请输入您要的搜索条件')
return false;
}
if((f_1==""&&f_2!="")||(f_1!=""&&f_2=="")){
alert('请输入正确的价格区间')
return false;
}
}

//套餐提交
function SetAddtcjj(tc_id){
	window.open('/Buy/AddTcjj.asp?ID='+tc_id);
	}
	
//生肖解密选项卡
function settab_sxnet(name,cursel,n){
 for(i=1;i<=n;i++){
  var menu=document.getElementById(name+i);
  var sx=document.getElementById("sx_"+name+"_"+i);
  menu.className=i==cursel?"hover":"";
  sx.style.display=i==cursel?"block":"none";
 }
}



function SetFocus(name,no){
c=document.getElementById(name).getElementsByTagName("dl").length;
for(i=0;i<c;i++){
if(i==no){document.getElementById(name).getElementsByTagName("dl")[i].className=''}else{document.getElementById(name).getElementsByTagName("dl")[i].className='bg'}
}
}
