// TOP 搜索下拉框模拟
$(document).ready(function(){
	$('#select .xst').click(function(){
		if($('#select ul').css('display') == 'none'){
			$('#select ul').css('display','block');
		} else {
			$('#select ul').css('display','none');
		}
	});
	$('.search .word input').click(function(){
		$('.search .word input').val('');
	});
	// 搜索 Go 按钮样式
	$("#searchsubmit").hover(
		function(){$(this).css({cursor:"pointer",background:"#C11717"});},
		function(){$(this).css({background:"#7C8E06"});}
	);
	
	//PNG透明（v3.17去掉）
	correctPNG();
});
var ooFile = 'products';
var search_select = function(id,text){
	if(id == 1){
		ooFile = 'news';
	} else if (id == 2){
		ooFile = 'download';
	} else {
		ooFile = 'products';
	}
	$('#select ul').css('display','none');
	$("#select .xst").html(text);
};

//PNG透明（v3.17去掉）
correctPNG = function(){ 
    var arVersion = navigator.appVersion.split("MSIE");
    var vs = parseFloat(arVersion[1]);
    if ((vs >= 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;
          } 
       } 
    }     
};

// 搜索表单提交URL转换,v3.17及以后版本中去掉该函数
SC.searchsubmit = function(form_id,wd_id,file,file_select_id){
	if(file_select_id != 0) file = $('#' + file_select_id).val();
	var nURL = 	'./?m1/f' + file + '/l' + Lang + '/w' + encodeURI($('#' + wd_id).val());
	document.getElementById(form_id).action = nURL;	
	return true;
}
