function upsPopIn (url, wid, hei) {
	var upsPop = document.getElementById("upsPopIn");
	var localContent = '<div id="popInBack"></div><div id="upsInner"><div id="closeUPS"><a href="#" onclick="closeUpsPopIn(); return false;">X</a></div><iframe src="' + url + '" width="' + wid + '" height="' + hei + '"></iframe></div>';
	upsPop.innerHTML = localContent;
	stretch("popInBack");
	idOffset("upsInner", wid, hei);
	var upsIn = document.getElementById("upsInner");
	var closeUp = document.getElementById("closeUPS");
	upsPop.style.display = "block";
	upsIn.style.width = wid;
	closeUp.style.width = wid;
	stretch("popInBack");
}

function closeUpsPopIn () {
	var upsPop = document.getElementById("upsPopIn");
	var localContent = '';
	upsPop.innerHTML = localContent;
	upsPop.style.display = "none";
}


function idOffset( id , wid, hei) {
	var topOff = 60 + document.body.scrollTop;
	var leftOff = document.body.scrollLeft;
	if ( typeof( window.innerWidth ) == 'number' ) {
		if ( window.innerWidth > wid ) {
			leftOff += ( window.innerWidth / 2 ) - (wid / 2); // "250" being 1/2 of the shipping popup width
		}
  	} else if( document.documentElement && document.documentElement.clientWidth ) {
		if ( document.documentElement.clientWidth > wid ) {
			leftOff += ( document.documentElement.clientWidth / 2 ) - (wid / 2); // "250" being 1/2 of the shipping popup width
		}
	} else if( document.body && document.body.clientWidth ) {
		if ( document.body.clientWidth > wid ) {
			leftOff += ( document.body.clientWidth / 2 ) - (wid / 2); // "250" being 1/2 of the shipping popup width
		}
	}
	if ( document.getElementById ) {
		document.getElementById( id ).style.left = leftOff;
		document.getElementById( id ).style.top = topOff;
	}
	else if ( document.layers ) {
	  	document.layers[ id ].style.left = leftOff;
	  	document.layers[ id ].style.top = topOff;
	}
	else if ( document.all ) {
		document.all[ id ].style.left = leftOff;
		document.all[ id ].style.top = topOff;
	}
}

function stretch( id ) {	
		var fillWidth = "100%";
		var fillHeight = "100%";
		if ( document.documentElement.scrollHeight < document.body.scrollHeight ) {
			fillHeight = document.body.scrollHeight;
	  	} 
		else if ( document.documentElement && document.documentElement.scrollHeight ) {
			fillHeight = document.documentElement.scrollHeight;
		}
		if ( document.documentElement.scrollWidth < document.body.scrollWidth ) {
			fillWidth = document.body.scrollWidth;
	  	} 
		else {
			fillWidth = document.documentElement.scrollWidth;
		}	
		if ( fillHeight < screen.height ) {
			fillHeight = screen.height;
		}
		if ( fillWidth < screen.width ) {
			fillWidth = screen.width;
		}
		var styleHei = document.getElementById( id );
		styleHei.style.height = fillHeight;
		var styleWid = document.getElementById( id );
		styleWid.style.width = fillWidth;
//		document.getElementById( id ).style.height = fillHeight;
//		document.getElementById( id ).style.width = fillWidth;
}

function hide( id ) {
	if ( document.getElementById ) {
		document.getElementById( id ).style.visibility = "hidden";
	}
  	else if ( document.layers ) {
  		document.layers[ id ].visibility = "hide";
  	}
	else if ( document.all ) {
		document.all[ id ].style.visibility = "hidden";
	}	
}

function show( id ) {
	if ( document.getElementById ) {
		document.getElementById( id ).style.visibility = "visible";
	}
  	else if ( document.layers ) {
  		document.layers[ id ].visibility = "show";
  	}
	else if ( document.all ) {
		document.all[ id ].style.visibility = "visible";
  	}
}

function innerDims (id) {
	var newID = document.getElementById(id);
	var x,y;
	if (self.innerHeight) {// all except Explorer
		x = self.innerWidth;
		y = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight) {
		// Explorer 6 Strict Mode
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	}
	else if (document.body) { // other Explorers 
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}
	document.newID.style.height = y;
	document.newID.style.width = x;
}
