
$(document).ready(function(){
	$("#search").submit( function () {
		var err="";
		err=($("#k").val()==""?"搜索关键字不能为空！\r\n":"");
		if(err!="") { 
			alert(err);
			return false;
		}else if($("select[name$='st']").val()=="pro"){
			window.location.href="/search/"+$("input[name$='k']").val()+".html";
		}else if($("select[name$='st']").val()=="news"){
			window.location.href="/search-news/"+$("input[name$='k']").val()+".html";
		}
		return false;
	});
	
	$(".img_show").ImageAutoSize(420,420);
});



jQuery.fn.ImageAutoSize = function(width,height)
{
    $("img",this).each(function()
    {
        var image = $(this);
        if(image.width()>width)
        {
            image.width(width);
            image.height(width/image.width()*image.height());
        }
        if(image.height()>height)
        {
            image.height(height);
            image.width(height/image.height()*image.width());
        }
    });
} 



$(document).ready(function(){

         $("form[name='Tsend']").click( function () { 
            $.ajax({
               type: "POST",
               beforeSend:function(){
                    if($("input[name='Tname']").val()==""){
                        alert("请输入您的姓名");
                        return false;
                    }
                    if($("input[name='Tmobile']").val()==""){
                        alert("请输入手机号码");
                        return false;
                    }
                    if($("input[name='Temail']").val()==""){
                        alert("请输入邮箱地址");
                        return false;
                    }
               },
               url: "http://www.35tool.com/Client.aspx?s=0&cid=10845&style=1&vid="+ _35tool.vid +"&kid=0&pt="+document.title+"&pu="+window.location,
               data: "lw_title=咨询&lw_name="+$("input[name='Tname']").val()+"&lw_tel="+$("input[name='Tmobile']").val()+"&lw_email="+$("input[name='Temail']").val()+"&lw_word=&lw_qq=&lw_msn=&lw_word=",
               success: function(msg){
                 alert("提交成功！");
               }
            }); 
         });
         
       
});
