﻿$(function(){
//----------------
var navh1=$("#lNav>h1");
var navul=$("#lNav>ul");
navh1.each(function(i){$(this).click(function(){sh(i)})});
function sh(o){
for(i=0;i<navh1.size();i++){
navul[i].style.display=i==o?"block":"none";
}
}

$(".leoo:even").css({background:"#feffff url(/images/blue.gif) no-repeat top left",color:"#9a4d14"})
$(".leoo:odd").css({background:"#f7fbfa url(/images/green.gif) no-repeat top left",color:"#09531e"})
//-----------
 
//点击搜索按钮时处理事件
$("#buttonS").click(function(){submitS()}); 
$("#word").keypress(function(){EnterPress(event)}); 
$("#word").keydown(function(){EnterPress()}); 
function submitS(){ 
var domain="http://www.lkbliss-stone.com/"
	var keyTXT=$("#word").val();
	var fileName="/proSearch.html";
	//取得当前搜索的类别和文字,组成需要的字符串形式,加入到form的action    /searchTxt/search.html.
	$("#s_search").attr("action",(domain+(keyTXT)+fileName));
	//decodeURI解码
	//搜索提交
	$("#s_search").submit();
}
function EnterPress(e){ //传入 event 
var e = e && window.event; 
if(e.keyCode == 13){submitS()} 
} 

//------------------




//----------------		   
});

function correctPNG() 
{ 
    var arVersion = navigator.appVersion.split("MSIE") 
    var version = parseFloat(arVersion[1]) 
    if ((version >= 5.5) && (document.body.filters)) 
    { 
       for(var j=0; j<document.images.length; j++) 
       { 
          var img = document.images[j] 
          var imgName = img.src.toUpperCase() 
          if (imgName.substring(imgName.length-3, imgName.length) == "PNG") 
          { 
             var imgID = (img.id) ? "id='" + img.id + "' " : "" 
             var imgClass = (img.className) ? "class='" + img.className + "' " : "" 
             var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' " 
             var imgStyle = "display:inline-block;" + img.style.cssText 
             if (img.align == "left") imgStyle = "float:left;" + imgStyle 
             if (img.align == "right") imgStyle = "float:right;" + imgStyle 
             if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle 
             var strNewHTML = "<span " + imgID + imgClass + imgTitle 
             + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" 
             + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" 
             + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
             img.outerHTML = strNewHTML 
             j = j-1 
          } 
       } 
    }     
} 
window.attachEvent("onload", correctPNG);
//PNG结束//

function ReSizeImg(Img,width,height){
var image=new Image(); 
image.src=Img.src; 
if(image.width>width||image.height>height) {
w=image.width/width;
h=image.height/height;
if(w>h) {
Img.width=width;
Img.height=image.height/w;
}else{
Img.height=height;
Img.width=image.width/h;
}
}
}




