function check_login(){
if (trim(document.form_login.username.value)==""){alert('请输入您的用户名！');form_login.username.focus();return false;}
if (trim(document.form_login.pwd.value)==""){alert('请输入您的密码！');form_login.pwd.focus();return false;}
document.all.url.value=window.location.href;
form_login.action='http://www.51365.net/register/hn_denglu.asp';
}
function check_login2(){
if (trim(document.form_login.username.value)==""){alert('请输入您的用户名！');form_login.username.focus();return false;}
if (trim(document.form_login.pwd.value)==""){alert('请输入您的密码！');form_login.pwd.focus();return false;}
document.all.url.value=window.location.href;
form_login.action='http://www.51365.net/register/hn_denglu2.asp';
}
function lbsong()
{
window.open("about:blank","lbsong","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,top=10,left=10,width=358,height=437");
}
function CheckOthers(form)
{
	for (var i=0;i<form.elements.length;i++)
	{
		var e = form.elements[i];
			if (e.checked)
			{
				e.checked = false;
			}
			else
			{
				e.checked = true;
			}
	}
}

function CheckAll(form)
{
	for (var i=0;i<form.elements.length;i++)
	{
		var e = form.elements[i];
			e.checked = true;
	}
}

function trim(inputString) {

  if (typeof inputString != "string") { return inputString; }
  var retValue = inputString;
  var ch = retValue.substring(0, 1);
  while (ch == " ") { 
  //检查字符串开始部分的空格
	  retValue = retValue.substring(1, retValue.length);
	  ch = retValue.substring(0, 1);
  }
  ch = retValue.substring(retValue.length-1, retValue.length);
  while (ch == " ") {
	 //检查字符串结束部分的空格
	 retValue = retValue.substring(0, retValue.length-1);
	 ch = retValue.substring(retValue.length-1, retValue.length);
  }
  while (retValue.indexOf("  ") != -1) { 
 //将文字中间多个相连的空格变为一个空格
	 retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); 
  }
  return retValue;
} 
//replace
function newreplace(inputString,oldstr,newstr) {

  if (typeof inputString != "string" || typeof oldstr != "string" || typeof newstr != "string") { return inputString; }
  var retValue = inputString;
  var oldlen=oldstr.length;
  while (retValue.indexOf(oldstr)!=-1) {
	 //检查字符串结束部分的oldstr
	 retValue = retValue.substring(0, retValue.indexOf(oldstr))+newstr+retValue.substring(retValue.indexOf(oldstr)+oldlen, retValue.length);
  }
  return retValue;
} 
//x=542,y=500
function pop(pageurl,x,y) {
var popurl=showModalDialog(pageurl,"index", "font-family:Verdana; font-size:12; status:no; unadorned:yes; scroll:auto; resizable:no;dialogWidth:"+x+"px; dialogHeight:"+y+"px");
if (popurl != null){document.all.url.value=popurl;return true;}
else  return false;
}
function pop11(pageurl,x,y) {
var popurl=showModalDialog(pageurl,"index", "font-family:Verdana; font-size:12; status:no; unadorned:yes; scroll:auto; resizable:no;dialogWidth:"+x+"px; dialogHeight:"+y+"px");
if (popurl != null){
str=popurl;
do{
sp=str.indexOf("/");
str=str.substring(sp+1,str.length);
}while(str.indexOf("/")!=-1)
document.all.mimg.value=str;}
else  return false;
}
function pop10(pageurl,x,y) {
var popurl=showModalDialog(pageurl,"index", "font-family:Verdana; font-size:12; status:no; unadorned:yes; scroll:auto; resizable:no;dialogWidth:"+x+"px; dialogHeight:"+y+"px");
if (popurl != null){
str=popurl;
do{
sp=str.indexOf("/");
str=str.substring(sp+1,str.length);
}while(str.indexOf("/")!=-1)
document.all.url.value=str;}
else  return false;
}
function pop1(pageurl,x,y) {
var popurl=showModalDialog(pageurl,"index", "font-family:Verdana; font-size:12; status:no; unadorned:yes; scroll:auto; resizable:no;dialogWidth:"+x+"px; dialogHeight:"+y+"px");
if (popurl != null){document.all.mtv_url.value=popurl;document.all.mtv_url1.value=escape(popurl);}
else  return false;
}
function pop2(pageurl,x,y) {
var popurl=showModalDialog(pageurl,"index", "font-family:Verdana; font-size:12; status:no; unadorned:yes; scroll:no; resizable:no;dialogWidth:"+x+"px; dialogHeight:"+y+"px");
if (popurl != null){
var p=popurl.indexOf(",");
document.all.singer_name.value=popurl.substring(0,p);
document.all.singer_id.value=popurl.substring(p+1,popurl.length);
document.all.singer_name.focus();}
else  return false;
}
function pop3(pageurl,x,y) {
var popurl=showModalDialog(pageurl,"index", "font-family:Verdana; font-size:12; status:no; unadorned:yes; scroll:no; resizable:no;dialogWidth:"+x+"px; dialogHeight:"+y+"px");
if (popurl != null){
var p=popurl.indexOf(".");
var str=popurl.substring(0,p);
do{
sp=str.indexOf("/");
str=str.substring(sp+1,str.length);
}while(str.indexOf("/")!=-1)
document.all.song_name.value=str;
document.all.song_type.value=popurl.substring(p+1,popurl.length);
document.all.url.value=popurl;}
else  return false;
}
function pop_pic(pageurl) {
var popurl=showModalDialog(pageurl,"index", "font-family:Verdana; font-size:12; status:no; unadorned:yes; scroll:no; resizable:no;dialogWidth:36em; dialogHeight:22em");
if (popurl != null){
	if (document.getElementById('imgurl').style.display=='none')
	document.getElementById('imgurl').style.display='';
document.getElementById('imgurl').src=popurl;
}
else  return false;
}
function pop4(pageurl,x,y) {
var popurl=showModalDialog(pageurl,"index", "font-family:Verdana; font-size:12; status:no; unadorned:yes; scroll:no; resizable:no;dialogWidth:"+x+"px; dialogHeight:"+y+"px");
if (popurl != null){
var p=popurl.indexOf(",");
document.all.button.value=popurl.substring(0,p);
document.all.song_class.value=popurl.substring(p+1,popurl.length);}
else  return false;
}
function pop5(pageurl,x,y) {
var popurl=showModalDialog(pageurl,"index", "font-family:Verdana; font-size:12; status:no; unadorned:yes; scroll:no; resizable:no;dialogWidth:"+x+"px; dialogHeight:"+y+"px");
if (popurl != null){
var p=popurl.indexOf(",");
document.all.authorname.value=popurl.substring(0,p);
document.all.author_id.value=popurl.substring(p+1,popurl.length);
document.all.authorname.focus();}
else  return false;
}
function tpop(pageurl) {
var popurl=showModalDialog(pageurl,"index", "font-family:Verdana; font-size:12; status:no; unadorned:yes; scroll:no; resizable:no;dialogWidth:36em; dialogHeight:36em");
if (popurl != null){getoption(popurl);}
else  return false;
}
function getoption(str){
var message=str;
var m=0
var n=document.all.imgcode.length
message=message.split(",");
for (i=0;i<=message.length-1;i++) {
if (message[i]!='0')
document.all.imgcode.options[i+n-m] = new Option(message[i],message[i]);
else
m+=1;
}
}

function DrawImage(ImgD,wid,hei){
   var image=new Image();
   image.src=ImgD.src;
   if(image.width>0 && image.height>0){
    flag=true;
    if(image.width/image.height>= wid/hei){
     if(image.width>wid){  
     ImgD.width=wid;
     ImgD.height=(image.height*wid)/image.width;
     }else{
     ImgD.width=image.width;  
     ImgD.height=image.height;
     }

     }
    else{
     if(image.height>hei){  
     ImgD.height=hei;
     ImgD.width=(image.width*hei)/image.height;     
     }else{
     ImgD.width=image.width;  
     ImgD.height=image.height;
     }

     }
    }
   }
function MM_openBrWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}
 

