function usaDateFormat(strDate,showTime)
{
		var stime=strDate.match(/[012]{0,1}[\d]{1}\:[\d]{1,2}\:[\d]{1,2}/);
		
		var sdate=strDate.match(/[\d]{1,4}\-[\d]{1,2}\-[\d]{1,2}/);
		var tdate=sdate[0];
		var ttime=stime[0];
		var dArr=new Array();
		var tArr=new Array();
		var returnvalue;
		if (tdate=="")
		{
			return "Unknow date!"	
		}
		else
		{
			dArr=tdate.split("-");
			var strDay;
			var strDate;
			var strMonth;
			var strYear;
			
			var dateObj = new Date(dArr[0],dArr[1]*1-1,dArr[2]);
			strDay=engWeakday(dateObj);
			strMonth=engMonthName(dArr[1]*1-1)
			returnvalue=strDay+" "+strMonth +" "+ dArr[2]+", "+dArr[0];
			
		}
		
		if (ttime!="" && showTime)
		{
			tArr=ttime.split(":");
			var tmpStr2="";
			if (tArr[1].length==1)
			{
				tArr[1]="0"+tArr[1]	
			}
			if (tArr[0]*1<12) 
			{
				tmpStr2=(tArr[0]==0?12:tArr[0])
				tmpStr2=tmpStr2+"";
				if (tmpStr2.length==1)
				{
					tmpStr2="0"+tmpStr2;	
				}
				returnvalue=returnvalue+"  "+tmpStr2+":"+tArr[1]+" AM";
			}
			else
			{
				tmpStr2=((tArr[0]-12)==0?12:(tArr[0]-12))
				tmpStr2=tmpStr2+"";
				if (tmpStr2.length==1)
				{
					tmpStr2="0"+tmpStr2;	
				}
				returnvalue=returnvalue+"  "+tmpStr2+":"+tArr[1]+" PM";	
			}
		}
		//alert(returnvalue);
		return returnvalue;
}

function usaDateFormat_at(strDate,showTime)
{
		var stime=strDate.match(/[012]{0,1}[\d]{1}\:[\d]{1,2}\:[\d]{1,2}/);
		
		var sdate=strDate.match(/[\d]{1,4}\-[\d]{1,2}\-[\d]{1,2}/);
		var tdate=sdate[0];
		var ttime=stime[0];
		var dArr=new Array();
		var tArr=new Array();
		var returnvalue;
		if (tdate=="")
		{
			return "Unknow date!"	
		}
		else
		{
			dArr=tdate.split("-");
			var strDay;
			var strDate;
			var strMonth;
			var strYear;
			
			var dateObj = new Date(dArr[0],dArr[1]*1-1,dArr[2]);
			strDay=engWeakday(dateObj);
			strMonth=engMonthName(dArr[1]*1-1)
			returnvalue=strDay+", "+strMonth +" "+ dArr[2]+", "+dArr[0];
			
		}
		
		if (ttime!="" && showTime)
		{
			tArr=ttime.split(":");
			var tmpStr2="";
			if (tArr[1].length==1)
			{
				tArr[1]="0"+tArr[1]	
			}
			if (tArr[0]*1<12) 
			{
				tmpStr2=(tArr[0]==0?12:tArr[0])
				tmpStr2=tmpStr2+"";
				if (tmpStr2.length==1)
				{
					tmpStr2="0"+tmpStr2;	
				}
				returnvalue=returnvalue+" at "+tmpStr2+":"+tArr[1]+" AM";
			}
			else
			{
				tmpStr2=((tArr[0]-12)==0?12:(tArr[0]-12))
				tmpStr2=tmpStr2+"";
				if (tmpStr2.length==1)
				{
					tmpStr2="0"+tmpStr2;
				}
				returnvalue=returnvalue+" at "+tmpStr2+":"+tArr[1]+" PM";	
			}
		}
		//alert(returnvalue);
		return returnvalue;
}

function engWeakday(dayFlag)
{
   var d, day, x;
   var x = new Array("Sunday", "Monday", "Tuesday");
   x = x.concat("Wednesday","Thursday", "Friday");
   x = x.concat("Saturday");
   
   day = dayFlag.getDay();
   return(x[day]);
}

function engMonthName(monthFlag)
{
	var x = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
	return(x[monthFlag]);
}
///////////////////////////////////////////////////////
function kbToMb(kbString)
{
	var mbString;
	mbString=kbString.toLowerCase().replace("kb","").replace(" ","");
	if (mbString*1<1000)
	{
		return 	mbString+" KB"
	}
	mbString=Math.floor(mbString/100);
	mbString=mbString/10;
	return mbString+" MB";
}

////////////////////////////
var backupClass=function()
{
	this.lastBackupTime="";
	this.firstBackupTime="";
	this.pointNumber=0;
	this.freeRitSpace="";
	this.SPointNumber=0;
	this.ritTtSpace="";
	this.getBackuptime= function()
	{
		var pointt;
		var pointInfoTmp;
		var firstBackup;
		var tmparr1;
		var ritSpaceInformation;
		var countNumStr="";
		
		try{
			ritSpaceInformation=RitIspX.RITGetSpaceSize();
			var test = RitIspX.RitGetCurState();
		}
		catch(e){
		return false;
		}
		
		try
		{
			pointInfoTmp=RitIspX.RitGetAllPoint();
			firstBackup=pointInfoTmp;
			while (true)
			{
				tmparr1=pointInfoTmp.split("|");
				if (pointInfoTmp.substr(pointInfoTmp.length-1,1)=="#")
				{
					countNumStr=pointInfoTmp.substr(0,pointInfoTmp.length-1);
				}
				else
				{
					countNumStr=pointInfoTmp;
				}
				if (tmparr1[4]==1)
				{
					this.pointNumber++;
				}
				else
				{
					this.SPointNumber++;
				}
				if (pointInfoTmp.indexOf("#")<0 && pointInfoTmp!="")
				{
					pointt=pointInfoTmp;
				}
				else
				{
					pointt=pointInfoTmp;
					break;
				}
				pointInfoTmp=RitIspX.RitGetAllPoint();
			}
			tmparr1=pointt.split("|");
			if (pointt!="") {this.lastBackupTime=tmparr1[3];}else{this.lastBackupTime="none"}
			tmparr1=firstBackup.split("|")
			if (firstBackup!="") {this.firstBackupTime=tmparr1[3];}else{this.firstBackupTime="none"}
			tmparr1=ritSpaceInformation.split("|");
			if (ritSpaceInformation!="") {this.freeRitSpace=tmparr1[2];this.ritTtSpace=tmparr1[0];}else{this.freeRitSpace="none"}
		}
		catch(e)
		{
			return false;
		}
		return true;
	}
}

///////////////////////////////////////////
function Rit_CreateCBP()
{
	alert("CreateCBP");

	aolRitCom.RitCreateCBP("farstone",0);
}

/////////////////////
function Rit_RestoreLastIBP()
{
	alert("call last ibp");
}
////////////
function Rit_CreateBootableDisc(witCbp)
{
	if (witCbp!="false")
	{
		aolRitCom.RitCreateRecoveryCD(1,"")
	}
	else
	{
		aolRitCom.RitCreateRecoveryCD(0,"")
	}
}
///////////////////////////////////////////////////
var xmlStringAgent=function()
{
	this.attachVar=function(name,value)
	{
		eval("this."+name+"=\""+value+"\"")
	}
}
function analyseXml(str)
{
	var innerStr;
	var XSA=new xmlStringAgent();
	str=str.replace(/^\s+/,'');
	str=str.replace(/\s+$/,'');
	var sstingArr=str.match(/\<\!\[CDATA\[[^(\]\]\>)]*\]\]\>/g);
	var arr1=new Array();
	if(sstingArr)
	{
		for (j=0;j<sstingArr.length;j++)
		{
		
		
			var tmpPushStr="farstoneCdataExp"+Math.floor(Math.random(1)*1000)+10000+j;
			arr1.push(tmpPushStr);

			str=str.replace(sstingArr[j],tmpPushStr);
			sstingArr[j]=sstingArr[j].match(/\<\!\[CDATA\[([^(\]\]\>)]*)\]\]\>/)[1];
		}
	}	

	var arrtmp=str.match(/\<([\w\s]+)\>([^\<]+)\<\/\1\>/);
	while (arrtmp!=null)
	{
		str=str.replace(/\<([\w\s]+)\>[^\<]+\<\/\1\>/,"");
		for (k=0;k<arr1.length;k++)
		{
			if (arr1[k]==arrtmp[2])
			{
				arrtmp[2]=sstingArr[k];
			}
		}
		
		XSA.attachVar(arrtmp[1],arrtmp[2]);
		arrtmp=str.match(/\<([\w\s]+)\>([^\<]+)\<\/\1\>/);
	}
	return XSA;
}

function getEfbMsg(msgId)
{
	try
	{
		var outMsg=getErrMsg(msgId);
	}
	catch(e)
	{
		var outMsg="Error";	
	}
	RIT_popMsg('',280,138,'ok',outMsg,'alert');
    return outMsg;
}