//Sets up the Pop up windows.
function Viewer(vLink,vWidth,vHeight){
			new_window = window.open(vLink,"PictureViewer","width="+vWidth+",height="+vHeight+",resizeable=1");
			new_window.focus();
		}

function PageViewer(url,windowname,width,height) {
 new_window = window.open(url,windowname,"width="+width+",height="+height+",directories=no,toolbar=no,menubar=no,location=no,scrollbars=yes,status=no,resizable=no");
 new_window.focus();
}		

// Layer Fixer for Netscape 4.x 

//Set Variables
var isNav4
var isOld
isNav4 = false
isOld = false
if (parseInt(navigator.appVersion) <= 4) {
	 if (navigator.appName === "Netscape") {
	 		isNav4 = true
			}
	 if (navigator.userAgent.indexOf("MSIE 5") === -1) {
		isOld = true}
	 if (navigator.userAgent.indexOf("MSIE 6") != -1) {
		isOld = false}
}
//window.confirm(location.href)	
//window.confirm("Browser version = " + navigator.appVersion);
//window.confirm("isOld = " + isOld + " isNav4 = " + isNav4);
//window.confirm("UserAgent = " + navigator.userAgent);
//window.confirm("IndexOf = " + navigator.userAgent.indexOf("MSIE 5"));

if (location.href != 'http://www.capitalmachineco.com/oldbrowser.asp'){			
  if (isOld) {
     if (GetCookie("browsesite") != "true") {
    location.href = "oldbrowser.asp";
    }
  }
}

//Positioning to specific pixel location
function shiftTo(obj, x, y, inColor) {
				 if (isNav4) {
				 		var theObj = eval("document." + obj)
				 		//window.confirm("N4 object: " + theObj + " is supposed to be moved to " +x+", "+y+" and be the color " +inColor);
						theObj.moveTo(x,y);
						theObj.bgColor = inColor;
						} 
}

function init(){
  		shiftTo("header", 23, 5, 'black');
      shiftTo("sidebar", 23, 85, '#555555');
      shiftTo("main", 223, 85, 'e3e3e3');
  		shiftTo("footer", 23, 1055, 'black');
}

function handleResize(){
				 location.reload()
				 return false
}
if (isNav4) {
	 window.captureEvents(Event.RESIZE)
	 window.onresize = handleResize
	 }
	 
function setBrowseCookie(jumpto){
				 document.cookie = "browsesite=true; domain=.capitalmachineco.com";
				 location.href = unescape(jumpto);
}
function GetCookie(name) { 
				 var arg = name+"=";
				 var alen = arg.length;
				 var clen = document.cookie.length;
				 var i = 0; while (i < clen) { 
				 		 var j = i + alen; 
						 if (document.cookie.substring(i, j) == arg) 
						 return getCookieVal(j); i = document.cookie.indexOf(" ", i) + 1; 
						 if (i == 0) break; 
					}
				return null;
}