//JavaScript Document


function PreloadImages()
{
	var viewportheight, blanket_height;
	var viewportwidth, blanket_width;
	
	if (typeof window.innerHeight != 'undefined') 
	{
		viewportheight = window.innerHeight;
	} 
	else 
	{
		viewportheight = document.documentElement.clientHeight;
	}
	
	if ((viewportheight > document.body.parentNode.scrollHeight) && (viewportheight > document.body.parentNode.clientHeight)) 
	{
		blanket_height = viewportheight;
	} 
	
	else 
	{
		if (document.body.parentNode.clientHeight > document.body.parentNode.scrollHeight) 
		{
			blanket_height = document.body.parentNode.clientHeight;
		} 
		
		else 
		{
			blanket_height = document.body.parentNode.scrollHeight;
		}
	}
	
	if (typeof window.innerWidth != 'undefined') 
	{
		viewportwidth = window.innerHeight;
	} 
	
	else 
	{
		viewportwidth = document.documentElement.clientHeight;
	}
	if ((viewportwidth > document.body.parentNode.scrollWidth) && (viewportwidth > document.body.parentNode.clientWidth)) 
	{
		blanket_width = viewportwidth;
	} 
	
	else 
	{
		if (document.body.parentNode.clientWidth > document.body.parentNode.scrollWidth) 
		{
			blanket_width = document.body.parentNode.clientWidth;
		} 
		
		else 
		{
			blanket_width = document.body.parentNode.scrollWidth;
		}
	}
	
	//Subtract half the width and height of popup
	document.getElementById("System").style.left = (blanket_width /2) - 100 +"px";  
	document.getElementById("System").style.top = "275px";
	document.getElementById("System").style.display = "block";
	
	imageObj = new Image();
	images = new Array();
	
	//Build Images array
	images[0] = "/images/2.jpg"
	images[1] = "/images/3.jpg"
	images[2] = "/images/4.jpg"
	images[3] = "/images/AbbyWilson.png"
	images[4] = "/images/backgroundgradient.png"
	images[5] = "/images/BenefitsColumn.png"
	images[6] = "/images/best.gif"
	images[7] = "/images/calc_0.jpg"
	images[8] = "/images/CBLogo.png"
	images[9] = "/images/CFLogo.png"
	images[10] ="/images/ChannelBanner.png"
	images[11] ="/images/ColumnSeparator.png"
	images[12] ="/images/compass.jpg"
	images[13] ="/images/CRLogo.png"
	images[14] ="/images/CWLogo.png"
	images[15] ="/images/DanStewart.png"
	images[16] ="/images/digineer.gif"
	images[17] ="/images/dimmerBG.png"
	images[18] ="/images/DropDownBG.png"
	images[19] ="/images/education.jpg"
	images[20] ="/images/EricRonning.png"
	images[21] ="/images/FlashBackground.png"
	images[22] ="/images/FlashBackgroundHome.png"
	images[23] ="/images/FlashBottomLeftBackground.png"
	images[24] ="/images/FlashRepeatBackground.gif"
	images[25] ="/images/FlashRepeatBackground.png"
	images[26] ="/images/FlashRightBackground.png"
	images[27] ="/images/getmorebanner.jpg"
	images[28] ="/images/houseplans.jpg"
	images[29] ="/images/individual_idd.jpg"
	images[30] ="/images/InputBackground.png"
	images[31] ="/images/InsideBackground.png"
	images[32] ="/images/JimMcDonald.png"
	images[33] ="/images/kellyolson.png"
	images[34] ="/images/ListDash.png"
	images[35] ="/images/Listen-Quote.gif"
	images[36] ="/images/LoginButton.png"
	images[37] ="/images/MainBottomLeft.png"
	images[38] ="/images/MainBottomRepeat.png"
	images[39] ="/images/MainBottomRight.png"
	images[40] ="/images/MainLeftRepeat.png"
	images[41] ="/images/MainRightRepeat.png"
	images[42] ="/images/MainUpperLeft.png"
	images[43] ="/images/MainUpperRepeat.png"
	images[44] ="/images/MainUpperRight.png"
	images[45] ="/images/marketingarr.gif"
	images[46] ="/images/MattGulseth.png"
	images[47] ="/images/mountain.jpg"
	images[48] ="/images/mouse_0.jpg"
	images[49] ="/images/nationalcamera.gif"
	images[50] ="/images/NavBarBackground.png"
	images[51] ="/images/NRPLogo.jpg"
	images[52] ="/images/NRP_logo.png"
	images[53] ="/images/popupbg.png"
	images[54] ="/images/PreloaderBG.png"
	images[55] ="/images/puzzle pieces.jpg"
	images[56] ="/images/RetirementColumn.png"
	images[57] ="/images/SearchBackground.png"
	images[58] ="/images/Solve-Quote.gif"
	images[59] ="/images/stock_book.jpg"
	images[60] ="/images/stock_filecabinet.jpg"
	images[61] ="/images/stock_pen.jpg"
	images[62] ="/images/TitleHR.png"
	images[63] ="/images/TomFitzpatrick.png"
	images[64] ="/images/Understand-Quote.gif"
	images[65] ="/images/WealthColumn.png"

//Iterage through all images
	for(var i=0; i <= images.length; i++)
	{
		//Make a call to image to load into cache
		imageObj.src=images[i];
		
		if (i = images.length)
		{
			//After iterating run the function
			imageObj.onLoad = imagesLoaded();
		}
	}
	

}

function imagesLoaded()
{
	//Display the Main Container
	document.getElementById("MainContainer").style.display = "block";
	
	//Hide the loading screen
	document.getElementById("System").style.display = "none";

}

function WealthPopup()
{
	var viewportheight, blanket_height;
	var viewportwidth, blanket_width;
	
	if (typeof window.innerHeight != 'undefined') 
	{
		viewportheight = window.innerHeight;
	} 
	else 
	{
		viewportheight = document.documentElement.clientHeight;
	}
	
	if ((viewportheight > document.body.parentNode.scrollHeight) && (viewportheight > document.body.parentNode.clientHeight)) 
	{
		blanket_height = viewportheight;
	} 
	
	else 
	{
		if (document.body.parentNode.clientHeight > document.body.parentNode.scrollHeight) 
		{
			blanket_height = document.body.parentNode.clientHeight;
		} 
		
		else 
		{
			blanket_height = document.body.parentNode.scrollHeight;
		}
	}
	
	if (typeof window.innerWidth != 'undefined') 
	{
		viewportwidth = window.innerHeight;
	} 
	
	else 
	{
		viewportwidth = document.documentElement.clientHeight;
	}
	if ((viewportwidth > document.body.parentNode.scrollWidth) && (viewportwidth > document.body.parentNode.clientWidth)) 
	{
		blanket_width = viewportwidth;
	} 
	
	else 
	{
		if (document.body.parentNode.clientWidth > document.body.parentNode.scrollWidth) 
		{
			blanket_width = document.body.parentNode.clientWidth;
		} 
		
		else 
		{
			blanket_width = document.body.parentNode.scrollWidth;
		}
	}
	
	document.getElementById("Dimmer").style.height = blanket_height +"px";
	document.getElementById("Dimmer").style.width = blanket_width +"px";
	document.getElementById("Dimmer").style.display = "block";
	
	//Subtract half the width and height of popup
	document.getElementById("WealthPopup").style.left = (blanket_width /2) - 150 +"px";  
	document.getElementById("WealthPopup").style.top = "275px";
	document.getElementById("WealthPopup").innerHTML = "<div style=\"font-size:14px\; font-weight:bold\; padding-top:25px\;\">You are now leaving Channel Financial</div><br/><br/>Click <b>OK</b> to continue to Channel Wealth<br/>or<br/>Click <b>BACK</b> to return to Channel Financial<p><br/><form><input type=\"button\" value=\"OK\" style=\"width:75px\;\" onclick=\"GoToWealth()\; return false\;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"button\" value=\"BACK\" style=\"width:75px\;\" onclick=\"HidePopup()\; return false\;\"></form>";
	document.getElementById("WealthPopup").style.display = "block";
	
	
}

function LeavingPopup()
{
	var viewportheight, blanket_height;
	var viewportwidth, blanket_width;
	
	if (typeof window.innerHeight != 'undefined') 
	{
		viewportheight = window.innerHeight;
	} 
	else 
	{
		viewportheight = document.documentElement.clientHeight;
	}
	
	if ((viewportheight > document.body.parentNode.scrollHeight) && (viewportheight > document.body.parentNode.clientHeight)) 
	{
		blanket_height = viewportheight;
	} 
	
	else 
	{
		if (document.body.parentNode.clientHeight > document.body.parentNode.scrollHeight) 
		{
			blanket_height = document.body.parentNode.clientHeight;
		} 
		
		else 
		{
			blanket_height = document.body.parentNode.scrollHeight;
		}
	}
	
	if (typeof window.innerWidth != 'undefined') 
	{
		viewportwidth = window.innerHeight;
	} 
	
	else 
	{
		viewportwidth = document.documentElement.clientHeight;
	}
	if ((viewportwidth > document.body.parentNode.scrollWidth) && (viewportwidth > document.body.parentNode.clientWidth)) 
	{
		blanket_width = viewportwidth;
	} 
	
	else 
	{
		if (document.body.parentNode.clientWidth > document.body.parentNode.scrollWidth) 
		{
			blanket_width = document.body.parentNode.clientWidth;
		} 
		
		else 
		{
			blanket_width = document.body.parentNode.scrollWidth;
		}
	}
	
	document.getElementById("Dimmer").style.height = blanket_height +"px";
	document.getElementById("Dimmer").style.width = blanket_width +"px";
	document.getElementById("Dimmer").style.display = "block";
	
	//Subtract half the width and height of popup
	document.getElementById("WealthPopup").style.left = (blanket_width /2) - 150 +"px";  
	document.getElementById("WealthPopup").style.top = "275px";
	document.getElementById("WealthPopup").innerHTML = "<div style=\"font-size:14px\; font-weight:bold\; padding-top:25px\;\">You are now leaving Channel Wealth</div><br/><br/>Click <b>OK</b> to continue to Channel Financial<br/>or<br/>Click <b>BACK</b> to return to Channel Wealth<p><br/><form><input type=\"button\" value=\"OK\" style=\"width:75px\;\" onclick=\"GoToWealth()\; return false\;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"button\" value=\"BACK\" style=\"width:75px\;\" onclick=\"HidePopup()\; return false\;\"></form>";
	document.getElementById("WealthPopup").style.display = "block";
	
	
}

function HidePopup()
{
	document.getElementById("WealthPopup").style.display = "none";
	document.getElementById("Dimmer").style.display = "none";
}

function GoToWealth()
{
	window.location.href = 'http://www.channel-wealth.com';	
}
