//Copyright(C) 2010 IR EasyWAy Co
//www.easyway.ir




function movemode(mid,ch,currentslide,midfirst,msldh,msldcount,speed){
var sld=document.getElementById(mid);
var sld2=document.getElementById(midfirst);

if (sldh - ch >=5 && sldh != ch){
sld.style.top=parseInt(sld.style.top) + 5 + 'px';

 if( currentslide==0 ) {sld2.style.top=parseInt(sld2.style.top) + 5 + 'px';}

}else {
         if (currentslide==0 ) {currentslide=1;}

         sld.style.top=parseInt(sld.style.top) + (sldh-ch ) + 'px';
         sld2.style.top=parseInt(sld2.style.top) + 5 + 'px';
      
     
           if(currentslide < sldcount) 
              { ;setTimeout("movemode('" + mid + "'," + 0 + "," + (currentslide + 1) + ",'" + midfirst + "'," + msldh + "," + msldcount + "," + speed + ")",speed); }
              
            if(currentslide== sldcount) {  
          
              sld2.style.top= -(msldh ) + 'px' ;
              setTimeout("movemodefirst('" + mid + "',0,'" + midfirst + "'," + msldh + "," + msldcount + "," + speed + ")",speed);
              }
           return;

      }

ch+=5;
setTimeout("movemode('" + mid + "'," + ch + "," + currentslide + ",'" + midfirst + "'," + msldh + "," + msldcount + "," + speed + ")",10);return;
}



function movemodefirst(mid,ch,midfirst,msldh,msldcount,speed){
var sld=document.getElementById(midfirst);
var sld2=document.getElementById(mid);


if (sldh - ch >=5 && sldh != ch){
sld2.style.top=parseInt(sld2.style.top) + 5 + 'px';
sld.style.top=parseInt(sld.style.top) + 5 + 'px';
}else {

       sld.style.top=parseInt(sld.style.top) + (sldh-ch) + 'px';
        sld2.style.top= -(msldh * msldcount ) + 'px' ;
               setTimeout("movemode('" + mid + "'," + 0 + ",0,'" + midfirst + "'," + msldh + "," + msldcount + "," + speed + ")",speed);
             return;

      }

ch+=5;
setTimeout("movemodefirst('" + mid + "'," + ch + ",'" + midfirst + "'," + msldh + "," + msldcount + "," + speed + ")",10);return;
}



