var rsOpenTab;
var rsOpenItem;
var totNumOffers;
var numCont1Offers;
var numCont2Offers;
var rscOffersHtml;
var interval;
var mallId = 'null';
var urlParamID;
var archivedEventID = 'null';
var isEditWindowOpen = false;

var sPath = window.location.pathname;
var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);

if(gup('id') === ""){
    urlParamID = gup('ID');
}else{
    urlParamID = gup('id');
}

if(gup('eid') !== ""){
    archivedEventID = gup('eid');
}

/* Error/Message Overlay
---------------------------------------------------	*/
function showMessage(messageTitle, messageBody) {
	$("#overlaySmall p, #overlaySmall h4").remove();
	$("#overlaySmall").append('<h4>' + messageTitle + '</h4><p>' + messageBody + '</p>');
	$("#overlaySmall").jqmShow();
}

/* Sliders Height Function
---------------------------------------------------	*/

function sliderResize(){
    $('.simonSlideContent.resizable').each(function(){
    	var podTallest = 0;
    	$(this).children().css('height','auto');
    	$(this).children().each(function(){
    	    if($(this).height() > podTallest){
    	    	podTallest = $(this).height();
    	    }
    	});
    	$(this).css('height',podTallest + 'px');
    	$(this).children().css('height',podTallest + 'px');
    	$(this).parent().siblings('.simonSlideLeft').css('height',podTallest + 'px');
    	$(this).parent().siblings('.simonSlideLeft').children('a').css('margin-top',((podTallest - 37)/2) + 'px');
    	$(this).parent().siblings('.simonSlideRight').css('height',podTallest + 'px');
    	$(this).parent().siblings('.simonSlideRight').children('a').css('margin-top',((podTallest - 37)/2) + 'px');
    	$(this).parent().css('height',podTallest + 'px');
    	$(this).parent().parent('.simonSlideContainer').css('height',podTallest + 'px');
    });
}


/* Retailer Showcase Interaction
---------------------------------------------------	*/

/* Retailer Showcase More Tiles
---------------------------------------------------	*/
function rscMoreTiles(){
	var offersContainerHeight = Math.ceil(totNumOffers/3)*165;
	
	if(mallId !== 'null'){
		urlParamOffer = 'id=' + mallId;
	}else{
		urlParamOffer = 'id=' + urlParamID;
	}
	
	$('#rsTilesContainer').parent('div').bind('scroll',function(){
	    if(-$('#rsTilesContainer').position().top < offersContainerHeight - 404){
	    	if($('#rsTilesContainer').children('a:last').position().top <= 404 && $('#rsTilesContainer').hasClass('enabled') && $('#rsTilesContainer').children('a').length < totNumOffers){
	    		$('#rsTilesContainer').removeClass('enabled');
	    		$('.rscLoading').fadeIn('slow');
	    		var currNumTiles = $('#rsTilesContainer').children('a').length;
	    		$.ajax({
	    			url: '/ajax/overlay/getoverlayitems.ashx?type=1&output=2&' + urlParamOffer + '&count=30&index=' + currNumTiles,
	    			cache: true,
	    			success: function(html){
	    				$('#rsTilesContainer').append(html);
	    				$('#rsTilesContainer').addClass('enabled');
	    				$('.rscLoading').fadeOut('slow');
	    			}
	    		});
	    	}
	    }
	});
}
	
function startRscPopulate(overlayMode,overlayModeId){
	var urlParamOffer;
	
	if(overlayMode === 'OfferPreview'){
		urlParamOffer = 'oid=' + overlayModeId;
	}else if(overlayMode === 'ShowcasePreview'){
		urlParamOffer = 'sid=' + overlayModeId;
	}else if(mallId !== 'null'){
		urlParamOffer = 'id=' + mallId;
	}else{
		urlParamOffer = 'id=' + urlParamID;
	}
	
	/* Pupulate Sales & Offers Tiles */
	$('#rsTilesContainer').load('/ajax/overlay/getoverlayitems.ashx?type=1&output=2&' + urlParamOffer + '&count=30',function(){
		$('.rscLoading').fadeOut('slow');
		rscMoreTiles();
	});
	
	/* Pupulate Sales & Offers Templates */
	$.ajax({
	    url: '/ajax/overlay/getoverlayitems.ashx?type=1&output=3&' + urlParamOffer + '&count=9',
	    cache: true,
	    success: function(html){
	    	$("#rsContent1 .rsSect2Content").append(html);
	    	$('.rscLoading').fadeOut('slow',function(){
	    		numCont1Offers = $("#rsContent1 .rsSect2Offer").length;
	    		$("#rsContent1 .rsSect2Content").width(numCont1Offers * 630 + "px");
	    		$('#rsContent1 .rsSect2Content').addClass('contentLoaded');
	    		doTrackingCont1();
	    	});
			
	    }
	});
	
	/* Pupulate News & Events Tiles */
	function getMallNews(numMallNews){
		$.ajax({
			url: '/ajax/overlay/getoverlayitems.ashx?type=3&output=2&' + urlParamOffer + '&count=' + numMallNews,
		    cache: true,
		    success: function(html){
				$('#rsContent2 .rsSect1MiddleLeft').append(html);
		    }
		});
	}
	
	function getUpcomingEvents(numUpcomingEvents){
		$.ajax({
			url: '/ajax/overlay/getoverlayitems.ashx?type=4&output=2&' + urlParamOffer + '&count=' + numUpcomingEvents,
		    cache: true,
		    success: function(html){
				$('.rscLoading').fadeOut('slow');
				$('#rsContent2 .rsSect1MiddleRight').append(html);
		    }
		});
	}
	
	$.ajax({
		url: '/ajax/overlay/getoverlayitems.ashx?type=3&output=5&' + urlParamOffer,
	    cache: true,
	    success: function(html){
			getMallNews(html);
	    }
	});
	$.ajax({
		url: '/ajax/overlay/getoverlayitems.ashx?type=4&output=5&' + urlParamOffer,
	    cache: true,
	    success: function(html){
			getUpcomingEvents(html);
	    }
	});
	
	/* Pupulate News & Events Templates */
	function getAllNewsEventsTemplates(numAllNewsEventsTemplates){
		$.ajax({
			url: '/ajax/overlay/getoverlayitems.ashx?type=2&output=3&' + urlParamOffer + '&count=' + numAllNewsEventsTemplates,
		    cache: true,
		    success: function(html){
				$('#rsContent2 .rsSect2Content').append(html);
				$('.rscLoading').fadeOut('slow',function(){
					numCont2Offers = $("#rsContent2 .rsSect2Offer").length;
					$("#rsContent2 .rsSect2Content").width(numCont2Offers * 630 + "px");
					$('#rsContent2 .rsSect2Content').addClass('contentLoaded');
				});
				$(".maskWhole").delay(1000).fadeOut("slow");
		    }
		});
	}
	
	$.ajax({
		url: '/ajax/overlay/getoverlayitems.ashx?type=2&output=6&' + urlParamOffer,
	    cache: true,
	    success: function(html){
			getAllNewsEventsTemplates(html);
	    }
	});
}

function opacityShift(){
	if($('.jqmOverlayRS').css('opacity') === '0.85'){
	    $('.jqmOverlayRS').fadeTo('fast',0.84);
	}else{
	    $('.jqmOverlayRS').fadeTo('fast',0.85);
	}
}

function goToMainOffer(mainOfferId){
	
	var urlParamOffer;
			
	if(mallId !== 'null'){
	    urlParamOffer = 'id=' + mallId;
	}else{
	    urlParamOffer = 'id=' + urlParamID;
	}
	
	$('#rsContent1 .rsSect2Content .rsSect2Offer').remove();
	//$(".rsPanelContent1").trigger("click");
	$("#rsContent1 .rsWhatsNow").css({ "left": "43px" });
	$("#rsContent1 .rsWhatsNow").removeClass("rsPanelRight");
	$("#rsContent1 .rsSect2").css({ "left": "79px" });
	opacityShift();
	$('.rscLoading').fadeIn('slow',function(){
	    $("#rsContent1 .rsSect2Content").css("left", "0px");
	    $.ajax({
	    	url: '/ajax/overlay/getoverlayitems.ashx?type=1&output=3&' + urlParamOffer + '&count=9&index=' + (mainOfferId + 1),
	        cache: true,
	        success: function(html){
	        	$("#rsContent1 .rsSect2Content").append(html);
	        	numCont1Offers = $("#rsContent1 .rsSect2Offer").length;
	    		$("#rsContent1 .rsSect2Content").width(numCont1Offers * 630 + "px");
	    		$('.rscLoading').fadeOut('slow');
	    		opacityShift();
	    		doTrackingCont1();
				
	        }
	    });
	});
}

function getTab1ItemsSearch(tab1Index){
	
	var urlParamOffer;
			
	if(mallId !== 'null'){
	    urlParamOffer = 'id=' + mallId;
	}else{
	    urlParamOffer = 'id=' + urlParamID;
	}
	
    $.ajax({
    	url: '/ajax/overlay/getoverlayitems.ashx?type=1&output=3&' + urlParamOffer + '&count=9&index=' + tab1Index,
        cache: true,
        success: function(html){
        	$('#rsContent1 .rsSect2Content .rsSect2Offer').remove();
        	$("#rsContent1 .rsSect2Content").append(html);
        	numCont1Offers = $("#rsContent1 .rsSect2Offer").length;
    		$("#rsContent1 .rsSect2Content").width(numCont1Offers * 630 + "px");
    		$('.rscLoading').fadeOut('slow');
    		doTrackingCont1();
			$(".maskWhole").delay(1000).fadeOut("slow");
        }
    });
}

function tab1Interval(){
	
	var urlParamOffer;
			
	if(mallId !== 'null'){
	    urlParamOffer = 'id=' + mallId;
	}else{
	    urlParamOffer = 'id=' + urlParamID;
	}
	
    if($('#rsContent1 .rsSect2Content').hasClass('contentLoaded')){
    	clearInterval(interval);
    	$("#rsTab1").trigger("click");
    	if($.trim($('#rsContent1 .rsSect2Content .rsSect2Offer:last .offerItemTotal').text()) <= 9){
			$("#rsTab1").trigger("click");
			$("#rsContent1 .rsWhatsNow").css({ "left": "43px" });
			$("#rsContent1 .rsWhatsNow").removeClass("rsPanelRight");
			$("#rsContent1 .rsSect2").css({ "left": "79px" });
			$("#rsContent1 .rsSect2Content").css({ "left": "-" + $("." + rsOpenItem).position().left + "px" });
			//$("#rsContent1 .rsSect2Content").animate({ "left": "-" + $("." + rsOpenItem).position().left + "px" }, "slow");
			opacityShift();
			doTrackingCont1();
			
		}else{
			$('.rscLoading').fadeIn('slow');
			$("#rsTab1").trigger("click");
			$("#rsContent1 .rsWhatsNow").css({ "left": "43px" });
			$("#rsContent1 .rsWhatsNow").removeClass("rsPanelRight");
			$("#rsContent1 .rsSect2").css({ "left": "79px" });
			$.ajax({
		    	url: '/ajax/overlay/getoverlayitems.ashx?type=1&output=7&' + urlParamOffer + '&rsItem=' + rsOpenItem,
		        cache: true,
		        success: function(html){
		        	getTab1ItemsSearch(html);
					$(".maskWhole").show();
		        }
		    });	
		}
    }
}

function tab2Interval(){
    if($('#rsContent2 .rsSect2Content').hasClass('contentLoaded')){
    	clearInterval(interval);
    	$("#rsTab2").trigger("click");
    	$("#rsContent2 .rsSect2Content").css({ "left": "-" + $("." + rsOpenItem).position().left + "px" });
    	opacityShift();
    	doTrackingCont2();
    	//$("#rsContent2 .rsSect2Content").animate({ "left": "-" + $("." + rsOpenItem).position().left + "px" }, "slow");
    }
}


$("#rsTab1").live("click",function() {
    if (!$(this).hasClass("current")) {
    	//$(".rsSectContainer").animate({ "left": "0px" });
    	$(".rsSectContainer").css({ "left": "0px" });
    	opacityShift();
    	$("#rsTab2").removeClass("current");
    	$(this).addClass("current");
    }
});

$("#rsTab2").live("click",function() {
    if (!$(this).hasClass("current")) {
    	//$(".rsSectContainer").animate({ "left": "-728px" });
    	$(".rsSectContainer").css({ "left": "-728px" });
    	opacityShift();
    	$("#rsTab1").removeClass("current");
    	$(this).addClass("current");
    }
});

/* Urchin Tracking - Begin */
function doTrackingCont1(){
	var urchLeft = $('#rsContent1 .rsSect2Content').position().left;
	if (urchLeft < 0){
	    urchLeft = -$('#rsContent1 .rsSect2Content').position().left;
	}
	var urchWidth = $('#rsContent1 .rsSect2Content').width();
	var urchAmt = $('#rsContent1 .rsSect2Content').width() / $('#rsContent1 .rsSect2Content .rsSect2Offer').width();
	var urchPos = (urchWidth - urchLeft) / $('#rsContent1 .rsSect2Content .rsSect2Offer').width();
	var urchIndex = urchAmt - urchPos;
	var urchVar = $('#rsContent1 .rsSect2Content .rsSect2Offer').eq(urchIndex).find('.rsTracking').val();
	if(urchVar){
		urchinTracker(urchVar);
		console.log(urchVar);
	}
}

function doTrackingCont2(){
	var urchLeft = $('#rsContent2 .rsSect2Content').position().left;
	if (urchLeft < 0){
	    urchLeft = -$('#rsContent2 .rsSect2Content').position().left;
	}
	var urchWidth = $('#rsContent2 .rsSect2Content').width();
	var urchAmt = $('#rsContent2 .rsSect2Content').width() / $('#rsContent2 .rsSect2Content .rsSect2Offer').width();
	var urchPos = (urchWidth - urchLeft) / $('#rsContent2 .rsSect2Content .rsSect2Offer').width();
	var urchIndex = urchAmt - urchPos;
	var urchVar = $('#rsContent2 .rsSect2Content .rsSect2Offer').eq(urchIndex).find('.rsTracking').val();
	if(urchVar){
		urchinTracker(urchVar);
		console.log(urchVar);
	}
}
/* Urchin Tracking - End */

$("#rsContent1 .rsSect2BottomNext").live("click",function() {
    var currClicked = $(this);
    if($(currClicked).hasClass("enabled")){
    	$(currClicked).removeClass("enabled");
    	
    	if (-$("#rsContent1 .rsSect2Content").position().left < (numCont1Offers * 630) - 630) {
    		/*$(currClicked).removeClass("enabled");
    		$("#rsContent1 .rsSect2Content").animate({ "left": "-=630px" }, "slow", function() {
    			$(currClicked).addClass("enabled");
    			opacityShift();
    		});*/
    		$("#rsContent1 .rsSect2Content").css({ "left": $("#rsContent1 .rsSect2Content").position().left - 630 + "px" });
    		opacityShift();
    		$(currClicked).addClass("enabled");
    		doTrackingCont1();
    	}else{			
    		var urlParamOffer;
    		
    		if(mallId !== 'null'){
    			urlParamOffer = 'id=' + mallId;
    		}else{
    			urlParamOffer = 'id=' + urlParamID;
    		}
    		
    		function getNextOffers(indexNumber){
    			//$("#rsContent1 .rsSect2Content").animate({ "left": "-=630px" }, "slow", function() {
    				$('.rscLoading').fadeIn('slow',function(){
    					$('#rsContent1 .rsSect2Content .rsSect2Offer').remove();
    					$("#rsContent1 .rsSect2Content").css("left", "0px");
    					$.ajax({
    						url: '/ajax/overlay/getoverlayitems.ashx?type=1&output=3&' + urlParamOffer + '&count=9&index=' + indexNumber,
    					    cache: true,
    					    success: function(html){
    					    	$("#rsContent1 .rsSect2Content").append(html);
    					    	numCont1Offers = $("#rsContent1 .rsSect2Offer").length;
    							$("#rsContent1 .rsSect2Content").width(numCont1Offers * 630 + "px");
    							$('.rscLoading').fadeOut('slow',function(){
    								$(currClicked).addClass("enabled");
    								doTrackingCont1();
    							});
    					    }
    					});
    				});
    			//});
    		}
    		
    		if($.trim($('#rsContent1 .rsSect2Content .rsSect2Offer:last .offerItemTotal').text()) <= 9){
    			//$("#rsContent1 .rsSect2Content").animate({ "left": "0px" }, "normal");
    			$("#rsContent1 .rsSect2Content").css({ "left": "0px" });
    			opacityShift();
    			$(currClicked).addClass("enabled");
    			doTrackingCont1();
    		}else if( $.trim($('#rsContent1 .rsSect2Content .rsSect2Offer:last .offerItemNumber').text()) === $.trim($('#rsContent1 .rsSect2Content .rsSect2Offer:last .offerItemTotal').text()) ){
    			getNextOffers(0);
    		}else{
    			getNextOffers( $.trim( $('#rsContent1 .rsSect2Content .rsSect2Offer:last .offerItemNumber').text() ) );
    		}
    	}
    }
});


$("#rsContent1 .rsSect2BottomPrevious").live("click",function() {
    var currClicked = $(this);
    if($(currClicked).hasClass("enabled")){
    	$(currClicked).removeClass("enabled");
    	
    	if ($("#rsContent1 .rsSect2Content").position().left < 0) {
    		/*$(currClicked).removeClass("enabled");
    		$("#rsContent1 .rsSect2Content").animate({ "left": "+=630px" }, "slow", function() {
    			$(currClicked).addClass("enabled");
    			opacityShift();
    		});*/
    		$("#rsContent1 .rsSect2Content").css({ "left": $("#rsContent1 .rsSect2Content").position().left + 630 + "px" });
    		opacityShift();
    		$(currClicked).addClass("enabled");
    		doTrackingCont1();
    	}else{
    		
    		var urlParamOffer;
    		
    		if(mallId !== 'null'){
    			urlParamOffer = 'id=' + mallId;
    		}else{
    			urlParamOffer = 'id=' + urlParamID;
    		}
    		
    		if($.trim($('#rsContent1 .rsSect2Content .rsSect2Offer:last .offerItemTotal').text()) <= 9){
    			/*$("#rsContent1 .rsSect2Content").animate({ "left": -((numCont1Offers * 630) - 630) + "px" }, "normal", function() {
    				$(currClicked).addClass("enabled");
    			});*/
    			$("#rsContent1 .rsSect2Content").css({ "left": -((numCont1Offers * 630) - 630) + "px" });
    			opacityShift();
    			$(currClicked).addClass("enabled");
    			doTrackingCont1();
    		}else if($.trim($('#rsContent1 .rsSect2Content .rsSect2Offer:first .offerItemNumber').text()) < 9 && $.trim($('#rsContent1 .rsSect2Content .rsSect2Offer:first .offerItemNumber').text()) > 1){
    			//$("#rsContent1 .rsSect2Content").animate({ "left": "+=630px" }, "slow", function() {
    				$('.rscLoading').fadeIn('slow',function(){
    					$.ajax({
    						url: '/ajax/overlay/getoverlayitems.ashx?type=1&output=3&' + urlParamOffer + '&count=' + ($.trim($('#rsContent1 .rsSect2Content .rsSect2Offer:first .offerItemNumber').text()) - 1),
    					    cache: true,
    					    success: function(html){
    					    	$('#rsContent1 .rsSect2Content .rsSect2Offer').remove();
    					    	$("#rsContent1 .rsSect2Content").append(html);
    					    	numCont1Offers = $("#rsContent1 .rsSect2Offer").length;
    					    	$("#rsContent1 .rsSect2Content").css("left", -((numCont1Offers * 630) - 630) + "px");
    					    	opacityShift();
    					    	doTrackingCont1();
    							$("#rsContent1 .rsSect2Content").width(numCont1Offers * 630 + "px");
    							$('.rscLoading').fadeOut('slow',function(){
    								$(currClicked).addClass("enabled");
    							});
    					    }
    					});
    				});
    			//});
    		}else if($.trim($('#rsContent1 .rsSect2Content .rsSect2Offer:first .offerItemNumber').text()) === '1'){
    			//$("#rsContent1 .rsSect2Content").animate({ "left": "+=630px" }, "slow", function() {
    				$('.rscLoading').fadeIn('slow',function(){
    					$.ajax({
    						url: '/ajax/overlay/getoverlayitems.ashx?type=1&output=3&' + urlParamOffer + '&count=9&index=' + ($.trim($('#rsContent1 .rsSect2Content .rsSect2Offer:first .offerItemTotal').text()) - 9),
    					    cache: true,
    					    success: function(html){
    					    	$('#rsContent1 .rsSect2Content .rsSect2Offer').remove();
    					    	$("#rsContent1 .rsSect2Content").append(html);
    					    	numCont1Offers = $("#rsContent1 .rsSect2Offer").length;
    					    	$("#rsContent1 .rsSect2Content").css("left", -((numCont1Offers * 630) - 630) + "px");
    					    	opacityShift();
    					    	doTrackingCont1();
    							$("#rsContent1 .rsSect2Content").width(numCont1Offers * 630 + "px");
    							$('.rscLoading').fadeOut('slow',function(){
    								$(currClicked).addClass("enabled");
    							});
    					    }
    					});
    				});
    			//});
    		}else{
    			//$("#rsContent1 .rsSect2Content").animate({ "left": "+=630px" }, "slow", function() {
    				$('.rscLoading').fadeIn('slow',function(){
    					$.ajax({
    						url: '/ajax/overlay/getoverlayitems.ashx?type=1&output=3&' + urlParamOffer + '&count=9&index=' + ($.trim($('#rsContent1 .rsSect2Content .rsSect2Offer:first .offerItemNumber').text()) - 10),
    					    cache: true,
    					    success: function(html){
    					    	$('#rsContent1 .rsSect2Content .rsSect2Offer').remove();
    					    	$("#rsContent1 .rsSect2Content").append(html);
    					    	numCont1Offers = $("#rsContent1 .rsSect2Offer").length;
    					    	$("#rsContent1 .rsSect2Content").css("left", -((numCont1Offers * 630) - 630) + "px");
    					    	doTrackingCont1();
    							$("#rsContent1 .rsSect2Content").width(numCont1Offers * 630 + "px");
    							$('.rscLoading').fadeOut('slow',function(){
    								$(currClicked).addClass("enabled");
    							});
    					    }
    					});
    				});
    			//});
    		}
    	}
    }
});

$("#rsContent2 .rsSect2BottomNext").live("click",function() {
    var currClicked = $(this);
    if($(currClicked).hasClass("enabled")){
    	$(currClicked).removeClass("enabled");
    	
    	if (-$("#rsContent2 .rsSect2Content").position().left < (numCont2Offers * 630) - 630) {
    		/*$(currClicked).removeClass("enabled");
    		$("#rsContent2 .rsSect2Content").animate({ "left": "-=630px" }, "slow", function() {
    			$(currClicked).addClass("enabled");
    			opacityShift();
    		});*/
    		$("#rsContent2 .rsSect2Content").css({ "left": $("#rsContent2 .rsSect2Content").position().left - 630 + "px" });
    		opacityShift();
    		$(currClicked).addClass("enabled");
    		doTrackingCont2();
    	}else{
    		/*$(currClicked).removeClass("enabled");
    		$("#rsContent2 .rsSect2Content").animate({ "left": "0px" }, "normal", function() {
    			$(currClicked).addClass("enabled");
    			opacityShift();
    		});*/
    		$("#rsContent2 .rsSect2Content").css({ "left": "0px" });
    		opacityShift();
    		$(currClicked).addClass("enabled");
    		doTrackingCont2();
    	}
    }
});

$("#rsContent2 .rsSect2BottomPrevious").live("click",function() {
    var currClicked = $(this);
    if($(currClicked).hasClass("enabled")){
    	$(currClicked).removeClass("enabled");
    	
    	if ($("#rsContent2 .rsSect2Content").position().left < 0) {
    		/*$(currClicked).removeClass("enabled");
    		$("#rsContent2 .rsSect2Content").animate({ "left": "+=630px" }, "slow", function() {
    			$(currClicked).addClass("enabled");
    			opacityShift();
    		});*/
    		$("#rsContent2 .rsSect2Content").css({ "left": $("#rsContent2 .rsSect2Content").position().left + 630 + "px" });
    		opacityShift();
    		$(currClicked).addClass("enabled");
    		doTrackingCont2();
    	}else{
    		/*$(currClicked).removeClass("enabled");
    		$("#rsContent2 .rsSect2Content").animate({ "left": -((numCont2Offers * 630) - 630) + "px" }, "normal", function() {
    			$(currClicked).addClass("enabled");
    			opacityShift();
    		});*/
    		$("#rsContent2 .rsSect2Content").css({ "left": -((numCont2Offers * 630) - 630) + "px" });
    		opacityShift();
    		$(currClicked).addClass("enabled");
    		doTrackingCont2();
			
    	}
    }
});

$('.rsSect2BottomViewAllOffers').live('click',function(){
	$("#rsContent1 .rsWhatsNow").css({ "left": "674px" });
	$("#rsContent1 .rsWhatsNow").addClass("rsPanelRight");
	$("#rsContent1 .rsSect2").css({ "left": "709px" });
	opacityShift();
});

$('.rsSect2BottomViewAllNewsEvents').live('click',function(){
	$("#rsContent2 .rsWhatsNow").css({ "left": "674px" });
	$("#rsContent2 .rsWhatsNow").addClass("rsPanelRight");
	$("#rsContent2 .rsSect2").css({ "left": "709px" });
	opacityShift();
});

function rsActivate() {
    if (rsOpenTab == null) {
        return;
    }  else if (rsOpenTab === "rsOpenTab1") {
		$("#rsTab1").trigger("click");
	} else if (rsOpenTab === "rsOpenTab2") {
		$("#rsTab2").trigger("click");
		doTrackingCont2();
	} else if (rsOpenTab === "rsOpenTabItem1") {
		if($("#rsContent1 .rsSect2Offer").length > 0 && $.trim($('#rsContent1 .rsSect2Content .rsSect2Offer:last .offerItemTotal').text()) <= 9){
			$("#rsTab1").trigger("click");
			//$("#rsContent1 .rsSect2Content").animate({ "left": "-" + $("." + rsOpenItem).position().left + "px" }, "slow");
			$("#rsContent1 .rsSect2Content").css({ "left": "-" + $("." + rsOpenItem).position().left + "px" });
			doTrackingCont1();
			$(".maskWhole").delay(3000).fadeOut("slow");
		}else{
			interval = setInterval('tab1Interval()',500);
		}
	} else if (rsOpenTab === "rsOpenTabItem2") {
		if($("#rsContent2 .rsSect2Offer").length > 0){
			$("#rsTab2").trigger("click");
			//$("#rsContent2 .rsSect2Content").animate({ "left": "-" + $("." + rsOpenItem).position().left + "px" }, "slow");
			$("#rsContent2 .rsSect2Content").css({ "left": "-" + $("." + rsOpenItem).position().left + "px" });
			doTrackingCont2();
		}else{
			interval = setInterval('tab2Interval()',500);
		}
	}
}

function rsAjaxCall() {
	var RSCOverlayMode = $('.RSCOverlayMode input').val();
	var RSCOverlayModeId = $('.RSCOverlayModeId input').val();

	if (RSCOverlayMode === 'OfferPreview'){
		$('#rsAjaxTarget').load('/ajax/overlay/getoverlaycontent.ashx?id=176', function() {
			rsActivate();
			startRscPopulate('OfferPreview',RSCOverlayModeId);
		});
	} else if (RSCOverlayMode === 'ShowcasePreview') {
		$('#rsAjaxTarget').load('/ajax/overlay/getoverlaycontent.ashx?id=176', function() {
			rsActivate();
			startRscPopulate('ShowcasePreview',RSCOverlayModeId);
		});
	} else if($('#rsAjaxTarget .rsFindProp').length > 0 && mallId !== 'null'){
		$('#rsAjaxTarget').empty();
		$('#rsAjaxTarget').append('<img class="ajaxLoaderLarge" src="/images/global/ajax-loader-large.gif" alt="" width="48" height="48"/>');
		$('#rsAjaxTarget').load('/ajax/overlay/getoverlaycontent.ashx?id=' + mallId, function() {
			rsActivate();
			$.ajax({
			    url: '/ajax/overlay/getoverlayitems.ashx?type=1&output=5&id=' + mallId,
			    cache: true,
			    success: function(html){
			    	totNumOffers = html;
			    	startRscPopulate();
			    }
			});
		});
	} else if (rsOpenTab === "rsFindProp" || urlParamID === "") {
		$("#rsAjaxTarget").load("/ajax/overlay/getoverlaysearch.ashx", function() {
			$("#rsAjaxTarget :text").blur();
		});
	} else if ($("#rsAjaxTarget .ajaxLoaderLarge").length > 0 && urlParamID !== "") {
		/*$("#rsAjaxTarget").load("/sandbox/retailer-showcase/retailer-showcase-content.html", function(){*/
		/*$("#rsAjaxTarget").load("/temp/retailer-showcase-content.html", function(){*/
		/*$("#rsAjaxTarget").load("/retailpromotions/showcase/ajax/GetOffer.ashx?Key=1246", function() {*/
		$('#rsAjaxTarget').load('/ajax/overlay/getoverlaycontent.ashx?id=' + urlParamID, function() {
			rsActivate();
			$.ajax({
			    url: '/ajax/overlay/getoverlayitems.ashx?type=1&output=5&id=' + urlParamID,
			    cache: true,
			    success: function(html){
			    	totNumOffers = html;
			    	startRscPopulate();
			    }
			});
		});
	} else {
		rsActivate();
	}
}

/* End Retailer Showcase Interaction
---------------------------------------------------	*/

var fadeOpen = function(hash) {
	hash.w.fadeIn(500);
	//hash.o.fadeIn(2000);
};
var rsFadeOpen = function(hash) {
	hash.w.fadeIn(500);
	hash.o.fadeIn(500);
	if (archivedEventID === 'null' && isEditWindowOpen == false) {
		rsAjaxCall();
	}
	isJQModalCall = true; //Used by adminEditor.js to decide if the window.onbeforeunload is because of a Modal popup call or not
};
var fadeClose = function(hash) {
	hash.w.fadeOut(500, function() { if(hash.o) hash.o.fadeOut(500); });
	if(sPage.toLowerCase() === 'tenantdetail.aspx'){
		if(gup('tid') === '0' && gup('preview') === ''){
        	history.go(-1);
        }
	}
};
var rsFadeClose = function(hash) {
	hash.w.fadeOut(500);
	hash.o.fadeOut(500);
	
	if($('#rsAjaxTarget .rsFindProp').length > 0){
		$('#rsAjaxTarget').empty();
		$('#rsAjaxTarget').append('<img class="ajaxLoaderLarge" src="/images/global/ajax-loader-large.gif" alt="" width="48" height="48"/>');
	}
	if(archivedEventID !== 'null'){
		archivedEventID = 'null';
		$('#rsAjaxTarget').empty();
		$('#rsAjaxTarget').append('<img class="ajaxLoaderLarge" src="/images/global/ajax-loader-large.gif" alt="" width="48" height="48"/>');
		$('#navCoverPanels').remove();
	}
	setTimeout("isJQModalCall = false;", 500);
};

function renderFlash() {
	var currentTime = new Date();

	if ($("#flashSales1").length > 0) {
		var flashvars = {};
		flashvars.xmlFile = "/xml/test.xml?=" + currentTime.getTime();
		var params = {};
		params.wmode = "transparent";
		params.base = "/swf/";
		var attributes = {};
		swfobject.embedSWF("/swf/slider.swf", "flashSales1", "589", "130", "9.0.0", "/swf/expressInstall.swf", flashvars, params, attributes);
	}
}

function oneMall() {
	$("#containerResultsMallHeader").addClass("open");
	$("#containerResultsMallHeader").siblings("#containerResultsMall").slideDown("slow");
}

function oneStore() {
	$("#containerResultsStoreHeader").addClass("open");
	$("#containerResultsStoreHeader").siblings("#containerResultsStore").slideDown("slow");
}

function activateStoreLinks() {
	$(".inMallsBottom a").click(function() {
		var mallLink = $(this).parent().siblings(".inMallsMid").children("select").children("option:selected").attr("value");
		if (mallLink !== undefined) {
			window.location = mallLink;
		} else {
			$(this).siblings(".error").show();
		}
	});
}

/* Retailer Showcase Default Content
---------------------------------------------------	*/

function rsFindCall() {
	rsOpenTab = "rsFindProp";
	$("#overlayRetailerShowcase").css("top", $(window).scrollTop() + "px");
	
	$("#overlayRetailerShowcase").jqmShow();
	
	
}

function rsTab1Call() {
	rsOpenTab = "rsOpenTab1";
	$("#overlayRetailerShowcase").css("top", $(window).scrollTop() + "px");
	
	$("#overlayRetailerShowcase").jqmShow();
	
}

function rsTab2Call() {
	rsOpenTab = "rsOpenTab2";
	$("#overlayRetailerShowcase").css("top", $(window).scrollTop() + "px");
	
	$("#overlayRetailerShowcase").jqmShow();
	
}

$(".aShift").live("click",function() {
    var currClicked = $(this);
    if ($(currClicked).siblings(".rsNoScroll").position().top == 0 && $(currClicked).hasClass("enabled")) {
    	$(currClicked).removeClass("enabled");
    	$(currClicked).siblings(".rsNoScroll").animate({ "top": "-374px" }, "slow");
    	$(currClicked).siblings(".rsScroll").animate({ "top": "0px" }, "slow", function() {
    		$(currClicked).css('background-position','left bottom');
    		opacityShift();
    		$(currClicked).addClass("enabled");
    	});
    } else if ($(currClicked).siblings(".rsScroll").position().top == 0 && $(currClicked).hasClass("enabled")) {
    	$(currClicked).removeClass("enabled");
    	$(currClicked).siblings(".rsNoScroll").animate({ "top": "0px" }, "slow");
    	$(currClicked).siblings(".rsScroll").animate({ "top": "374px" }, "slow", function() {
    		$(currClicked).css('background-position','left top');
    		opacityShift();
    		$(currClicked).addClass("enabled");
    	});
    }
});

$(".rsPromoTile").live("click",function() {
    if($(".rsPromoTile").length < 9){
    	$("#rsContent1 .rsWhatsNow").css({ "left": "43px" });
    	$("#rsContent1 .rsWhatsNow").removeClass("rsPanelRight");
    	$("#rsContent1 .rsSect2").css({ "left": "79px" });
    	//$("#rsContent1 .rsSect2Content").animate({ "left": "-" + (($('.rsPromoTile').index(this) * 630) + 630) + "px" }, "slow");
    	$("#rsContent1 .rsSect2Content").css({ "left": "-" + (($('.rsPromoTile').index(this) * 630) + 630) + "px" });
    	opacityShift();
    	doTrackingCont1();
		$(".maskWhole").delay(3000).fadeOut("slow");
    }else{
    	goToMainOffer($('.rsPromoTile').index(this));
    }
});

$(".aMoreNewsEvents").live("click",function() {
    $("#rsContent2 .rsWhatsNow").css({ "left": "43px" });
    $("#rsContent2 .rsWhatsNow").removeClass("rsPanelRight");
    $("#rsContent2 .rsSect2").css({ "left": "79px" });
    //$("#rsContent2 .rsSect2Content").animate({ "left": "-" + $("." + $(this).attr("rsItem")).position().left + "px" }, "slow");
    $("#rsContent2 .rsSect2Content").css({ "left": "-" + $("." + $(this).attr("rsItem")).position().left + "px" });
    opacityShift();
    doTrackingCont2();
});

function centerCards(){
	if($('#cardsAvailableColA .simonSlideContent').width() < 150){
	    $('#cardsAvailableColA .simonSlideContent').css('left','210px');
	}else if($('#cardsAvailableColA .simonSlideContent').width() < 290){
	    $('#cardsAvailableColA .simonSlideContent').css('left','140px');
	}else if($('#cardsAvailableColA .simonSlideContent').width() < 430){
	    $('#cardsAvailableColA .simonSlideContent').css('left','70px');
	}
}

/* End Retailer Showcase Default Content
---------------------------------------------------	*/

$(document).ready(function() {
	//renderFlash();

	$("head").append('<!--[if ie 6]><link rel="stylesheet" href="/css/ie6.css" type="text/css" media="screen" charset="utf-8" /><![endif]--> <!--[if ie 7]><link rel="stylesheet" href="/css/ie7.css" type="text/css" media="screen" charset="utf-8" /><![endif]-->');

	$("#btnFindPropertySlider").click(function() {
		if ($("#searchSlideDown").css("top") === "-46px") {
			$("#searchSlideDown").animate({ "top": "0px" }, "slow");
		} else {
			$("#searchSlideDown").animate({ "top": "-46px" }, "slow");
		}
	});

	$(".btnLogIn").click(function() {
		if ($("#slideSignInHolder").css("display") === "none") {
			$(".btnLogIn").css("text-decoration", "underline");
			$("#slideSignInHolder").show();
			$("#slideSignIn").animate({ "top": "0px" }, "slow");
			$("input[name='EmailLogin']").focus();
		} else {
			$("#slideSignIn").animate({ "top": "-165px" }, "slow", function() {
				$("#slideSignInHolder").hide();
				$(".btnLogIn").css("text-decoration", "none");
			});
		}
	});

	$("#slideSignIn .btnClose").click(function() {
		$("#slideSignIn").animate({ "top": "-165px" }, "slow", function() {
			$("#slideSignInHolder").hide();
			$(".btnLogIn").css("text-decoration", "none");
			$("#slideSignIn .error").hide();
		});
	});

	if ($("#slideCheckBalanceHolder").length > 0) {
		var position = $(".btnCheckBalance").position();

		$("#slideCheckBalanceHolder").css({
			"left": (position.left - 12) + "px",
			"top": "-" + (340 - position.top) + "px"
		});

		$(".btnCheckBalance").click(function() {
			if ($("#slideCheckBalanceHolder").css("display") === "none") {
				$(".btnCheckBalance").css("background", "url(/images/global/pod-nav-bottom-bg-hover.png) left top repeat-x");
				$("#slideCheckBalanceHolder").show();
				$("#slideCheckBalance").animate({ "top": "0px" }, "slow");
			} else {
				$("#slideCheckBalance").animate({ "top": "396px" }, "slow", function() {
					$("#slideCheckBalanceHolder").hide();
					$(".btnCheckBalance").css("background", "none");
				});
			}
		});

		$("#slideCheckBalance .btnClose").click(function() {
			$("#slideCheckBalance").animate({ "top": "396px" }, "slow", function() {
				$("#slideCheckBalanceHolder").hide();
				$(".btnCheckBalance").css("background", "none");
			});
		});
	}

	//$(".btnRegisterCard").attr("href","javascript:;");
	$(".btnRegisterCard span").click(function() {
		showMessage('Register Your Card', 'Planning to use your Simon Giftcard<sup>&reg;</sup> for online purchases? If so, register with us first to ensure smooth transactions! <br /><br /><a href="/giftcard/faq.aspx?giftcard=1">See our Gift Card FAQ&rsquo;s for more information.</a>');
		return false;
	});
	/*$(".btnRegisterCard :not(span)").click(function(){
	window.location = "/giftcard/"
	});*/

	$(".podTopNavHalf a").click(function() {
		if (!$(this).hasClass("current")) {
			$(".podTopNavHalf .current").removeClass("current");
			$(this).addClass("current");
			if ($(".podAMid .sect1").css("display") === "none") {
				$(".podAMid .sect2").hide();
				$(".podAMid .sect1").show();
			} else {
				$(".podAMid .sect1").hide();
				$(".podAMid .sect2").show();
			}
		}
	});

	$(".podBSlide .slideTrigger").click(function() {
		if ($(this).siblings(".podBSlideContent").css("display") === "none") {
			$(this).css("background-position", "-1099px bottom");
			$(this).siblings(".podBSlideContent").slideDown("slow");
		} else {
			$(this).css("background-position", "-1099px top");
			$(this).siblings(".podBSlideContent").slideUp("slow");
		}
	});

	$(".podNavABottom a.navLast").hover(
		function() {
			  $(this).children("span").css("background-position", "-1026px bottom");
		},
		function() {
			  $(this).children("span").css("background-position", "-1026px top");
		}
	);

	$(".hideValueKeyword").click(function() {
		if ($(this).attr("value") === "Keyword Search") {
			$(this).attr("value", "");
		}
	});
	$(".hideValueKeyword").blur(function() {
		if ($(this).attr("value") === "") {
			$(this).attr("value", "Keyword Search");
		}
	});
	
	$(".findOffersKeyword").click(function() {
		if ($(this).attr("value") === "Keyword") {
			$(this).attr("value", "");
		}
	});
	$(".findOffersKeyword").blur(function() {
		if ($(this).attr("value") === "") {
			$(this).attr("value", "Keyword");
		}
	});

	$(".hideValueZip").click(function() {
		if ($(this).attr("value") === "ZIP") {
			$(this).attr("value", "");
			$(this).mask("99999");
		}
	});
	$(".hideValueZip").blur(function() {
		if ($(this).attr("value") === "") {
			$(this).attr("value", "ZIP");
		}
	});

	$("#mallDirectoryList input").click(function() {
		if ($(this).attr("value") === "Search") {
			$(this).attr("value", "");
		}
	});
	$("#mallDirectoryList input").blur(function() {
		if ($(this).attr("value") === "") {
			$(this).attr("value", "Search");
		}
	});

	$(".rsFindPropText").click(function() {
		if ($(this).attr("value") === "Search here") {
			$(this).attr("value", "");
		}
	});
	$(".rsFindPropText").blur(function() {
		if ($(this).attr("value") === "") {
			$(this).attr("value", "Search here");
		}
	});

	$(".txtFooterSearch").click(function() {
		if (!$(this).css("background-image") === "") {
			$(this).css("background-image", "none");
		}
	});
	$(".txtFooterSearch").blur(function() {
		if ($(this).css("background-image") === "none") {
			$(this).css("background-image", "url(/images/global/bg-google.png)");
		}
	});


	$(":checkbox").each(function() {
		$(this).addClass("inputNotText");
	});

	/*	Forgot Password Overlay
	---------------------------------------------------	*/
	$("#overlayForgotPassword").jqm({
		onShow: fadeOpen,
		onHide: fadeClose,
		overlay: 85
	});
	$("#overlayForgotPassword .btnClose").click(function() {
		$("#overlayForgotPassword").jqmHide();
	});
	$(".forgotPassword").click(function() {
		$("#overlayForgotPassword").jqmShow();
	});

	/*	Small Overlay
	---------------------------------------------------	*/
	$("#overlaySmall").jqm({
		onShow: fadeOpen,
		onHide: fadeClose,
		overlay: 85,
		overlayClass: "jqmOverlaySmall"
	});
	$("#overlaySmall .btnClose").click(function() {
		$("#overlaySmall").jqmHide();
	});
	$(".showSmallOverlay").click(function() {
		$("#overlaySmall").jqmShow();
	});
	
	/*	divThreeDigit Overlay
	---------------------------------------------------	*/
	$("#divThreeDigit").jqm({
		onShow: fadeOpen,
		onHide: fadeClose,
		overlay: 85,
		overlayClass: "jqmOverlaySmall"
	});
	$("#divThreeDigit .btnClose").click(function() {
		$("#divThreeDigit").jqmHide();
	});
	$(".showSmallOverlay").click(function() {
		$("#divThreeDigit").jqmShow();
	});
	
	/*	divWarning Overlay
	---------------------------------------------------	*/
	$("#divWarning").jqm({
		onShow: fadeOpen,
		onHide: fadeClose,
		overlay: 85,
		overlayClass: "jqmOverlaySmall"
	});
	
	/*	divNY Overlay
	---------------------------------------------------	*/
	$("#divNY").jqm({
		onShow: fadeOpen,
		onHide: fadeClose,
		overlay: 85,
		overlayClass: "jqmOverlaySmall"
	});
	
	/*	Retailer Showcase Overlay
	---------------------------------------------------	*/
	$("#overlayRetailerShowcase").jqm({
		onShow: rsFadeOpen,
		onHide: rsFadeClose,
		overlay: 85,
		overlayClass: "jqmOverlayRS"
	});

	$(".showRS").live('click',function() {
		rsOpenTab = $(this).attr("rsOpenTab");
		if(mallId !== 'null'){
			$('#rsAjaxTarget').empty();
			$('#rsAjaxTarget').append('<img class="ajaxLoaderLarge" src="/images/global/ajax-loader-large.gif" alt="" width="48" height="48"/>');
			mallId = 'null';
			$(".maskWhole").delay(1000).fadeOut("slow");
			$('#overlayRetailerShowcase .rsTitle span').text($('h2 span').text());
		}
		$("#overlayRetailerShowcase").css("top", $(window).scrollTop() + "px");
		
		$("#overlayRetailerShowcase").jqmShow();
		
	});
	
	$('.simonSlidePod2 .slidePodImg').live('click',function(){
		if(mallId !== 'null'){
			$('#rsAjaxTarget').empty();
			$('#rsAjaxTarget').append('<img class="ajaxLoaderLarge" src="/images/global/ajax-loader-large.gif" alt="" width="48" height="48"/>');
			mallId = 'null';
			$('#overlayRetailerShowcase .rsTitle span').text($('h2 span').text());
		}
		$("#overlayRetailerShowcase").css("top", $(window).scrollTop() + "px");
		$(".maskWhole").hide();
		$("#overlayRetailerShowcase").jqmShow();
		
		
	});

	$(".btnCloseRS").click(function() {
		$(".maskWhole").show();
		$("#overlayRetailerShowcase").jqmHide();
	});
	
	$('.aRscFindMall').click(function(){
		if($('.rsFindProp').length === 0){
			$("#rsAjaxTarget").load("/ajax/overlay/getoverlaysearch.ashx", function() {
				$("#rsAjaxTarget :text").blur();
			});
		}
	});
	
	$('.rsButtonGo').live('click',function(){
		if($('#rscFindMallNames option:selected').val()){
			mallId = $('#rscFindMallNames option:selected').val();
			rsOpenTab = 'rsOpenTab1';
			$('#overlayRetailerShowcase .rsTitle span').text($('#rscFindMallNames option:selected').text());
			rsAjaxCall();
		}
	});
	
	$('#rscFindMallNames option').live('dblclick',function(){
		mallId = $('#rscFindMallNames option:selected').val();
		rsOpenTab = 'rsOpenTab1';
		$('#overlayRetailerShowcase .rsTitle span').text($('#rscFindMallNames option:selected').text());
		rsAjaxCall();
	});
	
	$(".rsPanelContent1").live("click",function() {
		if ($("#rsContent1 .rsWhatsNow").css("left") === "43px") {
			/*$("#rsContent1 .maskWhole").show();
			$("#rsContent1 .rsWhatsNow").animate({ "left": "674px" }, "slow", function() {
				$("#rsContent1 .rsWhatsNow").addClass("rsPanelRight");
				$("#rsContent1 .maskWhole").hide();
			});
			$("#rsContent1 .rsSect2").animate({ "left": "709px" }, "slow");*/
			$("#rsContent1 .rsWhatsNow").css({ "left": "674px" });
			$("#rsContent1 .rsWhatsNow").addClass("rsPanelRight");
			$("#rsContent1 .rsSect2").css({ "left": "709px" });
			opacityShift();
		} else {
			/*$("#rsContent1 .maskWhole").show();
			$("#rsContent1 .rsWhatsNow").animate({ "left": "43px" }, "slow", function() {
				$("#rsContent1 .maskWhole").hide();
			});
			$("#rsContent1 .rsWhatsNow").removeClass("rsPanelRight");
			$("#rsContent1 .rsSect2").animate({ "left": "79px" }, "slow");*/
			$("#rsContent1 .rsWhatsNow").css({ "left": "43px" });
			$("#rsContent1 .rsWhatsNow").removeClass("rsPanelRight");
			$("#rsContent1 .rsSect2").css({ "left": "79px" });
			opacityShift();
		}
	});

	$(".rsPanelContent2").live("click",function() {
		if ($("#rsContent2 .rsWhatsNow").css("left") === "43px") {
			$("#rsContent2 .rsWhatsNow").css({ "left": "674px" });
			$("#rsContent2 .rsWhatsNow").addClass("rsPanelRight");
			$("#rsContent2 .rsSect2").css({ "left": "709px" });
			opacityShift();
			/*$("#rsContent2 .maskWhole").show();
			$("#rsContent2 .rsWhatsNow").animate({ "left": "674px" }, "slow", function() {
				$("#rsContent2 .rsWhatsNow").addClass("rsPanelRight");
				$("#rsContent2 .maskWhole").hide();
			});
			$("#rsContent2 .rsSect2").animate({ "left": "709px" }, "slow");*/
		} else {
			$("#rsContent2 .rsWhatsNow").css({ "left": "43px" });
			$("#rsContent2 .rsWhatsNow").removeClass("rsPanelRight");
			$("#rsContent2 .rsSect2").css({ "left": "79px" });
			opacityShift();
			/*$("#rsContent2 .maskWhole").show();
			$("#rsContent2 .rsWhatsNow").animate({ "left": "43px" }, "slow", function() {
				$("#rsContent2 .maskWhole").hide();
			});
			$("#rsContent2 .rsWhatsNow").removeClass("rsPanelRight");
			$("#rsContent2 .rsSect2").animate({ "left": "79px" }, "slow");*/
		}
	});

	/*	Wide Overlay
	---------------------------------------------------	*/
	$(".jqmWindowWide").jqm({
		onShow: rsFadeOpen,
		onHide: fadeClose,
		overlay: 85
	});

	$(".showPropertyMap").click(function() {
		$("#PropertyMap").css("top", $(window).scrollTop() + "px");
		$("#PropertyMap").jqmShow();
	});

	$(".jqmWindowWide .btnClose").click(function() {
		$(".jqmWindowWide").jqmHide();
	});


	/*	Property Search Results
	---------------------------------------------------	*/

	if ($(".propResultsSub1").length > 0 || $("#tableView").length > 0) {
		var tallestMall = 0;
		var tallestStore = 0;

		$("#tableView").hide();

		$("#containerResultsMall .propResultsSub2").empty();
		$("#containerResultsStore .propResultsSub2").empty();

		$(".propResultsSubHeader h6").append('<img src="/images/global/ajax-loader.gif" alt="" width="25" height="25" style="float:left; display:none;"/>');

		//20090815 jhopper - these have been changed to separate pages
		$("#navTabsResults a").click(function() {
			if (!$(this).hasClass("current")) {
				if ($(this).parent().attr("id") === "tabTableView") {
					/*$("#navTabsResults a").removeClass("current");
					$("#tabTableView a").addClass("current");
					$("#mapView").hide();
					$("#tableView").show();*/
					location.href = $(this).attr("href") + '?' + location.href.split("?")[1];


				} else if ($(this).parent().attr("id") === "tabMapView") {
					/*$("#navTabsResults a").removeClass("current");
					$("#tabMapView a").addClass("current");
					$("#tableView").hide();
					$("#mapView").show();*/
					location.href = $(this).attr("href") + '?' + location.href.split("?")[1];
				}
			}
		});

		$(".propResultsMainHeader a").click(function() {
			if ($(this).parent().parent().next().css("display") === "none") {
				$(this).parent().parent().next().slideDown("slow");
				$(this).parent().parent().addClass("open");
			} else {
				$(this).parent().parent().next().slideUp("slow");
				$(this).parent().parent().removeClass("open");
			}
		});

		/* Mall Extended info ajax and slide calls
		---------------------------------------------------	*/
		$(".propResultsMalls .propResultsSubHeader p a").click(function() {
			$(this).parent().parent().children("h6").children("a").click();
		});

		$(".propResultsMalls .propResultsSubHeader h6 a").click(function() {
			if (!$(this).parent().parent().hasClass("open")) {
				var clickedMallId = $(this).attr("id");
				var currMallLink = $(this);

				 if (!$(this).parent().parent().next().children(".propResultsSubMap").length > 0) { 
					currMallLink.siblings("img").css("display", "block");
					$(this).parent().parent().next().children(".propResultsSub2").load("/ajax/search/GetSearchResultsExpandedMallView.ashx?id=" + clickedMallId, function() {
						currMallLink.siblings("img").css("display", "none");
						$(this).siblings(".propResultsSubMap").css("display", "none");
						$(this).css({
							"top": "0px",
							"left": "0px",
							"position": "relative",
							"display": "none"
						});
						currMallLink.parent().parent().addClass("open");

						$(this).slideDown("slow", function() {
							$(this).siblings(".propResultsSubMap").fadeIn("slow");
						});

						//$(this).css("display", "block");
						//$(this).children(".propResultsSubMap").css("display", "block");

					});
				 } else {
					 $(this).parent().parent().next().children(".propResultsSub2").load("/ajax/search/GetSearchResultsExpandedMallView.ashx?id=" + clickedMallId, function() {
						currMallLink.siblings("img").css("display", "none");
						$(this).siblings(".propResultsSubMap").css("display", "none");
						$(this).css({
							"top": "0px",
							"left": "0px",
							"position": "relative",
							"display": "none"
						});
						currMallLink.parent().parent().addClass("open");
						
						$(this).slideDown("slow", function() {
							$(this).siblings(".propResultsSubMap").fadeIn("slow");
						});
					});
					$(this).parent().parent().next().children(".propResultsSubMap").css("display", "none");
					$(this).parent().parent().next().children(".propResultsSub2").css({
						"top": "0px",
						"left": "0px",
						"display": "none"
					});
					$(this).parent().parent().addClass("open");
					$(this).parent().parent().next().children(".propResultsSub2").slideDown("slow", function() {
						$(this).siblings(".propResultsSubMap").fadeIn("slow");
					});
				} 
			} else {
				$(this).parent().parent().removeClass("open");
				$(this).parent().parent().next().children(".propResultsSubMap").fadeOut("slow", function() {
					$(this).siblings(".propResultsSub2").slideUp("slow");
				});
			}
		});
		/* Store Extended info ajax and slide calls
		---------------------------------------------------	*/

		$(".propResultsStores .propResultsSubHeader h6 a").click(function() {
			if (!$(this).parent().parent().hasClass("open")) {
				var clickedStoreName = $(this).attr("id");

				//clickedStoreName = clickedStoreName.replace(/\s+/g, "+");
				//clickedStoreName = escape(clickedStoreName);

				var currStoreLink = $(this);

				if (!$(this).parent().parent().next().children(".propResultsSub2").children(".storeInfo").length > 0) {
					currStoreLink.siblings("img").css("display", "block");
					$(this).parent().parent().next().children(".propResultsSub2").load("/ajax/search/GetSearchResultsExpandedStoreView.ashx?btid=" + clickedStoreName, function() {
						currStoreLink.siblings("img").css("display", "none");
						activateStoreLinks();
						$(this).css({
							"top": "0px",
							"left": "0px",
							"display": "none"
						});
						currStoreLink.parent().parent().addClass("open");

						//$(this).slideDown("slow");

						$(this).css("display", "block");

					});
				} else {
					$(this).parent().parent().next().children(".propResultsSub2").css({
						"top": "0px",
						"left": "0px",
						"display": "none"
					});
					$(this).parent().parent().addClass("open");

					//$(this).parent().parent().next().children(".propResultsSub2").slideDown("slow");

					$(this).parent().parent().next().children(".propResultsSub2").css("display", "block");
				}
			} else {
				$(this).parent().parent().removeClass("open");
				//$(this).parent().parent().next().children(".propResultsSub2").slideUp("slow");
				$(this).parent().parent().next().children(".propResultsSub2").css("display", "none");
			}
		});

		$("#tableView tr").each(function() {
			$(this).children("td:last").css("border-right", "none");
		});

		$("#tableView thead td:last").css("border-right", "none");
	}
	
	if($('.resultsPageTop').length > 0){
		$('.resultsPageBottom').html($('.resultsPageTop').html());
	}

	/* Mall Directory
	---------------------------------------------------	*/

	if ($("#mallDirectoryList").length > 0) {
		$(".sect2").localScroll();
		var storeLet = gup("let");
		var storeCat = gup("cid");

		if (storeLet !== "") {
			$("#viewLetter").trigger("click");
			$.scrollTo($("a[name=" + storeLet + "]"), "slow");
		} else if (storeCat !== "") {
			$.scrollTo($("#cat" + storeCat), "slow", { onAfter: function() { $("#cat" + storeCat).trigger("click"); } });
		}
	}

	$("#mallDirectoryLegend li:last").addClass("last");

	$(".liCatHead a").click(function() {
		if (!$(this).hasClass("open")) {
			$(this).addClass("open");
			$(this).parent(".liCatHead").children("div").slideDown("slow");
		} else {
			$(this).removeClass("open");
			$(this).parent(".liCatHead").children("div").slideUp("slow");
		}
	});

	/* Simon Card Slider
	---------------------------------------------------	*/
	function SelectCardJS(cardElement) {
	    var card = $(cardElement);
        alert(cardElement);
        
        /* init slider if sliderIndex value set */
		var initIndex = $("input[type=hidden][id*=sliderIndex]").val();
		if (initIndex != 'undefined'){
			InitHorizSlider(initIndex);
		}
    }
	
	function InitHorizSlider(index) {
        if (index > 0) {
            var contentHolder = $(".simonSlideContentHolder");
            var nextPodWidth = contentHolder.children(".simonSlideContent").children("div").eq(index).width() + 1;
            contentHolder.children(".simonSlideContent").css({ "left": "-" + (nextPodWidth * index) + "px" });
            var currCountLoc = $(".simonSlideRight").siblings(".simonSlidePodCount");
            currCountLoc.text(index);
        }
    }

	if ($(".simonSlideContent").size() > 0) {
		$(".simonSlideContent").each(function() {
		    
			
				var slideWidth = 0;
				$(this).parent(".simonSlideContentHolder").parent(".simonSlideContainer").append('<div class="simonSlidePodCount" style="display:none;">0</div>');
				$(this).children("div").each(function() {
					var currWidth = $(this).width() + 1;
					slideWidth = slideWidth + currWidth;
					//alert(slideWidth);
				});
				//alert(slideWidth);
				$(this).width(slideWidth+140); // kluge...The control is not catching all DIVS and setting width one DIV too short

				$("img.reflect").each(function() {
					$(this).attr({
						"width": "145",
						"height": "93"
					});
					$(this).reflect({ height: 0.1, opacity: 0.3 });
				});

                /* init slider if sliderIndex value set */
				var initIndex = $("input[type=hidden][id*=sliderIndex]").val();
				if (initIndex != 'undefined'){
					InitHorizSlider(initIndex);
				}

				$(".slideMallDirectory .simonSlidePod_Custom img").each(function() {
					var imgHeight = $(this).height();
					var containerHeight = 68;
					var imgMarginTop = (containerHeight - imgHeight) / 2;
					$(this).css("margin-top", imgMarginTop + "px");
				});

				/* Retailer Showcase Open Items */
				$(".showRSItemTab1").click(function() {
					rsOpenTab = "rsOpenTabItem1";
					rsOpenItem = $(this).attr("rsItem");
					if(mallId !== 'null'){
						$('#rsAjaxTarget').empty();
						$('#rsAjaxTarget').append('<img class="ajaxLoaderLarge" src="/images/global/ajax-loader-large.gif" alt="" width="48" height="48" />');
						mallId = 'null';
						$('#overlayRetailerShowcase .rsTitle span').text($('h2 span').text());
						
					}
					$("#overlayRetailerShowcase").css("top", $(window).scrollTop() + "px");
					
					$("#overlayRetailerShowcase").jqmShow();
					
				});

				$(".showRSItemTab2").click(function() {
					rsOpenTab = "rsOpenTabItem2";
					rsOpenItem = $(this).attr("rsItem");
					if(mallId !== 'null'){
						$('#rsAjaxTarget').empty();
						$('#rsAjaxTarget').append('<img class="ajaxLoaderLarge" src="/images/global/ajax-loader-large.gif" alt="" width="48" height="48"/>');
						mallId = 'null';
						$('#overlayRetailerShowcase .rsTitle span').text($('h2 span').text());
					}
					$("#overlayRetailerShowcase").css("top", $(window).scrollTop() + "px");
					
					$("#overlayRetailerShowcase").jqmShow();
					
				});
				
				if($(this).hasClass('resizable')){
					sliderResize();
				}
				
				//if($(this).width() < 570 && $(this).parent('.simonSlideContentHolder').width() > 230){
		    	//	$(this).parent().siblings('.simonSlideLeft').css('border','none');
		    	//	$(this).parent().siblings('.simonSlideLeft').children('a').hide();
		    	//	$(this).parent().siblings('.simonSlideRight').css('border','none');
		    	//	$(this).parent().siblings('.simonSlideRight').children('a').hide();
		    		//$(this).children(':last').css('background','none');
		    	//}
		    	
				setTimeout('centerCards()',100);
		    	
		    	if($(this).children('.simonSlidePod2').length > 0 && $(this).children('.simonSlidePod').length == 0 && $(this).parent().parent().parent().siblings('.podATop').children().children('.AdminEditLink').length == 0){
		    		$(this).parent().parent().parent().parent('.podA').hide();
		    	}
			
		});

		$(".btnSimonSlideRight").live('click', function() {
			var currClicked = $(this);
			//window.alert("right click");
			var widthDiff = $(this).closest(".simonSlideRight").siblings(".simonSlideContentHolder").children(".simonSlideContent").width() - $(this).closest(".simonSlideRight").siblings(".simonSlideContentHolder").width();
			if (-$(this).closest(".simonSlideRight").siblings(".simonSlideContentHolder").children(".simonSlideContent").position().left + 1 < widthDiff && $(currClicked).hasClass("enabled")) {
				$(currClicked).removeClass("enabled");
				var currCountLoc = $(this).closest(".simonSlideRight").siblings(".simonSlidePodCount");
				var currCount = currCountLoc.text();
				var nextPodWidth = $(this).closest(".simonSlideRight").siblings(".simonSlideContentHolder").children(".simonSlideContent").children("div").eq(currCount).width() + 1;
				$(this).closest(".simonSlideRight").siblings(".simonSlideContentHolder").children(".simonSlideContent").animate({ "left": "-=" + nextPodWidth + "px" }, "slow", function() {
					$(currClicked).addClass("enabled"); /// <reference path="file:///C:\Windows\TEMP\qao49v4a.bmp" />
				});
				currCount = (currCount * 1) + 1;
				currCountLoc.text(currCount);
			}//else{
			//	$(currClicked).removeClass("enabled");
			//	$(this).closest(".simonSlideRight").siblings(".simonSlideContentHolder").children(".simonSlideContent").animate({ "left": "0px" }, "slow", function() {
			//		$(currClicked).addClass("enabled");
			//	});
			//	$(this).closest(".simonSlideRight").siblings(".simonSlidePodCount").text('0');
			//}
		});

		$(".btnSimonSlideLeft").live('click', function() {
			var currClicked = $(this);
			if ($(this).closest(".simonSlideLeft").siblings(".simonSlideContentHolder").children(".simonSlideContent").position().left < 0 && $(currClicked).hasClass("enabled")) {
				$(currClicked).removeClass("enabled");
				var currCountLoc = $(this).closest(".simonSlideLeft").siblings(".simonSlidePodCount");
				var currCount = currCountLoc.text();
				var nextPodWidth = $(this).closest(".simonSlideLeft").siblings(".simonSlideContentHolder").children(".simonSlideContent").children("div").eq(currCount - 1).width() + 1;
				$(this).closest(".simonSlideLeft").siblings(".simonSlideContentHolder").children(".simonSlideContent").animate({ "left": "+=" + nextPodWidth + "px" }, "slow", function() {
					$(currClicked).addClass("enabled");
				});
				currCount = (currCount * 1) - 1;
				currCountLoc.text(currCount);
			}//else{
			//	$(currClicked).removeClass("enabled");
			//	var podWidth = 0;
			//	var containerWidthCount = $(this).closest(".simonSlideLeft").siblings(".simonSlideContentHolder").children(".simonSlideContent").children(".simonSlidePod").length;
			//	if($(this).closest(".simonSlideLeft").parent("#orderBuildCard").length > 0){
			//		containerWidthCount = containerWidthCount - 1;
			//	}else{
			//		containerWidthCount = containerWidthCount - 4;
			//	}
			//	for(i=0;i<containerWidthCount;i++){
			//		podWidth = podWidth + 1 + $(this).closest(".simonSlideLeft").siblings(".simonSlideContentHolder").children(".simonSlideContent").children(".simonSlidePod").eq(i).width();
			//	}
			//	$(this).closest(".simonSlideLeft").siblings(".simonSlideContentHolder").children(".simonSlideContent").animate({ "left": "-" +podWidth + "px" }, "slow", function() {
			//		$(currClicked).addClass("enabled");
			//	});
			//	$(this).closest(".simonSlideLeft").siblings(".simonSlidePodCount").text(containerWidthCount);
			//}
        });

        
    }

	if ($(".simonSlideContentVert").length > 0) {
		$(".simonSlideContentVert").each(function() {
			
				/* For giftcard slider to initialize */
				var initIndex = $("input[type=hidden][id*=sliderIndex]").val();
				if (initIndex != 'undefined'){
					InitVertSlider(initIndex);
				}
				if($(this).height() < 470){
		    		$(this).parent().siblings('.simonSlideTop').css({
		    			'border':'none',
		    			'background':'url(/images/global/slider-border-vert.png) left bottom repeat-x'
		    		});
		    		$(this).parent().siblings('.simonSlideTop').children('a').hide();
		    		$(this).parent().siblings('.simonSlideBottom').css({
		    			'border':'none',
		    			'background':'url(/images/global/slider-border-vert.png) left top repeat-x'
		    		});
		    		$(this).parent().siblings('.simonSlideBottom').children('a').hide();
		    		$(this).children(':last').css('background','none');
		    	}
	        
		});

		$(".btnSimonSlideBottom").click(function() {
		    var widthDiff = $(this).parent(".simonSlideBottom").siblings(".simonSlideContentHolderVert").children(".simonSlideContentVert").height() - $(this).parent(".simonSlideBottom").siblings(".simonSlideContentHolderVert").height();
		    if (-$(this).parent(".simonSlideBottom").siblings(".simonSlideContentHolderVert").children(".simonSlideContentVert").position().top + 1 < widthDiff) {
		    	$(this).parent(".simonSlideBottom").siblings(".simonSlideContentHolderVert").children(".simonSlideContentVert").animate({ "top": "-=155px" }, "slow");
		    }
		});

		$(".btnSimonSlideTop").click(function() {
		    if ($(this).parent(".simonSlideTop").siblings(".simonSlideContentHolderVert").children(".simonSlideContentVert").position().top < 0) {
		    	$(this).parent(".simonSlideTop").siblings(".simonSlideContentHolderVert").children(".simonSlideContentVert").animate({ "top": "+=155px" }, "slow");
		    }
		});

		function InitVertSlider(index) {
		    if (index > 0) {
		        var contentHolder = $(".simonSlideContentHolderVert");
		        var nextPodWidth = contentHolder.children(".simonSlideContentVert").children("div").eq(index).height() + 1;
		        contentHolder.children(".simonSlideContentVert").animate({ "top": "-=" + (nextPodWidth * index) + "px" }, "slow");
		        var currCountLoc = $(".simonSlideRight").siblings(".simonSlidePodCount");
		        currCountLoc.text(index);
		    }
		}
	}
	
	if(gup('rsc') === '1'){
		
		$('#overlayRetailerShowcase').jqmShow();
		
	}
	
	if(gup('tab') !== '' && gup('rsItem') !== ''){
		if(gup('tab') === '1'){
			rsOpenTab = "rsOpenTabItem1";
			rsOpenItem = gup('rsItem');
			$("#overlayRetailerShowcase").css("top", $(window).scrollTop() + "px");
			
			$("#overlayRetailerShowcase").jqmShow();
			
		}else if(gup('tab') === '2'){
			rsOpenTab = "rsOpenTabItem2";
			rsOpenItem = gup('rsItem');
			$("#overlayRetailerShowcase").css("top", $(window).scrollTop() + "px");
			
			$("#overlayRetailerShowcase").jqmShow();
			
		}
	}
	
	if(archivedEventID !== 'null'){
		$("#overlayRetailerShowcase").css("top", $(window).scrollTop() + "px");
		
		$("#overlayRetailerShowcase").jqmShow();
		
		$('#rsAjaxTarget').load('/ajax/overlay/getoverlaycontent.ashx?id=' + urlParamID, function() {
			$('.rsSect2BottomViewAllNewsEvents').hide();
			$('.rsSect2BottomPrevious').hide();
			$('.rsSect2BottomNext').hide();
			$('#rsTab1').hide();
			$('#overlayRetailerShowcase').append('<div id="navCoverPanels" style="position:absolute; z-index:1000; top:147px; left:9px; width:90px; height:474px;"></div>');
			$("#rsTab2").trigger("click");
			$.ajax({
			    url: '/ajax/overlay/getoverlayitems.ashx?type=2&output=3&eid=' + archivedEventID,
			    cache: true,
			    success: function(html){
					$('#rsContent2 .rsSect2Content').append(html);
					$('.rscLoading').fadeOut('slow',function(){
						numCont2Offers = $("#rsContent2 .rsSect2Offer").length;
						$("#rsContent2 .rsSect2Content").width(numCont2Offers * 630 + "px");
						$('#rsContent2 .rsSect2Content').addClass('contentLoaded');
						doTrackingCont2();
					});
			    }
			});
		});
	}

});



/* sIFR CONFIGURATION
---------------------------------------------------	*/

/*****************************************************************************
It is adviced to place the sIFR JavaScript calls in this file, keeping it
separate from the `sifr.js` file. That way, you can easily swap the `sifr.js`
file for a new version, while keeping the configuration.

You must load this file *after* loading `sifr.js`.

That said, you're of course free to merge the JavaScript files. Just make sure
the copyright statement in `sifr.js` is kept intact.
*****************************************************************************/

// Make an object pointing to the location of the Flash movie on your web server.
// Try using the font name as the variable name, makes it easy to remember which
// object you're using. As an example in this file, we'll use Futura.
var gothamMedium = { src: '../swf/gotham-medium.swf' };
var gothamBook = { src: '../swf/gotham-book.swf' };

// Now you can set some configuration settings.
// See also <http://wiki.novemberborn.net/sifr3/JavaScript+Configuration>.
// One setting you probably want to use is `sIFR.useStyleCheck`. Before you do that,
// read <http://wiki.novemberborn.net/sifr3/DetectingCSSLoad>.

// sIFR.useStyleCheck = true;

// Next, activate sIFR:
sIFR.activate(gothamMedium, gothamBook);

// If you want, you can use multiple movies, like so:
//
//	  var futura = { src: '/path/to/futura.swf' };
//	  var garamond = { src '/path/to/garamond.swf' };
//	  var rockwell = { src: '/path/to/rockwell.swf' };
//	  
//	  sIFR.activate(futura, garamond, rockwell);
//
// Remember, there must be *only one* `sIFR.activate()`!

// Now we can do the replacements. You can do as many as you like, but just
// as an example, we'll replace all `<h1>` elements with the Futura movie.
// 
// The first argument to `sIFR.replace` is the `futura` object we created earlier.
// The second argument is another object, on which you can specify a number of
// parameters or "keyword arguemnts". For the full list, see "Keyword arguments"
// under `replace(kwargs, mergeKwargs)` at 
// <http://wiki.novemberborn.net/sifr3/JavaScript+Methods>.
// 
// The first argument you see here is `selector`, which is a normal CSS selector.
// That means you can also do things like '#content h1' or 'h1.title'.
//
// The second argument determines what the Flash text looks like. The main text
// is styled via the `.sIFR-root` class. Here we've specified `background-color`
// of the entire Flash movie to be a light grey, and the `color` of the text to
// be red. Read more about styling at <http://wiki.novemberborn.net/sifr3/Styling>.
sIFR.replace(gothamBook, {
  selector: '#content_wLnav-R h2',
  css: '.sIFR-root { color: #221e19; }',
  transparent: 'true' 
});

sIFR.replace(gothamMedium, {
	selector: '#mallHomeBanner h2',
	css: '.sIFR-root { color: #ffffff; }',
	transparent: 'true',
	filters: {
		DropShadow: {
			knockout: false,
			distance: 2,
			color: '#000000',
			strength: 2
		}
	}
});

sIFR.replace(gothamBook, {
	selector: '#mallHomeBanner p',
	css: '.sIFR-root { color: #000000; }',
	transparent: 'true'
});


/*
 * jQuery UI 1.7.2
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI
 */
jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7.2",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m<n.length;m++){if(j.options[n[m][0]]){n[m][1].apply(j.element,k)}}}},contains:function(k,j){return document.compareDocumentPosition?k.compareDocumentPosition(j)&16:k!==j&&k.contains(j)},hasScroll:function(m,k){if(c(m).css("overflow")=="hidden"){return false}var j=(k&&k=="left")?"scrollLeft":"scrollTop",l=false;if(m[j]>0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var f=c.attr,e=c.fn.removeAttr,h="http:" + "/" + "/" + "www.w3.org/2005/07/aaa ",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var j;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return !!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(l,m){var k=l,j=this;if(typeof l=="string"){if(m===undefined){return this._getData(l)}k={};k[l]=m}c.each(k,function(n,o){j._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return !(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var j=this;this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;k.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);if(!this._mouseStarted){l.preventDefault();return true}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.browser.msie&&!j.button){return this._mouseUp(j)}if(this._mouseStarted){this._mouseDrag(j);return j.preventDefault()}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))}return !this._mouseStarted},_mouseUp:function(j){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);this._mouseStop(j)}return false},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)},_mouseDelayMet:function(j){return this.mouseDelayMet},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);;



/*
 * jQuery UI Accordion 1.7.2
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Accordion
 *
 * Depends:
 *	ui.core.js
 */
(function(a){a.widget("ui.accordion",{_init:function(){var d=this.options,b=this;this.running=0;if(d.collapsible==a.ui.accordion.defaults.collapsible&&d.alwaysOpen!=a.ui.accordion.defaults.alwaysOpen){d.collapsible=!d.alwaysOpen}if(d.navigation){var c=this.element.find("a").filter(d.navigationFilter);if(c.length){if(c.filter(d.header).length){this.active=c}else{this.active=c.parent().parent().prev();c.addClass("ui-accordion-content-active")}}}this.element.addClass("ui-accordion ui-widget ui-helper-reset");if(this.element[0].nodeName=="UL"){this.element.children("li").addClass("ui-accordion-li-fix")}this.headers=this.element.find(d.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){a(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){a(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){a(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){a(this).removeClass("ui-state-focus")});this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");this.active=this._findActive(this.active||d.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");this.active.next().addClass("ui-accordion-content-active");a("<span/>").addClass("ui-icon "+d.icons.header).prependTo(this.headers);this.active.find(".ui-icon").toggleClass(d.icons.header).toggleClass(d.icons.headerSelected);if(a.browser.msie){this.element.find("a").css("zoom","1")}this.resize();this.element.attr("role","tablist");this.headers.attr("role","tab").bind("keydown",function(e){return b._keydown(e)}).next().attr("role","tabpanel");this.headers.not(this.active||"").attr("aria-expanded","false").attr("tabIndex","-1").next().hide();if(!this.active.length){this.headers.eq(0).attr("tabIndex","0")}else{this.active.attr("aria-expanded","true").attr("tabIndex","0")}if(!a.browser.safari){this.headers.find("a").attr("tabIndex","-1")}if(d.event){this.headers.bind((d.event)+".accordion",function(e){return b._clickHandler.call(b,e,this)})}},destroy:function(){var c=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role").unbind(".accordion").removeData("accordion");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex");this.headers.find("a").removeAttr("tabindex");this.headers.children(".ui-icon").remove();var b=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active");if(c.autoHeight||c.fillHeight){b.css("height","")}},_setData:function(b,c){if(b=="alwaysOpen"){b="collapsible";c=!c}a.widget.prototype._setData.apply(this,arguments)},_keydown:function(e){var g=this.options,f=a.ui.keyCode;if(g.disabled||e.altKey||e.ctrlKey){return}var d=this.headers.length;var b=this.headers.index(e.target);var c=false;switch(e.keyCode){case f.RIGHT:case f.DOWN:c=this.headers[(b+1)%d];break;case f.LEFT:case f.UP:c=this.headers[(b-1+d)%d];break;case f.SPACE:case f.ENTER:return this._clickHandler({target:e.target},e.target)}if(c){a(e.target).attr("tabIndex","-1");a(c).attr("tabIndex","0");c.focus();return false}return true},resize:function(){var e=this.options,d;if(e.fillSpace){if(a.browser.msie){var b=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}d=this.element.parent().height();if(a.browser.msie){this.element.parent().css("overflow",b)}this.headers.each(function(){d-=a(this).outerHeight()});var c=0;this.headers.next().each(function(){c=Math.max(c,a(this).innerHeight()-a(this).height())}).height(Math.max(0,d-c)).css("overflow","auto")}else{if(e.autoHeight){d=0;this.headers.next().each(function(){d=Math.max(d,a(this).outerHeight())}).height(d)}}},activate:function(b){var c=this._findActive(b)[0];this._clickHandler({target:c},c)},_findActive:function(b){return b?typeof b=="number"?this.headers.filter(":eq("+b+")"):this.headers.not(this.headers.not(b)):b===false?a([]):this.headers.filter(":eq(0)")},_clickHandler:function(b,f){var d=this.options;if(d.disabled){return false}if(!b.target&&d.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");var h=this.active.next(),e={options:d,newHeader:a([]),oldHeader:d.active,newContent:a([]),oldContent:h},c=(this.active=a([]));this._toggle(c,h,e);return false}var g=a(b.currentTarget||f);var i=g[0]==this.active[0];if(this.running||(!d.collapsible&&i)){return false}this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");if(!i){g.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").find(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected);g.next().addClass("ui-accordion-content-active")}var c=g.next(),h=this.active.next(),e={options:d,newHeader:i&&d.collapsible?a([]):g,oldHeader:this.active,newContent:i&&d.collapsible?a([]):c.find("> *"),oldContent:h.find("> *")},j=this.headers.index(this.active[0])>this.headers.index(g[0]);this.active=i?a([]):g;this._toggle(c,h,e,i,j);return false},_toggle:function(b,i,g,j,k){var d=this.options,m=this;this.toShow=b;this.toHide=i;this.data=g;var c=function(){if(!m){return}return m._completed.apply(m,arguments)};this._trigger("changestart",null,this.data);this.running=i.size()===0?b.size():i.size();if(d.animated){var f={};if(d.collapsible&&j){f={toShow:a([]),toHide:i,complete:c,down:k,autoHeight:d.autoHeight||d.fillSpace}}else{f={toShow:b,toHide:i,complete:c,down:k,autoHeight:d.autoHeight||d.fillSpace}}if(!d.proxied){d.proxied=d.animated}if(!d.proxiedDuration){d.proxiedDuration=d.duration}d.animated=a.isFunction(d.proxied)?d.proxied(f):d.proxied;d.duration=a.isFunction(d.proxiedDuration)?d.proxiedDuration(f):d.proxiedDuration;var l=a.ui.accordion.animations,e=d.duration,h=d.animated;if(!l[h]){l[h]=function(n){this.slide(n,{easing:h,duration:e||700})}}l[h](f)}else{if(d.collapsible&&j){b.toggle()}else{i.hide();b.show()}c(true)}i.prev().attr("aria-expanded","false").attr("tabIndex","-1").blur();b.prev().attr("aria-expanded","true").attr("tabIndex","0").focus()},_completed:function(b){var c=this.options;this.running=b?0:--this.running;if(this.running){return}if(c.clearStyle){this.toShow.add(this.toHide).css({height:"",overflow:""})}this._trigger("change",null,this.data)}});a.extend(a.ui.accordion,{version:"1.7.2",defaults:{active:null,alwaysOpen:true,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()==location.href.toLowerCase()}},animations:{slide:function(j,h){j=a.extend({easing:"swing",duration:300},j,h);if(!j.toHide.size()){j.toShow.animate({height:"show"},j);return}if(!j.toShow.size()){j.toHide.animate({height:"hide"},j);return}var c=j.toShow.css("overflow"),g,d={},f={},e=["height","paddingTop","paddingBottom"],b;var i=j.toShow;b=i[0].style.width;i.width(parseInt(i.parent().width(),10)-parseInt(i.css("paddingLeft"),10)-parseInt(i.css("paddingRight"),10)-(parseInt(i.css("borderLeftWidth"),10)||0)-(parseInt(i.css("borderRightWidth"),10)||0));a.each(e,function(k,m){f[m]="hide";var l=(""+a.css(j.toShow[0],m)).match(/^([\d+-.]+)(.*)$/);d[m]={value:l[1],unit:l[2]||"px"}});j.toShow.css({height:0,overflow:"hidden"}).show();j.toHide.filter(":hidden").each(j.complete).end().filter(":visible").animate(f,{step:function(k,l){if(l.prop=="height"){g=(l.now-l.start)/(l.end-l.start)}j.toShow[0].style[l.prop]=(g*d[l.prop].value)+d[l.prop].unit},duration:j.duration,easing:j.easing,complete:function(){if(!j.autoHeight){j.toShow.css("height","")}j.toShow.css("width",b);j.toShow.css({overflow:c});j.complete()}})},bounceslide:function(b){this.slide(b,{easing:b.down?"easeOutBounce":"swing",duration:b.down?1000:200})},easeslide:function(b){this.slide(b,{easing:"easeinout",duration:700})}}})})(jQuery);;


