function FB_init(){FB_posts=$("#FB_posts");var FB_photos=$("#FB_photos");var FB_photos_link=$("#FB_photos_link");var FB_posts_link=$("#FB_posts_link");FB_posts[0].style.overflow="auto";FB_posts[0].style.overflowX="auto";FB_posts[0].style.overflowY="auto";FB_posts[0].style.width="300px";FB_posts[0].style.height="150px";FB_photos_link.click(function(){FB_photos_link.addClass("active");FB_posts_link.removeClass("active");FB_posts.hide();FB_photos.show();return false});FB_posts_link.click(function(){FB_posts_link.addClass("active");FB_photos_link.removeClass("active");FB_photos.hide();FB_posts.show();return false});$("#FB_header").mouseenter(function(){var inNode=$("#FB_header");var curNode=inNode[0];var pos={left:209,top:17};displayPopup(inNode,pos.left,pos.top,"Be the first to hear about the latest SPG updates, and chat with other SPG fans.")}).mouseleave(function(){hidePopup()});$("#FB_TripShare_header").mouseenter(function(){var inNode=$("#FB_TripShare_header");var curNode=inNode[0];var pos={left:208,top:17};displayPopup(inNode,pos.left,pos.top,"We all have something to share from our travels! Check out SPG TripShare to post photos and trade travel ideas with other fans.")}).mouseleave(function(){hidePopup()});FB_posts[0].style.cursor="pointer";FB_posts.click(function(){var url="http://www.facebook.com/pages/Starwood-Preferred-GuestR-SPG/8038492631";var name="Facebook_Posts";window.open(url);logClick(url,name)});FB_photos[0].style.cursor="pointer";FB_photos.click(function(){var url="http://www.facebook.com/SPG?v=photos&viewas=0";var name="Facebook_Photos";window.open(url);logClick(url,name)});setTimeout(FB_hidePost,2500)}function FB_Scroll(){if(FB_posts[0].scrollTop>0){FB_posts[0].scrollTop-=5;setTimeout(FB_Scroll,50)}}function FB_hidePost(){var last=FB_posts.find(".FB_post:last");last.hide();last.prependTo(FB_posts);FB_posts[0].scrollTop=last.outerHeight();last.show();setTimeout(FB_Scroll,75);setTimeout(FB_hidePost,5000)}function Twitter_init(){Twitter_posts=$("#Twitter_posts");var Twitter_header=$("#Twitter_header");Twitter_posts[0].style.overflow="auto";Twitter_posts[0].style.overflowX="auto";Twitter_posts[0].style.overflowY="auto";Twitter_posts[0].style.width="300px";Twitter_posts[0].style.height="150px";Twitter_header.mouseenter(function(){var inNode=Twitter_header;var curNode=inNode[0];var pos={left:209,top:17};displayPopup(inNode,pos.left,pos.top,"Receive quick tweets to snatch up concert tickets, Free Night Award opportunities and more.")}).mouseleave(function(){hidePopup()});Twitter_posts[0].style.cursor="pointer";Twitter_posts.click(function(){var url="http://www.twitter.com/SPGInsider";var name="Twitter_posts";window.open(url);logClick(url,name)});setTimeout(Twitter_hidePost,5000)}function Twitter_Scroll(){if(Twitter_posts[0].scrollTop>0){Twitter_posts[0].scrollTop-=7;setTimeout(Twitter_Scroll,70)}}function Twitter_hidePost(){var last=Twitter_posts.find("div.Twitter_post:last");last.hide();last.prependTo(Twitter_posts);last.show();Twitter_posts[0].scrollTop=last.outerHeight();setTimeout(Twitter_Scroll,55);setTimeout(Twitter_hidePost,5000)}function movePopupUp(){pagePopup.posY-=2;pagePopup[0].style.top=pagePopup.posY-pagePopup.height()+"px";if(pagePopup.isVisible&&Math.abs(pagePopup.startY-pagePopup.posY)<10){setTimeout(movePopupUp,30)}}function displayPopup(inNode,posX,posY,text,isRelative){if(arguments.length<5){isRelative=true}if(this.pagePopup==null){pagePopup=$("#popup")}var textElm=pagePopup.find("p");textElm[0].innerHTML=text;if(isRelative){pagePopup.appendTo(inNode)}else{pagePopup.appendTo($("body"))}if(!isRelative){posX+=inNode.offset().left;posY+=inNode.offset().top}pagePopup.posX=posX;pagePopup.posY=posY;pagePopup.startX=posX;pagePopup.startY=posY;posY-=pagePopup.height();pagePopup[0].style.left=posX+"px";pagePopup[0].style.top=posY+"px";pagePopup.isVisible=true;if(jQuery.browser.msie&&jQuery.browser.version=="6.0"){pagePopup.show()}else{if(jQuery.browser.msie){pagePopup.css({opacity:0});pagePopup.hide();pagePopup.animate({opacity:0.99,temp:"show"},400)}else{pagePopup.fadeIn(400)}}setTimeout(movePopupUp,100)}function hidePopup(){if(!this.pagePopup){pagePopup=$("#popup")}pagePopup.isVisible=false;pagePopup.stop(true,true);pagePopup.hide()};
