﻿// 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 topid=$("topid").value;
    var keyword=$("keyword").value;
    
    window.location.href="/course/search.aspx?topid="+topid+"&keyword="+escape(keyword);
}