function bbimg(o){
	var zoom=parseInt(o.style.zoom, 10)||100;zoom+=event.wheelDelta/12;if (zoom>0) o.style.zoom=zoom+'%';
	return false;
}
function GetCookie (name) {
var CookieFound = false;
var start = 0;
var end = 0;
var CookieString = document.cookie;
var i = 0;

while (i <= CookieString.length) {
start = i ;
end = start + name.length;
if (CookieString.substring(start, end) == name){
CookieFound = true;
break; 
}
i++;
}

if (CookieFound){
start = end + 1;
end = CookieString.indexOf(";",start);
if (end < start)
end = CookieString.length;
return unescape(CookieString.substring(start, end));
}
return "";
}

function openScript(url, width, height){
	var Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=yes' );
}

function chkdiv(divid){
	var chkid=document.getElementById(divid);
	if(chkid != null){return true; }
	else {return false; }
}

function getpara(){
	var str,pos,parastr
	str = window.location.href;
	pos = str.indexOf("?");
	parastr = str.substring(pos+1);
	return parastr;
}

function oblog_ViewCode(rnum)
{
	var bodyTag="<html><head><style type=text/css>.quote{margin:5px 20px;border:1px solid #CCCCCC;padding:5px; background:#F3F3F3 }\nbody{boder:0px}.HtmlCode{margin:5px 20px;border:1px solid #CCCCCC;padding:5px;background:#FDFDDF;font-size:14px;font-family:Tahoma;font-style : oblique;line-height : normal ;font-weight:bold;}\nbody{boder:0px}</style></head><BODY bgcolor=\"#FFFFFF\" >";
	bodyTag+=document.getElementById('scode'+rnum).value
	bodyTag+="</body></html>"
	preWin=window.open('preview','','left=0,top=0,width=550,height=400,resizable=1,scrollbars=1, status=1, toolbar=1, menubar=0');
	preWin.document.open();
	preWin.document.write(bodyTag);
	preWin.document.close();
	preWin.document.title="查看代碼內容";
	preWin.document.charset="UTF-8";
}

function $id(id,obj){
	
	if(obj==null){return document.getElementById(id)}
	else{return obj.getElementById(id)}
	}
function Hit(srcid,UserID,LUid){
	/*if (UserID==0){
		alert("尚未登陸,不能推薦!");
		}
	else{
		alert(UserID);
		var hitdiv_obj=$id("Src_HitNum"+srcid);
		 hitdiv_obj.innerHTML=(Math.round(hitdiv_obj.innerHTML)+1).toString();
		}
*/
		

	//var iddiv_obj=$id("Src_ID"+srcid);
	var hitdiv_obj=$id("Src_HitNum"+srcid);
	var RetCode,RetDes;
  var xmldocumento=GetXMLContent("/blog/doajax.asp?action=hit&src_id="+srcid+"&UserID="+UserID);
//alert(xmldocumento.xml);
  RetCode=xmldocumento.selectSingleNode( "//ReturnStr/RetCode/text()").nodeValue;
  RetDes=xmldocumento.selectSingleNode( "//ReturnStr/RetDes/text()").nodeValue;

  switch(RetCode){
  	case "0000" :
  	  hitdiv_obj.innerHTML=(Math.round(hitdiv_obj.innerHTML)+1).toString();
  	  //iddiv_obj.innerHTML="已推薦";
	 //  alert(RetDes);
  	  break;
  	case "0001" :
  	  alert(RetDes);
  	   break;
	case "0002" :
  	  alert(RetDes);
  	   break;
  	case "0003" :
  	 // hitdiv_obj.innerHTML=(Math.round(hitdiv_obj.innerHTML)+1).toString();
  	//  iddiv_obj.innerHTML="已推薦";
  	  alert(RetDes);
  	  break;
  	}
  	//window.status=Web_StatusKey;
	
	
	}
var navigatorname;
if (navigator.userAgent.indexOf("Opera")>=0)
{
  navigatorname="Opera"
}
if (navigator.userAgent.indexOf("MSIE")>=0)
{ 
navigatorname="IE"
}
if (navigator.userAgent.indexOf("Firefox")>=0)
{ 
navigatorname="Firefox"
}

//AJAX 對像
var XmlHTTP_obj=function(){
	if (window.XMLHttpRequest) { // Mozilla, Safari, ...
    return new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
    return new ActiveXObject("Microsoft.XMLHTTP");
}
}

//用於獲取相應地址返回的XML檔
function GetXMLContent(urlstr){
	var http_request;
	//alert(urlstr);
	urlstr.indexOf("?")==-1?urlstr=urlstr+"?"+Math.random():urlstr=urlstr+"&"+Math.random()
	
  if (window.XMLHttpRequest){ // Mozilla, Safari, ...
 
    http_request = new XMLHttpRequest();
    } 
    else if (window.ActiveXObject) { // IE
	 
    http_request = new ActiveXObject("Microsoft.XMLHTTP");
    }
	
    http_request.open("GET",urlstr,false);
	
    http_request.send(null);
	
    return http_request.responseXML;
	}

//使FIREFOX支持selectNodes()、selectSingleNode()
//代碼出處：http://km0ti0n.blunted.co.uk/mozXPath.xap
// check for XPath implementation
if( document.implementation.hasFeature("XPath", "3.0") )
{
// prototying the XMLDocument
XMLDocument.prototype.selectNodes = function(cXPathString, xNode)
{
if( !xNode ) { xNode = this; } 
var oNSResolver = this.createNSResolver(this.documentElement)
var aItems = this.evaluate(cXPathString, xNode, oNSResolver, 
XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null)
var aResult = [];
for( var i = 0; i < aItems.snapshotLength; i++)
{
aResult[i] = aItems.snapshotItem(i);
}
return aResult;
}

// prototying the Element
Element.prototype.selectNodes = function(cXPathString)
{
if(this.ownerDocument.selectNodes)
{
  return this.ownerDocument.selectNodes(cXPathString, this);
}
else{throw "For XML Elements Only";}
}
}

// check for XPath implementation
if( document.implementation.hasFeature("XPath", "3.0") )
{
// prototying the XMLDocument
XMLDocument.prototype.selectSingleNode = function(cXPathString, xNode)
{
if( !xNode ) { xNode = this; } 
var xItems = this.selectNodes(cXPathString, xNode);
if( xItems.length > 0 )
{
return xItems[0];
}
else
{
return null;
}
}

// prototying the Element
Element.prototype.selectSingleNode = function(cXPathString)
{ 
if(this.ownerDocument.selectSingleNode)
{
return this.ownerDocument.selectSingleNode(cXPathString, this);
}
else{throw "For XML Elements Only";}
}
}