Object.prototype.attachEvent = function (sEvent, fnHandler, bUseCapture) {
    this.addEventListener(sEvent.indexOf('on') == 0 ? sEvent.replace('on', '') : sEvent, fnHandler, bUseCapture);
}

var ROUND_RAD = 30;
var TITLE_RAD = 20;
var A_RAD = 12;

function hasClassName(objElement, strClass) {
	if ( objElement.className ) {
		var arrList = objElement.className.split(' ');
		var strClassUpper = strClass.toUpperCase();
		for ( var i = 0; i < arrList.length; i++ ) {
			if ( arrList[i].toUpperCase() == strClassUpper ) {
				return true;
			}
		}
	}
	return false;
}


function doRoundConners() {
	var elements = document.getElementsByTagName('h3');
	for ( i = 0; i < elements.length; i++ ) {
		var element = elements[i];
		if (hasClassName(element, 'title')) {
			var width;
			if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent)) {
				width = element.parentNode.clientWidth - TITLE_RAD;
                element.innerHTML = 
                    '<span style="margin-top: ' + (TITLE_RAD / 2) + 'px; overflow: hidden; float: left; display: block; height: ' + (TITLE_RAD * 2.5) + 'px; width: ' + TITLE_RAD + 'px;"><img src="/images/design/title20_left.png"></span>' + 
                    '<span style="margin-top: ' + (TITLE_RAD / 2) + 'px; overflow: hidden; float: left; display: block; height: ' + (TITLE_RAD * 2) + 'px; line-height: ' + (TITLE_RAD * 2) + 'px; background: #fce6ba; width: ' + (width - TITLE_RAD * 2) + 'px;">' + 
                    element.innerHTML +
                    '</span>' + 
                    '<span style="margin-top: ' + (TITLE_RAD / 2) + 'px; overflow: hidden; float: left; display: block; height: ' + (TITLE_RAD * 2.5) + 'px; width: ' + TITLE_RAD + 'px;"><img src="/images/design/title20_right.png"></span>';
			} else {
				width = element.clientWidth;
                element.innerHTML = 
                    '<span style="margin-top: ' + (TITLE_RAD / 2) + 'px; overflow: hidden; float: left; display: block; height: ' + (TITLE_RAD * 2.5) + 'px; width: ' + TITLE_RAD + 'px;"><img src="/images/design/title20_left.png"></span>' + 
                    '<span style="margin-top: ' + (TITLE_RAD / 2) + 'px; overflow: hidden; float: left; display: block; height: ' + (TITLE_RAD * 2) + 'px; line-height: ' + (TITLE_RAD * 2) + 'px; background: #fdeac2; width: ' + (width - TITLE_RAD * 2) + 'px;">' + 
                    element.innerHTML +
                    '</span>' + 
                    '<span style="margin-top: ' + (TITLE_RAD / 2) + 'px; overflow: hidden; float: left; display: block; height: ' + (TITLE_RAD * 2.5) + 'px; width: ' + TITLE_RAD + 'px;"><img src="/images/design/title20_right.png"></span>';
			}
		}
	}
	/*
    var elements = document.getElementsByTagName('a');
	for ( i = 0; i < elements.length; i++ ) {
		var element = elements[i];
		if (hasClassName(element, 'title')) {
			var width;
			if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent)) {
				width = element.parentNode.clientWidth - A_RAD * 2;
			} else {
				width = element.clientWidth;
			}
			element.innerHTML = 
				'<span style="margin-top: ' + (A_RAD / 2) + 'px; overflow: hidden; float: left; display: block; height: ' + (A_RAD * 2) + 'px; width: ' + A_RAD + 'px;"><img src="/images/design/title12_left.png" border="0"></span>' + 
				'<span style="margin-top: ' + (A_RAD / 2) + 'px; overflow: hidden; float: left; display: block; height: ' + (A_RAD * 2) + 'px; line-height: ' + (A_RAD * 2) + 'px; background: #E2CD9E; width: ' + (width - A_RAD * 2) + 'px;">' + 
				element.innerHTML +
				'</span>' + 
				'<span style="margin-top: ' + (A_RAD / 2) + 'px; overflow: hidden; float: left; display: block; height: ' + (A_RAD * 2) + 'px; width: ' + A_RAD + 'px;"><img src="/images/design/title12_right.png" border="0"></span>';
		}
	}
    */
	var elements = document.getElementsByTagName('div');
	for ( i = 0; i < elements.length; i++ ) {
		var element = elements[i];
		if (hasClassName(element, 'rounded1')) {
			if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent)) {
                element.innerHTML = 
                    '<div style="position: absolute; top: 0; left: 0; width: ' + ROUND_RAD + 'px; height: ' + ROUND_RAD + 'px; background: url(/images/design/round_top_left.png) no-repeat 0 0;"></div>' + 
                    '<div style="position: absolute; top: 0; right: -1px; width: ' + ROUND_RAD + 'px; height: ' + ROUND_RAD + 'px; background: url(/images/design/round_top_right.png) no-repeat 0 0;"></div>' + 
                    '<div style="position: absolute; bottom: -1px; left: 0; width: ' + ROUND_RAD + 'px; height: ' + ROUND_RAD + 'px; background: url(/images/design/round_bottom_left.png) no-repeat 0 0;"></div>' + 
                    '<div style="position: absolute; bottom: -1px; right: -1px; width: ' + ROUND_RAD + 'px; height: ' + ROUND_RAD + 'px; background: url(/images/design/round_bottom_right.png) no-repeat 0 0;"></div>' + 
                    element.innerHTML;
			} else {
                element.innerHTML = 
                    '<div style="position: absolute; top: 0; left: 0; width: ' + ROUND_RAD + 'px; height: ' + ROUND_RAD + 'px; background: url(/images/design/round_top_left.png) no-repeat 0 0;"></div>' + 
                    '<div style="position: absolute; top: 0; right: 0; width: ' + ROUND_RAD + 'px; height: ' + ROUND_RAD + 'px; background: url(/images/design/round_top_right.png) no-repeat 0 0;"></div>' + 
                    '<div style="position: absolute; bottom: 0; left: 0; width: ' + ROUND_RAD + 'px; height: ' + ROUND_RAD + 'px; background: url(/images/design/round_bottom_left.png) no-repeat 0 0;"></div>' + 
                    '<div style="position: absolute; bottom: 0; right: 0; width: ' + ROUND_RAD + 'px; height: ' + ROUND_RAD + 'px; background: url(/images/design/round_bottom_right.png) no-repeat 0 0;"></div>' + 
                    element.innerHTML;
			}
		}
        else if (hasClassName(element, 'rounded2')) {
			if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent)) {
                element.innerHTML = 
                    '<div style="position: absolute; top: 0; left: 0; width: ' + ROUND_RAD + 'px; height: ' + ROUND_RAD + 'px; background: url(/images/design/round2_top_left.png) no-repeat 0 0;"></div>' + 
                    '<div style="position: absolute; top: 0; right: -1px; width: ' + ROUND_RAD + 'px; height: ' + ROUND_RAD + 'px; background: url(/images/design/round2_top_right.png) no-repeat 0 0;"></div>' + 
                    '<div style="position: absolute; bottom: -1px; left: 0; width: ' + ROUND_RAD + 'px; height: ' + ROUND_RAD + 'px; background: url(/images/design/round2_bottom_left.png) no-repeat 0 0;"></div>' + 
                    '<div style="position: absolute; bottom: -1px; right: -1px; width: ' + ROUND_RAD + 'px; height: ' + ROUND_RAD + 'px; background: url(/images/design/round2_bottom_right.png) no-repeat 0 0;"></div>' + 
                    element.innerHTML;
			} else {
                element.innerHTML = 
                    '<div style="position: absolute; top: 0; left: 0; width: ' + ROUND_RAD + 'px; height: ' + ROUND_RAD + 'px; background: url(/images/design/round2_top_left.png) no-repeat 0 0;"></div>' + 
                    '<div style="position: absolute; top: 0; right: 0px; width: ' + ROUND_RAD + 'px; height: ' + ROUND_RAD + 'px; background: url(/images/design/round2_top_right.png) no-repeat 0 0;"></div>' + 
                    '<div style="position: absolute; bottom: 0px; left: 0; width: ' + ROUND_RAD + 'px; height: ' + ROUND_RAD + 'px; background: url(/images/design/round2_bottom_left.png) no-repeat 0 0;"></div>' + 
                    '<div style="position: absolute; bottom: 0px; right: 0px; width: ' + ROUND_RAD + 'px; height: ' + ROUND_RAD + 'px; background: url(/images/design/round2_bottom_right.png) no-repeat 0 0;"></div>' + 
                    element.innerHTML;
			}
		}
	}
}

window.attachEvent('onload', doRoundConners, true);

function showpicture(url,title) {
        var newwin = window.open('http://www.bontoys.ru/images/popup.html?' + url,null,0);
        newwin.focus();
}
function showpopup(title) {
        var newwin = window.open('http://www.bontoys.ru/discount.html',null,1); 
        newwin.focus();
}
function showpopup1(title) {
        var newwin = window.open('http://www.bontoys.ru/vacancy.html',null,1); 
        newwin.focus();
}
function showpopup2(title) {
        var newwin = window.open('http://www.bontoys.ru/acciya.html',null,1); 
        newwin.focus();
}


