﻿
var ContentHeight = 80;
var TimeToSlide = 250.0;
var openAccordion = '';
var verthorvert=1

        function createCookie(name,value,days) {
	        /*if (days) {
		        var date = new Date();
		        date.setTime(date.getTime()+(days*24*60*60*1000));
		        var expires = "; expires="+date.toGMTString();
	        }
	        else*/
	        var expires = "";
	        document.cookie = name+"="+value+expires+"; path=/";
        }

        function readCookie(name) {
	        var nameEQ = name + "=";
	        var ca = document.cookie.split(';');
	        for(var i=0;i < ca.length;i++) {
		        var c = ca[i];
		        while (c.charAt(0)==' ') c = c.substring(1,c.length);
		        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	        }
	        return null;
        }
        
        function runAccordion(index)
        {
            var nID = "Accordion" + index + "Content";
            if(openAccordion == nID)
            nID = '';

            setTimeout("animate(" + new Date().getTime() + "," + TimeToSlide + ",'" 
              + openAccordion + "','" + nID + "')", 33);

            openAccordion = nID;
        }
        function animate(lastTick, timeLeft, closingId, openingId)
        {  
                var curTick = new Date().getTime();
                var elapsedTicks = curTick - lastTick;

                var opening = (openingId == '') ? null : document.getElementById(openingId);
                var closing = (closingId == '') ? null : document.getElementById(closingId);

                if(timeLeft <= elapsedTicks)
                {
                if(opening != null)
                  opening.style.height = ContentHeight + 'px';

                if(closing != null)
                {
                  closing.style.display = 'none';
                  closing.style.height = '0px';
                }
                return;
                }

                timeLeft -= elapsedTicks;
                var newClosedHeight = Math.round((timeLeft/TimeToSlide) * ContentHeight);

                if(opening != null)
                {
                if(opening.style.display != 'block')
                  opening.style.display = 'block';
                opening.style.height = (ContentHeight - newClosedHeight) + 'px';
                }

                if(closing != null)
                closing.style.height = newClosedHeight + 'px';

                setTimeout("animate(" + curTick + "," + timeLeft + ",'" 
                  + closingId + "','" + openingId + "')", 33);
        }


            function vertinit_position(hv)
            {	
            verthorvert=hv;	
                for(i=1;i<=4;i++)
                {	
//                	vertimgid[i]=document.getElementById('vertpo'+i);	
                         //   if(vertimgid[i]==null)		
                           //      {		  
                                     setTimeout("vertinit_position("+parseInt(hv)+")",300);	
                           //          return;	
                             //      }	
                }	
                if(verthorvert==0)
                    {		
                         vertgorun_imgwidth=parseInt(  (460-((4-1)*2))     /(4));	
                         vertgorun_blockwidth=vertgorun_imgwidth+2;	
                         vertgorun_overblock_width=parseInt(((460-300)/(4-1)));	
                     }	
                 else	
                     {		
                         vertgorun_imgwidth=parseInt(     (320-((4-1)*2))     /(4));	
                          vertgorun_blockwidth=vertgorun_imgwidth+2;	
                         vertgorun_overblock_width=parseInt(((320-225)/(4-1)));
                     }
                for(i=1;i<=4;i++)
                     {		
                      //   vertimgid[i]=document.getElementById('vertpo'+i);	
                         sx=(vertgorun_blockwidth*(i-1))-2;	
                         if(verthorvert==0)	
                            {			
                             if(i==1)			
                                {	
            			      //      vertimgid[i].style.left="0px";		
                                 }			
                               else	
                                 {				
                              //    vertimgid[i].style.left=""+sx+"px";		
                                 }	
                             }	
                         else		
                            {		
                                if(i==1)	
                                 {		
                                //     vertimgid[i].style.top="0px";	
                                 }			
                                else			
                                {				
                                //     vertimgid[i].style.top=""+sx+"px";		
                                }		
                             }		
          //  vertstartposx[i]=sx;	
          //  vertcurrposx[i]=vertstartposx[i];
         
         }
         }
            

