// Author: DMhope
// Web site: http://dmhope.ru
// E-mail:
Dmhope@i.ua // More script for web master!
var BrowserDetect = {
init: function () {
this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
this.version = this.searchVersion(navigator.userAgent)
|| this.searchVersion(navigator.appVersion)
|| "an unknown version";
this.OS = this.searchString(this.dataOS) || "an unknown OS";
},
searchString: function (data) {
for (var i=0;i<data.length;i++) {
var dataString = data[i].string;
var dataProp = data[i].prop;
this.versionSearchString = data[i].versionSearch || data[i].identity;
if (dataString) {
if (dataString.indexOf(data[i].subString) != -1)
return data[i].identity;
}
else if (dataProp)
return data[i].identity;
}
},
searchVersion: function (dataString) {
var index = dataString.indexOf(this.versionSearchString);
if (index == -1) return;
return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
},
dataBrowser: [
{
string: navigator.userAgent,
subString: "Chrome",
identity: "Chrome"
},
{ string: navigator.userAgent,
subString: "OmniWeb",
versionSearch: "OmniWeb/",
identity: "OmniWeb"
},
{
string: navigator.vendor,
subString: "Apple",
identity: "Safari"
},
{
prop: window.opera,
identity: "Opera"
},
{
string: navigator.vendor,
subString: "iCab",
identity: "iCab"
},
{
string: navigator.vendor,
subString: "KDE",
identity: "Konqueror"
},
{
string: navigator.userAgent,
subString: "Firefox",
identity: "Firefox"
},
{
string: navigator.vendor,
subString: "Camino",
identity: "Camino"
},
{
string: navigator.userAgent,
subString: "Netscape",
identity: "Netscape"
},
{
string: navigator.userAgent,
subString: "MSIE",
identity: "Explorer",
versionSearch: "MSIE"
},
{
string: navigator.userAgent,
subString: "Gecko",
identity: "Mozilla",
versionSearch: "rv"
},
{
string: navigator.userAgent,
subString: "Mozilla",
identity: "Netscape",
versionSearch: "Mozilla"
}
],
dataOS : [
{
string: navigator.platform,
subString: "Win",
identity: "Windows"
},
{
string: navigator.platform,
subString: "Mac",
identity: "Mac"
},
{
string: navigator.platform,
subString: "Linux",
identity: "Linux"
}
]
};
BrowserDetect.init();
var divId = 'scroll_banner';
var tableId = 'table_banner'
var bWidth = 800;
var bHeight = 35;
var shift = 1;
var leftPos;
function vAlignment()
{
document.getElementById(divId).style.left = 0;
if (document.all)
{
document.getElementById(divId).style.top = (document.body.scrollTop + document.body.clientHeight - bHeight);
}
else
{
document.getElementById(divId).style.top = (document.body.clientHeight - bHeight)+'px';
if (BrowserDetect.browser=='Opera')
{
document.getElementById(divId).style.top = (document.body.scrollTop + document.body.clientHeight - bHeight)+'px';
}
}
document.getElementById(divId).style.width = document.body.clientWidth;
}
function vAlignment2(divIdd)
{
document.getElementById(divIdd).style.left = 0;
if (document.all)
document.getElementById(divIdd).style.top = (document.body.scrollTop + document.body.clientHeight - bHeight);
else
document.getElementById(divIdd).style.top = (document.body.clientHeight - bHeight);
document.getElementById(divIdd).style.width = document.body.clientWidth;
}
function start(DM_roll)
{
setInterval("roll()", "" + DM_roll + "");
vAlignment();
document.getElementById(divId).style.visibility = 'visible';
}
function roll()
{
if (document.all || document.getElementById)
{
leftPos = parseInt(document.getElementById(tableId).style.left);
document.getElementById(tableId).style.left = leftPos - shift;
if (Math.abs(leftPos) >= bWidth)
{
document.getElementById(tableId).style.left = (-shift);
}
}
}
function DM_Banner(DM_title, DM_link, DM_banner, DM_tlink, DM_roll, DM_time)
{
if(DM_tlink == '1'){
var DM_target = '_blank';
}
if(DM_tlink == '0'){
var DM_target = '_self';
}
var position;
if (window.attachEvent)
{
window.attachEvent("onscroll", vAlignment);
window.attachEvent("onresize", vAlignment);
position = "absolute";
}
else
{
window.addEventListener("resize", vAlignment, 1);
window.addEventListener("scroll", vAlignment, 1);
position = "fixed";
}
document.write('<div id="' + divId + '" onMouseout="shift=1" onMouseover="shift=0" style="visibility:hidden;overflow:hidden;position:' + position + ';left:0px;width:' + document.body.clientWidth + 'px;height:' + bHeight + 'px;z-index:100;">');
document.write('<table cellspacing=0 cellpadding=0 id="' + tableId + '" style="position:absolute;left:0;top:0;width:' + (bWidth * 4) + 'px"><tr><td>');
document.write('<a href="' + DM_link + '" target="' + DM_target + '"><img src="' + DM_banner + '" title="' + DM_title + '" border="0"></a>');
document.write('<a href="' + DM_link + '" target="' + DM_target + '"><img src="' + DM_banner + '" title="' + DM_title + '" border="0"></a>');
document.write('<a href="' + DM_link + '" target="' + DM_target + '"><img src="' + DM_banner + '" title="' + DM_title + '" border="0"></a>');
document.write('</td></table></div>');
setTimeout("start(" + DM_roll + ")", "" + DM_time + "");
}