﻿function killerrors() {
return true;
}
window.onerror = killerrors;
// JavaScript Document
function setPic(pic,width,height,alt){
	
	pic =  decode64(pic);
	
	writestr = "<img src='"+pic+"' ";
	if(width!=0){
		writestr+=" width="+width;
	}
	if(height!=0){
		writestr+=" height="+height;
	}
	writestr = writestr+" alt='"+alt+"' />";
	
	document.write(writestr);
}

function getpic(thispic,pic){
	
	pic =  decode64(pic);
	thispic.src = pic;
}
function tihuan()
{
	str = decode64(str);
	document.getElementById("tb_content").innerHTML = str;

}
function clickurl(urlid){
	urlid =  decode64(urlid);
	window.open(urlid);
	//location.href=urlid;
	
}

function checkLogin(session){//session为1记录登陆状态
    var ddusername=$('#loginuser').val();
	var dduserpwd=$('#loginpwd').val();
	var jump_href=$('#jump_href').attr('href');
	if(ddusername=='' || dduserpwd==''){
	    alert('用户名或密码不能为空');
	}
	else{
	    $.post('ajax.php?fun=checkLogin', {'ddusername':ddusername,'dduserpwd':dduserpwd,'session':session}, function(data){
		    if(data>0){
				//$('.jumpbox').hide();
				//location.replace(location.href);
			    window.location.href=jump_href;
		    }
			else{
			    alert('账号密码错误');
			}
	    });
	}
}

function parse_url(url){
 var pattern = /(\w+)=(\w+)/ig;
 var parames = {};
 url.replace(pattern, function(a, b, c){
  parames[b] = c;
 });
 return parames;
}

function AddFavorite(sURL, sTitle){
 try{
  window.external.addFavorite(sURL, sTitle);
  }
 catch (e){
  try{
   window.sidebar.addPanel(sTitle, sURL, "");
   }
  catch (e)
  {
   alert("加入收藏失败，您的浏览器不允许，请使用Ctrl+D进行添加");
  }
 }
}
// JavaScript Document

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6. 
{ 
    var arVersion = navigator.appVersion.split("MSIE") 
    var version = parseFloat(arVersion[1]) 
    if ((version >= 5.5) && (document.body.filters)) 
    { 
       for(var j=0; j<document.images.length; j++) 
       { 
          var img = document.images[j] 
          var imgName = img.src.toUpperCase() 
          if (imgName.substring(imgName.length-3, imgName.length) == "PNG") 
          { 
             var imgID = (img.id) ? "id='" + img.id + "' " : "" 
             var imgClass = (img.className) ? "class='" + img.className + "' " : "" 
             var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' " 
             var imgStyle = "display:inline-block;" + img.style.cssText 
             if (img.align == "left") imgStyle = "float:left;" + imgStyle 
             if (img.align == "right") imgStyle = "float:right;" + imgStyle 
             if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle 
             var strNewHTML = "<span " + imgID + imgClass + imgTitle 
             + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" 
             + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" 
             + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
             img.outerHTML = strNewHTML 
             j = j-1 
          } 
       } 
    }     
} 

function Showsearchcontent(id){
		for (var i = 0;i < 3;i++){
			var searchnav = document.getElementById("searchnav" + i);
			var searchcontent = document.getElementById("searchcontent" + i);
			if (i == id){searchnav.className = 'search_nav';searchcontent.style.display = "";}
			else{searchnav.className = 'search_nav_current';searchcontent.style.display = "none";}
		}
	}

