// ipladetget ver. 0.2 (2009.01.30)
// dependences: http://detector.ipla.pl/ipladetector.js

var sPromptIsInstalled = 'Na twoim komputerze jest już zainstalowana aplikacja ipla. Czy na pewno chcesz ją pobrać ponownie?';
var aInstallURLSearch = [ // array with URLs to match
	'http://download.ipla.redefine.pl/iplasetup.exe'
];

var iplaGetScan = function(){
	if (iplaCheck())
		if (document.getElementById && document.getElementsByTagName){
			var a = document.getElementsByTagName('a');
			for (var i = 0; i < a.length; i++)
				for (var j = 0; j < aInstallURLSearch.length; j++)
					if (a[i].href.length && a[i].href.indexOf(aInstallURLSearch[j]) != -1){
						a[i].prevOnclick = a[i].onclick;
						a[i].onclick = function(){
							var bInstall = confirm(sPromptIsInstalled);
							if(bInstall){
								if(typeof this.prevOnclick == 'function') this.prevOnclick();
							}
							else return false;
						}
					}
		}
}
var iplaGetInit = function(){
	if(typeof iplaCheck == 'function') {	// ipladetector.js is needed
		if (window.addEventListener) window.addEventListener('load',iplaGetScan, false);
		else if (window.attachEvent) window.attachEvent('onload', iplaGetScan);
	}
}
iplaGetInit();