﻿
var msg=new Array()

msg[0]="<p dir='rtl' align='center' ><a target='_blank ' href=http://www.leader.ir/><img border='0' src='../Images/daftar.jpg'  width='118' height='75'></a></p>"
msg[1]="<p dir='rtl' align='center'><a target='_blank' href=http://www.parliran.ir/><img border='0' src='../Images/majlis.jpg' width='120' height='70'></a></p></p>"
msg[2]="<p dir='rtl' align='center'><a target='_blank' href=http://www.icana.ir//><img border='0' src='../Images/khane melat.jpg'  width='120' height='60'></a></p>"
msg[3]="<p dir='rtl' align='center'><a target='_blank' href=http://www.majlis.ir/mhtml/index.php><img border='0' src='../Images/markazpajohesh.jpg'  width='120' height='60'></a> </p>"
msg[4]="<p dir='rtl' align='center'><a target='_blank' href=http://www.majlislib.com/><img border='0' src='../Images/lib_majlis.jpg'  width='120' height='60'></a> </p>"
msg[5]="<p dir='rtl' align='center'><a target='_blank' href=http://www.shora-gc.ir/portal/Home/><img border='0' src='../Images/shora_negahban.jpg'  width='120' height='60'></a> </p>"
speed=6
var divwidth=550
var divheight=180
var divincbt=1                 
var divinctb=-1
var divincrl=10
var divinclr=-10

var divpause=7000

var divtop="-16"
var divleft="-230"               

var divcolor=""

var divname1="scroll2"
var divname2="scroll3"
var whichscroll="1"

var divinc
var stopposa
var stopposb
var scrollmsga
var scrollmsgb 
var thediva
var thedivb
var posa
var posb
var ii=msg.length
var firsttime="y"
var divprop
var whichdiv=divname1
if(whichscroll=="1")
  {
   stopposa=0
   stopposb=divheight*-1
   divprop="top"
   divinc=divincbt
  }
if(whichscroll=="2")
  {
   stopposa=0
   stopposb=divheight
   divprop="top"
   divinc=divinctb
  }
if(whichscroll=="3")
  {
   stopposa=0
   stopposb=divwidth*-1
   divprop="left"
   divinc=divincrl
  }
if(whichscroll=="4")
  {
   stopposa=1
   stopposb=divwidth+2
   divprop="left"
   divinc=divinclr
  }

function Scrollboxa(obja)
     {
         savobja=obja
         posa=posa-divinc
         if(((whichscroll=="1" || whichscroll=="3")&&(posa<=stopposa))||
           ((whichscroll=="2" || whichscroll=="4")&&(posa>=stopposa)))
           {
            clearTimeout(scrollmsga)
            setTimeout("scrollit()",divpause)
           } 
         else
             {
              if(document.getElementById) // IE5 and NS6
                {
                 eval("elma.style."+divprop+"=posa")
                 elma.style.visibility="visible"
                }
              if(document.layers)    // NS4+
                {
                 eval("obja."+divprop+"=posa")
                 document.main.visibility="show"
                }
              scrollmsga=setTimeout("Scrollboxa(savobja)",speed)
             }
     }
function Scrollboxb(objb)
     {
         savobjb=objb
         posb=posb-divinc
         if(((whichscroll=="1" || whichscroll=="3")&&(posb<=stopposb))||
            ((whichscroll=="2" || whichscroll=="4")&&(posb>=stopposb)))
           {
            clearTimeout(scrollmsgb)
           }
         else
              {
               if(document.getElementById) // IE5 and NS6
                 {
                  eval("elmb.style."+divprop+"=posb")
                 }
               if(document.layers)  // NS4+
                 {
                  eval("objb."+divprop+"=posb")
                  objb.visibility="show"
                 }
               scrollmsgb=setTimeout("Scrollboxb(savobjb)",speed)
              }
     }
function scrollit()
   {
    ii++
    if(ii>=msg.length)
      {ii=0}
    posa=stopposb*-1
    posb=0
    if(firsttime=="y")
      {
       firsttime= "n"
       if(document.getElementById)      // IE5 and NS6
         {
          elma=document.getElementById(divname1)
          elma.innerHTML=msg[ii]
         }
      if(document.layers)   // NS4+
        {
         thediva=eval("document.main.document."+divname1)
         thediva.document.write(msg[ii])
         thediva.document.close()
        }
       Scrollboxa(thediva)
      }
    else
      {
       if(whichdiv==divname1)
         {
          if(document.getElementById)  // IE5 and NS6
            {
             elmb=document.getElementById(divname1)
             elma=document.getElementById(divname2)
             elma.innerHTML=msg[ii]
            }
          if(document.layers)  //  NS4+
            {
             thedivb=eval("document.main.document."+divname1)
             thediva=eval("document.main.document."+divname2)  
             thediva.document.write(msg[ii])
             thediva.document.close()
            }
          Scrollboxb(thedivb)
          whichdiv=divname2
          Scrollboxa(thediva)
         }
       else
         {
          if(document.getElementById)   // IE5 and NS6
            {
             elmb=document.getElementById(divname2)
             elma=document.getElementById(divname1)
             elma.innerHTML=msg[ii]
             }
          if(document.layers)  // NS4+
            {
             thedivb=eval("document.main.document."+divname2)
             thediva=eval("document.main.document."+divname1)
             thediva.document.write(msg[ii])
             thediva.document.close()
             }
          Scrollboxb(thedivb)
          whichdiv=divname1
          Scrollboxa(thediva)
         }
      }
  }
