// JavaScript Document

//返回引用
function $(id){
	if(!document.getElementById) return;
	return 	document.getElementById(id);
}

//加入最愛
function addFavorite(){
	var sURL="http://www.matthias.com.tw/";
	var sTitle="【瑪蒂亞斯】昕肯生化科技有限公司";
    try{ 
        window.external.addFavorite(sURL,sTitle); 
    }catch(e){ 
        try{ 
            window.sidebar.addPanel(sTitle,sURL,''); 
        }catch (e){ 
           alert("加入最愛失敗,请手動添加!"); 
        } 
    } 
} 

//左邊菜單
function showSubNav(obj){
	var getNodes=obj.parentNode.childNodes;
	for(i=0;i<getNodes.length;i++)
	{
		if((getNodes[i].nodeName.toLowerCase())=='ul')
		{
			getNodes[i].className=(getNodes[i].className=='hidden')?'':'hidden';
			break;
		}
	}
}

//IE6 BUG,PNG图片纠证
function currentPNG(){
   for(var i=0; i<document.images.length; i++)
      {
     var img = document.images[i]
     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
       i = i-1
        }
      }
}

function isLoadCurrentPNG(){
	 if(navigator.appName == "Microsoft Internet Explorer"&&parseFloat(navigator.appVersion.split("MSIE")[1])<7)
	 {
		 currentPNG();
		 return true;
	 }
	 else
	 {
		return false;	 
	 }
}

//顯示產品
function displayProShow(id){
	$('mark_div').style.display='block';
	$('mark_div').style.height=document.documentElement.scrollHeight+'px';
	//alert(document.documentElement.scrollTop);
	$(id).style.marginTop=Math.floor((document.documentElement.clientHeight-230)/2)+document.documentElement.scrollTop+'px';
	$(id).style.marginLeft=Math.floor((document.documentElement.clientWidth-460)/2)+'px';
	$(id).style.display='block';
}
function closeProShow(id){
	$('mark_div').style.display='none';
	$(id).style.display='none';
}

