function getCookie(c_name){if (document.cookie.length>0)  {  c_start=document.cookie.indexOf(c_name + "=");  if (c_start!=-1)    {    c_start=c_start + c_name.length+1;    c_end=document.cookie.indexOf(";",c_start);   if (c_end==-1) c_end=document.cookie.length;    return unescape(document.cookie.substring(c_start,c_end));    }  }return "";}
function setCookie(c_name,value,expiredays){ var exdate=new Date(); exdate.setDate(exdate.getDate()+expiredays); document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());}

function saveup(server,id, code,name){
	val1= server+"_"+id+"_"+code+"_"+name;
 setCookie('cod_'+id,val1,365)   ;
getallCookie();
}
function clearcookie(){
var whole_cookie = document.cookie;
var each_cookie = whole_cookie.split(";") ;
var value ="";
var index;
 var fl = new Array(); 
for (var i=0; i< each_cookie.length;i++){
 index = each_cookie[i].split("=");  
 cook=index[0]   ;
 setCookie(cook,'',-10);
}	
	
}

	 function checkfl() { 
var whole_cookie = document.cookie;
var each_cookie = whole_cookie.split(";") ;
var value ="";
var index;
 var fl = new Array(); 
 var count=0;
for (var i=0; i< each_cookie.length;i++){
index = each_cookie[i].indexOf("cod_");
if( index != -1) {
count=1;	
	
}

}
if(count>0)	 {document.write("<a href='history.php'><font color=#660066>[ Your uploaded Files ]</font></a>")}
	 }
  function getallCookie() { 
var whole_cookie = document.cookie;
var each_cookie = whole_cookie.split(";") ;
var value ="";
var index;
 var fl = new Array(); 
for (var i=0; i< each_cookie.length;i++){
index = each_cookie[i].indexOf("cod_");
if( index != -1) {
	//document.write(each_cookie[i]+"<br>");
index = each_cookie[i].split("=");
	fl.push(each_cookie[i]);    
value += unescape(index[1]);
}

}
fl.unique();
fl.reverse();
clearcookie();
var maxln=fl.length;

if(maxln>10){maxln=10;}
for (var z=0; z<maxln ;z++){     
	index = fl[z].split("=");  
 setCookie(index[0],index[1],365)   ;  
}

//return unescape(value);
}
function listfl(){
	
var whole_cookie = document.cookie;
var each_cookie = whole_cookie.split(";") ;
 each_cookie.sort();
 each_cookie.reverse();
var value ="";
var index;
var ix=0;
for (var i=0; i< each_cookie.length;i++){
index = each_cookie[i].indexOf("cod_");
if( index != -1) {
	//document.write(each_cookie[i]+"<br>");
index = each_cookie[i].split("=");
valfl=index[1].split("_");
srv=valfl[0];
id=valfl[1];
code=valfl[2];
name=valfl[3]; 
ix++;
document.write("<tr class='tablayout'><td class='tabsx'><img src='"+ix+".png'></td><td class='tab'>"+name+"</td><td class='tabdx'><a href='http://s"+srv+".leoshare.com/"+code+"_"+id+".htm' target='_blank'><img src='go.png' width=40 border=0></a></td></tr><tr height='3'></tr>");

	
	
}
}
	
	
	}


Array.prototype.unique = function () {
	var r = new Array();
	o:for(var i = 0, n = this.length; i < n; i++)
	{
		for(var x = 0, y = r.length; x < y; x++)
		{
			if(r[x]==this[i])
			{
				continue o;
			}
		}
		r[r.length] = this[i];
	}
	return r;
}
