﻿// JScript 文件

//获取对象
function $() {
  var elements = new Array();

  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (typeof element == 'string')
      element = document.getElementById(element);

    if (arguments.length == 1) 
      return element;

    elements.push(element);
  }

  return elements;
}

//隐藏某个对象
function hide(s)
{
	$(s).style.display=$(s).style.display=="none"?"":"none";
}

//幻灯片
function displayIMG(focus_width,focus_height,text_height,swf_height,pics,links,texts)
       {    
       
 document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
 document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="/focus.swf"><param name="quality" value="high"><param name="bgcolor" value="#F0F0F0">');
 document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
 document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
 document.write('<embed src="/focus.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#F0F0F0" quality="high" width="'+ focus_width +'" height="'+ focus_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');  document.write('</object>');
 }
 
//缩略图
function check(dd,mystr1,mystr2)
{
 var imgwidth;
 var imgheight;
 imgwidth=mystr1;
 imgheight=mystr2;
 if(dd.width>imgwidth && dd.height>imgheight){
    if(dd.width/dd.height>imgwidth/imgheight){
        dd.width=imgwidth;
    }
    else
    {
       dd.height=imgheight;
    }
 }
 else if(dd.width>imgwidth){
    dd.width=imgwidth;
 }
 else if(dd.height>imgheight){
    dd.height=imgheight;
 }
}

//回车事件
function KeyDown()
{
    if (event.keyCode == 13)
    {
        event.returnValue=false;
        event.cancel = true;
        addSearch();
    }
}

//转向
function addSearch()
{
    
    var keyword=$("keyword").value;
   
    window.location.href="/lesson/search.aspx?keyword="+escape(keyword);
}

// 切换城市菜单
/*Change City Start*/
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_startTimeout() {
	if( window.ActiveMenu ) {
		mmStart = new Date();
		mmDHFlag = true;
		mmHideMenuTimer = setTimeout("mmDoHide()", window.ActiveMenu.Menu.hideTimeout);
	}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
/*Change City End*/

function showCommendTab(obj)
          {
             
          //var commendcom=document.getElementById('a');
          //var hotper=document.getElementById('b');
          var sobj=document.getElementById(obj);
          var sobj1=document.getElementById(obj+'1');
         // alert(sobj1);
          a.style.display="none";
          b.style.display="none";
          c.style.display="none";
          d.style.display="none";
          e.style.display="none";
          f.style.display="none";
          g.style.display="none";
          h.style.display="none";
          i.style.display="none";
          j.style.display="none";
          
          a1.className="tt1";
          b1.className="";
          c1.className="";
          d1.className="";
          e1.className="";
          f1.className="";
          g1.className="";
          h1.className="";
          i1.className="";
          j1.className="";
          sobj.style.display="block";
          sobj1.className="tt1";    
           }
