﻿ $(document).ready(function() {
 
       loadFunctions();//load everything required //workaround
      
    });
    
    //functions to call on page load
    function loadFunctions() {
    
        tb_init('a.loginBox');//pass where to apply thickbox //for update panel fix
               // growl();
        loadHelpFunctions();
    };
    
    function loadHelpFunctions(){
        $(".toggle_container").hide();
     
	    $("h2.trigger").toggle(function(){
		    $(this).addClass("active"); 
		    }, function () {
		    $(this).removeClass("active");
	    });
    	
	    $("h2.trigger").click(function(){
		    $(this).next(".toggle_container").slideToggle("slow,");
	    });
     
    };
    	 
  
	         //jGrowl message display call
    
           function call_controls_msg()
            {
                jQuery( '#lnkShowJMsg' ).click();
	        };
      
    //mdlLinks
    
       
           function controls_helpBox_show(file)
            {
                self.parent.tb_show(null,'mdl/help/help.aspx?show=' + file + '&keepThis=true&TB_iframe=true&height=480&width=650&modal=true',null);
            };
            
           function controls_removeStoredCard()
            {
                jQuery( '#hiddenTbRemoveStoredCard' ).click();
	        };
           function controls_aboutAutoTopUp()
            {
                jQuery( '#hiddenTbAutoTopUp' ).click();
	        };
           function controls_loginBox()
            {
                jQuery( '#hiddenTbLoginLink' ).click();
	        };
	        function controls_helpBox()
	        {
	         jQuery( '#hiddenTbHelp' ).click();
	        };
	        function controls_orderBox()
	        {
	         jQuery( '#hiddenTbOrder' ).click();
	        };
	        function controls_PHorderBox()
	        {
	         jQuery( '#hiddenTbOrderPH' ).click();
	        };
           function controls_transactionsBox()
            {
                jQuery( '#hiddenTbTransactionsLink' ).click();
	        };
           function controls_registerBox()
            {
                jQuery( '#hiddenTbRegisterLink' ).click();
	        };
           function controls_tollingPrivacyPolicy()
            {
                jQuery( '#hiddenTbTollingPrivacyPolicy' ).click();
	        };
           function controls_tolltagOptions()
            {
                jQuery( '#hiddenTbTolltagOptions' ).click();
	        };    
           function controls_aboutWashValetBox()
            {
                jQuery( '#hiddenTbAboutWashValet' ).click();
	        };
           function controls_contact()
            {
                jQuery( '#hiddenTbContact' ).click();
	        };
           function controls_cardDetails()
            {
                jQuery( '#hiddenTbCardDetails' ).click();
	        };
           function controls_tellAFriend()
            {
                jQuery( '#hiddenTbTellAFriend' ).click();
	        };
           function controls_chargeNewCard()
            {
                jQuery( '#hiddenTbChargeNewCard' ).click();
	        };
    
	        
//jgrowl	        
		// In case you don't have firebug...
		if (!window.console || !console.firebug) {
			var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
			window.console = {};
			for (var i = 0; i < names.length; ++i) window.console[names[i]] = function() {};
		}
   //jgrowl
    
           function controls_msg(str)
            {
                
               // str =  str + str + str + str + str + str + str + str + str + str + str + str + str;
	            if (str != '')		
				  {  //$.jGrowl(str + str + str + str + str + str + str + str + str + str + str + str + str + str);
				  // $.jGrowl("Hello world!");
				    $.jGrowl(str, { 
					    //theme: 'manilla',
					    //sticky: true,
					    header: 'User Information',
					    life: 9000,
					    speed: 700,
					    easing: 'easeInOutExpo',
					    animateOpen: { 
						    height: "show",
						    width: "show"
					    },
					    animateClose: { 
						    height: "hide",
						    width: "show"
					    }
				    });
				    }
	        };
           function controls_msg_sticky(str)
            {
                
               // str =  str + str + str + str + str + str + str + str + str + str + str + str + str;
	            if (str != '')		
				  {  //$.jGrowl(str + str + str + str + str + str + str + str + str + str + str + str + str + str);
				  // $.jGrowl("Hello world!");
				    $.jGrowl(str, { 
					    // theme: 'manilla',
					     sticky: true,
					    header: 'User Information',
					    //life: 12000,
					    speed: 700,
					    easing: 'easeInOutExpo',
					    animateOpen: { 
						    height: "show",
						    width: "show"
					    },
					    animateClose: { 
						    height: "hide",
						    width: "show"
					    }
				    });
				    }
	        };
	         
      
      //Fix for .net update panel jQuery failing
      
       function load(){
            Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
        };

        function EndRequestHandler(){
        // call functions that should be in document.ready()

            loadFunctions();//load everything required

        };
        //end fix
              
        
        
      