function ask(str,url) {
  if (confirm(str)){
		window.location.href=url;
	}
}

function getdate(){
	var todayx=new Date();
	yearx=todayx.getYear();
	monthx=todayx.getMonth()+1;
	dayx=todayx.getDate();

	Hoursx=todayx.getHours();
	Minutesx=todayx.getMinutes();
	Secondsx=todayx.getSeconds();

	datex=Secondsx+""+yearx+""+monthx+""+dayx+""+Hoursx+""+Minutesx;
	return datex;
}

function getFileExtension(filePath) { //v1.0
  fileName = ((filePath.indexOf('/') > -1) ? filePath.substring(filePath.lastIndexOf('/')+1,filePath.length) : filePath.substring(filePath.lastIndexOf('\\')+1,filePath.length));
  return fileName.substring(fileName.lastIndexOf('.')+1,fileName.length);
}

function search4(){
	if(search.key.value){
		window.open("http://www.google.com/search?ie=GB2312&oe=GB2312&hl=zh-CN&lr=lang_zh-CN&q="+search.key.value,"mspg6");
		return false;   
	}else{
		 alert("提示:请先填写关键字.");
		 document.search.key.focus();  
		 return false;
	}
}

function EnterCheck(i) {
				if ( event.keyCode == 13 && i == 1 ) document.login.password.focus();
				if ( event.keyCode == 13 && i == 2 ) {
				   
					check_login();
				}
}

function check_login(){
     if(jtrim(document.login.username2.value)==""){
          alert("用户名不能为空!");
   	      document.login.username2.focus();
		  return false;
	 }
     if(jtrim(document.login.password2.value)==""){
          alert("密码不能为空!");
          document.login.password2.focus();
		  return false;
     }
	 document.login.username.value=document.login.username2.value
	 document.login.username2.value="";
	 document.login.password.value=document.login.password2.value
	 document.login.password2.value="";
	 document.login.submit(); 
}
function jtrim(str)
{     while (str.charAt(0)==" ")
          {str=str.substr(1);}      
     while (str.charAt(str.length-1)==" ")
         {str=str.substr(0,str.length-1);}
     return(str);
}

function openNewWindow(fileName,windowName,theWidth,theHeight){
	if (windowName == "new"){
			uniqueName = new Date();
			windowName = uniqueName.getTime();
	}
	cc=window.open(fileName,windowName,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width="+theWidth+",height="+theHeight)
	cc.focus(); 
}
function centerPopup(mypage, myname, w, h, scroll) { 
	var winl = (screen.width - w) / 2; 
	var wint = (screen.height - h) / 2 -20; 
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no,toolbar=no' 
	win = window.open(mypage, myname, winprops) 
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); } 
}

function play(i){
	openNewWindow('playsong/player.php?songid='+i+",",'music',320,63)
}