var updateInterval = null;   


// INITIAZIE REQUEST *******************************************
  function InitializeRequest(sender, args){
      // needed for credit card processing.
         //Disables the page from making any callbacks if another one is already in progress
     if (prm.get_isInAsyncPostBack() ) 
     {
         alert('The web site was in the middle of completing an update when you made another request. This initial update is now complete so please try your action again. \n (This is an information message and not a system error message)'); 
         prm.abortPostBack();                 //cancels current request
         args.set_cancel(true);               //cancels new request
     }

 }

 //** REGISTER AJAX FUNCTIONS ***********************
 function registerAjaxFunctions() {
     //We could register functions as recomended in the above function however there is a bug where each time an update panel does a ajax request
     //The handling functions are added so if there are 10 requests then the added functions are called 10 times.
     //Only want one function pass
     Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(pageLoaded);
 }

 function pageLoaded() {
         if (prm.get_isInAsyncPostBack() )
         {
            //Cufon.refresh("content");
         }
         else
         {
             $( '.button' ).each( function ()
             {
                 $( this ).after( unescape( '%3Cspan class="button"%3Eaa%3C/span%3E' ) );
                 $( this ).hide();
                 $( this ).next( 'span.button' ).text( $( this ).val() ).click( function ()
                 {
                     $( this ).prev( 'input.button' ).click();
                 } );
             } );

             Cufon.replace( '.button', {} );
             Cufon.replace( 'h1' );
             Cufon.replace( 'h2' );
             Cufon.replace( 'h3' );
             Cufon.replace( 'h4' );
             Cufon.replace( '.button2', { hover: 'true' } );
             Cufon.now();
         }
    }
  
   // SHOW RECEIPT **************************************************
   function showReceipt()
   {
        var a = window. open('','','scrollbars=yes');
        a.document.open("text/html");
        a.document.write('<html><head><link rel="stylesheet" href="css/Styles.css" /><style type="text/css">#frame{background-image:none;background-color:#FFFFFF;}</style></head><body style="padding-left:20px;background-image:none;background-color:#FFFFFF;text-align:center;">');
        a.document.write($get('print').innerHTML);
        a.document.write('</body></html>');
        a.document.close();
        a.print();
    }
    
    // CHANGE INPUT TYPE ***********************************************
    function changeInputType(obj)
    {
        if(obj.getAttribute('type')=='text')
        { 
            obj.setAttribute('type','password');
        }else
        {
            obj.setAttribute('type','text');
        }
        obj.focus();    
    }
    
     //DISABLE ENTER KEY - Uses to determine when to intiate a search *********************************
    function disableEnterKey(evt) 
    { 
         var key;   
         var targ;

         if (evt.target)
         { 
            targ = evt.target;
         }
         else if (evt.srcElement) 
         {
            targ = evt.srcElement;
         }
         if (targ.nodeType == 3) // defeat Safari bug
         {
            targ = targ.parentNode;
         }

         if(window.event) 
         {
              key = window.event.keyCode; //IE 
         }
         else 
         {
              key = evt.which; //firefox      
         } 

         if (targ.id == 'ctl00_txtSearch' && key == 13)
         {
            $get('ctl00_btnESearch').click(); //Works for IE
            return true;                      //Will allow FireFox to submit the first hidden button which will also handle a search server side.
         }
         else
         {
            return (key != 13); 
         }
    } 
  
//SCRIPT MANAGER END
if(typeof(Sys) !== 'undefined'){
    Sys.Application.notifyScriptLoaded();
}
