// JavaScript Document
        $(function(){	
            //Enter the slider
            $("#slidingImg").animate({ top: "0"}, { 
                duration: 600, 
                queue: false,
                complete: function() {
                    //Slide the slider
                    $(".tabs a").mouseover(function() {
                        x = this.offsetLeft + (this.offsetWidth / 2);
                        $("#slidingImg").stop();
                        $("#slidingImg").animate({
                            left: (x - 22) + "px"
                        }, { 
                            duration: 1200, 
                            queue: false 
                        });
                    });
                }
            });
            //Alt tags
            $("img[alt='']").each(function() {$(this).attr("alt", ( ( $(this).attr("name")== null ) ? $(this).attr("src") : $(this).attr("name")))});
            //Rollovers
            $("img").each(function() {
                if($(this).attr("over") != null) {
                    var overImg = $(this).attr("over");
                    var srcImg = $(this).attr("src");
                    $(this).hover(
                        function() {
                            $(this).attr("src", $(this).attr("over"));
                        },
                        function() {
                            $(this).attr("src", srcImg );
                        }		
                    )
                }
            });
            /* setup tooltips */
            var as = [];
            var popupTimer;
            $('img, a').each(function(a){
                if($(this).attr("popup") != undefined) {
                    $(this).hover(function(e) {
                        clearInterval(popupTimer);
                        var popupExists = false;
                        $(".popup").each(function() { popupExists = true; });
                        if(!popupExists) {
                            var popup = $(document.createElement("div"));
                            popup.addClass("popup");
                            popup.append($(this).attr("popup"));
                            var oLeft = e.pageX + 10;
                            var oTop = e.pageY + 3;				
                            popup.css({ position: "absolute", left:oLeft, top:oTop, opacity:1.0});
                            popup.css("z-index", 5000);
                            $("body").append(popup);
                            var windowHeight = getVPheight();
                            var windowScroll = $('html').scrollTop();
                            var popupHeight = $(".popup").height();
                            
                            while((oTop + popupHeight) > (windowHeight + windowScroll)) {
                                oTop--;
                            }				
                            $(".popup").css("left", oLeft);
                            $(".popup").css("top", oTop);	
                        }			
                    }, function() {
                        popupTimer = setInterval(function() {
                            $(".popup").each(function() {
                                $(this).removeClass("popup");
                                $(this).fadeOut("normal", function(){$(this).remove();});
                            });
                        }, 333);
                    });
                        
                    $(this).mousemove(function(e) {
                        var oLeft = e.pageX + 10;
                        var oTop = e.pageY + 3;
                        var windowHeight = getVPheight();
                        var windowScroll = $('html').scrollTop();
                        var popupHeight = $(".popup").height();
                        
                        var test = oTop + "|" + popupHeight + ">" + windowHeight + "-" +  windowScroll;
                        while((oTop + popupHeight) > (windowHeight + windowScroll)) {
                            oTop--;
                        }
                        
                        $(".popup").css("left", oLeft);
                        $(".popup").css("top", oTop);
                    });
        
                }
            });
        
            $(".tabs a").each(function(){
                if($(this).attr( "href" ) == window.location.pathname) {
                    $(this).addClass("current");
                }		
            });
        
            $("input[type='text']").focus(function() {
                $(this).select();
            });
        })
        
        function getVPwidth() {
            if (typeof window.innerWidth != 'undefined') {
                return window.innerWidth;
            }
            else {
                if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) {
                    returndocument.documentElement.clientWidth;
                }
                else {
                    returndocument.getElementsByTagName('body')[0].clientWidth;
                }
            }
        }
        function getVPheight() {
            if (typeof window.innerWidth != 'undefined') {
                return window.innerHeight;
            }
            else {
                if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) {
                    return document.documentElement.clientHeight;
                }
                else {
                    return document.getElementsByTagName('body')[0].clientHeight;
                }
            }
        }
