﻿ // (c) Copyright Microsoft Corporation.
        // This source is subject to the Microsoft Permissive License.
        // See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
        // All other rights reserved.
    
        // Script objects that should be loaded before we run
        var typeDependencies = ['AjaxControlToolkit.AccordionBehavior'];
        
        // Reference to the Test Harness
        var testHarness = null;
    
        // Controls in the test page
        var accordion = null;
        var boundAccordion = null;
        var xmlAccordion = null;
        var behavior = null;
        var btn;
        
      var currentTag = "scheduleTAB";
					
	  function Swap (newCurrent)
	  {
		  if (newCurrent != currentTag)
		  {
			  SwapId ("current", currentTag);
			  currentTag = newCurrent;
			  SwapId (currentTag, "current");
		  }
	  }
	  
      function Hide(obj){
        //var el = "ctl00_ContentPlaceHolder1_"+obj;
		document.getElementById(obj).style.display = "none";
	  }
	  
	  function Show(obj){
	    //var el = "ctl00_ContentPlaceHolder1_"+obj;
		document.getElementById(obj).style.display = "inline";
	  }
	  
        function setSelectedIndex(behavior, index) {
            return function() {
                behavior.set_SelectedIndex(index);
            };
        }
        
        function checkVisibility(behavior, expectedSelected) {
            return function() {
                var length = behavior.get_Count();
                for (var i = 0; i < length; i++) {
                    var height = behavior.get_Pane(i).content.offsetHeight;
                    if (i == expectedSelected) {
                        testHarness.assertNotEqual(height, 0, 'Height of pane ' + i + ' should not be 0');
                    } else {
                        testHarness.assertEqual(height, 0, 'Height of pane ' + i + ' is ' + height + ', not 0');
                    }
                }
            }
        }

        function checkHeaderCSS(behavior, expectedCSS) {
            return function() {
                var selectedIndex = behavior.get_SelectedIndex();
                var cssClass = behavior.get_Pane(selectedIndex).header.className;
                testHarness.assertEqual(cssClass, expectedCSS, 'Css class should be ' + expectedCSS + ' but it is ' + cssClass);
            }
        }
        
        function checkOpacity(behavior, index) {
            return function() {
                var pane = behavior.get_Pane(index);
                var opacity = 1;
                if (behavior.get_AutoSize() === AjaxControlToolkit.AutoSize.Fill) {
                    opacity = CommonToolkitScripts.getElementOpacity(pane.content._original);
                } else {
                    opacity = CommonToolkitScripts.getElementOpacity(pane.content);
                }
                testHarness.assertNotEqual(1, opacity);
            }
        }


