			var panel1;
			
			YAHOO.util.Event.onContentReady("favorites_panel", function () {
				panel1 = new YAHOO.widget.Panel("favorites_panel", { width:"150px", visible:true, close:false} );
				panel1.render();
			});
			
            YAHOO.util.Event.onContentReady("links", function () {
                var oMenuBar = new YAHOO.widget.MenuBar("links", { 
                                                            autosubmenudisplay: true, 
                                                            hidedelay: 750, 
															showdelay: 50,
                                                            lazyload: true });
                var aSubmenuData = [
                
                    {
                        id: "Selling", 
                        itemdata: [ 
                            { text: "Preparing Your Home For Sale", url: "http://www.sellwithsusan.com/preparingyourhome.html" },
                            { text: "Free Market Analysis", url: "http://www.sellwithsusan.com/Needtosell.html" },
                            { text: "Listing Your Home", url: "http://www.sellwithsusan.com/listwithsusan.html" },
                            { text: "Finding Your Buyers", url: "http://www.sellwithsusan.com/findbuyers.html" },
                            { text: "Checklist for Home Sellers", url: "http://www.sellwithsusan.com/sellerschecklist.html" },
                            { text: "20 Steps to Selling Your Own Home", url: "http://www.sellwithsusan.com/20steps.html" }
                        ]
                    },

                    {
                        id: "Buying", 
                        itemdata: [
                            { text: "Search MLS Listings", url: "http://www.sellwithsusan.com/listings_residential.php" },
                            { text: "My Featured Listings", url: "http://www.sellwithsusan.com/featuredlistings_susan.php" },
                            { text: "Top 10 Mistakes Buyers Make", url: "http://www.sellwithsusan.com/buyermistakes.html" },
                            { text: "Why Buying a Home is a Good Idea", url: "http://www.sellwithsusan.com/buyinggoodidea.html" },
                            { text: "Things Buyers Should Not Do", url: "http://www.sellwithsusan.com/buyingnottodo.html" },
                            { text: "Buying a House vs. a Home", url: "http://www.sellwithsusan.com/buyinghouseorhome.html" },
                            { text: "Helpful Calculators", url: "http://www.sellwithsusan.com/calculators/index.html" }
						]    
                    },
                    {
                        id: "Listings",
                        itemdata: [
                            { text: "My Featured Listings", url: "http://www.sellwithsusan.com/featuredlistings_susan.php" },
                            { text: "Rapid City Listings", url: "http://www.sellwithsusan.com/listings_residential.php" },
                            { text: "Search Homes for Sale", url: "http://www.sellwithsusan.com/featuredlistings.php" },
                            { text: "Land For Sale", url: "http://www.sellwithsusan.com/listings_land.php" }
							//,
                            //{ text: "Townhomes/Condominiums", url: "http://www.sellwithsusan.com/listings_residential.php?twnh=1" },
                            //{ text: "Manufactured Homes", url: "http://www.sellwithsusan.com/listings_residential.php?mhwl=1" }
						]
                    }                    
                ];
                oMenuBar.subscribe("beforeRender", function () {

                    if (this.getRoot() == this) {

                        this.getItem(1).cfg.setProperty("submenu", aSubmenuData[0]);

                        this.getItem(2).cfg.setProperty("submenu", aSubmenuData[1]);
                        this.getItem(4).cfg.setProperty("submenu", aSubmenuData[2]);

                    }

                });
                oMenuBar.render();         
            });

		function win() {
			msg=window.open("http://www.sellwithsusan.com/disclaimer.html","","height=430,width=420,left=80,top=80");
		}
	
		function init() {
			getFavorites();
		}	

		function sendRequest(url, callbackFn, imageName) {
			var callback = {
				success : callbackFn,
				argument : imageName
			};
			var transaction = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
		}
	
		function getFavorites() {
			sendRequest("list_favorites2.php", showFavorites, null);
		}
		
		function updateFavorites(req, data) {
			getFavorites();
		}
		
		function disableAddToFavoriteButton(mls_number) {
			var div = document.getElementById("button"+mls_number);
			div.innerHTML = 'Added to <a href="myfavorites.php">Favorites</a>';
		}
		
		function addFavorite(mls_number, imageName) {
			sendRequest("addfavorite.php?add=" + mls_number, updateFavorites, imageName);
			disableAddToFavoriteButton(mls_number);
//			var url = "http://www.javalicense.com/com/idx/" + imageName;
//			GB_showCenter("Added to Favorites", url, 425, 425, null);		
/*			var imagePanel = new YAHOO.widget.Panel("newfavorite", 
								{
									width : "425px",
									height : "320px",
									fixedcenter : true,
									close : true,
									draggable : false,
									modal : true,
									visible : false
								});
			imagePanel.setHeader("Added to Favorites");
			imagePanel.setBody('<img src="' + url + '" width="400"/>');
			imagePanel.render(document.body);
			imagePanel.show();
*/
//			alert(mls_number + ' added to Favorites.\r\nClick on "Edit/Email Favorites" to view your Favorites.');
		}
	
		function deleteFavorite(index) {
			sendRequest("deletefavorite.php?remove" + index + "=yes", getFavorites, null);
		}
	
		
		function showFavorites(req, data) {
				panel1.setBody(req.responseText);
		}