﻿
function getposOffset(what, offsettype) {
    var totaloffset = (offsettype == "left") ? what.offsetLeft : what.offsetTop;
    var parentEl = what.offsetParent;
    while (parentEl != null) {
        totaloffset = (offsettype == "left") ? totaloffset + parentEl.offsetLeft : totaloffset + parentEl.offsetTop;
        parentEl = parentEl.offsetParent;
    }
    return totaloffset;
}

//ff支持s
function isIE() {
    return !!(window.attachEvent && !window.opera);
}


if (!isIE()) { //firefox innerText define
    HTMLElement.prototype.__defineGetter__("innerText",
    function() {
        var anyString = "";
        var childS = this.childNodes;
        for (var i = 0; i < childS.length; i++) {
            if (childS[i].nodeType == 1)
                anyString += childS[i].tagName == "BR" ? '\n' : childS[i].innerText;
            else if (childS[i].nodeType == 3)
                anyString += childS[i].nodeValue;
        }
        return anyString;
    }
   );
    HTMLElement.prototype.__defineSetter__("innerText",
    function(sText) {
        this.textContent = sText;
    }
   );
}


//左菜单关于详细分类div 2008-10-16

var sortArray;
var sortId = -1;
function showwindowExtra(obj, objdiv, addx, addy, ids) { //this,sortbox,0,-2,5
    if (sortArray[ids].length > 0) {
//        document.getElementById("sortTitle").innerHTML = obj.innerText;
        document.getElementById("sortTitle").href = obj;
        document.getElementById("sortTitle").target = "_self";
        if (sortArray[ids].length == 0) {
            sortId = -1;
            document.getElementById("sortContentBox").style.display = "none";
            document.getElementById("sortTitle").className = "flxf_left2";
        }
        else {
            sortId = ids;
            document.getElementById("sortTitle").className = "flxf_left";
            document.getElementById("sortContentBox").style.display = "inline";
            document.getElementById("sortContent" + sortId).style.display = "";
        }
        var x = getposOffset(obj, 'left');
        var y = getposOffset(obj, 'top');
        var div_obj = document.getElementById(objdiv);
        div_obj.style.left = (x + addx) + 'px';
        div_obj.style.top = (y + addy) + 'px';
        div_obj.style.display = "inline";
        document.getElementById("SortBoxShadowRight").style.height = (document.getElementById("SortBoxRight").offsetHeight + 2) + "px";
    }
}

function hidewindowExtra(objdiv, ids) {
    var div_obj = document.getElementById(objdiv);
    var ul_obj = document.getElementById("sortContent" + ids);
    if (div_obj) div_obj.style.display = "none";
    if (ul_obj) ul_obj.style.display = "none";
}

function showwindowExtra2() {
    if (sortId != -1) document.getElementById("sortContent" + sortId).style.display = "";
    document.getElementById('sortBox').style.display = 'inline';
}

function hidewindowExtra2() {
    if (sortId != -1) document.getElementById("sortContent" + sortId).style.display = "none";
    document.getElementById('sortBox').style.display = 'none';
}

function loadOver() {
    if (!isIE()) {
        document.getElementById("SortBoxShadowRight").style.width = "240px";
    }
    else {
        document.getElementById("SortBoxShadowLeft").style.height = "2px";
        document.getElementById("SortBoxShadowLeft").style.position = "static";
    }
}
function initSort() {
    sortArray = [
    ["焦炭", "/news/?classid=2",
    "煤焦油", "/news/?classid=3",
    "粗苯", "/news/?classid=5",
    "硫酸铵", "/news/?classid=92"
    ],
    [
    "焦化苯", "/news/?classid=4",
    "焦化甲苯", "/news/?cx=1&k=1&sname=焦化甲苯",
     "焦化二甲苯", "/news/?cx=1&k=1&sname=焦化二甲苯",
    "顺酐", "/news/?classid=10",
    "氯化苯", "/news/?classid=93",
    "加氢苯", "/news/?classid=159"
    ],
    [
    "工业萘", "/news/?classid=6",
    "煤沥青", "/news/?classid=7",
    "蒽油", "/news/?classid=155",
    "洗油", "/news/?classid=157",
     "粗酚", "/news/?classid=156",
	"减水剂/2萘酚", "/news/?classid=94",
	"碳素产品", "/news/?classid=95"
	
    ],
    ["液氯", "/news/?classid=5",
	 "盐酸", "/news/?classid=5"
	 
	 ],
    [
        "苯酚", "/channel/benfen/",
		"丙酮", "/channel/benfen/",
        "环氧乙烷", "/channel/eo/Default.aspx",
        "环氧丙烷", "/news/?cx=1&k=1&sname=环氧丙烷",
        "环氧氯丙烷", "/channel/shuangfen/",
        "丁酮", "/channel/dingtong/Default.aspx",
	    "双酚A", "/channel/shuangfen/",
	    "环己酮", "/channel/huanjt/",
	    "苯胺", "/news/?cx=1&k=1&sname=苯胺",
		"二氯甲烷", "http://chem.chem99.com/news/default.aspx?cx=1&sname=%b6%fe%c2%c8&date=all",

		"二氯乙烷", "/news/?cx=1&k=1&sname=二氯乙烷",
		"MIBK", "/news/?cx=1&k=1&sname=MIBK",
		"乙醇胺", "/news/?cx=1&k=1&sname=乙醇胺",
		"氯化胆碱", "/news/?cx=1&k=1&sname=氯化胆碱",
		"碳酸二甲酯", "/news/?cx=1&k=1&sname=碳酸二甲酯",
		"乙二醇单丁醚", "/news/?cx=1&k=1&sname=乙二醇单丁醚",
		"乌洛托品", "/news/?cx=1&k=1&sname=乌洛托品",
		"环已烷", "/news/?cx=1&sname=环已烷"
    ],
	[
	 "环氧树脂", "/news/?cx=1&k=1&sname=环氧树脂",
	 "聚酯树脂", "/news/?cx=1&k=1&sname=不饱和树脂",
	 "石油树脂", "/channel/c5/",
	 "酚醛树脂", "/news/?cx=1&k=1&sname=酚醛树脂",
	 "双环戊二烯", "/channel/c5/",
	 "间戊二烯", "/channel/c5/",
	 "C5", "/channel/c5/",
	 "C9", "/channel/c5/"
	 ],
	[
	 "硫酸", "/news/?cx=1&k=1&sname=硫酸",
	 "盐酸", "/news/?cx=1&k=1&sname=盐酸",
	 "硝酸", "/news/?cx=1&k=1&sname=硝酸",
	 "烧碱", "/news/?cx=1&k=1&sname=烧碱",
	 "纯碱", "/news/?cx=1&k=1&sname=纯碱",
	  "液氯", "/news/?cx=1&k=1&sname=液氯"
	 ],
	 [
	 "甘油", "/news/?cx=1&k=1&sname=甘油",
	 "脂肪酸(硬脂酸)", "/news/?cx=1&k=1&sname=脂肪酸(硬脂酸)",
	 "棕榈油", "/news/?cx=1&k=1&sname=棕榈油"
	 ]
    ];
    initSortCreate();
}

function initSortCreate() {
    var tempString = "";
    for (var i = 0; i < sortArray.length; i++) {
        tempString += "<ul id=\"sortContent" + i + "\" style=\"display:none\">";
        for (var j = 0; j < sortArray[i].length; j++) {
            tempString += "<li><a href=\"" + sortArray[i][j + 1] + "\" target=\"_self\">" + sortArray[i][j] + "</a></li>";

            //tempString+="<div id=\"sortContent"+i+"\" style=\"display:none\">";
            // for(var j=0;j<sortArray[i].length;j++){
            //   tempString+="<div class='div_content_in'><a href=\""+sortArray[i][j+1]+"\">"+sortArray[i][j]+"</a></div>";
            j++;
        }
        tempString += "</ul>";
    }
    document.write(tempString);
}  




 

 

 
