testURL='ok'
lastDot=location.host.lastIndexOf('.')
preLastDot=location.host.lastIndexOf('.',lastDot-1)
prePreLastDot=location.host.lastIndexOf('.',preLastDot-1)

hostNam=location.host.substring(preLastDot+1)

if(hostNam=="domino.bg"){
if(prePreLastDot==-1){
    subHostNam=location.host.substring(0,preLastDot)
}else{
    subHostNam=location.host.substring(prePreLastDot+1,preLastDot)
    pre3LastDot=location.host.lastIndexOf('.',prePreLastDot-1)
    if(subHostNam=="ns")	subHostNam=location.host.substring(pre3LastDot+1,prePreLastDot)
}
    u=location.pathname
    i=0
    if(u.length>1){
    for (var i = 1;u.charAt(i)!="/"; i++){if(i>u.length)break}
    }
if(subHostNam=="bulgaria"){
    url=u.substring(1,i+1)
    if(u.substring(i+1,i+4)=='eng') lang='eng'
}else{
    url=subHostNam+'/'
    if(u.substring(1,4)=='eng') lang='eng'
}
 //   if(u.substring(i+1,i+4)=='eng') lang='eng'

}else{
	if(preLastDot==-1){self.location='http://www.'+location.host+location.pathname}
	else{
		//	url='/'+location.host.substring(preLastDot+1,lastDot)+'/'
		url=location.host.substring(preLastDot+1,lastDot)
		if(url.substring(url.length-2)=="bg"){
			url=url.substring(0,url.length-2)
			if(url.substring(url.length-1)=="-"){url=url.substring(0,url.length-1)}
		}
		url+='/'
		if(location.pathname.substring(1,4)=="eng"){
			lang='eng'
		}
  	}	
}

// alert(location.host)    
// alert(url+' '+lang+' '+' '+i+' '+hostNam)
