﻿var reg=/[\/\\&?<>"',|*:]/ ;


var siteRootUrl="";
var vv_u="undefined";
var gtConfirmDelete="确实要删除$text 么?";
var gtConfirmBreak="确实要阻止$text ,并将他列入黑名单么?";
var gtConfirmDel="确实要删除$text 么?";
var gtConfirmDelBreak="确实要从黑名单中移除,并删除$text么？";
var gtConfirmDelMsg="确实要删除所选中的信息么?";
var gtDeleteChildFirst="请先删除其子文件夹或文件!";
function copyToClipboard(txt){
	if(window.clipboardData){
		window.clipboardData.clearData();
		window.clipboardData.setData("Text",txt);
		
	}else if(navigator.userAgent.indexOf("Opera")!=-1){
		window.location=txt;
		
	}else if(window.netscape){
		try{
			netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
			
		}catch(e){
			alert("!!被浏览器拒绝！\n请在浏览器地址栏输入’about:config’并回车\n然后将’signed.applets.codebase_principal_support’设置为’true’");
			
		}var clip=Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
		if(!clip)return ;
		var trans=Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
		if(!trans)return ;
		trans.addDataFlavor('text/unicode');
		var str=new Object();
		var len=new Object();
		var str=Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
		var copytext=txt;
		str.data=copytext;
		trans.setTransferData("text/unicode",str,copytext.length*2);
		var clipid=Components.interfaces.nsIClipboard;
		if(!clip)return false;
		clip.setData(trans,null,clipid.kGlobalClipboard);
		
	}
	
	return true;
	
}
function generateGuid()
{
    var hex = new Array('0','1','2','3','4','5','6','7','8', '9','a','b','c','d','e','f');

    var outB = '';
	
    for (count = 0; count < 32; count++)
    {
	    if ((count == 8) || (count == 12) || (count == 16) || (count == 20))
		    outB += '';
			
	    outB += hex[Math.floor(Math.random() * 16)];
    }
	
    return outB.toUpperCase() + '';
}
function IsUrl(str_url){
str_url=str_url.toLowerCase();
        var strRegex = "^((https|http|ftp|rtsp|mms)?://)" 
        + "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" //ftp的user@ 
        + "(([0-9]{1,3}\.){3}[0-9]{1,3}" // IP形式的URL- 199.194.52.184 
        + "|" // 允许IP和DOMAIN（域名）
        + "([0-9a-z_!~*'()-]+\.)*" // 域名- www. 
        + "([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\." // 二级域名 
        + "[a-z]{2,6})" // first level domain- .com or .museum 
        + "(:[0-9]{1,4})?" // 端口- :80 
        + "((/?)|" // a slash isn't required if there is no file name 
        + "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$"; 
        var re=new RegExp(strRegex); 

      if (re.test(str_url)){
          return (true); 
      }else{ 
          return (false); 
      }
}

function isItParent(sourceNode,targetNode){
	if(!sourceNode||!targetNode)return true;
	if(sourceNode.ID==targetNode.ID)return true;
	if(sourceNode.GetParentNode().ID==targetNode.ID)return true;
	while(targetNode.GetParentNode()){
		targetNode=targetNode.GetParentNode();
		if(sourceNode.ID==targetNode.ID)return true;
		
	}return false;
	
}
 
function selectStart(){
	if(get_time_spent()>1000||get_time_spent()==0){
		time_start=new Date();
		clock_start=time_start.getTime();
		
	}
}function get_time_spent(clock_start){
	var time_now=new Date();
	return (time_now.getTime()-clock_start);
	
}
function checkInput(str,required){
    if(required&&str.Trim()==""){
	    return false;
    }
    var str1;
    var returnVal=true;
    for(var i=0;i < str.length;i++)
    {
	    str1=str.charAt(i);
        if(reg.test(str1)==true)
        {
            returnVal=false;
            return false;
            i=50;
        }
    }
    return returnVal;
}
function formatDoubleNumber(n)
{
var returnVal="100";
    if(!isNaN(n))
    {
        n=parseInt(n);
        if(n<100)
        {
            returnVal=100+n;
            returnVal=returnVal+"";
            returnVal=returnVal.substring(1,3);
            return returnVal;
        }
    }
    return n;
}
String.prototype.Tlength=function (){
	var arr=this.match(/[^\x00-\xff]/ig);
	return this.length+(arr==null?0:arr.length);
	
};
String.prototype.left=function (num,mode){
	if(!/\d+/.test(num))return (this);
	var str=this.substr(0,num);
	if(!mode)return str;
	var n=str.Tlength()-str.length;
	num=num-parseInt(n/2);
	return this.substr(0,num);
	
};
String.prototype.right=function (num,mode){
	if(!/\d+/.test(num))return (this);
	var str=this.substr(this.length-num);
	if(!mode)return str;
	var n=str.Tlength()-str.length;
	num=num-parseInt(n/2);
	return this.substr(this.length-num);
	
};
String.prototype.GetCount=function (str,mode){
	return eval("this.match(/("+str+")/g"+(mode?"i":"")+").length");
	
};
String.prototype.Trim=function (){
	return this.replace(/(^\s*)|(\s*$)/g,"");
	
};
String.prototype.Ltrim=function (){
	return this.replace(/(^\s*)/g,"");
	
};
String.prototype.Rtrim=function (){
	return this.replace(/(\s*$)/g,"");
	
};
String.prototype.toFormatString=function(){

return this.toString();
}
Date.prototype.toFormatString=function(){

return this.getFullYear()+"-"+(this.getMonth()+1)+"-"+this.getDate()+" "+formatDoubleNumber(this.getHours())+":"+formatDoubleNumber(this.getMinutes())+":"+formatDoubleNumber(this.getSeconds());
}

Date.prototype.toTimeStamp=function(){
return this.getFullYear()+this.getMonth()+this.getDate()+this.getHours()+this.getMinutes()+this.getSeconds()+this.getMilliseconds()+Math.random();
}
 
 
 function ChangeEmailAlert()
 {
     if(window.confirm("请尽快到您的注册邮箱激活帐户成为正式用户，如未收到激活邮件\n请点确定修改邮箱地址或重新发送验证邮箱.\n\n成为正式用户免费空间可达50M，并可以参加推广送免费空间的活动！"))
     {
        top.ChangeEmail();
     }
      
 }