var firefox = navigator.userAgent.indexOf('Firefox') != -1
var explorer = navigator.userAgent.indexOf('MSIE') != -1
var explorer7 = navigator.userAgent.indexOf('MSIE 7.0') != -1
var netscape = navigator.userAgent.indexOf('Netscape') != -1
var safari = navigator.userAgent.indexOf('Safari') != -1
var opera = navigator.userAgent.indexOf('Opera') != -1
var camino = navigator.userAgent.indexOf('Camino') != -1
var macintosh = navigator.platform.indexOf('Mac') != -1

/* Add a class to the last li of a all lists. */
jQuery(document).ready(function() {
	if(jQuery('.bb_content ul li:last-child') || jQuery('.bb_content ol li:last-child')){
		jQuery('.bb_content ul li:last-child').addClass('lastOfList');
		jQuery('.bb_content ol li:last-child').addClass('lastOfList');
	}
});


function truncateUsername(e) {
  var w = 86;
  var t = e.html();
  while (t.length > 0 && e.width() >= w) {
    t = t.substr(0, t.length - 1);
    e.html(t + "...");
  }
}

/**
 * Change the URL for the current window.
 * It can be used as:
 *
 * Example:
 *   previousUrl = http://www.bell.ca/home/Home_L_login.page?ADV=login&refreshLink=
 *   redirectUrl = https://www.ecare.bell.ca/ecare/oneBill.dl?target=/LoadOneBillSummaryAction.do
 * Part of the HTML code to use: href="javascript:goToDirectAccessLink(previousUrl, redirectUrl);"
 *
 * @param previousUrl Variable of type String. Indicate the first page to reach.
 *                                          Should include the 'refreshLink='.  If it is null then return '#'.
 * @param redirectUrl Variable of type String. Indicates the destination URL.
 *                                         If this is null then return the value for the 'previousUrl' parameter.
 */
function goToDirectAccessLink(previousUrl, redirectUrl) {
         /* Change the URL of the page */
         window.location.href = getComposedDirectAccessLink(previousUrl, redirectUrl);
}


/**
 * Gets the composed Direct Access Link resulting
 * by joining the first parameter (previousUrl)
 * with the encoding value of the second parameter (redirectUrl).
 *
 * Example:
 *   previousUrl = http://www.bell.ca/home/Home_L_login.page?ADV=login&refreshLink=
 *   redirectUrl = https://www.ecare.bell.ca/ecare/oneBill.dl?target=/LoadOneBillSummaryAction.do
 *   return value = http://www.bell.ca/home/Home_L_login.page?ADV=login&refreshLink=https%3A//www.ecare.bell.ca/ecare/oneBill.dl%3Ftarget%3D/LoadOneBillSummaryAction.do
 * Part of the javascript code to use: window.location.href = getComposedDirectAccessLink(previousUrl, redirectUrl);
 *
 * @param previousUrl Variable of type String. Indicate the first page to reach.
 *                                          Should include the 'refreshLink='.  If it is null then return '#'.
 * @param redirectUrl Variable of type String. Indicates the destination URL.
 *                                         If this is null then return the value for the 'previousUrl' parameter.
 * @return String the composed value
 */
function getComposedDirectAccessLink(previousUrl, redirectUrl) {
         /* Return '#' if the first parameter is null
           of doesn't contain the 'refreshLink=' text */
         if (previousUrl == null
                 || previousUrl.indexOf("refreshLink=") < 0) {
                 alert("The 'previousUrl' (" + previousUrl + ") is null or does not contain the 'refreshLink=' string on it.");
                 return "#";
         }

         /* Return the first parameter if the second is null */
         if (redirectUrl == null) {
                 return previousUrl;
         }

         /* Encode the second parameter */
         var redirectUrlEncoded = escape(redirectUrl);

         /* Compose the DLA URL */
         var composedUrl = previousUrl + redirectUrlEncoded;
         
         /* Return the composed value */
         return composedUrl;
}


function correctPNG() {
	for(var i=0; i<document.images.length; i++) {
		var img = document.images[i]
		var imgName = img.src.toUpperCase()
		if (imgName.substring(imgName.length-3, imgName.length) == "PNG") {
			var imgID = (img.id) ? "id='" + img.id + "' " : ""
			var imgClass = (img.className) ? "class='" + img.className + "' " : ""
			var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
			var imgStyle = "display:block;" + img.style.cssText 
			if (img.align == "left") imgStyle = "float:left;" + imgStyle
			if (img.align == "right") imgStyle = "float:right;" + imgStyle
			if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
			var strNewHTML = "<span class=\"pngFix\" " + imgID + imgClass + imgTitle
			+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
			+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
			+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
			img.outerHTML = strNewHTML
			i = i-1
		}
	}
}

if (explorer && !explorer7) {
	window.attachEvent('onload', correctPNG);
}




function clearOnFocus(oTxt) { 
	if (oTxt.defaultValue == oTxt.value) { 
		oTxt.value = ''; 
	} 
}

/* On load, open main menu */
function openMenu(whichMenu){
	jQuery(document).ready(function() {
		if(whichMenu == "shop") {
			if((jQuery('#Home').length > 0 || jQuery('#PrsShp_Landing').length > 0)) {			
				jQuery("#tnShop").animate({left:'0px'},{easing:"easeOutExpo"});
				jQuery("#tnSupport").addClass('shaded').animate({left:'673px', width:'112px'},{easing:"easeOutExpo", duration:2000});
				jQuery("#tnLogin").animate({left:'863px'},{easing:"easeOutExpo"});
				jQuery("#bt_tnSupport").attr({src:"web/images/en/bt_topNavSupport_in.gif"});
			} else {
				jQuery("#tnShop").css('left', '0px');
				jQuery("#tnSupport").css('left', '673px');
			}
		} else if(whichMenu == "support") {
			if(jQuery('#PrsCSrv_Landing').length > 0) {
				jQuery("#tnShop").addClass('shaded').animate({width:'112px'},{easing:"easeOutExpo", duration:2000});
				jQuery("#tnSupport").animate({left:'110px'},{easing:"easeOutExpo", duration:2000});
				jQuery("#tnLogin").animate({left:'863px'},{easing:"easeOutExpo"});
				jQuery("#bt_tnSupport").attr({src:"web/images/en/bt_topNavSupport.gif"});
			} else {
				jQuery("#tnShop").css('width', '112px');
				jQuery("#tnSupport").css('left', '110px');
			}
		}
	}); 
}

function changeBottom(){
	jQuery('.bb_bottom').addClass('beige');
}


function changeSection(whichSection){
	if (whichSection) {
		jQuery(".bb_content").addClass(whichSection);
	}
	jQuery(".bb_setPadding").removeClass('bb_setPadding');
}


function showProductSelection(){
	jQuery("#bb_productSelectLightbox").show();
}


function hideProductSelection(){
	jQuery("#bb_productSelectLightbox").hide();
}


function changeProductImage(whichImage){
	jQuery("#bigImage").hide(); 
	jQuery("#bigImage").attr("src", whichImage); 
	jQuery("#bigImage").show();
}


/*
	Home page menu animation
*/
jQuery(document).ready(function() {
	jQuery.fn.customFadeIn = function(speed, callback) {
		jQuery(this).show(speed, function() {
			if(jQuery.browser.msie && jQuery.browser.version.substr(0,3)=="6.0")
				jQuery(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
	jQuery.fn.customFadeOut = function(speed, callback) {
		jQuery(this).hide(speed, function() {
			if(jQuery.browser.msie && jQuery.browser.version.substr(0,3)=="6.0")
				jQuery(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
	
	jQuery('.bb_indexMenu ul li a').mouseover(function() {
		try {
			/* Find the menu id by using the menu item's id */
			var id = jQuery(this).attr('id');
			
			/* Hide all menus */
			jQuery('.bb_indexLightbox').hide();
			jQuery('.bb_indexMenu ul li').removeClass('active');
			jQuery('#' + id).parent().addClass('active');
			
			id = id.replace('index', 'menu');
			jQuery('#' + id).show();
		} catch(ex) {
			/*alert(ex);*/
		}
	});
						   
						   
	/* declaration de la variable pour compter le nb de wiresless plans selectionnes */
	var nbPlans = 0;
	var nbPhones = 0;
	
	/* Comment to prevent animations on menu click */
	/*$('.bb_topNav #btShop').bind('click',function(){
		$("#tnShop").animate({left:'0px'},{easing:"easeOutExpo"});
		$("#tnSupport").animate({left:'680px'},{easing:"easeOutExpo"});
		$("#tnLogin").animate({left:'863px'},{easing:"easeOutExpo"});
		$("#bt_tnSupport").attr({src:"web/images/en/bt_topNavSupport_in.gif"});
	});
	$('.bb_topNav #btSupport').bind('click',function(){
		$("#tnShop").animate({left:'0px'},{easing:"easeOutExpo"});
		$("#tnShop ul").hide();
		$("#tnSupport").animate({left:'110px'},{easing:"easeOutExpo"});
		$("#tnLogin").animate({left:'863px'},{easing:"easeOutExpo"});
		$("#bt_tnSupport").attr({src:"web/images/en/bt_topNavSupport.gif"});
	});
	$(".bb_topNav #btLogin").bind("click",function(){
		$("#tnShop").animate({left:'0px'},{easing:"easeOutExpo"});
		$("#tnSupport").animate({left:'110px'},{easing:"easeOutExpo"});
		$("#tnLogin").animate({left:'229px'},{easing:"easeOutExpo"});
		$("#bt_tnLogin").attr({src:"web/images/en/bt_topNavLogin.gif"});
	});*/
	
	/*Billing Center Landing
      for the steps of the type of bill */

    /* Upon selecting a value from the select box
      shows different result boxes on the right */
    jQuery("#bb_understandLanding").click(function() {
        var val = selectValue("slt_bills");
        hideAll_BBinfoLanding();
        hideAll_BBtabsContentResult();
        hideAll_BBbreadCrumbs();
        if(val == "--") {
            jQuery('#bb_billingBlock').height(200);
            jQuery('#bb_infoLanding_generalInfo').show();
        } else {
            jQuery('#bb_billingBlock').height(300);
            jQuery('#bb_billingSelection').show();
            jQuery('#bb_billingSelection_undo').hide();
            if (val == "paperBill-oneBill") {
                jQuery('#bb_result_paper_onebill').show();
                jQuery('#bb_breadcrumb_paper').show();
                jQuery('#bb_breadcrumb_onebill').show();
            } else if (val == "paperBill-wireless") {
                jQuery('#bb_result_paper_wireless').show();
                jQuery('#bb_breadcrumb_paper').show();
                jQuery('#bb_breadcrumb_separate').show();
                jQuery('#bb_breadcrumb_wireless').show();
            } else if (val == "paperBill-homephone") {
                jQuery('#bb_result_paper_homephone').show();
                jQuery('#bb_breadcrumb_paper').show();
                jQuery('#bb_breadcrumb_separate').show();
                jQuery('#bb_breadcrumb_homephone').show();
            } else if (val == "paperBill-internet") {
                jQuery('#bb_result_paper_internet').show();
                jQuery('#bb_breadcrumb_paper').show();
                jQuery('#bb_breadcrumb_separate').show();
                jQuery('#bb_breadcrumb_internet').show();
            } else if (val == "paperBill-television") {
                jQuery('#bb_result_paper_television').show();
                jQuery('#bb_breadcrumb_paper').show();
                jQuery('#bb_breadcrumb_separate').show();
                jQuery('#bb_breadcrumb_television').show();
            } else if (val == "ebill-oneBill") {
                jQuery('#bb_result_ebill_onebill').show();
                jQuery('#bb_breadcrumb_ebill').show();
                jQuery('#bb_breadcrumb_onebill').show();
            } else if (val == "ebill-wireless") {
                jQuery('#bb_result_ebill_wireless').show();
                jQuery('#bb_breadcrumb_ebill').show();
                jQuery('#bb_breadcrumb_separate').show();
                jQuery('#bb_breadcrumb_wireless').show();
            } else if (val == "ebill-homephone") {
                jQuery('#bb_breadcrumb_ebill').show();
                jQuery('#bb_breadcrumb_separate').show();
                jQuery('#bb_breadcrumb_homephone').show();
                jQuery('#bb_result_ebill_homephone').show();
            } else if (val == "ebill-internet") {
                jQuery('#bb_result_ebill_internet').show();
                jQuery('#bb_breadcrumb_ebill').show();
                jQuery('#bb_breadcrumb_separate').show();
                jQuery('#bb_breadcrumb_internet').show();
            } else if (val == "ebill-television") {
                jQuery('#bb_result_ebill_television').show();
                jQuery('#bb_breadcrumb_ebill').show();
                jQuery('#bb_breadcrumb_separate').show();
                jQuery('#bb_breadcrumb_television').show();
            }
        }
    });

    /* returns the value of the select box */
    function selectValue(id) {
        var val = "";
        var selectObj = document.getElementById(id);
        return selectObj.options[selectObj.selectedIndex].value;
    }

    /* Function takes care of the event of
       selecting the wizard at the first place */
    jQuery('#bt_startSteps').click(function() {
        hideAll_BBinfoLanding();
        hideAll_BBtabsContentResult();
        jQuery('#bb_billingBlock').height(200);
        jQuery('#bb_understandLanding').hide();
        jQuery('#bb_understandingStep1').show();
        jQuery('#bb_understandingStep1').addClass('stepActive');
        jQuery('#bb_infoLanding_generalInfo').show();
        enableRadio("typeBill1");
    });

    /* Value of the first question */
    var typeBill1Value="";
    /* Value of the second question */
    var typeBill2Value="";
    /* Value of the third question */
    var typeBill3Value="";
    var typeBillState="0";

    /* Function takes care of the event of
       selecting radio of the first question */
    jQuery('.bb_radioBtn').click(function () {
        typeBillState = "1";
        hideAll_BBinfoLanding();
        hideAll_BBtabsContentResult();
        jQuery('#bb_billingBlock').height(200);
        jQuery('#bb_understandingStep1').removeClass('stepActive');
        jQuery('#bb_understandingStep2').show();
        jQuery('#bb_understandingStep2').addClass('stepActive');
        jQuery('#bb_infoLanding_generalInfo').hide();
        typeBill1Value = radioValue("typeBill1");
        if (typeBill1Value == "paper") {
            jQuery('#bb_infoLanding_promoEbill').show();
            jQuery('#bb_breadcrumb_ebill').hide();
            jQuery('#bb_breadcrumb_paper').show();
        } else if (typeBill1Value == "ebill"){
            jQuery('#bb_infoLanding_pushLogin').show();
            jQuery('#bb_breadcrumb_paper').hide();
            jQuery('#bb_breadcrumb_ebill').show();
        }
        enableRadio("typeBill2");
    });

    /* Function takes care of the event of
       selecting radio of the second question */
    jQuery('.bb_radioBtn2').click(function() {
        typeBillState = "2";
        disableRadio("typeBill1");
        hideAll_BBinfoLanding();
        hideAll_BBtabsContentResult();
        hide_BBbreadCrumbs();
        jQuery('#bb_understandingStep2').removeClass('stepActive');
        jQuery('#bb_billingBlock').height(300);
        typeBill2Value = radioValue("typeBill2");
        jQuery('#bb_billingSelection_undo').show();       
        if (typeBill2Value == "separate") {
            jQuery('#bb_understandingStep3').show();
            jQuery('#bb_understandingStep3').addClass('stepActive');
            if (typeBill1Value == "paper") {
                jQuery('#bb_infoLanding_promoOnebill_paper').show();
            } else if (typeBill1Value == "ebill") {
                jQuery('#bb_infoLanding_promoOnebill_ebill').show();
            }
            jQuery('#bb_breadcrumb_onebill').hide();
            jQuery('#bb_breadcrumb_separate').show();
        }
        else if (typeBill2Value == "one") {
            jQuery('#bb_billingSelection').show();
            jQuery('#bb_understandingStep3').hide();
            jQuery('#bb_understandingStep3').removeClass('stepActive');
            jQuery('#bb_breadcrumb_separate').hide();
            jQuery('#bb_breadcrumb_onebill').show();
            if (typeBill1Value == "paper") {
                jQuery('#bb_result_paper_onebill').show();
            }
            else if (typeBill1Value == "ebill") {
                jQuery('#bb_result_ebill_onebill').show();
            }
        }
        enableRadio("typeBill3");
    });
	
    /* Function takes care of the event of
       selecting radio of the third question */
    jQuery('.bb_radioBtn3').click(function() {
        typeBillState = "3";
        disableRadio("typeBill2");
        hideAll_BBinfoLanding();
        hideAll_BBtabsContentResult();
        hide_BBbreadCrumbs();
        typeBill3Value = radioValue("typeBill3");
        jQuery('#bb_billingSelection').show();
        if (typeBill1Value == "paper") {
            if (typeBill3Value == "wireless") {
                jQuery('#bb_result_paper_wireless').show();
                jQuery('#bb_breadcrumb_wireless').show();
            }
            else if (typeBill3Value == "internet") {
                jQuery('#bb_result_paper_internet').show();
                jQuery('#bb_breadcrumb_internet').show();
            }
            else if (typeBill3Value == "homephone") {
                jQuery('#bb_result_paper_homephone').show();
                jQuery('#bb_breadcrumb_homephone').show();
            }
            else if (typeBill3Value == "television") {
                jQuery('#bb_result_paper_television').show();
                jQuery('#bb_breadcrumb_television').show();
            }
        } else if (typeBill1Value == "ebill") {
            if (typeBill3Value == "wireless") {
                jQuery('#bb_result_ebill_wireless').show();
                jQuery('#bb_breadcrumb_wireless').show();
            }
            else if (typeBill3Value == "internet") {
                jQuery('#bb_result_ebill_internet').show();
                jQuery('#bb_breadcrumb_internet').show();
            }
            else if (typeBill3Value == "homephone") {
                jQuery('#bb_result_ebill_homephone').show();
                jQuery('#bb_breadcrumb_homephone').show();
            }
            else if (typeBill3Value == "television") {
                jQuery('#bb_result_ebill_television').show();
                jQuery('#bb_breadcrumb_television').show();
            }
        }
    });
    
    /* Function takes care of the event of
       undoing any selection of answers to questions */
    jQuery('.undo').click(function() {
        hideAll_BBinfoLanding();
        hideAll_BBtabsContentResult();
        hideAll_BBbreadCrumbs();
        jQuery('#bb_understandLanding').show();
        jQuery('#bb_billingBlock').height(200);
        jQuery('#bb_infoLanding_generalInfo').show();
        jQuery('#bb_understandingStep1').hide();
        jQuery('#bb_understandingStep2').hide();
        jQuery('#bb_understandingStep3').hide();
    });
    
    /* Disables radio button */
    function disableRadio(name) {
        var radioArray = document.getElementsByName(name);
        for(var i = 0; i < radioArray.length; i++)
            radioArray[i].disabled = "true";
    }

    /* Enables radio button */
    function enableRadio(name) {
        var radioArray = document.getElementsByName(name);
        for(var i = 0; i < radioArray.length; i++) {
            radioArray[i].disabled = null;
            radioArray[i].checked = null;
        }
    }

    /* Return value of a radio */
    function radioValue(name) {
        var val = "";
        var radioArray = document.getElementsByName(name);
        for(var i = 0; i < radioArray.length; i++) {
            if(radioArray[i].checked)
                val = radioArray[i].value;
        }
        return val;
    }

    /* Hides breadcrumbs of the result section */
    function hide_BBbreadCrumbs() {
        jQuery('#bb_breadcrumb_wireless').hide();
        jQuery('#bb_breadcrumb_internet').hide();
        jQuery('#bb_breadcrumb_homephone').hide();
        jQuery('#bb_breadcrumb_television').hide();
    }

    /* function hides all the Breadcrumbs */
    function hideAll_BBbreadCrumbs() {
        jQuery('#bb_breadcrumb_paper').hide();
        jQuery('#bb_breadcrumb_ebill').hide();
        jQuery('#bb_breadcrumb_separate').hide();
        jQuery('#bb_breadcrumb_onebill').hide();
        hide_BBbreadCrumbs();
    }

    /* Hides all the promotional sections */
    function hideAll_BBinfoLanding() {
        jQuery('#bb_infoLanding_generalInfo').hide();
        jQuery('#bb_infoLanding_promoEbill').hide();
        jQuery('#bb_infoLanding_pushLogin').hide();
        jQuery('#bb_infoLanding_promoOnebill_paper').hide();
        jQuery('#bb_infoLanding_promoOnebill_ebill').hide();
    }

    /* Hides all the result sections */
    function hideAll_BBtabsContentResult() {
        jQuery('#bb_billingSelection').hide();
        jQuery('#bb_result_paper_onebill').hide();
        jQuery('#bb_result_paper_wireless').hide();
        jQuery('#bb_result_paper_internet').hide();
        jQuery('#bb_result_paper_homephone').hide();
        jQuery('#bb_result_paper_television').hide();
        jQuery('#bb_result_ebill_onebill').hide();
        jQuery('#bb_result_ebill_wireless').hide();
        jQuery('#bb_result_ebill_internet').hide();
        jQuery('#bb_result_ebill_homephone').hide();
        jQuery('#bb_result_ebill_television').hide();
    }


    /* Changes made by Mohiul ends
	   for internet options : check the checkbox and the background appears */
	jQuery('.io_check').click(function(){
		if(jQuery(this).parents('li').hasClass('io_selected')){
			jQuery(this).parents('li').removeClass('io_selected');
		} else {
			jQuery(this).parents('li').addClass('io_selected');
		}
    });
	/* for wireless features : check the checkbox and the background appears */
	jQuery('.wf_check').click(function(){
		if(jQuery(this).parent().parent().hasClass('wf_selected')){
			jQuery(this).parent().parent().removeClass('wf_selected');
		} else {
			jQuery(this).parent().parent().addClass('wf_selected');
		}
    });
	/* for wireless rate plans : show how many plans are selected */
	jQuery('.check_wirelessPlans').click(function () {
		if(jQuery(this).hasClass('wp_selected')){
			jQuery(this).removeClass('wp_selected');
			nbPlans -= 1;
			jQuery('.viewSelectedPlans').show();
			jQuery('.nbSelectedPlans').text(' (' + nbPlans + ')');
			if(nbPlans == 0){
				jQuery('.viewSelectedPlans').hide();
				}
		} else {
			jQuery(this).addClass('wp_selected');
			nbPlans += 1;
			jQuery('.viewSelectedPlans').show();
			jQuery('.nbSelectedPlans').text(' (' + nbPlans + ')');
		}
    });
	/* for phones : show how many phones are selected */
	jQuery('.check_phones').click(function () {
		if(jQuery(this).hasClass('p_selected')){
			jQuery(this).removeClass('p_selected');
			nbPhones -= 1;
			jQuery('.viewSelectedPhones').show();
			jQuery('.nbSelectedPhones').text(' (' + nbPhones + ')');
			if(nbPhones == 0){
				jQuery('.viewSelectedPhones').hide();
				}
		} else {
			jQuery(this).addClass('p_selected');
			nbPhones += 1;
			jQuery('.viewSelectedPhones').show();
			jQuery('.nbSelectedPhones').text(' (' + nbPhones + ')');
		}
    });
	/* for Province Selector lighbox */
	jQuery('.bb_btnClose').click(function () {
		jQuery('#bb_provinceSelector').hide();
    });
	/* for errorlogin */
	jQuery('#bb_errorLogin .bb_btnClose').click(function () {
		jQuery('#bb_errorLogin').hide();
    });
	/* for product lightbox */
	jQuery('#bb_productLightbox .bb_btnClose').click(function () {
		jQuery('#bb_productLightbox').hide();
    });
	/* for product lightbox */
	jQuery('#bb_productSelectLightbox .bb_btnClose').click(function () {
		jQuery('#bb_productSelectLightbox').hide();
    });
	/* for login form display */
	jQuery('.bb_linkLoginHeader').click(function () {
		jQuery('#bb_loginForm').show();
    });
	/* for login form hide */
	jQuery('.bb_linkLoginHeaderHide').click(function () {
		jQuery('#bb_loginForm').hide();
    });
	/* for login On show */
	jQuery('.btn_loginSubmit').click(function () {
		/*$('#bb_loginForm').hide();
		$('.login').hide();
		$('.loginOn').show(); */
		
    });
	/* for login options show */
	jQuery('.bb_linkLoginOptionsHeaderShow').click(function () {
		jQuery('#bb_loginOptions').show();
		truncateUsername(jQuery('#usernameDB'));
    })
	/* for login options hide */
	jQuery('.bb_linkLoginOptionsHeaderHide').click(function () {
		jQuery('#bb_loginOptions').hide();
		truncateUsername(jQuery('#username'));
    });
	/* for login in existing customer */
	jQuery('.bt_alreadyLogin').click(function () {
		/*$('#loginAlreadyForm').hide();	  
		$('#loginAlreadyOn').show();*/
		
    });
	/* for login in customer support */
	jQuery('.bt_customerSupportLogin').click(function () {
		/*$('#loginDashboard').hide();	  
		$('#loginDashboardOn').show();*/
    });
	/*for login in customer support*/
	jQuery('.bt_customerLogin').click(function () {
		/*$('.bb_login2').hide();	  
		$('.bb_loginOn2').show();*/
    });
});

jQuery(document).ready(function() {
	jQuery.each(jQuery.browser, function(i, val) {
  		if(i=="msie" && jQuery.browser.version.substr(0,3)=="6.0") {
     		jQuery('.bb_lightbox .bb_btnClose').click(function() {
				jQuery('.bb_content select').show();
			});
			
			jQuery('.bb_topSearch ul li.last a').click(function() {
				jQuery('.bb_content select').hide();
			});
     	}
	});
});

jQuery(document).ready(function() {
	jQuery('#bb_selectYourProvince').keyup(function() {
		showSelected();
	}).keydown(function() {
		showSelected();
	}).change(function() {
		showSelected();
	});
});

jQuery(document).ready(function() {
	jQuery('#bb_selectYourProvince').click(function(){
		showSelected();
	});
	jQuery('#bb_btnClose').click(function(){
		hideDiv('bb_provinceSelector');
	});
});