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;
}


function getCookieVal(offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}

function SetCookie (name, value) {
        var argv = SetCookie.arguments;
        var argc = SetCookie.arguments.length;
        var expires = (argc > 2) ? argv[2] : 365;  // always permanent
        var path = (argc > 3) ? argv[3] : '/';
//        var domain = (argc > 4) ? argv[4] : 'telus.com';
        
        var domain;
	if (argc > 4) {
	  domain = argv[4];
	}
	else {
	  if (window.location.hostname.match(/telus.com/) ) {
	    domain = 'telus.com';
	  }  
	  else {
	    domain = window.location.hostname;
	  }  
        }
        
        var secure = (argc > 5) ? argv[5] : false;

        // always permanent
        var today=new Date();
        var expTime=new Date();
        expTime.setTime(today.getTime()+3600000*24*expires*10)

        document.cookie = name + "=" + escape (value) +
        ((expires == null) ? "" : ("; expires=" + expTime.toGMTString())) +
        ((path == null) ? "" : ("; path=" + path)) +
        ((domain == null) ? "" : ("; domain=" + domain)) +
        ((secure == true) ? "; secure" : "");
}

function DeleteCookie (name) {  
	var exp = new Date();  
	exp.setTime (exp.getTime() - 1);  
 
	// This cookie is history  
	var cval = GetCookie (name);  
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

    function htmlDecode(s){
	var out = "";
	if (s==null) return;
	var l = s.length;
	for (var i=0; i<l; i++)	{
		var ch = s.charAt(i);		
		if (ch == '&') {
			var semicolonIndex = s.indexOf(';', i+1);
			
            if (semicolonIndex > 0) {
				var entity = s.substring(i + 1, semicolonIndex);
				if (entity.length > 1 && entity.charAt(0) == '#') {
					if (entity.charAt(1) == 'x' || entity.charAt(1) == 'X') ch = String.fromCharCode(eval('0'+entity.substring(1)));
					else ch = String.fromCharCode(eval(entity.substring(1)));
				}
		        else {
					switch (entity){
						case 'quot': ch = String.fromCharCode(0x0022); break;
						case 'amp': ch = String.fromCharCode(0x0026); break;
						case 'lt': ch = String.fromCharCode(0x003c); break;
						case 'gt': ch = String.fromCharCode(0x003e); break;
						case 'nbsp': ch = String.fromCharCode(0x00a0); break;
						case 'iexcl': ch = String.fromCharCode(0x00a1); break;
						case 'cent': ch = String.fromCharCode(0x00a2); break;
						case 'pound': ch = String.fromCharCode(0x00a3); break;
						case 'curren': ch = String.fromCharCode(0x00a4); break;
						case 'yen': ch = String.fromCharCode(0x00a5); break;
						case 'brvbar': ch = String.fromCharCode(0x00a6); break;
						case 'sect': ch = String.fromCharCode(0x00a7); break;
						case 'uml': ch = String.fromCharCode(0x00a8); break;
						case 'copy': ch = String.fromCharCode(0x00a9); break;
						case 'ordf': ch = String.fromCharCode(0x00aa); break;
						case 'laquo': ch = String.fromCharCode(0x00ab); break;
						case 'not': ch = String.fromCharCode(0x00ac); break;
						case 'shy': ch = String.fromCharCode(0x00ad); break;
						case 'reg': ch = String.fromCharCode(0x00ae); break;
						case 'macr': ch = String.fromCharCode(0x00af); break;
						case 'deg': ch = String.fromCharCode(0x00b0); break;
						case 'plusmn': ch = String.fromCharCode(0x00b1); break;
						case 'sup2': ch = String.fromCharCode(0x00b2); break;
						case 'sup3': ch = String.fromCharCode(0x00b3); break;
						case 'acute': ch = String.fromCharCode(0x00b4); break;
						case 'micro': ch = String.fromCharCode(0x00b5); break;
						case 'para': ch = String.fromCharCode(0x00b6); break;
						case 'middot': ch = String.fromCharCode(0x00b7); break;
						case 'cedil': ch = String.fromCharCode(0x00b8); break;
						case 'sup1': ch = String.fromCharCode(0x00b9); break;
						case 'ordm': ch = String.fromCharCode(0x00ba); break;
						case 'raquo': ch = String.fromCharCode(0x00bb); break;
						case 'frac14': ch = String.fromCharCode(0x00bc); break;
						case 'frac12': ch = String.fromCharCode(0x00bd); break;
						case 'frac34': ch = String.fromCharCode(0x00be); break;
						case 'iquest': ch = String.fromCharCode(0x00bf); break;
						case 'Agrave': ch = String.fromCharCode(0x00c0); break;
						case 'Aacute': ch = String.fromCharCode(0x00c1); break;
						case 'Acirc': ch = String.fromCharCode(0x00c2); break;
						case 'Atilde': ch = String.fromCharCode(0x00c3); break;
						case 'Auml': ch = String.fromCharCode(0x00c4); break;
						case 'Aring': ch = String.fromCharCode(0x00c5); break;
						case 'AElig': ch = String.fromCharCode(0x00c6); break;
						case 'Ccedil': ch = String.fromCharCode(0x00c7); break;
						case 'Egrave': ch = String.fromCharCode(0x00c8); break;
						case 'Eacute': ch = String.fromCharCode(0x00c9); break;
						case 'Ecirc': ch = String.fromCharCode(0x00ca); break;
						case 'Euml': ch = String.fromCharCode(0x00cb); break;
						case 'Igrave': ch = String.fromCharCode(0x00cc); break;
						case 'Iacute': ch = String.fromCharCode(0x00cd); break;
						case 'Icirc': ch = String.fromCharCode(0x00ce); break;
						case 'Iuml': ch = String.fromCharCode(0x00cf); break;
						case 'ETH': ch = String.fromCharCode(0x00d0); break;
						case 'Ntilde': ch = String.fromCharCode(0x00d1); break;
						case 'Ograve': ch = String.fromCharCode(0x00d2); break;
						case 'Oacute': ch = String.fromCharCode(0x00d3); break;
						case 'Ocirc': ch = String.fromCharCode(0x00d4); break;
						case 'Otilde': ch = String.fromCharCode(0x00d5); break;
						case 'Ouml': ch = String.fromCharCode(0x00d6); break;
						case 'times': ch = String.fromCharCode(0x00d7); break;
						case 'Oslash': ch = String.fromCharCode(0x00d8); break;
						case 'Ugrave': ch = String.fromCharCode(0x00d9); break;
						case 'Uacute': ch = String.fromCharCode(0x00da); break;
						case 'Ucirc': ch = String.fromCharCode(0x00db); break;
						case 'Uuml': ch = String.fromCharCode(0x00dc); break;
						case 'Yacute': ch = String.fromCharCode(0x00dd); break;
						case 'THORN': ch = String.fromCharCode(0x00de); break;
						case 'szlig': ch = String.fromCharCode(0x00df); break;
						case 'agrave': ch = String.fromCharCode(0x00e0); break;
						case 'aacute': ch = String.fromCharCode(0x00e1); break;
						case 'acirc': ch = String.fromCharCode(0x00e2); break;
						case 'atilde': ch = String.fromCharCode(0x00e3); break;
						case 'auml': ch = String.fromCharCode(0x00e4); break;
						case 'aring': ch = String.fromCharCode(0x00e5); break;
						case 'aelig': ch = String.fromCharCode(0x00e6); break;
						case 'ccedil': ch = String.fromCharCode(0x00e7); break;
						case 'egrave': ch = String.fromCharCode(0x00e8); break;
						case 'eacute': ch = String.fromCharCode(0x00e9); break;
						case 'ecirc': ch = String.fromCharCode(0x00ea); break;
						case 'euml': ch = String.fromCharCode(0x00eb); break;
						case 'igrave': ch = String.fromCharCode(0x00ec); break;
						case 'iacute': ch = String.fromCharCode(0x00ed); break;
						case 'icirc': ch = String.fromCharCode(0x00ee); break;
						case 'iuml': ch = String.fromCharCode(0x00ef); break;
						case 'eth': ch = String.fromCharCode(0x00f0); break;
						case 'ntilde': ch = String.fromCharCode(0x00f1); break;
						case 'ograve': ch = String.fromCharCode(0x00f2); break;
						case 'oacute': ch = String.fromCharCode(0x00f3); break;
						case 'ocirc': ch = String.fromCharCode(0x00f4); break;
						case 'otilde': ch = String.fromCharCode(0x00f5); break;
						case 'ouml': ch = String.fromCharCode(0x00f6); break;
						case 'divide': ch = String.fromCharCode(0x00f7); break;
						case 'oslash': ch = String.fromCharCode(0x00f8); break;
						case 'ugrave': ch = String.fromCharCode(0x00f9); break;
						case 'uacute': ch = String.fromCharCode(0x00fa); break;
						case 'ucirc': ch = String.fromCharCode(0x00fb); break;
						case 'uuml': ch = String.fromCharCode(0x00fc); break;
						case 'yacute': ch = String.fromCharCode(0x00fd); break;
						case 'thorn': ch = String.fromCharCode(0x00fe); break;
						case 'yuml': ch = String.fromCharCode(0x00ff); break;
						case 'OElig': ch = String.fromCharCode(0x0152); break;
						case 'oelig': ch = String.fromCharCode(0x0153); break;
						case 'Scaron': ch = String.fromCharCode(0x0160); break;
						case 'scaron': ch = String.fromCharCode(0x0161); break;
						case 'Yuml': ch = String.fromCharCode(0x0178); break;
						case 'fnof': ch = String.fromCharCode(0x0192); break;
						case 'circ': ch = String.fromCharCode(0x02c6); break;
						case 'tilde': ch = String.fromCharCode(0x02dc); break;
						case 'ndash': ch = String.fromCharCode(0x2013); break;
						case 'mdash': ch = String.fromCharCode(0x2014); break;
						case 'lsquo': ch = String.fromCharCode(0x2018); break;
						case 'rsquo': ch = String.fromCharCode(0x2019); break;
						case 'sbquo': ch = String.fromCharCode(0x201a); break;
						case 'ldquo': ch = String.fromCharCode(0x201c); break;
						case 'rdquo': ch = String.fromCharCode(0x201d); break;
						case 'bdquo': ch = String.fromCharCode(0x201e); break;
						case 'dagger': ch = String.fromCharCode(0x2020); break;
						case 'Dagger': ch = String.fromCharCode(0x2021); break;
						default: ch = ''; break;
					}
				}
				i = semicolonIndex; 
			}
		}
		out += ch;
	}
	return out;
}

function addEvent(elm, evType, fn, useCapture) {
	if (elm.addEventListener) { 
	elm.addEventListener(evType, fn, useCapture); 
	return true; 
	}
	else if (elm.attachEvent) { 
	var r = elm.attachEvent('on' + evType, fn); 
	EventCache.add(elm, evType, fn);
	return r; 
	}
	else {
	elm['on' + evType] = fn;
	}
}
function getEventSrc(e) {
	if (!e) e = window.event;

	if (e.originalTarget)
	return e.originalTarget;
	else if (e.srcElement)
	return e.srcElement;
}
function addLoadEvent(func) {
var oldonload = window.onload;
	if (typeof window.onload != 'function') {
	window.onload = func;
	} else {
	window.onload = 
		function() {
		oldonload();
		func();
		}
	}
}
var EventCache = function(){
	var listEvents = [];
	return {
		listEvents : listEvents,
	
		add : function(node, sEventName, fHandler, bCapture){
			listEvents.push(arguments);
		},
	
		flush : function(){
			var i, item;
			for(i = listEvents.length - 1; i >= 0; i = i - 1){
				item = listEvents[i];
				
				if(item[0].removeEventListener){
					item[0].removeEventListener(item[1], item[2], item[3]);
				};
				
				/* From this point on we need the event names to be prefixed with 'on" */
				if(item[1].substring(0, 2) != "on"){
					item[1] = "on" + item[1];
				};
				
				if(item[0].detachEvent){
					item[0].detachEvent(item[1], item[2]);
				};
				
				item[0][item[1]] = null;
			};
		}
	};
}();
addEvent(window,'unload',EventCache.flush, false);
// ****** opens link in popup window
var Pwin;
function pop(url) { 
    topL=20;
    leftL=20;
    width=640;
    height=520;    
    toolbar=0;      
    scrollbar=1;      
    wName='popUp';
    width = (arguments.length>1)?arguments[1]:width; // option to pass in width
    height = (arguments.length>2)?arguments[2]:height; // option to pass in height    
    toolbar = (arguments.length>3)?arguments[3]:toolbar; // option to turn toolbar off
    scrollbar = (arguments.length>4)?arguments[4]:scrollbar; // option to turn scrollbar off
    wName = (arguments.length>5)?arguments[5]:wName; // option to pass in window name     

	if (url.indexOf("?") != -1 )
	{
		url = url + "&referringUrl=" + window.location.href;
	}

	if (url.indexOf("?")  == -1 )
	{
		url = url + "?referringUrl=" + window.location.href;
	}

    var str="toolbar="+ toolbar +",location=0,directories=0,status=0,menubar=0,scrollbars="+ scrollbar +",width="+ width +",height="+ height +",screenX="+ leftL +",screenY="+ topL +",left="+ leftL +",top="+ topL +",resizable=yes";
    if(Pwin){
        Pwin.close();
    }
    Pwin = window.open(url,wName,str);
    Pwin.focus();
}

/*****************************************************************/
function doRegionJump(frm,sel){
    // set region cookie
    var rgn = sel.options[sel.selectedIndex].innerHTML.toUpperCase();
    // Set region cookie
    SetCookie('telusPortalRegion', rgn);
    // Set segment cookie
    SetCookie('telusPortalSegment', bpDoc.segment);
	// jump to the selected URL
	//document.location = sel.options[sel.selectedIndex].value;
    frm.action = sel.options[sel.selectedIndex].value;
	frm.submit();
    //return false;
}

/*****************************************************************/
function doSearchRegionJump(frm,sel){
    // set region cookie
    var rgn = sel.options[sel.selectedIndex].innerHTML.toUpperCase();
    // Set region cookie
    SetCookie('telusPortalRegion', rgn);
    // Set segment cookie
    SetCookie('telusPortalSegment', bpDoc.segment);
	// jump to the selected URL
    document.location = sel.options[sel.selectedIndex].value;
    return false;
}


function tabInit()
{
	// if the content include 'sectionNav' element
	if(document.getElementById('sectionNav'))
	{		
		//navigation tab index
		var navIndex = 0;

		//content div index
		var divIndex = 0;

		// current hash value
        var currHash = window.location.hash;
		if (currHash.indexOf('tab') == -1)
		{
			currHash = "#tab1";
		}

		// navigation tab list
		var tabs = document.getElementById('sectionNav').getElementsByTagName('a');
	      
        // set naviagtion tab
		for(navIndex = 0; navIndex < tabs.length; navIndex++)
		{
							
			if  (tabs[navIndex].href.substring(tabs[navIndex].href.lastIndexOf('#')) == currHash) 
			{
				tabs[navIndex].className = "current";
			}
			else
			{
				tabs[navIndex].className = '';
			}
		} 
		
		// The default anchor will cause the page jump.
        // To avoid this, we have to cheat the brower,
		// The div id will be changed to tabs.length + contentIndex
		var contentIndex = 1;		
		
		//get the right hash value to control div display
		var contentHash = "tab" + (parseInt(currHash.substring(4)) + tabs.length);

		// content div list
		var divs = document.getElementById('tabs').getElementsByTagName('div');

		// set content div
		for(divIndex = 0; divIndex < divs.length; divIndex++)
		{
			//if pages publish with title, then setup id = title 
			//normally, the div with publish with id
			if(divs[divIndex].title.indexOf('tab')==0)
			{	
				divs[divIndex].id = divs[divIndex].title;
				divs[divIndex].title = '';
			}

			//setup div with new id
			if (divs[divIndex].id.indexOf('tab') == 0)
			{	
				//setup new div id
				var newId = tabs.length + contentIndex;				
				divs[divIndex].id = "tab" + newId;
				
				//increase the contentIndex value
				contentIndex = contentIndex + 1;
				
				//control which div display
				if (divs[divIndex].id == contentHash)
				{
					divs[divIndex].className = "current";					
				}
				else
				{
					divs[divIndex].className = 'hide';
				}
			}
		}

		//set function to capture the click event on the navigation tab
		for(navIndex = 0; navIndex < tabs.length; navIndex++)
		{
			// set up clicks
			tabs[navIndex].onclick = function()
			{
				clearAllTabs(tabs);
				this.className = 'current';
				window.location.hash = this.href.substring(this.href.lastIndexOf('#'));		
				
				// because content div id has been changed to tabs.length + contentIndex
				// setup the right hash value to control content display
				var newHash = "tab" + (parseInt(window.location.hash.substring(4)) + tabs.length);
				
				// control which content div will display
				for(divIndex = 0; divIndex < divs.length; divIndex++)
				{
					if (divs[divIndex].id.indexOf('tab') == 0)
					{				
						if (divs[divIndex].id == newHash)
						{
							divs[divIndex].className = "current";					
						}
						else
						{
							divs[divIndex].className = 'hide';
						}	
					}
				}
				//use reload funcation will cause change on brower title
				//window.location.reload();
				return false;
			} //end set up clicks
		}//end set navigation tab

		//set function to capture the click event in the content
		var bookmarks = document.getElementById('tabs').getElementsByTagName('a');
		for(var bookMarksIndex = 0; bookMarksIndex < bookmarks.length; bookMarksIndex++)
		{
			//alert(bookmarks[i].href.indexOf("#tab"));

			if (bookmarks[bookMarksIndex].href.lastIndexOf("#tab") > 0)
			{

				if ( isSamePage(bookmarks[bookMarksIndex].href))
				{
					//start set up bookmark click
					bookmarks[bookMarksIndex].onclick = function()
					{
						clearAllTabs(tabs);
					
						// set up bookmark click
						var tabIndex = parseInt(this.href.substring(this.href.lastIndexOf("#tab") + 4));
						
						tabs[tabIndex - 1].className = 'current';
						
						window.location.hash = this.href.substring(this.href.lastIndexOf('#'));
											
					// because content div id has been changed to tabs.length + contentIndex
					// setup the right hash value to control content display
					var newHash = "tab" + (parseInt(window.location.hash.substring(4)) + tabs.length);

						for(divIndex = 0; divIndex < divs.length; divIndex++)
						{
							if (divs[divIndex].id.indexOf('tab') == 0)
							{				
								if (divs[divIndex].id == newHash)
								{
									divs[divIndex].className = "current";
									
									//if the bookmark just link the different tab
									if (window.location.hash.length = 5)
									{
										window.scrollTo(0,0);
									}
									
									//if there's bookmark link to the different content position
									//then scroll to the right position
									//***** the rigth bookmark name should be start with "tab + tab index", e.g. "tab2content3"
									if(window.location.hash.length > 5)
									{
										//get the content bookmark
										var contentBookMark = window.location.hash.substring(1);

										var posX = findPosX(document.getElementById(contentBookMark));
										var posY = findPosY(document.getElementById(contentBookMark));

										window.scrollTo(posX,posY);
		
									}

								}
								else
								{
									divs[divIndex].className = 'hide';
								}	
							}
						}

						//use reload funcation will cause change on brower title
						//window.location.reload();
						return false;
					} //end set up bookmark click
				}
			}

		}//end set bookmark inside the content

		///set function to capture the click event in the feature box
		var content = document.getElementById('content');

		var divArray = getElementsByClassName('column3', 'div', content);
		for (var i = 0, j = divArray.length; i < j; i++) 
		{   
			var featurebookmarks = divArray[i].getElementsByTagName('a');
			
			for(var featureIndex = 0; featureIndex < featurebookmarks.length; featureIndex++)
			{
				//alert(featurebookmarks[i].href.indexOf("#tab"));

				if (featurebookmarks[featureIndex].href.lastIndexOf("#tab") > 0)
				{
				
					if ( isSamePage(featurebookmarks[featureIndex].href))
					{
						//start set up bookmark click
						featurebookmarks[featureIndex].onclick = function()
						{
							clearAllTabs(tabs);
						
							// set up bookmark click
							var tabIndex = parseInt(this.href.substring(this.href.lastIndexOf("#tab") + 4));
							
							tabs[tabIndex - 1].className = 'current';
							
							window.location.hash = this.href.substring(this.href.lastIndexOf('#'));		

							// because content div id has been changed to tabs.length + contentIndex
							// setup the right hash value to control content display
							var newHash = "tab" + (parseInt(window.location.hash.substring(4)) + tabs.length);
					
							for(divIndex = 0; divIndex < divs.length; divIndex++)
							{
								if (divs[divIndex].id.indexOf('tab') == 0)
								{				
									if (divs[divIndex].id == newHash)
									{
										divs[divIndex].className = "current";
										//if the bookmark just link the different tab
										if (window.location.hash.length = 5)
										{
											window.scrollTo(0,0);
										}
										
										//if there's bookmark link to the different content position
										//then scroll to the right position
										//***** the rigth bookmark name should be start with "tab + tab index", e.g. "tab2content3"
										if(window.location.hash.length > 5)
										{
											//get the content bookmark
											var contentBookMark = window.location.hash.substring(1);

											var posX = findPosX(document.getElementById(contentBookMark));
											var posY = findPosY(document.getElementById(contentBookMark));

											window.scrollTo(posX,posY);
			
										}

									}
									else
									{
										divs[divIndex].className = 'hide';
									}	
								}
							}
							//use reload funcation will cause change on brower title
							//window.location.reload();
							return false;
						} //end set up bookmark click
					}

				}

			}

		}//end set bookmark inside the feature box

	}
}

	function isSamePage(forwardUrl)
	{
		var pos = 0 ;
		var currentUrl = "";
		
		//get the current url
		currentUrl = window.location.href;
		pos = currentUrl.indexOf("#");
		if (pos > -1)
		{	
			currentUrl = currentUrl.substring(0,pos);
		}
		
		//get the link url
		pos = forwardUrl.indexOf("#");
		if (pos > -1 )
		{
			forwardUrl = forwardUrl.substring(0,pos);
		}

		if (forwardUrl == currentUrl)
		{
			return true;
		}
		else
		{
			return false;
		}
	}

  function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

  function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }

function getElementsByClassName(strClass, strTag, objContElm) {
  strTag = strTag || "*";
  objContElm = objContElm || document;
  var objColl = (strTag == '*' && document.all && !window.opera) ? document.all : objContElm.getElementsByTagName(strTag);
  var arr = new Array();
  var delim = strClass.indexOf('|') != -1  ? '|' : ' ';
  var arrClass = strClass.split(delim);
  for (var i = 0, j = objColl.length; i < j; i++) {
    var arrObjClass = objColl[i].className.split(' ');
    if (delim == ' ' && arrClass.length > arrObjClass.length) continue;
    var c = 0;
    comparisonLoop:
    for (var k = 0, l = arrObjClass.length; k < l; k++) {
      for (var m = 0, n = arrClass.length; m < n; m++) {
        if (arrClass[m] == arrObjClass[k]) c++;
        if (( delim == '|' && c == 1) || (delim == ' ' && c == arrClass.length)) {
          arr.push(objColl[i]);
          break comparisonLoop;
        }
      }
    }
  }
  return arr;
}

// To cover IE 5.0's lack of the push method
Array.prototype.push = function(value) {
  this[this.length] = value;
}

// 'clears' all tabs
function clearAllTabs(tbs)
{
	for(var i = 0; i < tbs.length; i++) 
	{
		tbs[i].className = '';
	}
}

function regionInit(){
// read existing cookie
var ck = GetCookie('telusPortalRegion') + '';
ck = ck.toUpperCase();
if(ck=='NULL'){ck='';}
var pg = bpDoc.region.toUpperCase();
// do values for page and cookie match?

if(ck == pg && !(ck=='' && pg=='')){
// ...match...
// do nothing
// ...no match....
} else {
    // is the page a 'national' page?
    if(pg == 'NATIONAL'){
        // is the cookie value blank? If yes, set default value
        if(ck==''){
            SetCookie('telusPortalRegion', 'NS');
            ck = 'NS';
        }
    } else {
        if(ck=='' && pg==''){
            SetCookie('telusPortalRegion', 'NS');
            ck = 'NS';
        } else if (ck=='AB' && pg=='BC'){
            // leave the AB cookie if this is a BC page
            ck = 'AB';
        } else {
        // otherwise make the cookie equal to whatever the page is
        ck = pg;
        SetCookie('telusPortalRegion', ck);
        }
    }    
}
//set hidden vars
if(document.getElementById('telusPortalRegion')){
    document.getElementById('telusPortalRegion').value = ck.toUpperCase();
}
// This should already be set
/*if(document.getElementById('telusPortalSegment')){
    document.getElementById('telusPortalSegment').value = bpDoc.segment;
}*/
// set the drop down nav to the value of 'ck'
if(document.getElementById('dropRegion')){
    var rd = document.getElementById('dropRegion');
    for (var i = 0; i < rd.options.length; i++){
        if(rd.options[i].innerHTML.toUpperCase() == ck.toUpperCase()){
            rd.options[i].selected = "selected";
        }
    }
}

SetCookie('CustomerType','business');

if (document.location.href.indexOf('fr_CA') > -1)
    SetCookie('lang','fr');
else
    SetCookie('lang','en');
    
}

addEvent(window,'load',regionInit,false);


// Function to allow one JavaScript file to be included by another.
function includeJavaScript(jsFile)
{
   var languageCode = "en_CA";
   var pageUrl = unescape(document.location.href);
   if (pageUrl.indexOf('fr_CA') > -1)
   	languageCode = "fr_CA";
   
   document.write('<script type="text/javascript" src="/'+ languageCode + '/common/javascript/' + jsFile + '"></script>');
}

includeJavaScript('commonJs.js');