// JavaScript Document
$(document).ready(function(){
	$("#nav > li").hover(function(){
		//alert($(this));
		var curDiv=$(this).children().eq(2);
		var curUl=$(this).children().eq(2).children().eq(0);
		//alert(curUl);
		//curUl.css("display","none");
		var curHeight=curUl.outerHeight();
		curDiv.animate({height:curHeight+"px"},400);
		curUl.animate({top:-2+"px"},400);
	},function(){
		//alert($(this));
		var curDiv=$(this).children().eq(2);
		var curUl=$(this).children().eq(2).children().eq(0);
		//alert(curUl);
		//curUl.css("display","none");
		var curHeight=curUl.outerHeight();
		curDiv.animate({height:0+"px"},400);
		curUl.animate({top:-curHeight+"px"},400);
	}
	);
	
});

$(function()
  {
	var $index_tab=$('#index_tab');
    if($index_tab.size())
    {
       var tab_h=$index_tab.find('.tab_head:first').children(),tab_b=$index_tab.find('.tab_body:first').children();
       tab_h.each(
		    function(i,o)
			{
				o.onmouseover=function()
				{
					if(!$(this).hasClass('active'))
					{
					   tab_h.filter('.active').removeClass('active');
					   tab_b.filter(':visible').addClass('hide');
					   tab_h.eq(i).addClass('active');
					   tab_b.eq(i).removeClass('hide')
					}
				}
			}
		);
     }
	
	/*
   var slideBar=$('#slide_bar');
   slideBar.find('dl').hover(function(){
     clearTimeout(slideBar.data('tmr'));
     if(!$(this).hasClass('active'))
     {
        slideBar.find('.active').removeClass('active').find('dd').css('display','none');
        $(this).addClass('active').find('dd').css('display','block');
     }
   },
   function(){     
     $(this).removeClass('active').find('dd').css('display','none');
     slideBar.data('tmr',setTimeout(function(){slideBar.find('dl').eq(dropdown_id).addClass('active').find('dd').css('display','block')},100));
   }).eq(dropdown_id).addClass('active');
   */

	var $slideBar=$('#slide_bar');
	if ($slideBar.size())
	{
		var dllist = $slideBar.children();
		dllist.each(
			function(i,o)
			{
				o.onmouseover = function()
				{
					if (!$(this).hasClass('active'))
					{
						dllist.filter('.active').removeClass('active').find('dd').css('display','none');
						dllist.eq(i).addClass('active').find('dd').css('display','block');
					}
				}
			}		
		)
	}
  }
);


function ie_handler(o,ns)
{
  if('slide_bar'==o.id)
  {
    var t=document.createElement('div'),b=t.cloneNode(true);
    t.className='top';
    b.className='bottom';
    o.insertBefore(t,o.firstChild);
    o.appendChild(b);
    with(o.style)
    {
      backgroundColor='transparent';
      borderWidth='0';
      width=o.clientWidth+5+'px';
    }
  }
  else if(o.nodeName.toLowerCase()=='select')
  {
  	 var w=o.offsetWidth;
     o.style.width='auto';
     if(o.offsetWidth>w+20)
    {
       var lb=document.createElement('label'),sp=document.createElement('span');
       lb.className='dropdownlabel';lb.style.width=w+'px'; 
       sp.title='请点左边文字';
       lb.appendChild(sp);
       o.parentNode.insertBefore(lb,o);       
       lb.appendChild(o);      
    }
    else
    {
      o.style.width=w+'px';
    } 
  }
  else
  {
    if(!document.v&&!ns.v&&document.styleSheets.length)
    {
      document.v=true;
      ns.add('v','');
      document.styleSheets[0].addRule('v\\:roundrect','behavior:url(#default#VML)');
      document.styleSheets[0].addRule('v\\:shadow','behavior:url(#default#VML)');
    }
    var w=o.clientWidth,h=o.clientHeight,z=5/h,s=document.createElement('span');
    s.innerHTML=ie_handler.rt.replace('{w}',++w).replace('{h}',++h).replace('{z}',z);
    o.appendChild(s);
    with(o.style)
    {
      position='relative';
      backgroundColor='transparent';
      borderWidth='0';
      padding='1px';
    }
  }
}
ie_handler.rt='<v:roundrect style="width:{w}px;height:{h}px;z-index:-2;" arcsize="{z}" strokecolor="#8FA5B2" class="roundrect_ie""><v:shadow on="T" type="single" opacity="0.8" color="#C1CED4" offset="3px,3px" /></v:roundrect>';

