function IE_CorrectAlpha_PNG(){
	for(i=0; i<document.images.length; i++){
		img    = document.images[i];
		imgExt  = img.src.substring(img.src.length-3, img.src.length);
		imgExt  = imgExt.toUpperCase();
		if (imgExt == "PNG" && (img.className == 'alpha' || img.className == 'alphaScaled')){
			imgID    = (img.id) ? "id='" + img.id + "' " : "";
			imgClass= (img.className) ? "class='" + img.className + "' " : "";
			imgTitle= (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
			imgStyle= "display:inline-block;" + img.style.cssText;
			if (img.align == "left") { imgStyle = "float:left;"  + imgStyle; } else if (img.align == "right"){ imgStyle = "float:right;" + imgStyle; }
			if (img.parentElement.href)   { imgStyle = "cursor:hand;" + imgStyle; }       
			if (img.className == 'alphaScaled') {
				strNewHTML    = '<span '+imgID+imgClass+imgTitle+' style="width: 100%; height:'+img.height+';'+imgStyle+';'+'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+img.src+'\', sizingMethod=\'scale\');"></span>';
			} else {
				strNewHTML    = '<span '+imgID+imgClass+imgTitle+' style="width:'+img.width+'; height:'+img.height+';'+imgStyle+';'+'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+img.src+'\', sizingMethod=\'scale\');" ></span>';
			}
			img.outerHTML = strNewHTML;
			i = i-1;
		}
	}
}
     var userAgent=navigator.userAgent;
     if (userAgent.indexOf('MSIE') != -1) {
 //         window.attachEvent("onload", IE_CorrectAlpha_PNG);
}

function is_loaded() { //DOM
	if (document.getElementById){
		document.getElementById('main').style.visibility = 'visible';
		if (document.getElementById('Section')) {
			document.getElementById('Section').style.visibility = 'visible';
		}
		document.getElementById('loader').style.visibility = 'hidden';
	}else{
		if (document.layers){ //NS4
			document.main.visibility = 'visible';
			if (document.Section) {
				document.Section.visibility = 'visible';
			}
			document.loader.visibility = 'hidden';
		}
		else { //IE4
			document.all.main.style.visibility = 'visible';
			if (document.all.Section) {
				document.all.Section.visibility = 'visible';
			}
			document.all.loader.style.visibility = 'hidden';
		}
	}
}
	 
function zoom_show() { //DOM
	if (document.getElementById){
		document.getElementById('zoom').style.visibility = 'visible';
	}else{
		if (document.layers){ //NS4
			document.zoom.visibility = 'visible';
		}
		else { //IE4
			document.all.zoom.style.visibility = 'visible';
		}
	}
}

function zoom_hide() { //DOM
	if (document.getElementById){
		document.getElementById('zoom').style.visibility = 'hidden';
	}else{
		if (document.layers){ //NS4
			document.zoom.visibility = 'hidden';
		}
		else { //IE4
			document.all.zoom.style.visibility = 'hidden';
		}
	}
}

function resize(value) { 
    var realsize = String(value);
	var full = 'Zoom to full size';
	var window = 'Shrink to window size';
	if (document.getElementById){
		if (document.getElementById('page').width != realsize) {
			document.getElementById('page').removeAttribute('width');
			if (navigator.appName == 'Microsoft Internet Explorer') {
				document.getElementById('page').style.width = realsize;
			}
			document.getElementById('zoom').setAttribute('title',window);
			document.getElementById('zoom').style.backgroundPosition = '0px -50px';
		} else {
			if (navigator.appName == 'Microsoft Internet Explorer') {
				document.getElementById('page').style.width = '100%';
			}
			document.getElementById('page').setAttribute('width','100%');
			document.getElementById('zoom').setAttribute('title',full);
			document.getElementById('zoom').style.backgroundPosition = '0px 0px';
		}
	}else{
		if (document.layers){ //NS4
			if (document.page.width != realsize) {
				document.page.setAttribute('width',realsize);
				document.zoom.setAttribute('title',window);
				document.zoom.style.backgroundPosition = '0px -50px';
			} else {
				document.page.setAttribute('width','100%');
				document.zoom.setAttribute('title',full);
				document.zoom.style.backgroundPosition = '0px 0px';
			}
		}
		else { //IE4
			if (document.all.page.width != realsize) {
				document.all.page.setAttribute('width',realsize);
				document.all.zoom.setAttribute('title',window);
				document.all.zoom.style.backgroundPosition = '0px -50px';
			} else {
				document.all.page.setAttribute('width','100%');
				document.all.zoom.setAttribute('title',full);
				document.all.zoom.style.backgroundPosition = '0px 0px';
			}
		}
	}
}

function comicChange(factor) {
  if (!archiveDir) archiveDir = 'www/comics/bs/';
  if (!comicPrefex) comicPrefex = 'bs';
  if (!commonHeight) commonHeight = '800';
  var archive = document.getElementById('archive');
  var current = archive.selectedIndex;
  if (factor == 'first') var factor = 0;
  else if (factor == 'last') var factor = archive.length - 1;
  else if (factor == undefined) var factor = current;
  else var factor = current + factor;
  if (archive[factor]) {
    scroll(0, 150);
    var comic = document.getElementById('comic4');
    comic.innerHTML = 'Loading...';
    comic.style.lineHeight = commonHeight+'px';
    var newComic = document.createElement('img');
    newComic.alt = document.getElementById('comicTitle').innerHTML = archive[factor].value;
    newComic.onload = function () {
      archive.selectedIndex = factor;
      comic.innerHTML = '';
      comic.style.lineHeight = '1.2em';
      comic.appendChild(newComic);
    }
    newComic.src = archiveDir+comicPrefex+archive[factor].value+'.jpg';
  }
}

