// JavaScript Document
//------------------------------------------------------------------------------------------ BEGIN FUNCTION
function centerDiv(){
	var pictureframe = document.getElementById('viewercontent');
	var pictureshadow = document.getElementById('viewercontentshadow');
	//---------------
	var scrolledX, scrolledY; 
	
	if(self.pageYOffset){ 
		scrolledX = self.pageXOffset; 
		scrolledY = self.pageYOffset;}
	else if(document.documentElement && document.documentElement.scrollTop ){ 
		scrolledX = document.documentElement.scrollLeft; 
		scrolledY = document.documentElement.scrollTop;}
	else if(document.body){ 
		scrolledX = document.body.scrollLeft; 
		scrolledY = document.body.scrollTop;} 

	// Next, determine the coordinates of the center of browser's window 

	var centerX, centerY; 
	
	if(self.innerHeight) { 
		centerX = self.innerWidth; 
		centerY = self.innerHeight;}
	else if(document.documentElement && document.documentElement.clientHeight){ 
		centerX = document.documentElement.clientWidth; 
		centerY = document.documentElement.clientHeight;}
	else if(document.body){ 
		centerX = document.body.clientWidth; 
		centerY = document.body.clientHeight;} 

	// Xwidth is the width of the div, Yheight is the height of the 
	// div passed as arguments to the function: 
	var leftOffset = scrolledX + (centerX - 500 - 6) / 2; 
	//var topOffset = scrolledY + (centerY - 750) / 2; 
	
	// The initial width and height of the div can be set in the 
	// style sheet with display:none; divid is passed as an argument to // the function 
	
	pictureframe.style.position='absolute'; 
	//pictureframe.style.top = topOffset + 'px'; 
	pictureframe.style.top = '96px'; 
	pictureframe.style.left = leftOffset + 'px';
	
	fadeIn(pictureshadow);
	pictureshadow.style.position='absolute'; 
	pictureshadow.style.top = '102px'; 
	pictureshadow.style.left = leftOffset + 6 + 'px';
}//----------------------------------------------------------------------------------------- END FUNCTION
//-----------------------------------------------------------------------------------BEGIN FUNCTION
function launchViewer(){
	document.location='#';
	var shade=document.getElementById('viewershade');
	
	adjustSize(shade);
	fadeIn(shade);
	
	var content=document.getElementById('viewercontent');
	
	content.style.display='';
	var desc='<table border="0" cellpadding="0" cellspacing="0" width="500" style="font-family:Verdana, Arial, Helvetica, sans-serif; color:#003300; font-size:10px; font-weight:bold"><tr><td colspan="2" style="padding:12px; padding-top:260px; text-align:justify; cursor:pointer;" onclick="javascript:jumpEstimator();">*Must complete purchase during promotional period (December 4, 2009 through midnight December 14, 2009, all times EST). To redeem, you must provide the promotional code listed above at time of purchase. Sales tax (if applicable) and/or shipping charges not included in discount. May not be combined with any other offer. UCoat It gift cards are not eligible for promotion. Valid for online or phone orders through promotional period.</td></tr><tr><td width="428">&nbsp;</td><td width="72" style="cursor:pointer; height:44px;" onclick="javascript:closeViewer();">&nbsp;</td></tr></table>';
	content.innerHTML=desc;
	centerDiv();
}//----------------------------------------------------------------------------------END FUNCTION
//-----------------------------------------------------------------------------------BEGIN FUNCTION
function fadeIn(obj){
	obj.style.display='';
}//----------------------------------------------------------------------------------END FUNCTION
//-----------------------------------------------------------------------------------BEGIN FUNCTION
function closeViewer(){
	var shade=document.getElementById('viewershade');
	var shadow=document.getElementById('viewercontentshadow');
	var content=document.getElementById('viewercontent');
	content.innerHTML='';
	content.style.display='none';
	shade.style.display='none';
	shadow.style.display='none';
}//----------------------------------------------------------------------------------END FUNCTION
//-----------------------------------------------------------------------------------BEGIN FUNCTION
function adjustSize(obj){
	var origWidth = document.body.clientWidth;
	var origHeight = document.body.clientHeight;
	obj.style.width=origWidth+'px';
	obj.style.height=origHeight+'px';
}//----------------------------------------------------------------------------------END FUNCTION
//-----------------------------------------------------------------------------------BEGIN FUNCTION
function adjustDiv(){
	var shade=document.getElementById('viewershade');
	adjustSize(shade);
}//----------------------------------------------------------------------------------END FUNCTION
//-----------------------------------------------------------------------------------BEGIN FUNCTION
function jumpEstimator(){
	document.location="estimator.htm";
}//----------------------------------------------------------------------------------END FUNCTION