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 google(){
	if(mysearch.key.value){
		window.open("http://www.google.com/search?ie=GB2312&oe=GB2312&hl=zh-CN&lr=lang_zh-CN&q="+mysearch.key.value,"mspg6");
		return false;   
	}else{
		 alert("提示:请先填写关键字.");
		 document.mysearch.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_search(){
	 d=document.form_search;
	 if(d.keyword.value==""){
	 　 alert("请输入搜索关键字！");
        d.keyword.focus();  
		return false;
	 }
	 if(d.bigClass.selectedIndex==0)
	 {
	     alert("请选择搜索栏目！");
		 return false;
	 }
	    return true;
	
   }


function check_login(){
     d=document.form_login;
     if(jtrim(d.username.value)==""){
          alert("用户名不能为空!");
   	      d.username.focus();
		  return false;
	 }
     if(jtrim(d.password.value)==""){
          alert("密码不能为空!");
          d.password.focus();
		  return false;
     }
	return true; 
}
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)
}
function select_go(t){
	window.open(t);
}
