

// File path: /bs-graphics/

var default_minH = 437;
var default_minW = 0;

function my_isIE(){
	var is_IE;
	if(navigator.appName == 'Microsoft Internet Explorer' ||
	   navigator.appName.indexOf('Microsoft') >= 0){
		is_IE = true;
	}else{
		is_IE = false;
	}
	return is_IE;
}

function setPageSize(minH, minW) {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  //alert(myHeight);
  if(document.getElementById('autoheight'))
  	document.getElementById('autoheight').style.height = myHeight - minH + 'px';
  if(document.getElementById('autowidth'))
  	document.getElementById('autowidth').style.width = (myWidth - minW) / 2 + 'px';
}

function setUl(){
	var uls = document.getElementsByTagName('ul');

	if(my_isIE()){
		for(i = 0; i < uls.length; i++){
			if(uls[i].className == 'list'){
				uls[i].style.marginLeft = '45px';
			}
		}
	}
	if(document.all || window.opera){
		for(i = 0; i < uls.length; i++){
			if(uls[i].className == 'list'){
				for(e = 0; e < uls[i].childNodes.length; e++){
					if(window.opera){
						if(uls[i].childNodes[e].firstChild && uls[i].childNodes[e].firstChild.nodeName == 'A')
							uls[i].childNodes[e].firstChild.style.marginLeft = '20px';
					}else{
						if(uls[i].childNodes[e].firstChild.style)
							uls[i].childNodes[e].firstChild.style.marginLeft = '20px';
					}
				}
			}
		}
	}
}

document.observe('dom:loaded', function () {
	if(my_isIE()){
		setPageSize(default_minH);
	}else{
		setPageSize(default_minH - 103);
	}
	setUl();
});

if(window.opera){
	document.addEventListener('load', function(){
		setPageSize(default_minH - 103);
		setUl();
	}, false);
}

function addToFavorite(){
	var url = 'http://www.32dezember.ru/bs-graphics/';
	var title = '«BS Graphics» — ìóëüòèìåäèéíûå òåõíîëîãèè.';

	if(window.sidebar){
		// Firefox
		window.sidebar.addPanel(title, url, '');
	}else if(window.opera){
		//Opera
		var a = document.createElement("A");
		a.rel = "sidebar";
		a.target = "_search";
		a.title = title;
		a.href = url;
		a.click();
	} else if(document.all){
		//IE
		window.external.AddFavorite(url, title);
	}
}

