function handlePnBEquipmentError(xhr, status, error)
{
    var errMsg = getErrorMessage(xhr,status,error);
    $("#ajaxContentContainer").html('<div class="largeGboxContainer"><span class="errorMessage">'+errMsg+'</span></div>');
}

$(document).ready(function() {
    $("[id$='btnContinue']").unbind("click").bind("click", SaveToCart);
    //Add click Event to SaveToTrip
    $("[id$='hlSave']").click(SaveToCart);
    DeactiveRemoveLink();
    displayContinueModal();

    var w = '';

    if ($('[id$=hdnMapDimensions]').length > 0) {
        w = Number($('[id$=hdnMapDimensions]').val().split(',')[0]);
    }
    if (w >= 960 || w == '') {
        w = 960;
    }

    //setting up the modal window attributes
    $('.equipmentRentalLocationMapModal').dialog({
        bgiframe: true,
        autoOpen: false,
        width: w,
        modal: true,
        resizable: false,
        position: 'center',
        closeOnEscape: true
    });

    attachFilterEvents(w);


    //setting up the modal window attributes

    $('.divShowWhatsThis').dialog({
        bgiframe: true,
        autoOpen: false,
        width: 460,
        height: 250,
        modal: true,
        resizable: false,
        position: 'center',
        closeOnEscape: true
    });


    $('.openModalWhatsThis').click(function() {
        try {
            $('.divShowWhatsThis').dialog('open');
        }
        catch (e) {
        }
        return false;
    });

    // accordian
    if ($('.accordion').text()) {
        $('.accordion').accordion({
            header: '.heading',
            collapsible: true
        });
    }

    
    if($('#beavercreek').length >0)
    {    
        if(jQuery.browser.msie)
        {
         $('.singleColumn .equipmentRentalContainer ').css('padding','0 10px')
        }
    }

});

//Function Name : displayContinueModal
//Purpose : This function is used to open modal window
//Parameters : NA

function displayContinueModal(){

	$('.saveToTripDialog').dialog({
	   bgiframe: true,
		autoOpen: false,
		width: 960,
		height:620,
		modal: true,
		resizable: false,
		position: 'center',
		closeOnEscape: true
	});
	// Open dialog for lists
	
	$('.lgbSave .linkSave').unbind("click").bind("click", function(e) 
	{	
	    e.preventDefault();
	    var urlContent = $(this).attr('href');	
	            
	   $('body > .ui-dialog .saveToTripDialog iframe')
	        .attr('src',urlContent)
	        .attr('width','100%')
	        .attr('height','100%')
	        .attr('scrolling','no');	        
	    $('body > .ui-dialog .saveToTripDialog').dialog('open');
	    
        return false;
    })
	// Open dialog for bucket
	$('.linkLeftAligned').click(function(e) {
	    e.preventDefault();
	    if($("#droppable ul li").length <= 0)
        {
            var divError = $("#customErrorMessages")
            var errorMsg = "<span id='lblErrorMessage' class='errorMessage'>Please select a product before proceeding.</span>"; 
            divError.html(errorMsg);
		    return false;		
	    }  

	     // grabs url from href and loads it into the modal window
	    var hd = $("[id$='_hdEquipments']"); 
	    var hdnField = hd.val();
	    var urlContent = $(this).attr('href') + "&ProductId=" + hdnField;    


	    $('.saveToTripDialog iframe')
	        .attr('src',urlContent)
	        .attr('width','100%')
	        .attr('height','100%')
	        .attr('scrolling','no');
	        
	    $('.saveToTripDialog').dialog('open');
        return false;
    })
};

//Function Name : attachFilterEvents
//Purpose : This function is used to bind all the required events to the controls
//Parameters : NA
function attachFilterEvents(w){
	$('.equipmentRentalLocationMap').click(function(e) {
		e.preventDefault();
		// grabs url from href and loads it into the modal window
		var urlContent = $(this).attr('href');
		$(".equipmentRentalLocationMapModal img").attr("src", "").attr("src", urlContent).attr("width", w-20);
		//$('#iframeloadMap').attr('src',urlContent).attr('width','100%').attr('height','100%').attr('scrolling','auto');
		$('.equipmentRentalLocationMapModal').dialog('open');
		return false;
	})
};


	$(function() {

	    $("[id$='btnContinue']").click(SaveToCart);
	    var fullURL = parent.document.URL.toLowerCase();
	    var filterCriteria;
	    var SelectedValue = $("select.ddlEquipRentalSelect").val();
	    var StartDate = $("[id$='_txtStartDate']").val();
	    if (fullURL.indexOf('search=') != -1) 
	    {
	        var hdEdidtedProductSKU = $("[id$='_hdEditedProductSKU']");
	        var extractURL = fullURL.substring(fullURL.indexOf('search=') + 7, fullURL.length);
	        var searchCriteria = extractURL.toString().split(',');
	        var sku = searchCriteria[1];
	        var sellingComponentCode = searchCriteria[3];
	        filterCriteria = StartDate + "," + SelectedValue + "," + sku + "," + sellingComponentCode;	        
	    }
	    else 
	    {
	        filterCriteria = StartDate + "," + SelectedValue;
	    }
	    // Set the Email Href value
	    var newurl = $("input[id$=hidEmailVacation]").val() + '?Search=' + StartDate;
        $(".emailVacationLink").attr('href',newurl);
        
	    if ($("input[id$=hdnIsEquipmentRentalSaleable]").val().toLowerCase() == 'false') 
	    {
	        $(".listFilterContainer").addClass("hideDiv");
	        $(".liftTicketContainer").addClass("hideDiv");
	        $(".liftTicketListFilters ").addClass("hideDiv");
	    }
	    else 
	    {
			initInterstitial();
	        $("#ajaxContentContainer").showLoading({loadingStr: "Please wait a moment while we search for your results", autoFocus: false});
	        $.ajax
            ({
                type: "POST",
                url: "/vailresorts/sites/PlanningAndBooking/WebServices/EquipmentRental.svc/GetEquipmentRentalResults",
                async: true,
                data: "{\"filterCriteria\" : \"" + filterCriteria + "\"}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function(msg) {
                    
                    if ($.browser.msie) 
                    {
//                        $(window).load(function() {
                            RenderHTML(msg);
                            var hdnval = $("input.txtSearchClass").val();
                            if (hdnval != "") {
                                
                                var arrSearch = hdnval.toString().split(',');
                                if (arrSearch.length == 6) {
                                    AddEditedItemToBucket(arrSearch[0], arrSearch[1], arrSearch[2], arrSearch[3], arrSearch[4], arrSearch[5]);
                                }
                            }
                            $(".selectThis").unbind('click').bind('click',function(){
                                animateToTray($(this));
                            })                 
//                        });
                    } 
                    else 
                    {
                        RenderHTML(msg);
                        var hdnval = $("input.txtSearchClass").val();
                        if (hdnval != "")
                        {
                            var arrSearch = hdnval.toString().split(',');
                            if (arrSearch.length == 6)
                            {
                                AddEditedItemToBucket(arrSearch[0], arrSearch[1], arrSearch[2], arrSearch[3], arrSearch[4], arrSearch[5]);
                            }
                        }
                    
                    TagEquipmentRentalResults();
                    $(".selectThis").unbind('click').bind('click',function(){
                        animateToTray($(this));
                    })                 
                }
                
                if($("input[id$=hdnDataCount]").length > 0)
                {
                    SetStartDate($("input[id$=hdnDataCount]").val());
                }
                hideInterstitial();
              },
                error: function(xhr, status, error) {
                    handlePnBEquipmentError(xhr, status, error);
                }
            });
	    }


 
	    //Ajax Call to the Equipment rental Service
	    $("select.ddlEquipRentalSelect").change(function() {

	        var StartDate = $("[id$='_txtStartDate']").val();
	        if (StartDate != "") {
	            var SortValue = $("select.ddlEquipRentalSelect").val();
	            var minDay = $("#hidMinDays").val();
	            var maxDay = $("#hidMaxDays").val();
	            var EquipmentType = GetEquipmentType();                
	            var filterCriteria = StartDate + "," + SortValue + "," + minDay  + "," + maxDay + "," + EquipmentType;
	            
				initInterstitial();
	            $("#ajaxContentContainer").showLoading({loadingStr: "Please wait a moment while we search for your results", autoFocus: false});
	            $.ajax
                ({
                    type: "POST",
                    url: "/vailresorts/sites/PlanningAndBooking/WebServices/EquipmentRental.svc/GetEquipmentRentalFilteredResults",
                    data: "{\"filterCriteria\" : \"" + filterCriteria + "\"}",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function(msg) {
                        RenderHTML(msg);
                        $(".selectThis").unbind('click').bind('click',function(){
                            animateToTray($(this));
                        })                 
                        hideInterstitial();
                    },
                    error: function(xhr, status, error) {
                        handlePnBEquipmentError(xhr, status, error);
                    }
                });
	        }
	        else {
	            var SortValue = $("select.ddlEquipRentalSelect").val();
	            var minDay = $("#hidMinDays").val();
	            var maxDay = $("#hidMaxDays").val();
	            var EquipmentType = GetEquipmentType();                
	            var filterCriteria = "InvalidDate" + "," + SortValue + "," + minDay  + "," + maxDay + "," + EquipmentType;
				initInterstitial();
	            $("#ajaxContentContainer").showLoading({loadingStr: "Please wait a moment while we search for your results", autoFocus: false});
	            $.ajax({
					type: "POST",
					url: "/vailresorts/sites/PlanningAndBooking/WebServices/EquipmentRental.svc/GetEquipmentRentalFilteredResults",
					data: "{\"filterCriteria\" : \"" + filterCriteria + "\"}",
					contentType: "application/json; charset=utf-8",
					dataType: "json",
					success: function(msg) {
						RenderHTML(msg);
						$(".selectThis").unbind('click').bind('click',function(){
							animateToTray($(this));
						})   
						hideInterstitial();
					},
					error: function(xhr, status, error) {
						handlePnBEquipmentError(xhr, status, error);
					}
				});
	        }

	    });


       
	    $(".equipmentSplList .collapsibleLink").click(function() {
	        var $childLayer = $(this).parents("li").find("ul");
	        var me = this;
	        $childLayer.slideToggle(350, function() {
	            if ($childLayer.css("display") == "none") {
	                $(me).attr("src", "/VailResorts/sites/PlanningAndBooking/assets/img/iconPlus.gif");
	            } else {
	                $(me).attr("src", "/VailResorts/sites/PlanningAndBooking/assets/img/iconMinus.gif");
	            }
	        });
	    });

	    $("li.equipTypeItem input.btnChkbox").click(function() {
	        var clsName = getEquipClassName(this);
	        if (this.checked) {
	            $("ul.draggableArea ." + clsName).show();
	            
	        } else {
	            $("ul.draggableArea ." + clsName).hide();
	        }
	        	        

	    });

	    //ticketFilter(1, 7); // Forcefully filter the results. Default Setting.
	    $("#daySlider").slider({
	        animate: true,
	        range: true,
	        min: 1,
	        max: 7,
	        step: 1,
	        values: [1, 7],
	        change: function(event, ui) {
	            // Set the min & max days of slider in hidden variable
	            $("#hidMinDays").val(ui.values[0]);
	            $("#hidMaxDays").val(ui.values[1]);
	            ticketFilter(ui.values[0], ui.values[1]);
	        }
	    });

	    //Init datepicker calendar
	    var cal = $("input[name='startDateTextField']").datepicker({
	        showOn: 'button',
	        buttonImage: 'assets/img/icon_calender.gif',
	        buttonImageOnly: true,
	        maxDate: '+1y',
	        minDate: '0',
	        onSelect: function(dateText, inst) { updateSeason(this) }
	    });
	    $("#startDatePicker").click(function() {
	        $("input[name='startDateTextField']").datepicker('show');
	    });

	    $('div#iFrameModal').dialog({
	        bgiframe: true,
	        autoOpen: false,
	        width: 700,
	        height: 600,
	        modal: true,
	        resizable: false,
	        position: 'center',
	        closeOnEscape: true
	    });
	    $(".mapOfLocations").click(function() {
	        var mapUrl = $(this).attr('href');
	        $('div#iFrameModal iframe').attr({
	            src: mapUrl,
	            width: '100%',
	            height: '100%',
	            scrolling: 'no'
	        });
	        $('div#iFrameModal').dialog('open');
	        return false;
	    });



	    $('#equipWhatIsThisDialog').dialog({
	        bgiframe: true,
	        autoOpen: false,
	        width: 960,
	        modal: true,
	        resizable: false,
	        position: 'center',
	        closeOnEscape: true
	    });
	    //$(".equipWhatIsThisLink a").click(function() {
	        //var urlContent = $(this).attr('href');
	        
	          //  $('#equipWhatIsThisDialog').dialog('close').load(urlContent, function() {
	            //    $('#equipWhatIsThisDialog').dialog('open');
	            //});
	         
	            //return false;
	        
	    //});
	});

function getEquipClassName(obj){
	var clsNameStart 	= obj.className.indexOf("equip-");
	var clsNameEnd 		= obj.className.indexOf(" ", clsNameStart) >= 0 ? obj.className.indexOf(" ", clsNameStart) : obj.className.length;
	var clsName 		= obj.className.substring(clsNameStart, clsNameEnd);
	return clsName;
}

function ticketFilter(minDays,maxDays){
	var arrRows = $("div.largeGbox");
	arrRows.find(".lgbDays span:first").each(function (i) 
	{
	    
		if ( parseInt($(this).html()) >= parseInt(minDays) && parseInt($(this).html()) <= parseInt(maxDays) ) 
		{
			$(arrRows[i]).parents("li").show();
		} 
		else 
		{
			$(arrRows[i]).parents("li").hide();
		}
				
	});
	$(".draggableArea li").removeClass("first");
	$(".draggableArea li:visible:first").addClass("first");	
	
	if ( $(".draggableArea li:visible").length > 0 ){
	    $(".largeGboxContainer .errorMessage").addClass( "hideDiv" );
	} else {
	    $(".largeGboxContainer .errorMessage").removeClass("hideDiv");
	}
}

function addTicketToTray(draggedObj){ //alert('hi003');
	var droplet = $("#dropTemplate :first").clone().appendTo(
		$("<li></li>").appendTo("#droppable ul")
	);
	
	var hiddenSelectedSKU = droplet.find("input[name='hdSelectedSKU']");
	var hiddenSelectedSCCode = droplet.find("input[name='hdSelectedSellingCompCode']");
	var hiddenSelectedPStartDate =  droplet.find("input[name='hdSelectedPStartDate']");
	
	hiddenSelectedSKU.val(draggedObj.find(".lgbMoreInfoDialogContent .hdSKU #hdEquipmentSKU").val());
	hiddenSelectedSCCode.val(draggedObj.find(".lgbMoreInfoDialogContent .hdSKU #hdSellingCompCode").val());
	hiddenSelectedPStartDate.val(draggedObj.find(".lgbMoreInfoDialogContent .ProductStartDate .hdPStartDate").val());	
	
	droplet.find(".type").html(
		draggedObj.find(".lgbTitle h4").html()
	);
	droplet.find(".days").html(
		draggedObj.find(".lgbDays").html()
	);
	droplet.find(".amount").html(
		draggedObj.find(".lgbAmount").html()
	);
	droplet.find(".iconDelete").click(function(){
		$(this).parents("li").remove();
		DeactiveRemoveLink();
	})
	//var ticketID = draggedObj.find(".hiddenTicketID").html();
	//droplet.find("input[name='purchasedTicketID']").attr("value",ticketID);
	if($("#droppable ul li").length > 0)
    {
        ActiveRemoveLink();
        var divError = $("#customErrorMessages")
        divError.html('');
	}    
}

function clearPurchaseTray(){
	$(".dropItem li").not("#hiddenDroppableTicketTemplate").remove();
	DeactiveRemoveLink();
}


    
 function  equipmentRentalFilter()
 {  
    var StartDate=$("[id$='_txtStartDate']").val();    
    if(StartDate!="")
    {
        $("[id$='_reqdStartDateValidator']").hide();
        var SortValue = $("select.ddlEquipRentalSelect").val();
        var EquipmentType = GetEquipmentType();
        var filterCriteria=StartDate+","+SortValue+","+EquipmentType;          
        // Set the Email Href value
	    var newurl = $("input[id$=hidEmailVacation]").val() + '?Search=' + StartDate;
        $(".emailVacationLink").attr('href',newurl);
        
		initInterstitial();
        $("#ajaxContentContainer").showLoading({loadingStr: "Please wait a moment while we search for your results", autoFocus: false}); 
        $.ajax
            ({
                type: "POST",
                url: "/vailresorts/sites/PlanningAndBooking/WebServices/EquipmentRental.svc/GetEquipmentRentalFilteredResults",
                data: "{\"filterCriteria\" : \""+filterCriteria+"\"}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function(msg)
                { 
                    RenderHTML(msg);        
                    // Modal dialog for save
                    displayContinueModal();
                    $(".selectThis").unbind('click').bind('click',function(){
                    animateToTray($(this));
                    })                 
                    hideInterstitial();
                },
                error: function(xhr, status, error) {
                    handlePnBEquipmentError(xhr, status, error);
                }
            });
      
     }
     else
     {
        $("[id$='_reqdStartDateValidator']").show();
     }
}


function SelectEquipmentFilters()
{

var StartDate=$("[id$='_txtStartDate']").val();
var SortValue = $("select.ddlEquipRentalSelect").val();
var EquipmentType="";
if($("#equipTypeSkiing").is(":checked")==true && $("#equipTypeSnowboarding").is(":checked")==true)
{    
    EquipmentType=$("#equipTypeSkiing").val()+"~"+$("#equipTypeSnowboarding").val();
}
else if($("#equipTypeSkiing").is(":checked")==true && $("#equipTypeSnowboarding").is(":checked")==false)
{   
    EquipmentType=$("#equipTypeSkiing").val()+"~";
}
else if($("#equipTypeSkiing").is(":checked")==false && $("#equipTypeSnowboarding").is(":checked")==true)
{     
     EquipmentType="~"+$("#equipTypeSnowboarding").val();
}
else
{    
    EquipmentType="undefined";
}

var filterCriteria=StartDate+","+SortValue+","+EquipmentType;
    initInterstitial();
    $("#ajaxContentContainer").showLoading({loadingStr: "Please wait a moment while we search for your results", autoFocus: false});
	$.ajax({
		type: "POST",
		url: "/vailresorts/sites/PlanningAndBooking/WebServices/EquipmentRental.svc/GetEquipmentRentalFilteredResults",
		data: "{\"filterCriteria\" : \""+filterCriteria+"\"}",
		contentType: "application/json; charset=utf-8",
		dataType: "json",
		success: function(msg)
		{ 
		
		   RenderHTML(msg);
		   $(".selectThis").unbind('click').bind('click',function(){
				animateToTray($(this));
			})
			if($("#hidMinDays").val().length > 0)
			{
			ticketFilter($("#hidMinDays").val(), $("#hidMaxDays").val());   
			}              
			hideInterstitial();
		},
		error: function(xhr, status, error) {
			handlePnBEquipmentError(xhr, status, error);
		}
	});
   
}


    function RenderHTML(msg)
    {
        $('#ajaxContentContainer').removeClass('loading');
        $('#ajaxContentContainer').html(msg.d);
//        $(".gBox").gBox
//        ({
//            theme: "gradientBox",
//            callback: function()
//            {
                $(".draggable").show();
//            }			
//        });
        $(".draggableArea li:first").addClass("first");
        
	    if ($("#dialogContainer").length == 0) {
	        $("body").append('<div id="dialogContainer"></div>');
	        $('#dialogContainer').dialog({
		        bgiframe: true,
		        autoOpen: false,
		        width: 500,
		        modal: true,
		        resizable: false,
		        position: 'center',
		        closeOnEscape: true
	        });
	    }
	    $("a.lgbMoreInfo").click(function(){
		    var content = $(this).next(".lgbMoreInfoDialogContent").html();
		    //$('#dialogContainer').html("<div class='gradientBox'>" + content + "</div>").dialog('open');
		      $('#dialogContainer').html('<div class="gBoxWrapper"><div class="gradientBoxTopLeft"><span></span></div><div class="gradientBoxMiddleLeft"><div class="gradientBoxMiddleRight"><div class="gradientBoxContentWrapper gBoxContentContainer">' +  content  + '</div></div></div><div class="gradientBoxBottomLeft"><span></span></div></div>').dialog('open');
			//$(".gradientBox").gBox({ theme:"gradientBox"});

		    return false;
	    });

        $(".draggable").draggable({
            helper: 'clone',
            start: function(event, ui){
                ui.helper.css("width", $(this).outerWidth());
            }
        });//Make ticket price boxes draggable
        $("#droppable").droppable
        ({
            drop: function(event, ui)
            {
                addTicketToTray(ui.draggable);
            },
			tolerance: "touch"
        });
		displayContinueModal();
    }
    
    
    function SaveToCart()
    {
        
        if($("#droppable ul li").length <= 0)
        {
            var divError = $("#customErrorMessages")
            var errorMsg = "<span id='lblErrorMessage' class='errorMessage'>Please select a product before proceeding.</span>"; 
            divError.html(errorMsg);
		    return false;		
	    }    
        var hd=$("[id$='_hdEquipments']");      
        hd.val("");
        $('.dropItem li').each(function(i){              
           if(hd.val()=='')
            {
                hd.val($(this).find('.boxData #hdSelectedSKU').val() + '|' + $(this).find('.boxData #hdSelectedPStartDate').val()+ '|' + $(this).find('.boxData #hdSelectedSellingCompCode').val());
            }
            else
            {
                hd.val(hd.val()+','+$(this).find('.boxData #hdSelectedSKU').val() + '|' + $(this).find('.boxData #hdSelectedPStartDate').val()+ '|' + $(this).find('.boxData #hdSelectedSellingCompCode').val());
            }
        }); 
        if(hd.val()=='')
        {
            return false;
        }
        return true;
    }
    
    ///<summary>
    ///This method is used to add the edited product to the bucket
    ///</summary>
    function AddEditedItemToBucket(sku,startDate,price,name,noOfDays,sellingComponentCode)
    {        
        var ul=$('.dropTray .dragDropBoxMiddle #droppable .dropItem');
        var hdStartDate="<input id='hdSelectedPStartDate' name='hdSelectedPStartDate' type='hidden' value='" + startDate + "'/>";
        var hdSKU="<input id='hdSelectedSKU' name='hdSelectedSKU' type='hidden' value='" + sku + "'/>";
        var hdSCC="<input id='hdSelectedSellingCompCode' name='hdSelectedSellingCompCode' type='hidden' value='"+sellingComponentCode+"'/>";
        var spanImage="<span class='iconDelete'><img alt='Delete' src='/VailResorts/sites/PlanningAndBooking/assets/img/iconDelete.gif'/></span>";
        var spanName="<h6><span class='type'>"+name+"</span>- <span class='days'>"+noOfDays+" Days</span></h6>";
        var spanPrice="<span class='amount'>$"+price+"</span>";
        ul.html("<li><div class='boxData clearfix'>"+spanImage+" "+ hdSKU + " " + hdSCC + " "+ hdStartDate+" "+spanName+" "+spanPrice+ " </div></li>");
        $(".dropTray .dragDropBoxMiddle #droppable .dropItem .boxData .iconDelete").click(function(){
		$(this).parents("li").remove();
		DeactiveRemoveLink(); })
		ActiveRemoveLink();
    }
    
     //This method enable the 'Remove Link' when user add product to purchase tray.
 function ActiveRemoveLink()
 {
  		if($("#droppable ul li").length > 0)
        {
            $(".linkClear").attr("href","javascript:clearPurchaseTray();");
	        $(".linkClear").attr("style"," ");
	    }

 }
 
 //This method disable the 'Remove Link' when user remove all the products from purchase tray.
 function DeactiveRemoveLink()
 {
 		if($("#droppable ul li").length == 0)
        {
            $(".linkClear").css("color","#666");
            $(".linkClear").attr("href","javascript:void(0);");
            $(".linkClear").css("cursor","text");
            $(".linkClear").css("textDecoration","none");
	    }

 }
    

function animateToTray(obj){
	var clickedItem = obj.closest(".draggable");
	var animationObj = clickedItem.clone();
	var myParentContainer = obj.closest("li");
	var positionX = clickedItem.offset().left+"px";
	var positionY = clickedItem.offset().top+"px";
	var purchaseTray = $(".dottedBoxTop").offset();
	var endPosX = purchaseTray.left-180;
	var endPosY = purchaseTray.top+60;
	var notificationBubble = "<div class='addedToCartBubble'>Added to Purchase Tray</div>";
	animationObj.css({
		'position':'absolute',
		'top': positionY,
		'left' : positionX,
		'z-index':9999
	});
	animationObj.prependTo(myParentContainer);
	//notificationBubble.prependTo(myParentContainer);

	animationObj.animate( {
		'top':endPosY,
		'left':endPosX
	}, 800,function(){
		addTicketToTray(animationObj);
		$(this).fadeOut(function(){
			$(this).remove();
		});
	});
}

function GetEquipmentType()
{
    var EquipmentType="";
    if($("#equipTypeSkiing").is(":checked")==true && $("#equipTypeSnowboarding").is(":checked")==true)
    {  
        EquipmentType=$("#equipTypeSkiing").val()+"~"+$("#equipTypeSnowboarding").val();
    }
    else if($("#equipTypeSkiing").is(":checked")==true && $("#equipTypeSnowboarding").is(":checked")==false)
    {   
        EquipmentType=$("#equipTypeSkiing").val()+"~";
    }
    else if($("#equipTypeSkiing").is(":checked")==false && $("#equipTypeSnowboarding").is(":checked")==true)
    { 
        EquipmentType="~"+$("#equipTypeSnowboarding").val();
    }
    else
    {    
        EquipmentType="undefined";
    }
    
    return EquipmentType;
}

function SetStartDate(startDate)
{
    $("[id$='_txtStartDate']").val(startDate);
    $("input[id$=hdnDataCount]").val('');
    
}
