﻿// JScript 文件

//下拉框
function AjaxSelectBox(v){
 var dl = v.parentNode;
 var dd = dl.getElementsByTagName("dd")[0];
 var dt = dl.getElementsByTagName("dt")[0];
 var lis = dl.getElementsByTagName("li");
 var html = '';
 for(var y=0; y<lis.length; y++){   
  html += '<li onmouseout="SetSelectInput(this,2);" onmousemove="SetSelectInput(this,3);" value="'+lis[y].value+'">' + lis[y].innerHTML + '</li>';
 }
 dl.getElementsByTagName("ul")[0].innerHTML = html;
 dd.style.display = "block";
 dl.onmouseout = function() {dd.style.display = "none";}
 dd.onmouseover = function() {dd.style.display = "block";}
}

function SetSelectInput(v,flag){
 var dl = v.parentNode;
 while(dl.nodeName != 'DL'){
  dl = dl.parentNode;
 }
 var input = dl.getElementsByTagName("input")[0];
 var dd = dl.getElementsByTagName("dd")[0]; 
 var dt = dl.getElementsByTagName("dt")[0]; 
 dd.onmouseover = function() {dd.style.display = "block";}
 v.onmouseover = function() {dd.style.display = "block";} 
 dd.onmouseout = function() {dd.style.display = "none"} 
 if(flag == 1){
 var strvalue = v.attributes.getNamedItem("value").value;;
 input.value = strvalue;
  dt.innerHTML = v.innerHTML;
  dd.style.display = "none";
 } else if(flag == 2){
  v.className = 'out'; return; 
 } else{
  v.className = 'move'; return; 
 }  
}
function ShowType(SearchTypeID)
{
    alert(getObj(SearchTypeID).value);
}

function CheckNull(txtid)
{
    var txtKey = getObj(txtid);
    if(txtKey.value == "请输入关键字")
    {
        txtKey.value = "";
    }
}


function AjaxSelectSearch(v,TypeID){
 var dl = v.parentNode;
 var dd = dl.getElementsByTagName("dd")[0];
 var dt = dl.getElementsByTagName("dt")[0];
 var lis = dl.getElementsByTagName("li");
 var html = '';
 for(var y=0; y<lis.length; y++){   
  html += '<li onclick="SetSelectInput(this,1);"  onmouseout="SetSelectInput(this,2);" onmousemove="SetSelectInput(this,3);" value="'+lis[y].value+'">' + lis[y].innerHTML + '</li>';
 }
 dl.getElementsByTagName("ul")[0].innerHTML = html;
 dd.style.display = "block";
 dl.onmouseout = function() {dd.style.display = "none";}
 dd.onmouseover = function() {dd.style.display = "block";}
}

//将页面的PNG图片背景转换成透明度
function correctPNG() 
   {
   for(var i=0; i<document.images.length; i++)
      {
      var img = document.images[i]
      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
         i = i-1
         }
      }
   }
//window.attachEvent("onload", correctPNG);



function Topdisp()
{
    if(getObj("Webtop_txtsearch").value=="" || getObj("Webtop_txtsearch").value=='请输入商品名称' || getObj("Webtop_txtsearch").value=='请输入品牌名称' || getObj("Webtop_txtsearch").value=='请输入公司名称')
    {
        window.alert("搜索关键词不能为空！");
		getObj("Webtop_txtsearch").focus();
		getObj("Webtop_txtsearch").value = '';
		return false;
    }
    return true;
}


function getObj(obj)
{
    return document.getElementById(obj);
}

//*****************滑动门********************/
function init(ids,cons,dis,LiID){
   document.getElementById(ids).getElementsByTagName('li')[0].className='active';
  document.getElementById(cons).innerHTML=document.getElementById(dis+LiID).innerHTML;
//  document.getElementById(ids).onmouseover=function(){onmousOver(ids,cons,dis);}//鼠标指向激发效果
  document.getElementById(ids).onmouseover=function(){
   var obj;
   if(navigator.appName.indexOf("Microsoft") > -1){      /////////提前了,加了个浏览器判断
    obj = window.event.srcElement;
   }else{
    obj = arguments[0].target;
   }
   onmousOver(ids,cons,dis,obj);                        /////////加个参数obj
  }//点击激发效果
}
function onmousOver(ids,cons,dis,obj){        ///////////加个参数obj
////////这两行删了
if (obj.tagName=='LI'){
  if (obj.className=='active'||obj.id=='more')return;
  var o=document.getElementById(ids).getElementsByTagName('li');
  for (var i=0;i<=o.length-1;i++){o[i].className='default'}
  
  obj.className='active';
  if (obj.className=='active'){document.getElementById(cons).innerHTML=document.getElementById(dis+obj.id).innerHTML;}
}
}
//焦点新闻滑动
<!-- 
function $(o){return document.getElementById(o);} 
function HoverLi(n)//如果有N个标签,就将i<=N; //本功能非常OK,兼容IE7,FF,IE6;http://www.xiaogezi.cn/ [小鸽子]系列 
{ 
    for(var i=1;i<=3;i++)
    {
        $('focus_'+i).className='focus_normal';
        $('focusc_0'+i).className='undis';
    }
    $('focusc_0'+n).className='dis';
    $('focus_'+n).className='focus_hover'; 
}
//--> 
