var recordMedia=new function(){
		this.recordData=new Array();
		this.addData=function(index,file_name,play_time,time_stamp,strm_path){
			for (var i = 0; i < this.recordData.length; i++) {
			  	 if(this.recordData[i]["index"] == index ){
			   		 this.recordData[i]["file_name"] =file_name;
			         this.recordData[i]["play_time"] =play_time;
					 this.recordData[i]["time_stamp"]=time_stamp;
			         this.recordData[i]["strm_path"] =strm_path;
			   		 return;
			  	 }
	 	  	}
		   this.recordData[this.recordData.length] = new Object();
		   this.recordData[this.recordData.length - 1]["index"] =index;
		   this.recordData[this.recordData.length - 1]["file_name"] =file_name;
		   this.recordData[this.recordData.length - 1]["play_time"] =play_time;
 		   this.recordData[this.recordData.length - 1]["time_stamp"]=time_stamp;
		   this.recordData[this.recordData.length - 1]["strm_path"] =strm_path;
		}

		this.getFile=function(index){
			/*for (var i = 0; i < this.recordData.length; i++){
			  *	 if(this.recordData[i]["index"] == index){
			   *		 if(!(this.recordData[i]["strm_path"].endWith("/"))){
			   	*	 	this.recordData[i]["strm_path"]=this.recordData[i]["strm_path"]+"/";
			   	*	 }
			   	*	 return this.recordData[i]["strm_path"]+this.recordData[i]["file_name"];
			  	 *}
	 	  	*}
	 	  	*return "";*/
/*		   	if(!(this.recordData[index]["strm_path"].endWith("/"))){
		   		this.recordData[index]["strm_path"]=this.recordData[index]["strm_path"]+"/";
		   	}*/
		   	return this.recordData[index]["strm_path"];
		}
		this.getAllPlayTime= function()
		{
			var ret=0;
			for(i=0;i<this.recordData.length;i++)
			ret+=parseInt(this.recordData[i]["play_time"],10);
			return this.get_duration(ret);
		}
		this.getAllPlayTimeLengh= function()
		{
			var ret=0;
			for(i=0;i<this.recordData.length;i++)
			ret+=parseInt(this.recordData[i]["play_time"],10);
			return ret;
		}
		this.getPlayTime=function(index){
			 return this.recordData[index]["play_time"];
		}
		this.getWhichMedia = function(playtime)
		{
			if(playtime>0)
			{
				var duration=0;
				for(i =0;i<this.recordData.length;i++)
				{
						duration+= parseInt(this.recordData[i]["play_time"],10);
						if(duration>=playtime)
						{
								return i;
						}
				}
			}
			return -1;
		}
		
		this.getTimeStamp=function(index){
			return this.recordData[index]["time_stamp"];
		}

		this.getLength=function(){
			return this.recordData.length;
		}
		this.get_duration= function(time)
		{
			var return_str="";
			var df=parseInt(time/3600,10); 
			if(df>0){
					if(df>9)
					{		
						return_str+=df+":";
					}
					else return_str+="0"+df+":";
					
				}
			df=parseInt(time/60)%60
			if(df>0){
					if(df>9)
						return_str+=df+":";
					else return_str+="0"+df+":";
				}
			else{
				return_str+="00:";
			}
			df =parseInt(time)%60
			if(df>0){
					if(df>9)
						return_str+=df;
					else return_str+="0"+df;
				}
			else
				return_str+="00";
			return return_str;
		}

}