var origHeight, origWidth;
var coll = ""
var styleObj = ""
var isMac, isPC
var isPic = false;
var goodToGo = false;

if (navigator.platform.indexOf('Mac') != -1) {
	isMac = true
} else {
	isPC = true
}

if (document.layers) {
	origWidth = innerWidth;
    origHeight = innerHeight;
} else if (document.all) {
	coll = "all.";
	styleObj = ".style";
} else if (document.getElementById) {
	coll = "getElementById('";
	styleObj = "').style";
}

function NetscapeSux() {
      if (innerWidth != origWidth || innerHeight != origHeight) {
		origWidth = innerWidth;
		origHeight = innerHeight;
		location.reload()
		return false
	}
}

if (document.layers) {
	window.captureEvents(Event.RESIZE)
	window.onresize = NetscapeSux();
}

function fixLayer(lname) {
	var fixedLayer
	fixedLayer = eval("document." + coll + lname + styleObj);
	return fixedLayer;
}

function fixShortLayer(lname) {
	var fixedLayer;
	if (document.layers) {
		fixedLayer = "document." + lname;
		alert(fixedLayer);
	} else if (document.all) {
		fixedLayer = "document.all." + lname;
	} else if (document.getElementById) {
		fixedLayer = "document.getElementById('" + lname + "')";
	}
	return fixedLayer;
}

function fixLayer2(childLayer,parentLayer) {
	var fixedLayer;
	if (document.layers) {
		fixedLayer = "document." + parentLayer + ".document." + childLayer;
	} else if (document.all) {
		fixedLayer = "document.all." + lname;
	} else if (document.getElementById) {
		fixedLayer = "document.getElementById('" + lname + "')";
	}
	return fixedLayer;
}

function fixImg(imageTitle,lName) {
	if (document.layers) {
		fixedImage = eval("document." + lName + ".document." + imageTitle);
	} else if (document.all || document.getElementById) {
		fixedImage = eval("document." + imageTitle);
	}
	return fixedImage;
}

function openPic(whichImg,hgt,wdt) {
	if (isPic && picWindow.closed == false) {
		picWindow.close();
	}
	var windowDim = "'height=" + hgt + ",width=" + wdt + "'";
	picWindow = eval("window.open('','picWindow'," + windowDim + ")");
	var newStuff = "<html><head><title>Perma-Zyme 11X - cтроительство дорог без асфальта!!!</title></head><body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0><img src='" + whichImg + "' height='" + hgt + "' width='" + wdt + "'>\n</body></html>";
	isPic = true;
	picWindow.document.write(newStuff);
	picWindow.document.close();
	picWindow.focus();
}
