	function focusInLocatorSearch()
	{
		if(document.getElementById("searchVal"))
			$("#searchVal").focus();	
	}
	
		//SETTING UP OUR POPUP
        //0 means disabled; 1 means enabled;
        var popupStatus = 0;
        var highlightArea = '';
        var crntIllustration = '';
        var illustrationStatus = 0;
        var helpPageShown = '';


        //loading popup with jQuery magic!
        function loadPopup(helpPage,helpSection){
            if(helpPageShown!='')
            {
                disablePopup();
            }
            //loads popup only if it is disabled
            if(popupStatus==0){
                $("#backgroundPopup").css({
                "opacity": "0.7"
                });
                $("#backgroundPopup").fadeIn("slow");
                $(helpPage).fadeIn("slow");
                popupStatus = 1;
            }
            centerPopup(helpPage);
            helpPageShown = helpPage;
            
            if(helpSection != "")
            {
                highlightHelpText(helpSection);
            }
        }
        
        //disabling popup with jQuery magic!
        function disablePopup(){
            //disables popup only if it is enabled
            if(popupStatus==1){
                $("#backgroundPopup").fadeOut("slow");
                $(helpPageShown).fadeOut("slow");
                popupStatus = 0;
            }
        }
        
        //disabling popup with jQuery magic!
        function closeIllustration(){
            //disables popup only if it is enabled
            if(illustrationStatus==1){
                $("#illustrationPopup").fadeOut("fast");
                $(crntIllustration).fadeOut("fast");
                illustrationStatus = 0;
            }
        }

        //centering popup
        function centerPopup(popupName){
            //request data for centering
            var windowWidth = document.documentElement.clientWidth;
            var windowHeight = document.documentElement.clientHeight;
            var popupHeight = $(popupName).height();
            var popupWidth = $(popupName).width();
            //centering
            
			var newTop = windowHeight/2-popupHeight/2;
			if(newTop < 20)
				newTop = 20;
			
			var newLeft = windowWidth/2-popupWidth/2;
			if(newLeft < 20)
				newLeft = 20;
			
            $(popupName).css({
            "position": "absolute",
            "top": newTop,
            "left": newLeft
            });
            //only need force for IE6

            $("#backgroundPopup").css({"height": windowHeight});
            $("#illustrationPopup").css({"height": windowHeight});
        }
        
        function highlightHelpText(sectionName){
            if(highlightArea != '')
            {
                $(highlightArea).removeClass("pad-small border-black bg-white");
            }
            
            $(sectionName).addClass("pad-small border-black bg-white");
            highlightArea = sectionName;
        }
        
        
        function showIllustration(illustrationName){            
            if(crntIllustration != '')
            {
                $(crntIllustration).fadeOut("fast");
            }
            $("#illustrationPopup").css({"opacity": "0.2"});
            $("#illustrationPopup").fadeIn("fast");
            $(illustrationName).fadeIn("fast");
            crntIllustration = illustrationName;
            
            centerPopup(illustrationName);
            
            illustrationStatus = 1;
        }
		
		var showingApp = '';
        
        //loading popup with jQuery magic!
        function switchAppTabs(showThisTab){
			if(showingApp == '')
				showingApp = $("[id$=showingApp]").val();
				
            if(showingApp!='')
            {
                $("[id$=" + showingApp + "]").css({"display":"none"});
                $("[id$=" + showingApp + "Tab]").css({"display":""});
            }
            
            $("[id$=" + showThisTab + "]").css({"display":""});
            $("[id$=" + showThisTab + "Tab]").css({"display":"none"});
            showingApp = showThisTab;
        }
		
        function submitLogin(){
            var options = { path: '/', expires: 365 };
            $.cookie('fi_login','1',options);
            $('#topLoginForm').submit();
        }
        
        jQuery.cookie = function(name, value, options) {
        if (typeof value != 'undefined') { // name and value given, set cookie
            options = options || {};
            if (value === null) {
                value = '';
                options.expires = -1;
            }
            var expires = '';
            if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
                var date;
                if (typeof options.expires == 'number') {
                    date = new Date();
                    date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
                } else {
                    date = options.expires;
                }
                expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
            }
            // CAUTION: Needed to parenthesize options.path and options.domain
            // in the following expressions, otherwise they evaluate to undefined
            // in the packed version for some reason...
            var path = options.path ? '; path=' + (options.path) : '';
            var domain = options.domain ? '; domain=' + (options.domain) : '';
            var secure = options.secure ? '; secure' : '';
            document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
        } else { // only name given, get cookie
            var cookieValue = null;
            if (document.cookie && document.cookie != '') {
                var cookies = document.cookie.split(';');
                for (var i = 0; i < cookies.length; i++) {
                    var cookie = jQuery.trim(cookies[i]);
                    // Does this cookie string begin with the name we want?
                    if (cookie.substring(0, name.length + 1) == (name + '=')) {
                        cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                        break;
                    }
                }
            }
            return cookieValue;
        }
    };
	
	$(document).ready(function(){
            $("[id$=phoneNumber1]").bind('keyup', function(e) { 
                var code = (e.keyCode ? e.keyCode : e.which);
                if((code >= 96 && code <= 105) || (code >= 48 && code <= 57)) 
                {
                    if($("[id$=phoneNumber1]").val().length >= 3)
                    {
                        $("[id$=phoneNumber2]").focus();
                    }
                }
             } );
             
            $("[id$=phoneNumber2]").bind('keyup', function(e) { 
                var code = (e.keyCode ? e.keyCode : e.which);
                if((code >= 96 && code <= 105) || (code >= 48 && code <= 57)) 
                {
                    if($("[id$=phoneNumber2]").val().length >= 3)
                    {
                        $("[id$=phoneNumber3]").focus();
                    }
                }
             } );
             
            $("[id$=ccNumber1]").bind('keyup',function(e){
                var code = (e.keyCode ? e.keyCode : e.which);
                if((code >= 96 && code <= 105) || (code >= 48 && code <= 57)) 
                {
					if($("[id$=ccNumber1]").val().length >=4)
					{
						checkCustomField(document.getElementById($("[id$=ccNumber1]").attr("ID")),"true|numbers|length|4")
						if(validateCustomField($("[id$=ccNumber1]").val(),$("[id$=ccNumber1]").attr("title"),"true|numbers|length|4") == "")
						{
							$("[id$=ccNumber2]").focus();
						}
					}
				}
                });
            $("[id$=ccNumber2]").bind('keyup',function(e){
				var code = (e.keyCode ? e.keyCode : e.which);
                if((code >= 96 && code <= 105) || (code >= 48 && code <= 57)) 
                {
					if($("[id$=ccNumber2]").val().length >=4)
					{
						checkCustomField(document.getElementById($("[id$=ccNumber2]").attr("ID")),"true|numbers|length|4")
						if(validateCustomField($("[id$=ccNumber2]").val(),$("[id$=ccNumber2]").attr("title"),"true|numbers|length|4") == "")
						{
							$("[id$=ccNumber3]").focus();
						}
					}
				}
                });
            $("[id$=ccNumber3]").bind('keyup',function(e){
			    var code = (e.keyCode ? e.keyCode : e.which);
                if((code >= 96 && code <= 105) || (code >= 48 && code <= 57)) 
                {
					if($("[id$=ccNumber3]").val().length >=4)
					{
						checkCustomField(document.getElementById($("[id$=ccNumber3]").attr("ID")),"true|numbers|length|4")
						if(validateCustomField($("[id$=ccNumber3]").val(),$("[id$=ccNumber3]").attr("title"),"true|numbers|length|4") == "")
						{
							$("[id$=ccNumber4]").focus();
						}
					}
				}
                }); 
			$("[id$=ccNumber4]").bind('keyup',function(e){
				if($("[id$=ccNumber4]").val().length >=4)
				{
					checkCustomField(document.getElementById($("[id$=ccNumber4]").attr("ID")),"true|numbers|length|4")
					if(validateCustomField($("[id$=ccNumber4]").val(),$("[id$=ccNumber4]").attr("title"),"true|numbers|length|4") == "")
					{
						var strResult = validateCreditCardNumber($("[id$=ccType]").val(),$("[id$=ccNumber1]").val(),$("[id$=ccNumber2]").val(),$("[id$=ccNumber3]").val(),$("[id$=ccNumber4]").val());
						if(strResult != '')
						{
							alert(strResult);	
						}
					}
				}
                }); 
            $("#password").bind('keypress', function(e) { 
                var code = (e.keyCode ? e.keyCode : e.which);
                if(code == 13) 
                {
                    submitLogin();
                }
             } );
            
            //Click out event!
            $("#backgroundPopup").click(function(){
                disablePopup();
            });
            
            //Press Escape event!
            $(document).keypress(function(e){
                if(e.keyCode==27 && popupStatus==1){
                disablePopup();
            }
            });
            
             
            
            //Click out event!
            $("#illustrationPopup").click(function(){
                closeIllustration();
            });
            
            //Press Escape event!
            $(document).keypress(function(e){
                if(e.keyCode==27 && illustrationStatus==1){
                closeIllustration();
            }
            });

        });

