﻿

function urlOpen(URL,id,t,l, w, h) {

var windowprops = "location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=no" +

",left=" + l + ",top=" + t + ",width=" + w + ",height=" + h;
window.open(URL,id,windowprops);
}


function log_out()
{
	ht = document.getElementsByTagName("html");
	ht[0].style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)";
	if (confirm('你确定要退出？'))
	{
		return true;
	}
	else
	{
		ht[0].style.filter = "";
		return false;
	}
}
function onlyNum() // onkeydown="onlyNum();"
{
if(!((event.keyCode>=48&&event.keyCode<=57)||(event.keyCode>=96&&event.keyCode<=105)||event.keyCode==8||event.keyCode==46))
	event.returnValue=false;
}
function runCode()  //定义一个运行代码的函数，
{
  var code=event.srcElement.parentElement.children[0].value;//即要运行的代码。
  var newwin=window.open('','','');  //打开一个窗口并赋给变量newwin。
  newwin.opener = null // 防止代码对论谈页面修改
  newwin.document.write(code);  //向这个打开的窗口中写入代码code，这样就实现了运行代码功能。
  newwin.document.close();
}

function BASEtrim(str)
{
//去掉空格
  lIdx=0;rIdx=str.length;
  if (BASEtrim.arguments.length==2)
  act=BASEtrim.arguments[1].toLowerCase();
  else
  act="all";
for(var i=0;i<str.length;i++){
   thelStr=str.substring(lIdx,lIdx+1);
  therStr=str.substring(rIdx,rIdx-1);
if ((act=="all" || act=="left") && thelStr==" "){
   lIdx++;
}
if ((act=="all" || act=="right") && therStr==" "){
   rIdx--;
}
}
  str=str.slice(lIdx,rIdx);
return str;
}

function NumberCheck(f) {
	if(!TypeCheck(BASEtrim(f.value), "0123456789-/")) {
		msg = "______________________________________________\n\n";
		msg += "不能含空格,只可输入半角字符:0123456789-/\n";
		msg += "\n切换方法:用组合键(Shift+空格键)即可进行全角、半角的转换\n";
		msg += "\n或用鼠标直接在输入法的图标上切换(半月形)\n";
                msg += "_____________________________________________\n";
		
		
		alert(msg + "\n\n");
		
		f.value="";
		f.focus();
		return false;
	}
}

function TypeCheck (s, spc) {
    var i;
    for(i=0; i< s.length; i++) {
        if (spc.indexOf(s.substring(i, i+1)) < 0) {
            return false;
        }
    }
    return true;
}

/* 图片 */
var imgObj;
function checkImg(theURL,winName){
  if (typeof(imgObj) == "object"){
    if ((imgObj.width != 0) && (imgObj.height != 0))
      OpenFullSizeWindow(theURL,winName, ",width=" + (imgObj.width+18) + ",height=" + (imgObj.height+25));
    else
      setTimeout("checkImg('" + theURL + "','" + winName + "')", 100)
  }
}

function OpenFullSizeWindow(theURL,winName,features) {
  var aNewWin, sBaseCmd;
  sBaseCmd = "toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,";
  if (features == null || features == ""){
    imgObj = new Image();
    imgObj.src = theURL;
    checkImg(theURL, winName)
  }
  else{
    aNewWin = window.open(theURL,winName, sBaseCmd + features);
    aNewWin.focus();
  }
}


//使用onload=DrawImage(this,长,宽);
function DrawImage(ImgD,w,h){
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= w/h){
if(image.width>w){
ImgD.width=w;
ImgD.height=(image.height*w)/image.width;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
//ImgD.alt=image.width+"×"+image.height;
}
else{
if(image.height>h){
ImgD.height=h;
ImgD.width=(image.width*h)/image.height;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
//ImgD.alt=image.width+"×"+image.height;
}
}
}




<!-- Begin
maxLen = 120; // max number of characters allowed

function checkMaxInput(form) {
if (form.skillname.value.length > maxLen) // if too long.... trim it!
form.skillname.value = form.skillname.value.substring(0, maxLen);
// otherwise, update §characters left§ counter
else form.remLen.value = maxLen - form.skillname.value.length;
}
//  End -->


  function callindex()
  {
    
    window.location.reload(); 

  }


