function formatText(index, panel) {
                    return index + "";
                }

                $(function () {

                    $('.anythingSlider').anythingSlider({
                        easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
                        autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
                        delay: 5000,                    // How long between slide transitions in AutoPlay mode
                        startStopped: false,            // If autoPlay is on, this can force it to start stopped
                        animationTime: 1000,             // How long the slide transition takes
                        hashTags: true,                 // Should links change the hashtag in the URL?
                        buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
                        pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
                        startText: "",             // Start text
                        stopText: "",               // Stop text
                        navigationFormatter: formatText       // Details at the top of the file on this use (advanced use)
                    });

                    $("#slide-jump").click(function(){
                        $('.anythingSlider').anythingSlider(6);
                    });

                });

                function lookup(inputString) {
                    if(inputString.length == 0) {
                        // Hide the suggestion box.
                        $('#suggestions').hide();
                    } else {
                        //                    alert('on');
                        $.post("rpc.php", {queryString: ""+inputString+""}, function(data){
                            if(data.length >0) {
                                $('#suggestions').show();
                                $('#autoSuggestionsList').html(data);
                            }
                        });
                    }
                } // lookup

                function fill(thisValue) {
                    //            alert('thisValue');
                    $('#inputString').val(thisValue);
                    $('#suggestions').hide();
                }

                function gotoproduct(thisValue) {
                    //            alert(thisValue);
                    document.location='product.php?id='+thisValue;
                }

                //        $(document).ready(function(){
                //		$('.navi li').hover(
                //			function() { $('ul', this).css('display', 'block'); },
                //			function() { $('ul', this).css('display', 'none'); });
                //	});

                $(document).ready(function () {

                    $(function(){

                        $("ul.dropdown li").hover(function(){

                            $(this).addClass("hover");
                            $('ul:first',this).css('visibility', 'visible');

                        }, function(){

                            $(this).removeClass("hover");
                            $('ul:first',this).css('visibility', 'hidden');

                        });

                        $("ul.dropdown li ul li:has(ul)").find("a:first").append(" &raquo; ");

                    });

                });
				
				 $(function(){

                    $('select#speedA').selectmenu({
                        width: 150,
                        format: addressFormatting
                    });

                    $('select#speedAa').selectmenu({maxHeight: 150});

                    $('select#speedB').selectmenu({
                        width: 150,
                        /*format: addressFormatting*/
                        style:'dropdown'
                    });

                    $('select#speedC').selectmenu({
                        width: 150,
                        style:'dropdown'
                    });

                    $('select#speedD').selectmenu({
                        style:'dropdown',
                        menuWidth: 400,
                        format: addressFormatting
                    });

                    $('select#files, select#filesC').selectmenu({
                        icons: [
                            {find: '.script', icon: 'ui-icon-script'},
                            {find: '.image', icon: 'ui-icon-image'}
                        ]
                    });

                    $('select#filesB').selectmenu({
                        icons: [
                            {find: '.video'},
                            {find: '.podcast'},
                            {find: '.rss'}
                        ]
                    });
                });


                //a custom format option callback
                var addressFormatting = function(text){
                    var newText = text;
                    //array of find replaces
                    var findreps = [
                        {find:/^([^\-]+) \- /g, rep: '<span class="ui-selectmenu-item-header">$1</span>'},
                        {find:/([^\|><]+) \| /g, rep: '<span class="ui-selectmenu-item-content">$1</span>'},
                        {find:/([^\|><\(\)]+) (\()/g, rep: '<span class="ui-selectmenu-item-content">$1</span>$2'},
                        {find:/([^\|><\(\)]+)$/g, rep: '<span class="ui-selectmenu-item-content">$1</span>'},
                        {find:/(\([^\|><]+\))$/g, rep: '<span class="ui-selectmenu-item-footer">$1</span>'}
                    ];

                    for(var i in findreps){
                        newText = newText.replace(findreps[i].find, findreps[i].rep);
                    }
                    return newText;
                }


                function addToNewsletter() {
                    // get the form values
                    $.ajax({
                        type: "POST",
                        url: "addToNewsletter.php",
                        data: "email="+$('#newsletter').val(),/*+$('.cant'+pid).val(),*/
                        success: function(resp){
                            $('#newsletterresponse').empty();
                            $('#newsletterresponse').append(resp);
                        },
                        error: function(e){
                            alert('Error: ' + e);
                        }
                    }
                );
                }

                function hidesuggestions(){
                    // $("#suggestions").hide(); 
                    $("#suggestions").hover(
                    function(){
                        //  $(this).show();
                    },
                    function(){
                        $(this).hide();
                    });
                }
