﻿        function strLTrim(strInput) {
            var strWhiteSpace = new String(" \t\n\r");
            var strOut = new String(strInput);

            if (strWhiteSpace.indexOf(strOut.charAt(0)) != -1) {
                // We have a string with leading blank(s)...
                var j = 0, i = strOut.length;

                // Iterate from the far left of string until we
                // don't have any more whitespace...
                while (j < i && strWhiteSpace.indexOf(strOut.charAt(j)) != -1)
                    j++;

                // Get the substring from the first non-whitespace
                // character to the end of the string...
                strOut = strOut.substring(j, i);
            }
            return strOut;
        }

        function strRTrim(strInput) {
            var strWhiteSpace = new String(" \t\n\r");
            var strOut = new String(strInput);

            if (strWhiteSpace.indexOf(strOut.charAt(strOut.length - 1)) != -1) {
                // We have a string with treiling blank(s)...
                var i = strOut.length - 1;

                // Iterate from the far left of string until we
                // don't have any more whitespace...
                while (i >= 0 && strWhiteSpace.indexOf(strOut.charAt(i)) != -1)
                    i--;

                // Get the substring from the first non-whitespace
                // character to the end of the string...
                strOut = strOut.substring(0, i + 1);
            }
            return strOut;
        }

        function strTrim(strInput) {
            return strRTrim(strLTrim(strInput));
        }

        function changefield() {
            document.getElementById("passwordbox").innerHTML = '<input id="password" type="password" name="password" title="password" onblur="changefieldback(this.value);" />';
            //IE8 fix
            setTimeout("document.getElementById('password').focus();", 1);
        }

        function changefieldback(val) {
            if (strTrim(val) == '') {
                document.getElementById("passwordbox").innerHTML = '<input id="text" type="text" name="password" title="password" value="password" onfocus="changefield();" />';
            }
        }

        function showLoginPopup() {
            var loginPopup = document.getElementById("loginpopup");
            loginPopup.style.display = 'block';
            $("[id*='txtEmail']").focus();
            $("[id*='txtPsw']").focus();
            $("a[id*='btnSALogin2_btnSAButton']").focus();
        }

        function closeLoginPopup() {
            //document.form1.reset();
            $("[id*='txtEmail']").val('');
            $("[id*='txtPsw']").val('');   
            var loginPopup = document.getElementById("loginpopup");
            loginPopup.style.display = 'none';
        }

        $().ready(function() {
            $('#coda-slider-1').codaSlider(
		    {
		        slideEaseFunction: "easeInSine",
		        autoHeightEaseDuration: 1000,
		        dynamicTabsAlign: "right",
		        autoSlide: true,
		        autoSlideInterval: 7000,
		        autoSlideStopWhenClicked: true,
		        dynamicArrows: false,
		        dynamicTabs: false,
		        dynamicTabsPosition: "bottom",
		        slideEaseDuration: 1000,
		        navInPanel: true,
		        autoHeight: false,
		        navClass: "coda-nav",
		        carousel: true
		    }
		);

        });
     
     
        
        // join the conversation
        $().ready(function() {
            $('#coda-slider-2').codaSlider(
		    {
		        autoHeightEaseDuration: 1000,
		        slideEaseDuration: 0,
		        dynamicTabsAlign: "left",
		        autoSlide: true,
		        autoSlideInterval: 10000,
		        autoSlideStopWhenClicked: true,
		        crossLinking: false,
		        dynamicArrows: false,
		        dynamicTabs: false,
		        dynamicTabsPosition: "top",
		        navInPanel: false,
		        autoHeight: false,
		        navClass: "coda-nav1",
		        firstPanelToLoad: ActiveTabNumber
		    }
		);
        });

        // newest stuff

        $().ready(function() {
            $('#coda-slider-3').codaSlider(
		    {
		        autoHeightEaseDuration: 1000,
		        slideEaseDuration: 0,
		        dynamicTabsAlign: "left",
		        autoSlide: false,
		        autoSlideInterval: 5000,
		        autoSlideStopWhenClicked: true,
		        crossLinking: false,
		        dynamicArrows: false,
		        dynamicTabs: true,
		        dynamicTabsPosition: "top",
		        navInPanel: false,
		        autoHeight: false,
		        navClass: "coda-nav2",
		        panelContainer: 'neweststuff',
		        nestedParent: 'coda-slider-2',
		        firstPanelToLoad: ActivePanelTab1
		    }
		);
        });




        // hot picks
        $().ready(function() {
            $('#coda-slider-4').codaSlider(
		    {
		        autoHeightEaseDuration: 1000,
		        slideEaseDuration: 0,
		        dynamicTabsAlign: "left",
		        autoSlide: true,
		        autoSlideInterval: 5000,
		        autoSlideStopWhenClicked: true,
		        crossLinking: false,
		        dynamicArrows: false,
		        dynamicTabs: false,
		        dynamicTabsPosition: "top",
		        navInPanel: false,
		        autoHeight: false,
		        navClass: "coda-nav3"
		    }
		);
        });


        // What's hot
        $().ready(function() {
            $('#coda-slider-5').codaSlider(
		    {
		        autoHeightEaseDuration: 1000,
		        slideEaseDuration: 0,
		        dynamicTabsAlign: "left",
		        autoSlide: false,
		        autoSlideInterval: 5000,
		        autoSlideStopWhenClicked: true,
		        crossLinking: false,
		        dynamicArrows: false,
		        dynamicTabs: true,
		        dynamicTabsPosition: "top",
		        navInPanel: false,
		        autoHeight: false,
		        firstPanelToLoad: ActivePanelTab2,
		        navClass: "coda-nav4",
		        panelContainer: 'whatshot',
		        nestedParent: 'coda-slider-2'
		    }
		);
        });

        // Twitter/Facebook
        $().ready(function() {
            $('#coda-slider-6').codaSlider(
		    {
		        autoHeightEaseDuration: 1000,
		        slideEaseDuration: 0,
		        dynamicTabsAlign: "left",
		        autoSlide: false,
		        autoSlideInterval: 5000,
		        autoSlideStopWhenClicked: true,
		        crossLinking: false,
		        dynamicArrows: false,
		        dynamicTabs: true,
		        dynamicTabsPosition: "top",
		        navInPanel: false,
		        autoHeight: false,
		        firstPanelToLoad: ActivePanelTab3,
		        navClass: "coda-nav5",
		        panelContainer: 'twitter',
		        nestedParent: 'coda-slider-2'
		    }
		);
		});



		$(document).ready(function() {

		    jQuery("[id*='fakepassword']").focus(function(e) {
		        var pswID = "#" + $("[id*='txtPsw']").attr("id");
		        $(this).hide();
		        $(pswID).show();
		        $(pswID).focus();
		    });

		    jQuery("[id*='txtPsw']").blur(function(e) {
		        var pswID = "#" + $(this).attr("id");
		        var pswID = "#" + $(this).attr("id");
		        if ($(pswID).attr('value') == '') {
		            $(pswID).hide();
		            $("[id*='fakepassword']").show();
		        }

		    });
		});
