﻿var cur_obj = null;
var cur_menu_item = null;
var menu_showed = false;
var thumbWidth = 120; var thumbHeight = 90;
var thumbHWidth = thumbWidth; var thumbHHeight = thumbHeight;
var urlPrefix = "";
var search_category = 1;
function WriteThumb(img, url, alt, blank, highlight) {
    if (blank == null)
        blank = false;
    if (highlight == null)
        highlight = false;

    var str = "<table class='thumbnail' align=\"center\">";
    str += "<tr><td>";
    str += "<a href='";
    str += url;
    if (blank)
        str += "' target='_blank'>";
    else
        str += "'>";
    str += "<img src='";
    str += img;
    str += "' alt='";
    str += alt;
    str += "' ";
    if (highlight) {
        if (thumbHWidth > 0) {
            str += " width='";
            str += thumbHWidth;
            str += "' ";
        }
        if (thumbHHeight > 0) {
            str += " height='";
            str += thumbHHeight;
            str += "' ";
        }
    } else {
        if (thumbWidth > 0) {
            str += " width='";
            str += thumbWidth;
            str += "' ";
        }
        if (thumbHeight > 0) {
            str += " height='";
            str += thumbHeight;
            str += "' ";
        }
    }
    str += "></a></td></tr></table>";
    document.write(str);

}
function Fixmenu() {
    var sfEls = document.getElementById("nav_menu").getElementsByTagName("div");
    for (var i = 0; i < sfEls.length; i++) {
        sfEls[i].onmouseover = function () {
            this.className += (this.className.length > 0 ? " " : "") + "sfhover";
        }
        sfEls[i].onMouseDown = function () {
            this.className += (this.className.length > 0 ? " " : "") + "sfhover";
        }
        sfEls[i].onMouseUp = function () {
            this.className += (this.className.length > 0 ? " " : "") + "sfhover";
        }
        sfEls[i].onmouseout = function () {
            this.className = this.className.replace(new RegExp("( ?|^)sfhover\\b"),"");
        }
    }
}
function search() {
    var category_1 = document.getElementById("category_1");
    var category_2 = document.getElementById("category_2");
    category_1.onclick = function () {
        this.className = "span_selected";
        category_2.className = "span_noselected";
        search_category = 1;
    }
    category_2.onclick = function () {
        this.className = "span_selected";
        category_1.className = "span_noselected";
        search_category = 2;
    }
}
function search_go() {
    var key = document.getElementById("searchekey");
    if (key.value == "") {
        alert("Please enter the keyword");
        key.focus();
        return;
    }
    window.location.href = "product.aspx?i=" + search_category + "&keyword=" + key.value;
}
function gotoyear(i, y) {
    window.location.href = "news.aspx?i=" + i + "&year=" + y;
}
function gotopage(i,key, cpage) {
    window.location.href = "product.aspx?i=" + i + "&keyword=" + key + "&page=" + cpage;
}
function _onload_() {
    Fixmenu();
    search();
}
window.onload = _onload_;
