﻿function resetsize(rw,rh,obj)
{    
    var img = new Image();
    img.src = obj.src;
    if(img.width>rw && img.height>rh)
    {
        if(img.width/img.height>rw/rh)
        {
            obj.width=rw;
        }
        else
        {
            obj.height=rh;
        }
    }
    //alert("原始宽:"+img.width+"原始高:"+img.height);
}
function display(o)
{
    var sbj = o;
    var obj = document.getElementById(o.id+"_menu");
   
    if (o.id.indexOf("_menu")>0)
    {
        obj = o;            
        sbj = document.getElementById(o.id.replace("_menu",""));
    }
    if(obj)
    {
        var a = 4;
        for(var i=0;i<obj.childNodes[0].childNodes.length;i++)
        {
            if(obj.childNodes[0].childNodes[i].childNodes[0].innerHTML.length>a)
            {
                a = obj.childNodes[0].childNodes[i].childNodes[0].innerHTML.length;
                //obj.style.width="120px";
                //break;
            }
        }
        //alert(obj.childNodes[0].childNodes[0].childNodes[0].innerHTML);
        b = 20*4+(a-4)*10;
        obj.style.width=b+"px";//"120px";
        obj.style.display="block";
        obj.style.marginLeft=sbj.offsetLeft+"px";
        //obj.style.marginTop = sbj.offsetTop+"px";
    }
    if(document.getElementById("03_menu"))
    {
        document.getElementById("03_menu").style.filter="filterAlpha(style=0,opacity=100)";
    }
}
function hidden(o)
{
    var sbj = o;
    if(o.id.indexOf("_menu")<0)
    {
        sbj = document.getElementById(o.id+"_menu");
    }
    if(sbj)
    {
        sbj.style.display="none";
    }
}

function displays(o)
{
    var sbj = o;
    var obj = document.getElementById(o.id+"_menu");
    if(o.id.indexOf("_menu")>0)
    {
        obj = o;
        sbj = document.getElementById(o.id.replace("_menu",""));
    }
    if(obj)
    {
        var a=4;
        {
            for(var i=0;i<obj.childNodes[0].childNodes.length;i++)
            {
                a = obj.childNodes[0].childNodes[i].childNodes[0].innerHTML.length;
            }
        }
        b = 20*4+(a-4)*18;
        obj.style.width=b+"px";//"120px";
        
        obj.style.display="block";
        obj.style.marginLeft=34+sbj.offsetLeft+document.getElementById(o.id.substring(0,2)).offsetLeft+document.getElementById(o.id.substring(0,2)).offsetWidth+2+"px";
        obj.style.marginTop=sbj.offsetTop+"px";
    }
    document.getElementById(o.id.substring(0,2)+"_menu").style.display="block";
    document.getElementById(o.id.substring(0,2)+"_menu").style.filter="filterAlpha(style=0,opacity=100)"; 
}
function hiddens(o)
{
    var sbj = o;
    if(o.id.indexOf("_menu")<0)
    {
        sbj = document.getElementById(o.id+"_menu");
    }
    if(sbj)
    {
        sbj.style.display="none";
    }
    document.getElementById(o.id.substring(0,2)+"_menu").style.display="none";
}

function acolor(n)
{
   n.style.color="#ffff00";
}
function reacolor(n)
{
   n.style.color="";
}
function tdbgcolor(n)
{
  n.style.filter="filterAlpha(style=0,opacity=100)";
  if(n.id.length==6)
  {
    document.getElementById(n.id.substring(0,4)+"_menu").style.filter="filterAlpha(style=0,opacity=100)"; 
  }
  //document.getElementById(n.id.substring(0,2)+"_menu").style.filter="Alpha(style=0,opacity=60)";
  //n.parent.parent.style.filter="Alpha(style=0,opacity=100)";
}
function retdbgcolor(n)
{
  n.style.filter="Alpha(style=0,opacity=60)";
  if(n.id.length==6)
  {
    document.getElementById(n.id.substring(0,4)+"_menu").style.filter="filterAlpha(style=0,opacity=100)"; 
  }
  //document.getElementById(n.id.substring(0,2)+"_menu").style.filter="Alpha(style=0,opacity=60)";
}
function golinks()
{
  var links=document.getElementById("Select1");
  var lin=links.options[links.selectedIndex].value; 
  if(lin=="")
    return;
  else
    window.open(lin,"_blank");
}

function changecolor(n,t,d,s,x,y,z,l)
{
  document.getElementById(n).src="images/"+n+"top.gif";
  document.getElementById(t).src="images/"+t+"down.gif";
  document.getElementById(d).src="images/"+d+"down.gif";
  document.getElementById(s).src="images/"+s+"down.gif";
  document.getElementById(x).style.visibility="visible";
  document.getElementById(y).style.visibility="hidden";
  document.getElementById(z).style.visibility="hidden";
  document.getElementById(l).style.visibility="hidden";
}
function showhide(u,id)
{
    var obj = document.getElementById(id+"_left");
    if(obj!=null)
    {
        if(obj.innerHTML.toLowerCase().indexOf("tr")>0)
        {        
            if(obj.style.display=="none")
            {
                obj.style.display="block";
            }
            else
            {
                obj.style.display="none";
            }
        }
        else
        {
            location.href=u;
        }
    }
    else
    {
        location.href=u;
    }
}
function GoSoBa(w) 
{
    if(w=="baidu")
    {
        window.open("http://www.baidu.com/s?tn=sitehao123&word="+document.getElementById("Baidu1_word").value,"mspg6");
    } 
    else if(w=="google") 
    { 
        window.open("http://www.google.cn/search?client=pub-5048082969411906&forid=1&prog=aff&ie=GB2312&oe=GB2312&hl=zh-CN&q="+document.getElementById("Baidu1_q").value,"mspg4");
    }
}
function SetMenu()
{
    var obj = document.getElementById("qcmenu");
    if(obj)
    {
        obj.childNodes[0].childNodes[0].style.background="none";
    }
}
function ShowThisPro(c,n)
{movehtml();
    if(document.getElementById("prosign").value==c)
    {
        return;
    }
    else
    {
		selectThisPro(n);
        clearInterval(MyMar1);
        document.getElementById("prosign").value=c;
        var url="/qcControls/productShow.aspx?";
        url=url+"ID="+c;
        XMLHTTP.sendReq('GET',url,'','demo11','加载中...');
        
        MyMar1=setInterval(Marquee11,speed);
    }
}
function selectThisPro(n)
{
	var obj = document.getElementById("prothis");
	var c = obj.childNodes[0].childNodes[0].childNodes.length;
	for(var i=1;i<c;i++)
	{
		if(n==i)
		{
			obj.childNodes[0].childNodes[0].childNodes[i].className="tdstyle3 tdstyle3select";			
		}
		else
		{
			obj.childNodes[0].childNodes[0].childNodes[i].className="tdstyle3";
		}
	}
}
function playwmv(str,name)
{
	var WindowsMediaPlayer = document.getElementById("MediaFlashPlay");
	WindowsMediaPlayer.movie="/qcMediaVideoPlay.swf?qcVideo="+str+"?"+name;
}
function GoSearch(o,u)
{
    var obj = document.getElementById(o);
    if(obj)
    {
        if(obj.value!="")
        {        
            var url=u+"?ID="+request("id")+"&TE="+obj.value;
            if(u.toLowerCase()=="")
                url+="&AC="+request("ac");
            location.href=url;
            return true;
        }
        else
        {
            alert("请输入搜索关键字！");
            obj.focus();
            return false;
        }
    }
}
function request(paras)
{
	var url = location.href;
	var paraString = url.substring(url.indexOf("?")+1,url.length).split("&");
	var paraObj = {};
	for(var i=0;j=paraString[i];i++)
	{
		paraObj[j.substring(0,j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf("=")+1,j.length);		
	}
	var returnValue = paraObj[paras.toLowerCase()];
	if(typeof(returnValue)=="undefined")
	{
		return "";
	}
	else
	{
		return returnValue;
	}
}
/* 搜索全部 */
function gosearchinfo()
{
    var obj = document.getElementById("txt_prokey");
    if(obj.value=="请输入产品关键字..." || obj.value=="")
    {
        alert('请输入产品关键字！');
        obj.focus();
        return false;
    }
    else
    {
        location.href="Search.aspx?te="+escape(obj.value);
    }
}