function killErrors() {
return true;
}
window.onerror = killErrors;




var currTId = null;
var currDId = null;
function mouseOver(obj,tag0,tag1,id)
{

if( currTId!=null)
{

 if(document.getElementById(currTId)) document.getElementById(currTId).style.display="block";
 if(document.getElementById(currDId)) document.getElementById(currDId).style.display="none";	   
}	

var Tid = tag0 + id;
var Did = tag1 + id;

if(document.getElementById(Tid)) document.getElementById(Tid).style.display="none";	   
if(document.getElementById(Did)) document.getElementById(Did).style.display="block";	  

currTId = Tid;
currDId = Did;

}

var aq01currTIdx = null;
var aq01currDIdx = null;
function aq01mouseOver(obj,tag0,tag1,id,css1,css2)
{
 
 try
 {
if( aq01currTIdx!=null)
{
	
							
 if(document.getElementById(aq01currTIdx)) document.getElementById(aq01currTIdx).className=css2;
 if(document.getElementById(aq01currDIdx)) document.getElementById(aq01currDIdx).style.display="none";	   
}	
 
var Tid = tag0 + id;
var Did = tag1 + id;
 
if(document.getElementById(Tid)) document.getElementById(Tid).className=css1;	   
if(document.getElementById(Did)) document.getElementById(Did).style.display="block";	  
 
aq01currTIdx = Tid;
aq01currDIdx = Did;
 }catch(e)
 {}
 
}
var aq02currTIdx = null;
var aq02currDIdx = null;
function aq02mouseOver(obj,tag0,tag1,id,css1,css2)
{
 
 try
 {
if( aq02currTIdx!=null)
{
	
							
 if(document.getElementById(aq02currTIdx)) document.getElementById(aq02currTIdx).className=css2;
 if(document.getElementById(aq02currDIdx)) document.getElementById(aq02currDIdx).style.display="none";	   
}	
 
var Tid = tag0 + id;
var Did = tag1 + id;
 
if(document.getElementById(Tid)) document.getElementById(Tid).className=css1;	   
if(document.getElementById(Did)) document.getElementById(Did).style.display="block";	  
 
aq02currTIdx = Tid;
aq02currDIdx = Did;
 }catch(e)
 {}
 
}

var aq03currTIdx = null;
var aq03currDIdx = null;
function aq03mouseOver(obj,tag0,tag1,id,css1,css2)
{
 
 try
 {
if( aq03currTIdx!=null)
{
	
							
 if(document.getElementById(aq03currTIdx)) document.getElementById(aq03currTIdx).className=css2;
 if(document.getElementById(aq03currDIdx)) document.getElementById(aq03currDIdx).style.display="none";	   
}	
 
var Tid = tag0 + id;
var Did = tag1 + id;
 
if(document.getElementById(Tid)) document.getElementById(Tid).className=css1;	   
if(document.getElementById(Did)) document.getElementById(Did).style.display="block";	  
 
aq03currTIdx = Tid;
aq03currDIdx = Did;
 }catch(e)
 {}
 
}

function addcart(pid,codestr,numstr,xinghaostr)
{
	if(pid=="")
	{
	alert("参数传输不正确或者该商品是不符合订购规定");
	return;
	}
						  
 $.post("../inc/cart_post.php",{addcart:"true",id:pid,codeid:codestr,num:numstr,xinghao:xinghaostr,tp:"0"},function(data)
	{
		 if(data.indexOf("ok")!=-1)
			 {
											  
											  if(confirm("该商品成功加入了您的购物车，是否进入购物车？")){
												location.href='cart_list.php';
														 }
										  }else if(data.indexOf("no")!=-1)
										  {
											  if(confirm("您的购物车已经存在该商品，是去结账？")){
											  location.href='cart_list.php';
										    }
										  }else if(data.indexOf("np")!=-1)
			{
				alert("商品库不存在或者此商品不符合订购规定（如免费商品或者下架商品是无法购买的）");
			}else if(data.indexOf("pk")!=-1)
			{
				alert("您的账号类型不能购买商品");
			}else if(data.indexOf("databad")!=-1)
			{
				alert("该商品还没有上传资源，暂不提供购买，抱歉！");
			}
			
			
										  }
			)	
  }
  
  function addshoucang(pid,codestr)
{
						  
 $.post("../inc/cart_post.php",{shoucang:"true",proid:pid,codeid:codestr},function(data)
	{
		 if(data.indexOf("ok")!=-1)
			 {						  
				alert("收藏成功，可以在您的收藏库查到！");
			 }else if(data.indexOf("0")!=-1)
			 {
				
				
				 if(confirm("您没有登录，是否现在登录？")){
											 location.href="login.php";
														 }
			}else if(data.indexOf("1")!=-1)
			{
				alert("非法参数");
			}else if(data.indexOf("2")!=-1)
			{
				alert("商品库不存在此商品");
			}else if(data.indexOf("3")!=-1)
			{
				alert("您已经收藏了该商品");
			}else if(data.indexOf("pk")!=-1)
			{
				alert("您的账号类型不能收藏商品");
			}
	}
			)	
  }
  
 $(document).ready(function() {
							
			aq01mouseOver(this,'qy','qyxq','01','mose','');
			aq02mouseOver(this,'xq_1','xq_1xq','01','pcount','');
			aq03mouseOver(this,'xq_2','xq_2xq','01','pcount','');
			
			$("#keyword").autocomplete(
			"inc/get.php",
			{
				delay:10,
            	minChars:1,
            	matchSubset:1,
            	matchContains:1,
            	cacheLength:10,
            	onItemSelect:selectItem,
            	onFindValue:findValue,
            	formatItem:formatItem,
            	autoFill:false
        	}
    		);
			});
 function findValue(li) {
    			if( li == null ) return alert("No match!");
				if( !!li.extra ) var sValue = li.extra[0];
				else var sValue = li.selectValue;
				}
			function selectItem(li) { findValue(li);}
			function formatItem(row) { 
			return row[0];
		//	return "<table width=100% align=left ><tr><td width=70%>"+row[0] + " </td><td width=30% align=right>(" + row[1] + ")</td></tr></table>"//如果有其他参数调用row[1]，对应输出格式Sparta|896
			}
			function lookupAjax(){
			var oSuggest = $("#keyword")[0].autocompleter;
			oSuggest.findValue();
			return false;
			}
			
			function addfavorite()
{
   if (document.all)
   {
      window.external.addFavorite('http://www.eebook.cn','万利达数字出版平台');
   }
   else if (window.sidebar)
   {
      window.sidebar.addPanel('万利达数字出版平台', 'http://www.eebook.cn', "");
   }
} 
function showdu2(url,ko)
{
	if(ko=="")
	{
	alert('暂无阅读内容');
	return ;
	}
	$.zxxbox.ajax("getpic.php?id="+url+"",null,{title:"试读"});
}
  function getmyfile(pid,codestr,name)
{
			if(codestr=='')
			{
				alert('您还没有绑定机器码，请先绑定再执行此操作！');
				return false;
				}
		$("#contentdiv").hide(0);
		$("#mshowdiv").show(0);		
		$("#mshowdiv").html("正在处理数据，请不刷新页面，这过程可能得花费6-30秒...");
 $.post("../inc/getfile.php",{getdata:"true",fid:pid,codeid:codestr,topicname:name},function(data)
	{
		  if(data.indexOf("xq0")!=-1)
			 {
				 alert("不存在源文件");
				 $("#mshowdiv").html("下载失败");
			 }
			   if(data.indexOf("kkkno")!=-1)
			 {
				 alert("服务器端加密程序处理异常");
				 $("#mshowdiv").html("下载失败。原因：服务器端加密程序处理异常。<a href='javascript:;resend()'>请返回重新尝试</a>");
			 }
		 if(data.indexOf("http")!=-1)
			 {	
		
			  location.href=data;
			   $("#mshowdiv").html("处理完毕,如果浏览器不能自动下载，请点如下连接下载 <br><a href="+data+">"+data+"</a>");
			 // $("#mshowdiv").hide(2000);	
            // $("#contentdiv").show(4000);
			 }
	});

 }
 function resend()
 {
$("#mshowdiv").hide(1);
$("#contentdiv").show(1);	 
}
  function getcodediv()
 {
	   $("#contentdiv").hide(1);
	    $("#codediv").hide(1);
		 $("#insertdiv").show(1);
	   
}
