
<!-- Hide this script from old browsers --
if (document.images) {


/*
		AHJM: 20070314 :  
		i have commented these images out as they are slowing down the homepage
		and are not needed with the current selectRegion page.

        img1_off = new Image;
        img1_off.src = "/images/region_bc.gif";
        img1_on = new Image;
        img1_on.src = "/images/region_bc_on.gif";

        img2_off = new Image;
        img2_off.src = "/images/region_alberta.gif";
        img2_on = new Image;
        img2_on.src = "/images/region_alberta_on.gif";

        img3_off = new Image;
        img3_off.src = "/images/region_manitoba3.gif";
        img3_on = new Image;
        img3_on.src = "/images/region_manitoba3_on.gif";

        img3lb_off = new Image;
        img3lb_off.src = "/images/region_manitoba3.gif";
        img3lb_on = new Image;
        img3lb_on.src = "/images/region_manitoba3_on.gif";
   
        img4_off = new Image;
        img4_off.src = "/images/region_ontario.gif";
        img4_on = new Image;
        img4_on.src = "/images/region_ontario_on.gif";

        img4smb_off = new Image;
        img4smb_off.src = "/images/region_ontario3.gif";
        img4smb_on = new Image;
        img4smb_on.src = "/images/region_ontario3_on.gif";   

        img4lb_off = new Image;
        img4lb_off.src = "/images/region_ontario3.gif";
        img4lb_on = new Image;
        img4lb_on.src = "/images/region_ontario3_on.gif";   

        img5_off = new Image;
        img5_off.src = "/images/region_quebec.gif";
        img5_on = new Image;
        img5_on.src = "/images/region_quebec_on.gif";

        target = new Image;
        target.src = "/images/map_canada.gif";
        target1 = new Image;
        target1.src = "/images/map_bc.gif";
        target2 = new Image;
        target2.src = "/images/map_alberta.gif";
        target3 = new Image;
        target3.src = "/images/map_manitoba.gif";
        target4 = new Image;
        target4.src = "/images/map_ontario.gif";        
        target5 = new Image;
        target5.src = "/images/map_quebec.gif";
*/
}

function hiLite(imgDocID,imgObjName,imgDocID2,imgObjName2) {

        if (document.images) {
           if (imgDocID != "" && imgObjName != "") {
                  document.images[imgDocID].src = eval(imgObjName + ".src");
           }
           if (imgDocID2 != "" && imgObjName2 != "") {
                hiLiteCommand = 'document.images["' + imgDocID2 + '"].src = ';
                hiLiteCommand += imgObjName2 + '.src;';
                setTimeout('eval(hiLiteCommand);',0);
           }
      }
}

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 useRegionLink(hrefA, hrefB, hrefSelect) {
	var region = GetCookie('TelusRegion');
	switch (region) {
		case "A":
			top.location.href = hrefA;
			return;
		case "B":
			top.location.href = hrefB;
			return;
		default:
			top.location.href = hrefSelect;
			return;
	}
}

function SetCookie (name, value) {  
	var argv = SetCookie.arguments;  
	var argc = SetCookie.arguments.length;  
	var expires = (argc > 2) ? argv[2] : null;  
	var path = (argc > 3) ? argv[3] : null;  
	var domain = (argc > 4) ? argv[4] : null;  
	var secure = (argc > 5) ? argv[5] : false;  
	
	document.cookie = name + "=" + escape (value) + 
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
	((path == null) ? "" : ("; path=" + path)) +  
	((domain == null) ? "" : ("; domain=" + domain)) +    
	((secure == true) ? "; secure" : "");
}

function setPersonalRegionCookie (region) {
	var expDays = 365*5;
	var exp = new Date(); 
	if (region == "A" || region == "B")	{
		exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
	}
	else {
		exp.setTime(exp.getTime() - 1);
	}
    var hostname = window.location.hostname;
    if (hostname.indexOf("telus.com") >= 0)
    {
        var domain = "";
        domain = ".telus.com";
        SetCookie('TelusRegion',region,exp,'/',domain);
    }
    else
        SetCookie('TelusRegion',region,exp,'/');	
}

function setBusinessRegionCookie (region) {
	var expDays = 365*5;
	var exp = new Date(); 
	exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
	
	if (region == "") {
	  exp.setTime(exp.getTime() - 1);
  }

  var hostname = window.location.hostname;
  if (hostname.indexOf("telus.com") >= 0)
  {
      var domain = "";
      domain = ".telus.com";
      SetCookie('telusPortalRegion',region,exp,'/',domain);
  }
  else
      SetCookie('telusPortalRegion',region,exp,'/');	
}

function setRegionCookie (region) {
	var expDays = 365;
	var exp = new Date(); 
	exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
    var hostname = window.location.hostname;
    if (hostname.indexOf("telus.com") >= 0)
    {
        var domain = "";
        domain = ".telus.com";
        SetCookie('TelusRegion',region,exp,'/',domain);
    }
    else
        SetCookie('TelusRegion',region,exp,'/');	
}

function setLanguageCookie (language) {
	var expDays = 365;
	var exp = new Date(); 
	exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
    var hostname = window.location.hostname;
    if (hostname.indexOf("telus.com") >= 0)
    {
        var domain = "";
        domain = ".telus.com";
        SetCookie('TelusLang',language,exp,'/',domain);
    }
    else
        SetCookie('TelusLang',language,exp,'/');	
}

function setCustomerTypeCookie (customer_type) {
	var expDays = 365*5;
	var exp = new Date(); 
	if (customer_type != "")	{
		exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
	}
	else {
		exp.setTime(exp.getTime() - 1);
	}
    //NB - This value must match the same value as the static value CUSTOMER_TYPE_COOKIE_NAME in Constants.java
    var CUSTOMER_TYPE_COOKIE_NAME = "CustomerType";

    var hostname = window.location.hostname;
    if (hostname.indexOf("telus.com") >= 0)
    {
        var domain = "";
        domain = ".telus.com";
        
        SetCookie(CUSTOMER_TYPE_COOKIE_NAME ,customer_type,exp,'/',domain);
    }
    else
		
        SetCookie(CUSTOMER_TYPE_COOKIE_NAME ,customer_type,exp,'/');	
}

function removeRegionCookie () { 
	var exp = new Date(); 
	exp.setTime(exp.getTime() - (24*60*60*1000));
	SetCookie('TelusRegion','',exp,'/');
}	


// -- End Hiding Here -->


