﻿// functions needed to use the OLSSiteControls Library

var _sHiddenButtonID = "ctl00_MainContent_btnHiddenUpdate"
function __doSort(sSortExpression) 
{
    var hdnSortBy = $get('__SORTBY');
    var hdnActionIndicator = $get('__REPEATERACTION')
    if (hdnSortBy) 
    {
        hdnActionIndicator.value = "sort"
        hdnSortBy.value = sSortExpression;
        $get(_sHiddenButtonID).click()
    } 
}
function __doPaginateLink(page) 
{
    var hdnNextPage = $get('__NEXTPAGE');
    var hdnActionIndicator = $get('__REPEATERACTION')
    if (hdnNextPage) 
    {
        hdnActionIndicator.value = "page"
        hdnNextPage.value = page;
        $get(_sHiddenButtonID).click()
    }
}
function __doRefinement()
{
    var element =  $get('__REFINEMENT');
    if(element)
    {
        element.value = true;
        $get(_sHiddenButtonID).click()       
    }
}
function OlsSiteControlsLibIni()
{
    //this will allow the variable that hold the paging and sorting to be reset. If they are not reset 
    //the paging and sorting events will continue to fire when this page is posted back
    try
    {
        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(RepeaterCompleted);
    }catch(e){;}       
}
function RepeaterStarted(sender, args)
{
//    var hdnAnimationControlID = $get("hdnAnimationControlID")
//    if(hdnAnimationControlID != null)
//    {
//        oAnimationTarget = $get(hdnAnimationControlID.value);
//        if(oAnimationTarget != null)
//        {
            o = $get("objViewEvents_Repeater_Results")
            for(var i=0; i < o.childNodes.length;i++)
            {
                AjaxControlToolkit.Animation.FadeOutAnimation.play("objViewEvents_Repeater_Results")
            }
            
            //alert(oAnimationTarget)
//        }
   // }
}
function RepeaterCompleted(sender, args)
{
    var hdnActionIndicator = $get('__REPEATERACTION')
    if (hdnActionIndicator) 
        hdnActionIndicator.value = "";
}

function DateIsValid(source, clientside_arguments)
{         
  clientside_arguments.IsValid = Date.parse(clientside_arguments.Value); 
}

function ShowVenueMapPopup(venueID, eventID)
{
	try {_bShowCoupon = false; }
    catch (e) {;}
	var sTarget = 'http://tickettransaction.com/VenueInformation.aspx?VenueID=' + venueID + '&eventID=' + eventID;
    var win = window.open(sTarget,'popup','width=800,height=700,toolbar=0,location=0,directories=0,status=0,scrollbars=1,menubar=0,resizable=0')
    win.focus()	
}
