/* *****
 * User defined fade objects and messages
 *
 * These messages are used in fades triggered by mouseovers and
 * mouseouts on table cells.  They are the simplest type of fade and
 * require no extra Javascript code.
 */
var fader = new Array();
var fader100 = new Array();
var fader200 = new Array();
var fader300 = new Array();




/* *****
 * The code below describes how to make a throbbing or automatic fade
 * sequence of messages.  It is important to note that this function is
 * NOT part of the Buffered Text-Fade Effect, but merely an example of
 * how it can be used.  In this example, the throb() function controls
 * the commands which are sent to the fade engine; it is called
 * repeatedly at set time intervals rather than using mouseover events
 * as triggers.
 *
 * Notes:
 * - A global array "hash" is used to keep track of where each
 *   animation is currently in the sequence.
 * - The list of messages defined in the fader *must* start at one (1)
 *   and count upwards without skipping any integers.
 * - The third line of the throb() function controls how fast
 *   commands get sent to the fade engine.  It waits only 100 milli-
 *   seconds when fading out, but 5000 milliseconds (5 seconds) when
 *   fading in; this means the message will remain visible for about 5
 *   seconds before fading out again.
 *
 * Other types of fade animation are possible simply by designing
 * different ways to control the fade-ins and fade-outs!
 */
var hash = new Array();
function throb(item) {

  // If the hash array does not have an entry for this item, initialise it at 2
  if (!hash[item]) hash[item] = 2;

  // Send a fade command, using the hash array to tell us what parameters we should use
  fader[item].fade(Math.floor(hash[item] / 2), !(hash[item] % 2));
  fader100[item].fade(Math.floor(hash[item] / 2), !(hash[item] % 2));
  fader200[item].fade(Math.floor(hash[item] / 2), !(hash[item] % 2));
  fader300[item].fade(Math.floor(hash[item] / 2), !(hash[item] % 2));



  // Call this function again for this same item after a certain amount of time
  setTimeout(function() { throb(item); }, (hash[item] % 2) ? 100 : 15000);

  // If we have exceeded the number of messages in this fader, start over again at 2
  if (++hash[item] > fader[item].msg.length * 2 - 1) hash[item] = 2;
}

fader[2] = new fadeObject('fade2', 'bbbbbb', '000000', 100, 100);
fader[2].msg[1] = "<b><CENTER> قصص العرب.... </center></b>";

fader100[2] = new fadeObject('fade100', 'bbbbbb', '000000', 100, 100);
fader100[2].msg[1] = "<b><CENTER> قصص العرب.... </center></b>";

fader200[2] = new fadeObject('fade200', 'bbbbbb', '000000', 100, 100);
fader200[2].msg[1] = "<b><CENTER> قصص العرب.... </center></b>";

fader300[2] = new fadeObject('fade300', 'bbbbbb', '000000', 100, 100);
fader300[2].msg[1] = "<b><CENTER> قصص العرب.... </center></b>";


   dsoCities.async = false;//make sure xml is loaded before scripting
   dsoCities.load('http://www.alwaraq.net/Core/dg/body_slideshowxml') ;


Document = dsoCities.XMLDocument ;
  
  for (i = 1 ; i < Document .documentElement.childNodes.length ; i++) 
   {
     fader[2].msg[i] = "<font style='font:bold 12pt simplified arabic;'>"+Document .documentElement.childNodes(i).childNodes(4).text+"</font><br><font style='font:bold 10pt simplified arabic;'>"+Document .documentElement.childNodes(i).childNodes(1).text+"</font><br><br>"+Document .documentElement.childNodes(i).childNodes(2).text +" ...."+"<br><br><a style='color:inherit;' href="+Document .documentElement.childNodes(i).childNodes(3).text +" ><font color=black size=1>اقرأ القصة</font></a>";
     switch(i)
     {
       case 1 :{
       fader100[2].msg[1] = "<a style='color:white;' href="+Document .documentElement.childNodes(1).childNodes(3).text +" ><font style='font:bold 12pt simplified arabic;'>"+Document .documentElement.childNodes(1).childNodes(4).text+"</font></a>";
       fader200[2].msg[1] = "<a style='color:black;' href="+Document .documentElement.childNodes(2).childNodes(3).text +" ><font style='font:bold 12pt simplified arabic;'>"+Document .documentElement.childNodes(2).childNodes(4).text+"</font></a>";
       fader300[2].msg[1] = "<a style='color:black;' href="+Document .documentElement.childNodes(3).childNodes(3).text +" ><font style='font:bold 12pt simplified arabic;'>"+Document .documentElement.childNodes(3).childNodes(4).text+"</font></a>";
      
    			break;
    		    }
       case 2 :{
       fader100[2].msg[2] = "<a style='color:black;' href="+Document .documentElement.childNodes(1).childNodes(3).text +" ><font style='font:bold 12pt simplified arabic;'>"+Document .documentElement.childNodes(1).childNodes(4).text+"</font></a>";
       fader200[2].msg[2] = "<a style='color:white;' href="+Document .documentElement.childNodes(2).childNodes(3).text +" ><font style='font:bold 12pt simplified arabic;'>"+Document .documentElement.childNodes(2).childNodes(4).text+"</font></a>";
       fader300[2].msg[2] = "<a style='color:black;' href="+Document .documentElement.childNodes(3).childNodes(3).text +" ><font style='font:bold 12pt simplified arabic;'>"+Document .documentElement.childNodes(3).childNodes(4).text+"</font></a>";
      
    			break;
    		    }
		case 3 :{
       fader100[2].msg[3] = "<a style='color:black;' href="+Document .documentElement.childNodes(1).childNodes(3).text +" ><font style='font:bold 12pt simplified arabic;'>"+Document .documentElement.childNodes(1).childNodes(4).text+"</font></a>";
       fader200[2].msg[3] = "<a style='color:black;' href="+Document .documentElement.childNodes(2).childNodes(3).text +" ><font style='font:bold 12pt simplified arabic;'>"+Document .documentElement.childNodes(2).childNodes(4).text+"</font></a>";
       fader300[2].msg[3] = "<a style='color:white;' href="+Document .documentElement.childNodes(3).childNodes(3).text +" ><font style='font:bold 12pt simplified arabic;'>"+Document .documentElement.childNodes(3).childNodes(4).text+"</font></a>";
      
    			break;
    		    }

     }
   
   
   }
    



// Start this fader
setTimeout(function() { throb(2); }, 5000);
