//Declare Global Variables

var strHomeDir="../../";
var strHomePage="/Pages/default.aspx";
var strImgDirPath = strHomeDir + "Style Library/Images/concentra/";
var strBannerImgDirPath = strImgDirPath + "banner/";

//Declare re-usable variables for rows
var strColShading="1"; //1=shaded, 2=white

var strProductArea="";
var strProductLink="";
var strProductLinkLogIn="";
var strLink="";
var strDiv="";


// SHARED FUNCTIONS *********************************************************************



function sizeWin(optional_supplied_width) {
if (window.screen) {
var w = screen.availWidth;
var h = screen.availHeight;
var predefined_width  = 700; //pixels

if (optional_supplied_width > 700){
 predefined_width = optional_supplied_width;
}
 
var lh_start = w - predefined_width;

if (lh_start < 0){
lh_start = 0;
}

window.resizeTo(predefined_width, h);
window.moveTo(lh_start, 0);
  }
}


function getQuerystring(key, default_)
{
  if (default_==null) default_=""; 
  key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
  var qs = regex.exec(window.location.href);
  if(qs == null)
    return default_;
  else
    return qs[1];
} // function


// FORM VIEWING FUNCTIONS ***************************************************************

function ComposeFormTitle()
{

var strTempTitle = "";
var strTitle = "";

strTempTitle = getQuerystring("active");
strTempTitle=strTempTitle.toLowerCase();

//alert(strTempTitle);
switch (strTempTitle) {

//common definition
case "na": strTtitle=""; break;

//class definitions
case "general": strTitle = "General"; break;
case "estate": strTitle = "Estate Payout"; break;
case "solicitor": strTitle = "Mortgage Solicitor"; break;
case "pension": strTitle = "Pension Lock-In"; break;
case "prescribed": strTitle = "Prescribed"; break; //this will be overreaching
case "prescribedlock-in": strTitle = "Prescribed Lock-In"; break;
case "sample": strTitle = "Sample"; break;

//jurisdiction definitions
case "common": strTitle = "Common Lock-In"; break;
case "federal%20pbsa": strTitle = "Federal PBSA, 1985"; break;
case "non-pbsa": strTitle = "Federal Non-PBSA"; break; 
case "ab": strTitle = "Alberta"; break; 
case "bc": strTitle = "British Columbia"; break;
case "mb": strTitle = "Manitoba"; break; 
case "nb": strTitle = "New Brunswick"; break; 
case "nl": strTitle = "Newfoundland & Labrador"; break;
case "ns": strTitle = "Nova Scotia"; break; 
case "nt": strTitle = "Northwest Territory"; break;
case "nu": strTitle = "Nunavut"; break; 
case "ont": strTitle = "Ontario"; break;
case "pe": strTitle = "Prince Edward Island"; break; 
case "qc": strTitle = "Quebec"; break;
case "sk": strTitle = "Saskatchewan"; break; 
case "yt": strTitle = "Yukon"; break;

default: strTitle = "";

}

// Write out the page header, including the type of form in brackets

if ((strTitle=="")||(strTitle=="na"))
	{
		//Do nothing
	}
else
	{
		strTitle="(" + strTitle + ")";
	}
	
document.write("<span class='heading-strong-title'>Forms " + strTitle + "</span>");

} // end function



function ValidateContext()
{
// Creat a variable to hold the subsite based on referring page 
var strReferSubsite = "";
// Creat a variable to hold the requested progprod
var strQSSubsite = getQuerystring("pgpd");


// Check the referring page's URL for the subsite folder name
var strRefer = document.referrer;

var arrRefer = strRefer.split("/");
	//The folder appears in the fifth section of the path
var strReferSubsite = arrRefer[5];

// Make an exception for CU DRP (its folder name does not match progprod)
if (strReferSubsite == "cu_drp") {
strReferSubsite = "drpcu";
}

// Compare the two values - if they match all okay, if not redirect
if (strReferSubsite == strQSSubsite) {
// Do Nothing
}
else
{
//window.location.href="default.aspx?pgpd=unauthorized";
}

}



function forceURL()
{
//This code examines the URL and ensures a proper QS parameter exists to set the default tab for the tabbed table

var strHrefInitial=document.location.href;

alert(strHrefInitial);
alert(strHrefInitial.indexOf('?'));


// The front page filename is defined by the global variable, strHomePage, in functions.js
	if (strHrefInitial.indexOf('?')==-1)
	{
		// Introduce an id querystring to the address, with default value equal to 1 (CUs)
		self.location = strHrefInitial + "?id=1";
	}
	else
	{
		// Consider the case where a QS exists but not including an id parameter
		if (strHrefInitial.indexOf('id=')==-1)
		{
		//Preserve the original address including any pre-existing query string and append on the id component
		self.location = strHrefInitial + "&id=1";
		}
	}

} // function


function forceRedirect()
{
//This code examines the URL and ensures the referring page is authorized

var strHrefInitial=document.location.href;
var strRefer=document.referrer;
var strSite=getQuerystring('pgpd');
var strCheck="http://www.concentrafinancial.ca/sites/ConcentraSecure/" + strSite;

alert(strRefer);
alert(strSite);


// The front page filename is defined by the global variable, strHomePage, in functions.js
	if (strRefer.indexOf(strCheck)==-1)
	{
		// Introduce an id querystring to the address, with default value equal to 1 (CUs)
		self.location = "http://www.concentrafinancial.ca/pages/showforms/unauthorized.aspx";
	}

} // function



// END SHARED FUNCTIONS ******************************************************************

function get_target_page(strProgProd){

var strTargetPage="";
strTargetPage=strProgProd + ".asp";
return strTargetPage;
} // end function


// LOG-IN FUNCTIONS *********************************************************************

function get_username_and_password(strCurrSection){

var arrCredentials= new Array(2); 
arrCredentials[0]="credit";
arrCredentials[1]="unions";

switch (strCurrSection) {
case "cu_deposits": arrCredentials[0] = "cu"; arrCredentials[1] = "deposits"; break;
case "cu_mortgages": arrCredentials[0] = "cu"; arrCredentials[1] = "mortgages"; break;
case "cu_trusts": arrCredentials[0] = "cu"; arrCredentials[1] = "trusts"; break;
case "cu_leasing": arrCredentials[0] = "cu"; arrCredentials[1] = "leasing"; break;
case "cu_corpbanking": arrCredentials[0] = "cu"; arrCredentials[1] = "corpbanking"; break;
case "cu_corpfinance": arrCredentials[0] = "cu"; arrCredentials[1] = "corpfinance"; break;

case "comm_deposits": arrCredentials[0] = "comm"; arrCredentials[1] = "deposits"; break;
case "comm_mortgages": arrCredentials[0] = "comm"; arrCredentials[1] = "mortgages"; break;
case "comm_leasing": arrCredentials[0] = "comm"; arrCredentials[1] = "leasing"; break;

// If something other than show or hide was specified set it to show
//default: strTargetPage = "index.aspx"; break;
}
return arrCredentials;
} // end function

// END LOG-IN FUNCTIONS ******************************************************************



function checkform(strProductArea){

var strTargetPage = "";
strTargetPage = get_target_page(strProductArea);

var strObjName;

strObjName = strProductArea;

var strUser="document." + strObjName + ".username_" + strObjName + ".value";

var strPwd = "document." + strObjName + ".pwd_" + strObjName + ".value";

var strNewTarg=document.location.href;

var strUsername="";
var strPassword="";  

var tempstring;
tempstring = "credit";

var ArrCurrentPair = new Array();

ArrCurrentPair=eval(get_username_and_password(strProductArea));

if ((eval(strUser))==ArrCurrentPair[0] && (eval(strPwd)) ==ArrCurrentPair[1] ) 
{
	strNewTarg=strTargetPage;
	window.location=strNewTarg;
}
else
{
	alert("Please enter valid sign-in credentials");
	eval("document." + strObjName + ".pwd_" + strObjName + ".value=''");
	eval("document." + strObjName + ".pwd_" + strObjName + ".style.background= '#F7EAC8'");
	eval("document." + strObjName + ".username_" + strObjName + ".style.background= '#F7EAC8'");
	eval("document." + strObjName + ".username_" + strObjName + ".focus()");
	eval("document." + strObjName + ".username_" + strObjName + ".select()");
}
} //end function






function buildform(strProductArea){

document.write("<form method='post' name='" + strProductArea + "'>");	
document.write("<br />");
document.write("<label for='name' style='width:80px; float:left'>Username:</label>");
document.write("<input id='username_" + strProductArea + "' type='text'  size='20' style='float:inherit' />");
document.write("<br />");
document.write("<label for='pwd' style='width:80px; float:left'>Password:</label>");
document.write("<input id='pwd_" + strProductArea + "' type='password'  size='20' style='float:inherit' />");

//With no variables passed:
//document.write("<input name='Submit1' type='button' value='Log-in' OnClick='javascript:checkform()'");

// The following statement applies if you are passing a string directly:
//document.write("<input name='Submit1' type='button' value='Log-in' OnClick=\"javascript:checkform('http://www.cnn.com');\">");

// For a string as attribute:
//document.write("<input id='submit_" + strProductArea + "' type='button' style='margin-left:10px' value='Log-in' OnClick=javascript:checkform(strProductArea)>");
document.write("<input id='submit_" + strProductArea + "' type='button' style='margin-left:10px' value='Log-In' OnClick=\"javascript:checkform('" + strProductArea + "');\">");
document.write("<br />");
document.write("<br />");
document.write("</form>");

//Reset variable
strProductArea="";
}  //end function








function IsNumeric(val) {
//This function returns true if the supplied value is numeric
    if (isNaN(parseFloat(val))) {
          return false;
     }
     return true
}



// TABBED TABLE FUNCTIONS **************************************************************************


function CreateProductRow(arrProgramRow){

// This function generates a program/product row in the "What We Do" table of the front page
// Because 2D and associative arrays cannot be reliably implemented in Javascript and 
// because we envision that product owners will want to change the ordering and labeling of rows frequently
// we have decided to employ repetitive "manual" calls to this function instead of utilizing a loop that would
// automatically step through.  To that end, row shading is also done manually by toggling the value of the
// global variable, strColShading {1 = shading, 2 = white (none)}

// Provide the description text for the row header (i.e label)
	eval(start_services_row(arrProgramRow[0], arrProgramRow[1]));

// Put in the text you want hidden/toggled here:
	document.write(arrProgramRow[2]);

//Finish off the html to close the row
	eval(end_services_row(arrProgramRow[1]));	
	
}  // End CreateProductRow function

function start_services_row(strProductArea, strProductLink){

var strLink="";

document.write("<tr class='table-row-" + strColShading + "'>");
document.write("<td style='width: 60%'>");

strLink = create_toggle(strProductLink);
document.write(strLink);

document.write("<strong>" + strProductArea + "</strong></td>");
document.write("<td align='center'>");

document.write("</td>");
document.write("</tr>");

document.write("<tr class='table-row-" + strColShading + "'>");
document.write("<td style='width: 90%' colspan='2'>");
 
//End always visible text

//Open (create) the div tag that handles visibility
document.write(toggle_text(strProductLink));

//Supress the log-in form of hidden component if dealing with Public Tab Info
if (strProductLink.indexOf('public')==-1)
{
//document.write("<p>");
//eval(buildform(strProductLink + "_form"));
//eval(buildform(strProductLink));
//document.write("</p>");
}

} // end function


function create_toggle(param,txtimg)
{

/* This function takes an input parameter in the query string and toggles its value to 'show' or '' (=hide), respectively.
The txtimg variable is optional and if set to 1, will use textual hyperlinks as oppossed to image hyperlinks
The altered querystring component is then swapped into the URL and as such, will allow the user to click and toggle views
Hiding/unhiding views is accomplished by div tag alterations in a separate function
If no input parameter specifically has a value of 'show'in the original URL, than the URL is returned unchanged. 
*/

var stateLabel="";

// Utilize the global image directory variable to define location of +/- toggle images
var stateLabelA=strImgDirPath + "tvplus.gif";
var stateLabelB=strImgDirPath + "tvminus.gif";

// Supply text labels for added versatility as an aleternative to images
var stateLabelC="More Info";
var stateLabelD="Hide Info";

var strParamValue = "";
var strToggledPair = "";
var strOrigPair = "";
var stateLabel="More Info";
var strParam="";
var strOutput="";
var strNEWQS="";
var intSentinel=0;
var intFlagtxtimg=0;
var intCounter=0;
var intOrigCounter = 0; 
var intNewCounter = 0; 
var ST;
var strQS="";
var strHref;
var arrNEWQSComponents = [];
var arrQSComponents = [];

//Get the current URL
strHref=document.location.href;

//Get the QS
strQS=location.search;

//Split the querystring into its constituent parts
arrQSComponents = strQS.split("&");

//Check that the function was called with the text image option
// If so, assign the flag to a local variable or otherwise set it to default (image)

if ((txtimg==null)||(txtimg==undefined)||(txtimg==""))
{
intFlagtxtimg=0;
} 

if ((txtimg==1))
{
intFlagtxtimg=1;
}

//Populate the new array with query string paramaters that 

	if (intFlagtxtimg==1)
	{
	stateLabelA=stateLabelC;
	stateLabelB=stateLabelD;
	}

for(i = 0; i < arrQSComponents.length; i++){
	if (arrQSComponents[i].indexOf('show')==-1) //show not present, therefore already expanded view
		{
		arrNEWQSComponents[intNewCounter] = arrQSComponents[intOrigCounter]	
		intOrigCounter++;
		intNewCounter++;
		}
	else //if here, then expanded view and hence link must collapse (i.e pullout all show strings)
		{
		intOrigCounter++;
		}
} // for


var intIn;
var strPair;

strPair=param + "=show";
intIn=strQS.indexOf(strPair);

switch (intIn)
{
case -1:
	//minus condition
	stateLabel = stateLabelA;
	ST=arrNEWQSComponents.join("&") + "?" + param + "=show";
	break
default:
	//plus condition
	stateLabel = stateLabelB;
	ST=arrNEWQSComponents.join("&")
}

strNEWQS= document.location.pathname + ST;

switch (intFlagtxtimg)
{
case 1:
	//text link
	strOutput="(<a href='" + strNEWQS + "'>" + stateLabel + "</A>)";	break
default:
	// image link (i.e. button)
	strOutput="<a href='" + strNEWQS + "'><img class='toggle' src='" + stateLabel + "' /></A>";
}

return strOutput; 

} // end function


function toggle_text(param)
{
/* This function takes an input parameter in the query string and upon reading its associated parameter value,
it returns a div tag that will show or hide the text respectively that follows the function call. 
*/

var stateDiv="";
var strParamValue = "";
var strParam="";
var strOutput="";

//Check that the called parameter exists and, if it does, then find the matching parameter value
if ((param!=null)||(param!=undefined)||(param!=""))
{
	strParam = param;
	strParamValue = getQuerystring(strParam); 
}

switch (strParamValue) {
case "show": stateDiv = 'visibletext'; break;
// If something other than show or hide was speciifed set it to show
default: stateDiv = 'hiddentext'; break;
}

strOutput = "<div id='" + stateDiv + "'>";
return strOutput; 
} // end function

function end_services_row(strProductLink){

document.write("</div>");
//End always hidden text 

//END OF TOGGLE TEXT SECTION
document.write("</td></tr>");  
       
}

// END TABBED TABLE FUNCTIONS ***********************************************************************

// CORP PROFILE FUNCTIONS ***********************************************************************
function start_toggtext(strProductArea, strProductLink){

var strLink="";
strLink = create_toggle(strProductLink, 1);
document.write("<p style='text-align:right;margin-right:15px'>");
document.write(strLink);
document.write("</p>");

//End always visible text

//Open (create) the div tag that handles visibility

document.write(toggle_text(strProductLink));


} // end function

function end_toggtext(strProductLink){

document.write("</div>");
//End always hidden text 

//END OF TOGGLE TEXT SECTION
//document.write("</td></tr>");  
       
}

// END CORP PROFILE FUNCTIONS ***********************************************************************

// BANNER FUNCTIONS ***********************************************************************

// An array of the images to be rotated (Image Path) 
var arrCtrImg = new Array(); 
arrCtrImg[0] = [strImgDirPath + 'ctrban.jpg']; 
arrCtrImg[1] = [strImgDirPath + 'ctrban2.jpg']; 

var arrLHSImg = new Array(); 
arrLHSImg[0] = [strImgDirPath + 'lhsban.jpg']; 
arrLHSImg[1] = [strImgDirPath + 'lhsban2.jpg']; 

var arrRHSImg = new Array(); 
arrRHSImg[0] = [strImgDirPath + 'rhsban.jpg']; 
arrRHSImg[1] = [strImgDirPath + 'rhsban2.jpg'];

function rotateImage(){ 
    // index = Math.floor(Math.random() * arrCtrImg.length); 
   
    //(img = document.getElementById('banner_lhs_image_id')).src = arrLHSImg[index][0];
    //(img = document.getElementById('banner_ctr_image_id')).src = arrCtrImg[index][0];  
    //(img = document.getElementById('banner_rhs_image_id')).src = arrRHSImg[index][0]; 
    
} 

// TABBED TABLE FUNCTIONS **************************************************************************

function GetActiveTab(){

//This function returns the tab of the front page table that has been selected
//As such it can only be called after the table has been loaded.

var strClassInfo = "";
var intNumListTabs = 0;
var intActiveTab = 0;
var intTriggerIndex = 0;
   						
var nodelist = document.getElementsByTagName('li');

//Step through all list tags on the page
for(i = 0; i < nodelist.length; i++)
{
// Get the HTML content of each list item 
strListHTML = nodelist[i].innerHTML;
						
//Examine content for the presence of the JS postback function (indicative of a tab)
if (strListHTML.indexOf("doPostBack")== -1) {
// Not a tabbed list item
// Do nothing
} else {
//Add the existence of the tab to the count of total tabs found so far
intNumListTabs = intNumListTabs + 1;
							
//Having verified that the current list item is a tab, get its class
strClassInfo = nodelist[i].className;
						 	
//Check to see if is the active tab (class = selected)
if (strClassInfo=="selected") {
//If so record at what point the active tab was discovered.
intTriggerIndex = i;
}		
}
}
						
// The active tab is equal to the difference in the point at which the active tab was discovered ("selected")
// minus the total number of list items
// We increment by one to account for zero-indexing
//intActiveTab = (intNumListTabs - (nodelist.length - intTriggerIndex)) + 1;
intActiveTab = (intTriggerIndex-intNumListTabs) + 1;

//alert("[# Tabs: " + intNumListTabs + "] [Nodelist Length: " + nodelist.length + "] [intTriggerIndex: " + intTriggerIndex + "]   > [Active Tab: " + intActiveTab + "]");

return intActiveTab; 

}


function RotateBanner(){
//This function changes banner images and center cell background color based on active tab in tabbed table

  					var stateofpage=GetActiveTab();
  					var strBGCol;
				
					switch (stateofpage)
					{
					case 1: // CUs
					  strBGCol = "#ADCED7";
					  break
					case 2: // Commercial
					  strBGCol = "#E9EFEB";
					  break
					case 3: // Consumer
					  strBGCol = "#D6C6AD";
					  break
					default:
					  strBGCol = "#ADCED7";
					 }

  					//Create variables to access properties of the banner images
  					var imagestate_lhs = document.getElementById('banner_lhsimg');
  					var imagestate_ctr = document.getElementById('banner_ctrimg');
  					var imagestate_rhs = document.getElementById('banner_rhsimg');
  					
  					
  					
  					//Create variables to hold image paths
  					var imgpath_lhs = imagestate_lhs.src;
  					var imgpath_ctr = imagestate_ctr.src;
  					var imgpath_rhs = imagestate_rhs.src;
  					
  					//alert("LHS is : " + imgpath_lhs + "   RHS is : " + imgpath_rhs);
  					  									  					   						
   						//Adjust which images are present
   						imagestate_lhs.src=imgpath_lhs.replace("lhsban1.jpg", "lhsban" + stateofpage + ".jpg");
   						imagestate_ctr.src=imgpath_ctr.replace("ctrban1.jpg", "ctrban" + stateofpage + ".jpg");
   						imagestate_rhs.src=imgpath_rhs.replace("rhsban1.jpg", "rhsban" + stateofpage + ".jpg");
   						
   						//Adjust background color of center cell (visble at higher resolutions/bigger screens)
   						document.getElementById('banner_ctrcell').style.backgroundColor=strBGCol;

return;
}


function NewRotateBanner(){
//This function changes banner images and center cell background color based on active tab in tabbed table

  					var stateofpage=GetActiveTab();
  					var strBGCol;
				
					switch (stateofpage)
					{
					case 1: // CUs
					  strBGCol = "#FFFFFF";
					  break
					case 2: // Commercial
					  strBGCol = "#FFFFFF";
					  break
					case 3: // Consumer
					  strBGCol = "#FFFFFF";
					  break
					default:
					  strBGCol = "#FFFFFF";
					 }

  					//Create variables to access properties of the banner images
  					//var imagestate_lhs = document.getElementById('banner_lhsimg');
  					var imagestate_ctr = document.getElementById('banner_ctrimg');
  					//var imagestate_rhs = document.getElementById('banner_rhsimg');
  					
  					
  					
  					//Create variables to hold image paths
  					//var imgpath_lhs = imagestate_lhs.src;
  					var imgpath_ctr = imagestate_ctr.src;
  					//var imgpath_rhs = imagestate_rhs.src;
  					
  					//alert("LHS is : " + imgpath_lhs + "   RHS is : " + imgpath_rhs);
  					  									  					   						
   						//Adjust which images are present
   						//imagestate_lhs.src=imgpath_lhs.replace("lhsban1.jpg", "lhsban" + stateofpage + ".jpg");
   						imagestate_ctr.src=imgpath_ctr.replace("ctrban1.jpg", "ctrban" + stateofpage + ".jpg");
   						//imagestate_rhs.src=imgpath_rhs.replace("rhsban1.jpg", "rhsban" + stateofpage + ".jpg");
   						
   						//Adjust background color of center cell (visble at higher resolutions/bigger screens)
   						document.getElementById('banner_ctrcell').style.backgroundColor=strBGCol;

return;
}



function RotateGradientBanner(){
//This function changes banner images and center cell background color based on active tab in tabbed table

  					var stateofpage=GetActiveTab();
  					var strBGCol;
				
					switch (stateofpage)
					{
					case 1: // CUs
					  strBGCol = "#ADCED7";
					  break
					case 2: // Commercial
					  strBGCol = "#E9EFEB";
					  break
					case 3: // Consumer
					  strBGCol = "#D6C6AD";
					  break
					default:
					  strBGCol = "#ADCED7";
					 }

  					//Create variables to access properties of the banner images
  					var imagestate_lhs = document.getElementById('banner_lhsimg');
  					var imagestate_ctr = document.getElementById('banner_ctrimg');
  					var imagestate_rhs = document.getElementById('banner_rhsimg');
  					var imagestate_bg = document.getElementById('banner_bg');
  					
  					
  					//Create variables to hold image paths
  					var imgpath_lhs = imagestate_lhs.src;
  					var imgpath_ctr = imagestate_ctr.src;
  					var imgpath_rhs = imagestate_rhs.src;
  					var imgpath_bg = imagestate_bg.background;

  					
  					//alert("LHS is : " + imgpath_lhs + "   RHS is : " + imgpath_rhs);
   						//Adjust which images are present
   						imagestate_lhs.src=imgpath_lhs.replace("grad_lhsban1.jpg", "grad_lhsban" + stateofpage + ".jpg");
   						imagestate_ctr.src=imgpath_ctr.replace("grad_ctrban1.jpg", "grad_ctrban" + stateofpage + ".jpg");
   						imagestate_rhs.src=imgpath_rhs.replace("grad_rhsban1.jpg", "grad_rhsban" + stateofpage + ".jpg");						   						imagestate_bg.background=imgpath_bg.replace("grad_bgban1.jpg", "grad_bgban" + stateofpage + ".jpg");
   						
   						//Adjust background color of center cell (visble at higher resolutions/bigger screens)
   						document.getElementById('banner_ctrcell').style.backgroundColor=strBGCol;

return;
}


// END BANNER FUNCTIONS ***********************************************************************


// PRINT FUNCTIONS ***********************************************************************

function removeprintbutton(){
//Make the document background white
document.style.backgroundColor="white"
}

function revertback(){
//Reload the window
setTimeout("window.location.reload()",50)

}



function ClosePrintWindow() {

}

function PrintPage() {
 		window.print();
 		window.focus();
}

function OpenPrintWindow() {
self.window.name = "P";
var g = self.window.name;
var strInclude;

strInclude = "<script type='text/javascript' src='includes/js/my_fyi.js'></script>";




var pagecode_start =  "<html><head><title>Print Page</title><link rel='stylesheet' href='css/main.css' type='text/css' />" + strInclude + "</head><body>";

var xx = document.getElementById("wrap").innerHTML;
var pagecode_end =  "<center><form><input type ='Button' value='Close Window' onClick='window.close()'></form></center></body></html>";


	PrintWin=window.open("", "Print_Window","toolbar=no, location=no, scrollbars=yes, directories=no, status=no, menubar=no, resizable=yes, copyhistory=yes,top=0, left=0, width=756,height=600");
		PrintWin.document.write(pagecode_start); 
 		PrintWin.document.write(xx);  
 		PrintWin.document.write(pagecode_end); 
 		
 		window.print();
 		PrintWin.focus();
}

function CloseWindow() {
this.document.close()
}

function CloseWindowButton() {
document.write("<center>");
document.write("<INPUT TYPE='BUTTON' value='Close' onClick='self.close()'>");
document.write("<center>");
}

function get_province(supplied_abbreviation){

//Set the default as BC
var strFullProvName = "British Columbia";

switch (supplied_abbreviation) {
case "bc": strFullProvName = "British Columbia"; break;
case "ab": strFullProvName = "Alberta"; break;
case "sk": strFullProvName = "Saskatchewan"; break;
case "mb": strFullProvName = "Manitoba"; break;
case "nb": strFullProvName = "New Brunswick"; break;
case "ns": strFullProvName = "Nova Scotia"; break;
case "nf": strFullProvName = "Newfoundland"; break;
case "pe": strFullProvName = "Prince Edward Island"; break;
case "on": strFullProvName = "Ontario"; break;
}
return strFullProvName;
} // end function

