﻿/// <reference path="jquery-1.3.2-vsdoc2.js" />
/// <reference path="jquery-1.3.2.min.js" />

function search() {

    var skeys = $("#keys").val();
    if (skeys == "" || skeys == "输入产品名称快速查找" || skeys=="Enter the product name to quickly find") {
        alert("请输入关键词!");
        return false;
    }
    location.href = "Product.aspx?keys=" + encodeURI(skeys);

}
function searchonfocus() {
    var skeys = $("#keys").val();
    if (skeys == "输入产品名称快速查找" || skeys == "Enter the product name to quickly find") {
        $("#keys").val("");
        return false;
    }
}
$(document).ready(function() {

    $('.Languageul select').change(function() {
        if ($(this).val() != "") {
            
                window.location.href = $(this).val();
          

        }
    });


});


function swf(name,width,height,transparent){
    document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='"+width+"' height='"+height+"'>");
    document.write("<param name='movie' value='"+name+"'>");
    document.write("<param name='quality' value='high'>");
    document.write("<param name='menu' value='false'>");
    if(transparent==1) document.write("<param name='wmode' value='transparent'>");
    document.write("<embed src='"+name+"' quality='high'");
    if (transparent == 1) document.write(" wmode='transparent'");
    document.write(" pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" + width + "' height='" + height + "'></embed>");
    document.write("</object>");
}
var flag = false;
function DrawImage(ImgD, w, h) {
    xwidth = w;
    xheight = h;
    var image = new Image();
    image.src = ImgD.src;
    if (image.width > 0 && image.height > 0) {
        flag = true;
        if (image.width / image.height >= xwidth / xheight) {
            if (image.width > xwidth) {
                ImgD.width = xwidth;
                ImgD.height = (image.height * xwidth) / image.width;
            } else {
                ImgD.width = image.width;
                ImgD.height = image.height;
            }

        }
        else {
            if (image.height > xheight) {
                ImgD.height = xheight;
                ImgD.width = (image.width * xheight) / image.height;
            } else {
                ImgD.width = image.width;
                ImgD.height = image.height;
            }

        }
    }
}
function mycall1() {
    window.open("http://www.qihuatong.com/chat/webChat?u_i=4601&lang=0&r_u=&v_u=http%3A%2F%2Fwww.jinjian-test.com.cn%2F&skin=2&target=chat&cookie=125533286154080731&free=1&s_i=17037&t_i=7712");
}
function mycall2() {
    window.open("msnim:chat?contact=chengdejinjian@hotmail.com");
}
function mycall3() {
    window.open("http://wpa.qq.com/msgrd?V=1&amp;Uin=412904166&Site=" + window.location.href + "&Menu=yes");
}
function mycall4() {
    window.location.href = 'feedback.aspx?id=4';
}
function setbigpic(obj) {
    document.getElementById("bigpic").src = obj.src;

}
//显示左边产品菜单
function switchMenu(curr_id, total_num) {
     for(var i=0; i<total_num; i++)
	 {         //二级菜单         
		  var el = document.getElementById('leftmenu3-'+i);          
		  if(!el) return;          //一级菜单前面的图片    
		  var el2 = document.getElementById('leftmenu1-'+i);
		  var el3 = document.getElementById('leftmenu2-'+i);
		  if(i == curr_id)         
		  {             
		     if(el.style.display =="block"){
			    el2.className="leftmenu1";
				el.style.display = "none";
			    el3.style.color="";
		     }
			 else{
				el2.className="leftmenu1a";
		        el.style.display = "block";
		        el3.style.color="#E84C00";
		     }
		  }
		  else{
		  el2.className="leftmenu1";
		  el.style.display = "none";
		  el3.style.color="";
		  }
	 }

}

$(document).ready(function() {
    var i = 0;
    setInterval(function() {
        $("#defaultnews span.mid ul li").hide(1000);
        $("#defaultnews span.mid ul li:eq(" + i + ")").show(1000);
        i++;
        if (i >= $("#defaultnews span.mid ul li").length) {
            i = 0;
        }
    }, 3000);
    $('a[rel=lightbox]').lightBox();


    serverDivTop = serverTop = 50;
    serverDivTop2 = serverTop2 = $(window).height() - 20;
    serverDivRight = 0;
    serverDiv = function() {
        $('#siderIMchat_main').css({ "position": "absolute", "top": serverTop + "px", "right": serverDivRight + "px" });
        $('#siderIMchat_main2').css({ "position": "absolute", "top": serverTop + "px", "right": serverDivRight + "px" });
        $('#gotop').css({ "position": "absolute", "top": serverTop2 + "px", "right": serverDivRight + "px" });
    }
    serverDiv();
    $(window).scroll(function() {
        scrollTop = $(document).scrollTop();
        serverTop = serverDivTop + scrollTop;
        serverTop2 = serverDivTop2 + scrollTop;
        serverDiv();
    });

    $(document).bind('keydown', function(e) {

        var key = e.which;
        if (key == 13) {
            e.preventDefault();
            return search();
        }
    });

    $("#logo").click(function() {
        location.href = "Default.aspx";
    });
//    $(".filter ul li a").click(function() {

//    location.href = "Product.aspx?keys=" + encodeURI($(this).html());
//    });

}
)

/*
$("#siderIMchat_main2").bind("mousemove", function(){   open_chat();   }); 
function yuyp(){
$("#siderIMchat_main2").bind("mousemove", function(){   open_chat();   });
}*/

function close_chat() {
    $("#siderIMchat_main2").unbind();
    $("#siderIMchat_main").hide();
    $("#siderIMchat_main2").show();
}


function open_chat() {
    $("#siderIMchat_main2").unbind();
    $("#siderIMchat_main2").hide();
    $("#siderIMchat_main").show();
}

function SetCookie(name, value)//两个参数，一个是cookie的名子，一个是值
{
    var Days = 1; //此 cookie 将被保存 30 天
    var exp = new Date();    //new Date("December 31, 9998");
    exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
    document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
}
function getCookie(name)//取cookies函数        
{
    var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
    if (arr != null) return unescape(arr[2]); return null;

}
function delCookie(name)//删除cookie
{
    var exp = new Date();
    exp.setTime(exp.getTime() - 1);
    var cval = getCookie(name);
    if (cval != null) document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
}



