
function ToolBar(){
    // creation de l'objet url on découpe l'url
    var URL=new CUrlParser();
    var nb; 
    var tt;
    document.write('&nbsp;&nbsp;<A class="topnav" href="http://www.doggybag.org">Home</A>');
    for(nb=0;nb<URL.Dir.length;nb++)
    {
        document.write('&nbsp;>&nbsp;<A class="topnav" href="');
        for (tt=0;tt<nb;tt++)
        {
            document.write(URL.Dir[tt] + '/' );
        }
        if (URL.Dir[nb] == 'cdsale')
        {
            document.write('index.htm">2nd Hand Records</A>');
        }
        else
        {
            document.write('">'+ URL.Dir[nb] +'</A>');
        }
    }
    if (URL.FileName != 'index')
    {
        document.write('&nbsp;>&nbsp;<A class="topnav" href="'+ self.location +'">'+ document.title +'</A>');
    }
}                 

function CUrlParser(){
    this.Dns=new Array();
    this.Dir=new Array();
    this.Querystring=new Array();
    this.FileName='';
    this.Country='';
    this.Domain='';
    this.Construct=CUrl_Construct;
    this.GetUrl=CUrl_GetUrl;
    this.Clean=CUrl_Clean;
    // appel a la fonction CUrl_Construct
    this.Construct();
}
 
 function CUrl_Construct(){
	// reprise de l'url courante
	var url=this.GetUrl(); 
	var arr=new Array();
	var iSize=0;
	var i=0;
	// découpage de l'url
	arr=url.split("/");
	iSize=arr.length;
	// découpage de la racine de l'url pour récuper l'extension pays
	this.Dns=arr[0].split(".");
	if(this.Dns.length>1)
	{
		this.Country=this.Dns[this.Dns.length-1];
		this.Domain=this.Dns[this.Dns.length-2];
	}
	else
	{
		this.Country="";
		this.Domain=this.Dns[0];
	}
	this.Dir[0]='';
	// recherche du répertoire courant
	for(var k=1;k<iSize-1;k++)this.Dir[k-1]=arr[k];
	// recherche du nom de la page courante
	this.FileName=this.Clean(arr[iSize-1]);
 }

// recherche l'url courante 
function CUrl_GetUrl(){ 
	var sLocation=new String(self.location); 
	sLocation=sLocation.toLowerCase();
	var iLenght=sLocation.length;
	var iStart=sLocation.indexOf("http://",0);
	if(iStart==0)sLocation=sLocation.substring(7,iLenght);
	return sLocation;
}

// nettoie l'url des query string  
function CUrl_Clean(sValue){
	var iLenght=sValue.length;
	var iStart=sValue.indexOf(".",0);
	if(iStart>0)sValue=sValue.substring(0,iStart);
	return sValue;
}
  
ToolBar();
