﻿// JScript 文件

  function $(id)
    {
        return document.getElementById(id);
    }    

 function xuanze(kongjian,s)
{

if (kongjian.value==s)
    {
    kongjian.value="";
    kongjian.focus();
    } 
}
 function xuanze2(kongjian,s)
{

if (kongjian.value=='')
    {
    kongjian.value=s;   
    } 
}




function wu(ob){
$(ob).style.display="none";
}
function you(ob){
$(ob).style.display="block";
}

function getdivdisplay(ob1,ob2,str){

if (str=='1')
{
wu($(ob1))
you($(ob2))

}
else
{

you($(ob1))
wu($(ob2))
}
}



  function del(message,url)
  {
  if (confirm(message))
     {window.location.href=url;}
  else
      {
        return false;
      }
  
  }

    function myAddPanel(title,url,desc) 
    { 
    if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function'))
 
        { 
        window.sidebar.addPanel(title,url,desc); 
        } 
    else
   
        { 
        window.external.AddFavorite(url,title); 
        } 
    } 

 
 function checkEmail(email) {
    var i,schar,batbegin,bdotbegin;
    schar=email.substr(i, 1);
    if ((schar == "@") || (schar == "."))
    {
        return false;
    }
    for (i = 1;  i < email.length;  i++)
    {
        schar=email.substr(i, 1);
        if (email.substr(i, 1) == "@")
        {
            if (bdotbegin || batbegin)
            {
                return false;
            }
            batbegin=true;
        }
        if (email.substr(i, 1) == ".")
        {
            if (!batbegin)
            {
                return false;
            }
            bdotbegin=true;
        }
    }
    
    if ((!batbegin) || (!bdotbegin))
    {
        return false;
    }
    return true;
}    

   function getPathimgyulan(obj)
    {
        if(obj)
        { 
            if (window.navigator.userAgent.indexOf("MSIE")>=1)
            {
                obj.select();
                return document.selection.createRange().text;
            } 
            else if(window.navigator.userAgent.indexOf("Firefox")>=1)
            {
                if(obj.files)
                { 
                    return obj.files.item(0).getAsDataURL();
                }
                return obj.value;
            }
            return obj.value;
        }
    }
 
 
var flag=false; 
function DrawImage(ImgD){ 
var image=new Image();

image.src=ImgD.src; 
if(image.width>0 && image.height>0){ 
if(image.width>image.height){ 
var width_old= image.width; 
var width_new="50";
ImgD.height=(image.height/width_old)*width_new;
ImgD.width=width_new; 
}else{ 
if (image.width<image.height) {
var height_old= image.height;
var height_new="50";
ImgD.width=(image.width/height_old)*height_new;
ImgD.height=height_new;

} 
if(image.width==image.height){
ImgD.width="50";
ImgD.height="50";
}
} 
}
}




  
  
