<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>PicGallery Test Page</title>
    <style type="text/css">
.accordionHeader 
{ 
border: 1px solid #2F4F4F; 
color: white; 
background-color: #719DDB; 
font-family: Arial, Sans-Serif; 
font-size: 12px; 
font-weight: bold; 
padding: 5px; 
margin-top: 5px; 
cursor: pointer; 
width:878px; 
height:18px; 
} 
.accordionContent 
{ 
background-color: #DCE4F9; 
border: 1px dashed #2F4F4F; 
border-top: none; 
padding: 5px; 
padding-top: 10px; 
width:878px;
height:0px; 
text-align:left;

} 
</style>
</head>

<body style="text-align: center">

    <form id="form1" runat="server">
    
         <asp:ScriptManager ID="ScriptManager1" runat="server" />
         
        <h2 style="text-align: center">Slide Gallery</h2>
        
        
        <div style="text-align: center">
        
        
     <script runat="Server" type="text/C#">
            [System.Web.Services.WebMethod]
            [System.Web.Script.Services.ScriptMethod]
            public static AjaxControlToolkit.Slide[] GetSlides1(string contextKey)
            {
                AjaxControlToolkit.Slide[] slides = null;
                int i = -1;
                int index = int.Parse(contextKey);

                System.IO.DirectoryInfo dir1234 = new System.IO.DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory.ToString() + "picgallery/images/");
                System.IO.DirectoryInfo[] tempdir = dir1234.GetDirectories();


                System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory.ToString() + dir1234.Parent + "/" + tempdir[index].Parent.Name + "/" + tempdir[index].Name + "/");
                System.IO.FileInfo[] gFiles = dir.GetFiles("*.jpg");

                slides = new AjaxControlToolkit.Slide[gFiles.Length];               

                int tempi;
                    
              
                foreach (System.IO.FileInfo fi in gFiles)
                {
                    i++;
                    tempi = i + 1;
                    slides[i] = new AjaxControlToolkit.Slide(tempdir[index].Parent.Name + "/" + tempdir[index].Name + "/" + fi.Name, "", "< " + tempi.ToString() + " of " + gFiles.Length + " >  " + tempdir[index].Name + ": " + fi.ToString().Split('.')[0]);
                    //2. parameter does not work because of error in the toolkit
                }


                return (slides);

            }
    </script>

 
            &nbsp; &nbsp;<br />
            <br />
        

         
          
           <div id="MyAccordion">
	<input type="hidden" name="MyAccordion_AccordionExtender_ClientState" id="MyAccordion_AccordionExtender_ClientState" /><div class="accordionHeader">
		client side
	</div><div class="accordionContent" style="display:block;">
	
	

           test
            
                
               
            <asp:Image ID="Image1" ImageAlign="Left" runat="server" Height="316px" Width="388px" 
                BorderColor="Black" BorderStyle="Ridge" /><br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            
            <br />
            <br />
            <br />
           <asp:Label ID="lblImageDescription" runat="server" /><br />
           <br />
            <br />
    
           <asp:Button ID="Btn_Previous" runat="server" Text="Previous" />&nbsp;&nbsp;            
            <asp:Button ID="Btn_Play" runat="server" Text="Play" />&nbsp;&nbsp;
            <asp:Button ID="Btn_Next" runat="server" Text="Next" Width="64px" /><br />
            <br />
            <br /> 
            test        
                
              <cc1:SlideShowExtender ID="SlideShowExtender1" BehaviorID="ss1" PlayInterval="3000"
              AutoPlay="false" ImageDescriptionLabelID="lblImageDescription"
               Loop="true" NextButtonID="Btn_Next" PlayButtonID="Btn_Play" 
               PlayButtonText="Play" PreviousButtonID="Btn_Previous" 
                 SlideShowServiceMethod="GetSlides1" ContextKey="0" StopButtonText="Stop" 
                  TargetControlID="Image1" runat="server">
            </cc1:SlideShowExtender> 
            
            </div>
            
            
            <input type="hidden" name="MyAccordion_AccordionExtender_ClientState" id="Hidden1" /><div class="accordionHeader">
		client side
	</div><div class="accordionContent" style="display:block;">
	
	

           test
            
                
               
            <asp:Image ID="Image2" ImageAlign="Left" runat="server" Height="316px" Width="388px" 
                BorderColor="Black" BorderStyle="Ridge" /><br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            
            
           <asp:Label ID="Label111" runat="server" /><br />
            <br />
    
           <asp:Button ID="Button1" runat="server" Text="Previous" />&nbsp;&nbsp;            
            <asp:Button ID="Button2" runat="server" Text="Play" />&nbsp;&nbsp;
            <asp:Button ID="Button3" runat="server" Text="Next" Width="64px" /><br />
            <br />
            <br /> 
            test        
                
               
            <cc1:SlideShowExtender ID="SlideShowExtender2" 
              AutoPlay="false" ImageDescriptionLabelID="Label111"  
               Loop="true" NextButtonID="Button3" PlayButtonID="Button2" 
               PlayButtonText="Play" PreviousButtonID="Button1" 
                 SlideShowServiceMethod="GetSlides1" ContextKey="1" StopButtonText="Stop" 
                  TargetControlID="Image2" runat="server">
            </cc1:SlideShowExtender> 
            </div>

           </div>
             
             
           
            
   <cc1:Accordion ID="MyAccordion" runat="server" RequireOpenedPane="false" 
HeaderCssClass="accordionHeader" ContentCssClass="accordionContent" 
FadeTransitions="true" FramesPerSecond="40" TransitionDuration="150" > 
  </cc1:Accordion>
   <cc1:Accordion ID="MyAccordion1"  runat="server" RequireOpenedPane="false" 
HeaderCssClass="accordionHeader"  ContentCssClass="accordionContent" 
FadeTransitions="true" FramesPerSecond="40" TransitionDuration="150" > 
  </cc1:Accordion>
  <cc1:AnimationExtender id="MyExtender" runat="server" BehaviorID="ae" TargetControlID="Image1">
  <Animations>
    <OnLoad>
    <Sequence>
      <FadeOut Duration="0" Fps="20" />
      <FadeIn Duration="0" Fps="20" />
    </Sequence>
    </OnLoad>
  </Animations>
</cc1:AnimationExtender>

            
          
        </div>
     <script language="javascript" type="text/javascript">
         var fadein;
         var fadeout;
         var ss, be;
         var playInterval;
         var inFadeout = false;
         var fadeplayInterval;
         var timerFadeout;

         function pageLoad() {
             ss = $find("ss1");
             ss.add_slideChanging(onChanging);
             playInterval = ss._playInterval;

             var ae = $find("ae");
             be = ae.get_OnLoadBehavior();
             var an = be.get_animation();
             fadein = an.get_animations()[1];
             fadeout = an.get_animations()[0];

             fadein.set_duration(0.5);
             fadeout.set_duration(0.2);
             fadeplayInterval = (fadein.get_duration() + fadeout.get_duration()) * 1000;
         }
         function onChanging(sender, args) {
             fadein.play();
             timerFadeout = window.setTimeout("before_fadeout()", playInterval - fadeplayInterval);
         }
         function before_fadeout() {
             if (ss._inPlayMode) {
                 inFadeout = true;
                 fadeout.play();
                 window.setTimeout("clear_inFadeout()", fadeplayInterval);
             }
         }
         function PlayButton_ClientClick() {
             if (ss._inPlayMode & inFadeout) {
                 fadein.play();
             }
         }
         function clear_inFadeout() {
             inFadeout = false;
         }
         function NavigateButton_ClientClick() {
             window.clearTimeout(timerFadeout);
         }
</script>


    </form>
</body>
</html>
