//Í¼Æ¬¼ÓÔØÍê³ÉÇ°Ö´ÐÐ
function domReady(fn){
        if(navigator.userAgent.match(/MSIE/)){
            var timer = setInterval(function(){
                    try{
                        document.documentElement.doScroll('left');
                        clearInterval(timer);
                        timer = null;
                        fn();        
                    }catch(e){}
                },500);
            return true;
        }else{
            document.addEventListener('DOMContentLoaded',fn,false);    
            return true;
        }
    }


function subMit(event) {    
  if(event.keyCode==13)
  {
    onclickMit()
  }
}

function onclickMit(event) {
    var keyword = document.getElementById("ctl00_Top1_search_box_KeyWord").value;
    if (keyword != "search" || keyword != "") {
        document.all["ctl00_Top1_butSearch_info"].click();
    }
    else {

        return;
        alert("ÇëÊäÈëËÑË÷¹Ø¼ü´Ê£¡");
    }
}


function keyDown(button) {
    if (event.keyCode == 13) {

        var keyword = document.getElementById("ctl00_Top1_search_box_KeyWord").value;
        if (document.getElementById("ctl00_ContentPlaceHolder1_TB_KeyWord") != null) {
            var product_keyword = document.getElementById("ctl00_ContentPlaceHolder1_TB_KeyWord").value;
        }
        if ((keyword == "search" || keyword == "") && product_keyword == "") {

            return;
            alert("ÇëÊäÈëËÑË÷¹Ø¼ü´Ê£¡");
        }
        else {
            event.keyCode = 9;
            event.returnValue = false;
            document.all[button].click();
        }
     }
 }



        function imgCenter(img,height)
        {
            var h = img.height;
            var top = (height-h)/2;
            if(h==0)
            {
                top = 8;
            }
            
            img.style.cssText="padding-top:"+ top +"px;";
        }
        
var  flag=false;  
function  DrawImage(ImgD,X,Y,H)
{  
     var  image=new  Image();  
     image.src=ImgD.src;  
     if(image.width>0  &&  image.height>0)
     {  
       flag=true;  
       if(image.width/image.height>=  X/Y)
       {  
         if(image.width>X)
  {      
           ImgD.width=X;  
           ImgD.height=(image.height*X)/image.width;  
         }
  else
         {  
           ImgD.width=image.width;      
           ImgD.height=image.height;  
         }  
       }  
       else
       {  
         if(image.height>Y)
         {      
           ImgD.height=Y;  
           ImgD.width=(image.width*Y)/image.height;            
         }
         else
         {  
           ImgD.width=image.width;      
           ImgD.height=image.height;  
         } 
       }  
     }  
     
     if(H==0)
     {
        return;
     }
     
     if(ImgD.height!=0)
     {
        var top = (H - ImgD.height)/2;
        ImgD.style.cssText="border: 0;padding-top:"+ top +"px;";
     }
     else
     {
        ImgD.style.cssText="border: 0;padding-top:3px;";
     }
}

function main() {
    new SlideView("contact");
    _menuInit("col_m");  
}
domReady(main);


//window.onload = function() 
//{
//    new SlideView( "contact");
//    if(document.readyState=="complete")
//    {
//        _menuInit("col_m");
//    }
//}




function SlideView(e){
    
    var H = 180;
    var h =33;

   for(var r=document.getElementById(e).getElementsByTagName('dl'),c=clearInterval,i=-1,p=r[0],j; j=r[++i];){
       j.style.height=(i?h:H)+'px';
       j.onclick=function(){clearTimeout(j);var i=this;j=setTimeout(function(){if(p!=i)_(p,H,h)(p=i,h,H)},200)};
   }
   function _(el,f,t){
       c(el.$1);el.className=f>t?'':'on';
       return el.$1=setInterval(function(){el.style.height=(f+=Math[f>t?'floor':'ceil']((t-f)*.5))+'px';if (f==t)c(el.$1)},5),_
   }
};





function _menuInit(e){
	e=document.getElementById(e);
	var f=e.getElementsByTagName("LI");
	for(var i=0;i<f.length;i++){
		with(f[i]){
			onmouseover=new Function("__DoShowMenu("+i+");");
			onmouseout=new Function("__DoUnInstallMenu("+i+");");
		}
	}
}
function __DoShowMenu(ID){
	var p=document.getElementById("col_m").getElementsByTagName("LI");
	p[ID].value="true";
	__c(p[ID],"on");
	var m=p[ID].getElementsByTagName("div"),w;
	for(var i=0;i<m.length;i++) if(m[i].className=="col_cm"){
		m[i].style.display="block";
		m[i].style.left=parseInt(getPosition(p[ID]).x+p[ID].offsetWidth/2)-parseInt(m[i].offsetWidth/2)+"px";
	}
	//	p[ID].style.background ="transparent url(CSS/image/menu_item_bg.png) repeat-x scroll 0 0px";
	p[ID].style.backgroundColor = "#84c700";
}
function __c(e,c){
	e = e || event.srcElement;
	if(navigator.appName.indexOf('Microsoft')!=-1)
		e.setAttribute("className",c);
	else
		e.setAttribute("class",c);	
}
function __DoUnInstallMenu(ID){
	var p=document.getElementById("col_m").getElementsByTagName("LI");
	p[ID].value="false";
	__c(p[ID],"");
	var m=p[ID].getElementsByTagName("div");
	for (var i = 0; i < m.length; i++)
	 if(m[i].className=="col_cm"){
	     m[i].style.display = "none";
	     p[ID].style.background = "";
	}
	
   
}
function getPosition(e){
var left = 0;
	var top  = 0;
	while (e!=null)
	{
		left += e.offsetLeft;
		top  += e.offsetTop;
		e     = e.offsetParent;
	}
	return {x:left, y:top};
}



function g(o){return document.getElementById(o);}
function HoverLi(n){
	var tb_nodes = g('tb_'+n).parentNode.childNodes;
	var tbc_nodes= g('tbc_'+n).parentNode.childNodes;
	for(var i=0;i<tb_nodes.length;i++)
	{
		tb_nodes[i].className='normaltab';
		tbc_nodes[i].className='undis';
	}
		g('tbc_'+n).className='dis';
		g('tb_'+n).className='hovertab';
}
function p_HoverLi(n){
	var tb_nodes = g('tb_'+n).parentNode.childNodes;
	var tbc_nodes= g('tbc_'+n).parentNode.childNodes;
	for(var i=0;i<tb_nodes.length;i++)
	{
		tb_nodes[i].className='p_normaltab';
		tbc_nodes[i].className='undis';
	}
		g('tbc_'+n).className='dis';
		g('tb_'+n).className='p_hovertab';
}


function ClearText(obj)
{
	if(obj.value=="search")
	{
		obj.value="";
	}

}

function BackText(obj)
{
	if( obj.value=="")
	{
		obj.value = "search";
	}
}

function ResumeError() { 
return true; 
} 
window.onerror = ResumeError; 



