﻿function showConentMenu(name,phone,fax,email,address)
{	
	if ($("#showConentMenu").length==0)
	{
		$("body").append("<div id='showConentMenu'></div>");
	}
	var text = "";
	if (name != '') {
	    text += name + "<br/>";
	}
	if (phone != '') {
	    text += "电话：" + phone + "<br/>";
	}
	if (fax != '') {
	    text += "传真：" + fax + "<br/>";
	}
	if (email != '') {
	    text += "Email：" + email + "<br/>";
	}
	if (address != '') {
	    text += "地址：" + address;
	}
	$("#showConentMenu").html(text);  
	
	var top = parseInt(document.documentElement.scrollTop,0)+event.clientY+5;
	var left = parseInt(document.documentElement.scrollLeft,0)+event.clientX+5;
	
	$("#showConentMenu").css({"display":"block","position":"absolute","top":top,"left":left});
}

function hiddenConentMenu()
{	
	$("#showConentMenu").css({"display":"none"});
}

function searchTab(element) {
    var index = $("#SearchTab div").index(element);
    var action = $(element).attr("action");
    if (index == 0)
        $(element).removeClass().addClass("SearchMenu").siblings().removeClass().addClass("SearchMenuNo");
    else
        $(element).removeClass().addClass("SearchMenu2").siblings().removeClass().addClass("SearchMenuNo");

    if (action == "product") {
        $("#SearchForm").attr("action", "/Product.aspx");
    }
    else {
        $("#SearchForm").attr("action", "/News.aspx");
    }
   
}
function initSearchTab(path) {
    if (path) {
        var current = $("#SearchTab div[action=" + path + "]").first();
        searchTab(current);
    }
}

$(function() {
    $("#SearchTab div").click(function() {
        searchTab(this);
    });

    if ($("#sltop").length == 0) {
        $("body").append("<div id='sltop'></div>");
        $("#sltop").html("<a href=\"#\"><img src=/images/top.jpg style='border:0px;'></a>");
    }
    var poswidth = 0;
    if (window.screen.width > 1040) {
        poswidth = (window.screen.width - 1040) / 2;
    }
    var posheight = window.screen.height - 350;
    $("#sltop").css({ "display": "block", "position": "fixed", "top": posheight, "right": poswidth });

});

