
function showCafeMap() {
     var url = "/locations/cafes3/remote.html?src=homepage_mapbutton";
     var windWidth;
     var windHeight;
     windWidth = (window.screen.width/2) - (320 + 5);
     windHeight = (window.screen.height/2) - (200 + 25);
     poster=window.open(url,"map","scrollbars=no,resizable=no,menubar=no,status=no,toolbar=no,location=no,directories=no,width=640,height=429, left="+ windWidth + ",top=" + windHeight + ",screenX=" + windWidth + ",screenY=" + windHeight +" ");
}

function showNewsPopup(id){
    //window.open('/hrcnewspop.aspx?id=' + id + "&src=homepage_newsstory",'ViewNews','scrollbars=no,menubar=yes,status=no,width=495,height=500');
    window.open('http://blog.hardrock.com/hrcnewspop.aspx?id=' + id + "&src=homepage_newsstory",'ViewNews','scrollbars=no,menubar=yes,status=no,width=495,height=500');
    return false;
}


var xmlDataSet;
var objCarousel;
var curPos;
var rndNum = 0;
var TrackingSrc = "homepage";

//dom ready functions
$(function(){
    
    //reset feature slider on window resize
    $(window).resize(function(){       
        if(typeof(objCarousel) != 'undefined'){
            objCarousel.reset();       
        }     
    });

    //load feature slider
	$.ajax({
		type: "GET",
		url: "/featureslider/merch.aspx",
		dataType: "xml",
		success: function(xmlData)
		{
			xmlDataSet = xmlData;
		    carousel = jQuery('#FeatureSlider').jcarousel({
            itemLoadCallback: itemLoadCallbackFunction,
            visible: 1,
            scroll: 1,
            auto: 6,           
            animation: 800,
            wrap: "circular",
            initCallback: onInitCarousel, 
            itemVisibleInCallback: {onBeforeAnimation: mycarousel_itemVisibleInCallback},
            itemVisibleOutCallback: {onAfterAnimation: mycarousel_itemVisibleOutCallback}
            });    
		}
	});
    
    $("#newsContainer .RSSItemLink a").each(function(){
        $(this).click(function(){
            //var strTitle = $(this).find(".RSSItemTitle").html();
            var guid = $(this).parents(".RSSItem").attr("id");
                       
           
            //strTitle = escape(strTitle);
            //showNewsPopup(strTitle);
            //showNewsPopup($(this).parent().parent().attr('id'));
            
            showNewsPopup(guid);
            return false;
        });
    });
    
    $("#eventsContainer .RSSItemLink a").each(function(){
        $(this).click(function(){            
            window.open($(this).attr("href").replace("/locations/cafes3/events.aspx","/live2/eventDetails.aspx") + "&src=homepage_events",'ViewEvent','menubar=yes,width=420,height=500,scrollbars=yes');
            return false;
        });
    });
    
    
    //ie 6 & 7 fix
     var featureOffsetBottom = 0;    
      if($.browser.msie && (jQuery.browser.version.substr(0,1) < 8) ){        
         featureOffsetBottom = 2;         
      }
      
    //add hovers to feature boxes
    $(".featureBox").each(function(){
        $(this).click(function(){
            window.location = $(this).find("a.featureLink").attr('href');
        });
                        
        
        //Set feature text positions
        $(this).find(".featureBoxText").each(function(){                        
            $(this).animate({marginLeft: "0px"}, 1000).animate({                             
                bottom: ($(this).parent().find(".featureTitle").height() + 6 + featureOffsetBottom) + "px",
                height: ($(this).parent().find(".featureTitle").height() -4) + "px"
            });
        });
        
        
        //Set feature box text hover animations
        $(this).hover(function(){
            //hover over
            $(this).find(".featureBoxText").each(function(){
                                
                $(this).stop().animate({ 
                    //bottom: "102px",
                    //height: "92px"
                    bottom: ($(this).parent().find(".featureDesc").height() + 50 + featureOffsetBottom) + "px",
                    height: ($(this).parent().find(".featureDesc").height() + 40) + "px"
                    
                },{ duration: "slow", queue:false, complete: function(){}});                        
            });
            
            $(this).find(".featureCorner").animate({"opacity": "hide"});
            
            },function(){
            //hover out                    
                $(this).find(".featureBoxText").each(function(){                        
                    $(this).animate({marginLeft: "0px"}, 1000).animate({ 
                        //bottom: "38px",
                        //height: "28px"
                        bottom: ($(this).parent().find(".featureTitle").height() + 6 + featureOffsetBottom) + "px",
                        height: ($(this).parent().find(".featureTitle").height() -4) + "px"
                    });
                });
                $(this).find(".featureCorner").animate({marginLeft: "0px"}, {duration: 1200, queue:false}).animate({"opacity": "show"});
            }
        );
    });
    
    //aligns all the nav dropdowns
    $("li.navItem ul:not(#lastSubMenu, #firstSubMenu)").each(function() {$(this).css("left",((($(this).width() - ($(this).parent().width() - 10) ) /2) * -1) + "px") });
    //$("li.navItem ul:last").css("left","inherit").css("right","-23px");
    
    //initialize scrollers
    $('.scrollpane').jScrollPane({scrollbarWidth: 11, showArrows:true, dragMinHeight: 39, dragMaxHeight:39});
    $('.scrollpane').css("visibility","visible");

    //hotel pic slideshow	
    var slideShowImages = new Array("Singapore.jpg","Bali.jpg","Biloxi.jpg","Chicago.jpg","HollywoodFL.jpg","LasVegas.jpg","Macau.jpg","Orlando.jpg","Pattaya.jpg","SanDiego.jpg","Tampa.jpg");    
    var markup = '<div id="slideshow">'
	    + '<a href="http://www.hardrockhotels.com?src=homepage_hotelbox_photos" ><img src="/images/home/hotels/' + slideShowImages[0] + '"  alt="' + slideShowImages[0].replace(".jpg","") + ' Hotel" width="212" height="221" /><div class="imgTitle ' + slideShowImages[0].replace(".jpg","") + '">' + slideShowImages[0].replace(".jpg","").replace("_"," ") + '</div></a>'
	    + '<a href="http://www.hardrockhotels.com?src=homepage_hotelbox_photos" ><img src="/images/home/hotels/' + slideShowImages[1] + '" alt="' + slideShowImages[1].replace(".jpg","") + ' Hotel" width="212" height="221"/><div class="imgTitle ' + slideShowImages[1].replace(".jpg","") + '">' + slideShowImages[1].replace(".jpg","").replace("_"," ") + '</div></a>'
	    + '</div>';
    
    var currImageNum = 2;
    
    $('#hotelSlideShow').html(markup);    
    $('#slideshow').cycle({	    
	    timeout: 7000,
	    delay:  3000,
	    speed: 3000,
	    before: onBefore,
	    after: onAfter 
	    
    });
	    	
     function onBefore(curr, next, opts) {
        //$(".imgTitle").fadeOut("fast");
        
        if (!opts.addSlide) 
            return; 
     
        if(currImageNum == slideShowImages.length){
            opts.addSlide = null; 
            return;
        }
        
        opts.addSlide('<a href="http://www.hardrockhotels.com?src=homepage_hotelbox_photos" ><img src="/images/home/hotels/' + slideShowImages[currImageNum] + '" alt="' + slideShowImages[currImageNum].replace(".jpg","") + ' Hotel"  width="212" height="221"/><span class="imgTitle ' + slideShowImages[currImageNum].replace(".jpg","") + '">' + slideShowImages[currImageNum].replace(".jpg","").replace("_"," ") + '</span></a>');
        currImageNum++;
        
     }
     
     function onAfter(){
         //$(".imgTitle").fadeIn("fast");
     }
});            






