//
// LINK REDIRECTOR
// Copyright (c)1999 by Predrag Supurovic
// All rights reserved
//

topdir = '/html/'

function ldd(url,dir) {
	this.url = url
	this.dir = dir
}

ld = new Array()
ld[0] = new ldd ('http://www.dv.co.yu','dv')
ld[1] = new ldd ('http://www.uzice.net','uzicenet')
ld[2] = new ldd ('http://www.seval.co.yu','seval')
ld[3] = new ldd ('http://www.bonex.co.yu','bonex')
ld[4] = new ldd ('http://www.motomat.com','motomat')
ld[5] = new ldd ('http://www.motomat.co.yu','motomat')
ld[6] = new ldd ('http://www.luna.co.yu','luna')
ld[7] = new ldd ('http://www.drypoint.org.yu','drypoint')
ld[8] = new ldd ('http://www.tv5-ue.co.yu','tv5')
ld[9] = new ldd ('http://www.coppersev.com','coppersev')
ld[10] = new ldd ('http://www.uzice.org.yu','uzicenet')
ld[11] = new ldd ('http://www.sirogojno.org.yu','sirogojno')
ld[12] = new ldd ('http://www.zlatne-ruke.co.yu','zlatneruke')
ld[13] = new ldd ('http://www.kondor.co.yu','kondor')
ld[14] = new ldd ('http://www.plastikanova.com','plastika')
ld[15] = new ldd ('http://www.seoski-prag.org.yu','seoski-prag')
ld[16] = new ldd ('http://www.rpk-uzice.co.yu','rpkuzice')
ld[17] = new ldd ('http://www.radio31.co.yu','radio31')
ld[18] = new ldd ('http://www.ok-jedinstvo.org.yu','okjedinstvo')
ld[19] = new ldd ('http://www.fasau.com','fasau')

function fixpath (inpath) {
	outpath = inpath
	if (outpath.charAt (outpath.length-1) != '/') {
		outpath = outpath + '/'
	}
	return outpath
}

function cl(lnkref) {
	var pos
	var out
  out = lnkref
	if ((window.location.host.length == 0) && (out.indexOf('http:',0) > -1)) {
		for (i = 0; i < ld.length; i++) {
      pos = out.indexOf(ld[i].url)
			if ( pos > -1) {
				path = out.substring(pos + ld[i].url.length, out.length)
				out = document.URL.substring(0, document.URL.indexOf(topdir,0) + topdir.length) + ld[i].dir + path
				if (out.indexOf('.htm',0) == -1) {
					out = fixpath (out)
					out += 'index.htm'
				}
				break
			}
		}
	}
	return out
}

function lr(lnk) {
  lnk.href = cl(lnk.href) 
	if ((window.location.host.length == 0) && (lnk.href.indexOf('http:',0) > -1)) {
		// alert ('Link pokazuje na dokument koji ne pripada ovoj prezentaciji.\nDa bi ste ga pogledali potrebno je da se povezete na Internet.')

    return confirm(lnk.href + '\n\nLink pokazuje na dokument koji ne pripada ovoj prezentaciji.\nDa bi ste ga pogledali potrebno je da se povezete na Internet.\nZelite li da pristupite dokumentu na Internetu?')
		// return false
	}
	return true
}

