////////////////////////////////////////////////////////////////
/// Magic Image Rotation                                     ///
///        v 1.0.1                                           ///
/// Copyright 2007, Loyce Bradley Petrey                     ///
///        All Rights Reserved.                              ///
/// http://www.EchoChrist.com/MagicImage                     ///
/// webmaster@EchoChrist.com                                 ///
///                                                          ///
///        This script is free to use as long as this notice ///
/// remains unchanged and intact.                            ///
///                                                          ///
/// This program is free software: you can redistribute      ///
///        it and/or modify it under the terms of the GNU    ///
///        General Public License as published by the Free   ///
///        Software Foundation.                              ///
///                                                          ///
/// This program is distributed in the hope that it          ///
/// will be useful, but WITHOUT ANY WARRANTY; without        ///
///        even the implied warranty of MERCHANTABILITY or   ///
///        FITNESS FOR A PARTICULAR PURPOSE.                 ///
///                                                          ///
/// Be Imitators of God as dear children and walk            ///
/// in love as Christ also loved us.                         ///
///        Ephesians 5:1-2                                   ///
////////////////////////////////////////////////////////////////



var img_Height="175px";
var img_Width="250px";
var img_MarginBottom="5px";
var img_Border="1";



/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



var Text1 = "Textile Chemicals";
var ImageLoad1 =
[
['/chemicals/textile.html','/_img/banner_chemical_textile_image1.jpg',Text1],
['/chemicals/textile.html','/_img/banner_chemical_textile_image2.jpg',Text1],
['/chemicals/textile.html','/_img/banner_chemical_textile_image3.jpg',Text1]
];

var ImageCount1   = 3;                     //  *****  Change this to the total number of images loaded above  *****               //
var ImageDelay1   = 3000;                  //  *****  Set this to the delay interval desired.  5000 = 5 seconds.                  //
var LinkTarget1   = "_self"                //  *****  Defines where you want linked page to open. _self, _blank, _top, etc        //
var ImageIndex1   = 0;                     //  DO NOT ALTER                                                                       //
var FirstLoad1    = 0;                     //  DO NOT ALTER                                                                       //
var QuickStartID1 = 0;                     //  DO NOT ALTER                                                                       //
var htmlString1   = ""                     //  DO NOT ALTER                                                                       //

//  This function rotates the banner  //
function ImageChange1()
{
  htmlString1 = '';
  htmlString1 = htmlString1 + '<center>';
  htmlString1 = htmlString1 + '<a target="';
  htmlString1 = htmlString1 + LinkTarget1;
  htmlString1 = htmlString1 + '" href="';
  htmlString1 = htmlString1 + ImageLoad1[ImageIndex1][0];
  htmlString1 = htmlString1 + '"><img alt="' + Text1 + '" style="margin-bottom:' + img_MarginBottom + '" width="' + img_Width + '" height="' + img_Height + '" border="' + img_Border + '" src="';                                //  Image border size may be changed here                                //
  htmlString1 = htmlString1 + ImageLoad1[ImageIndex1][1];
  htmlString1 = htmlString1 + '"></a><br>';
  htmlString1 = htmlString1 + ImageLoad1[ImageIndex1][2];
  htmlString1 = htmlString1 + '</center>';

  document.getElementById('MagicImage1').innerHTML = htmlString1;

  if(ImageIndex1 == ImageCount1 - 1)                //  This statement increments image displayed and resets if displaying last image  //
  {
    ImageIndex1= 0;
  }
  else
  {
    ImageIndex1++;
  }

  if(FirstLoad1 == 0)                                                //  Determins if this is the first time function has run.   //
  {
    SlowFinish1();
  }

}
//  End Funtion  //


//  This function sets display rate to user defined speed  //
function SlowFinish1()
{
  clearInterval(QuickStartID1);
  clearInterval(QuickStartID2);
  clearInterval(QuickStartID3);
  clearInterval(QuickStartID4);
  FirstLoad1 = 1;
  setInterval("ImageChange1()", ImageDelay1);
  setInterval("ImageChange2()", ImageDelay2);
  setInterval("ImageChange3()", ImageDelay3);
  setInterval("ImageChange4()", ImageDelay4);
}
//  End Funtion  //



/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



var Text2 = "Non Textile Chemicals";
var ImageLoad2 =
[
['/chemicals/nontextile.html','/_img/banner_chemical_nontextile_image1.jpg',Text2]
];

var ImageCount2   = 1;                     //  *****  Change this to the total number of images loaded above  *****               //
var ImageDelay2   = 3000;                  //  *****  Set this to the delay interval desired.  5000 = 5 seconds.                  //
var LinkTarget2   = "_self"                //  *****  Defines where you want linked page to open. _self, _blank, _top, etc        //
var ImageIndex2   = 0;                     //  DO NOT ALTER                                                                       //
var FirstLoad2    = 0;                     //  DO NOT ALTER                                                                       //
var QuickStartID2 = 0;                     //  DO NOT ALTER                                                                       //
var htmlString2   = ""                     //  DO NOT ALTER                                                                       //
var alt4          = "Laboratory";

//  This function rotates the banner  //
function ImageChange2()
{
  htmlString2 = '';
  htmlString2 = htmlString2 + '<center>';
  htmlString2 = htmlString2 +'<a target="';
  htmlString2 = htmlString2 + LinkTarget2;
  htmlString2 = htmlString2 + '" href="';
  htmlString2 = htmlString2 + ImageLoad2[ImageIndex1][0];
  htmlString2 = htmlString2 + '"><img alt="' + Text2 + '" style="margin-bottom:' + img_MarginBottom + '" width="' + img_Width + '" height="' + img_Height + '" border="' + img_Border + '" src="';                                //  Image border size may be changed here                                //
  htmlString2 = htmlString2 + ImageLoad2[ImageIndex1][1];
  htmlString2 = htmlString2 + '"></a><br>';
  htmlString2 = htmlString2 + ImageLoad2[ImageIndex1][2];
  htmlString2 = htmlString2 + '</center>';

  document.getElementById('MagicImage2').innerHTML = htmlString2;

  if(ImageIndex2 == ImageCount2 - 1)                //  This statement increments image displayed and resets if displaying last image  //
  {
    ImageIndex2= 0;
  }
  else
  {
    ImageIndex2++;
  }

  if(FirstLoad2 == 0)                                                //  Determins if this is the first time function has run.   //
  {
    SlowFinish2();
  }

}
//  End Funtion  //


//  This function sets display rate to user defined speed  //
function SlowFinish2()
{
  clearInterva2(QuickStartID2);
  FirstLoad2 = 1;
  setInterval("ImageChange2()", ImageDelay2);
}
//  End Funtion  //



/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



var Text3 = "Textile Dyestuffs";
var ImageLoad3 =
[
['/dyestuffs/index.html','/_img/banner_dyestuffs_image1.jpg',Text3],
];

var ImageCount3   = 1;                     //  *****  Change this to the total number of images loaded above  *****               //
var ImageDelay3   = 3000;                  //  *****  Set this to the delay interval desired.  5000 = 5 seconds.                  //
var LinkTarget3   = "_self"                //  *****  Defines where you want linked page to open. _self, _blank, _top, etc        //
var ImageIndex3   = 0;                     //  DO NOT ALTER                                                                       //
var FirstLoad3    = 0;                     //  DO NOT ALTER                                                                       //
var QuickStartID3 = 0;                     //  DO NOT ALTER                                                                       //
var htmlString3   = ""                     //  DO NOT ALTER                                                                       //
var alt4          = "Laboratory";

//  This function rotates the banner  //
function ImageChange3()
{
  htmlString3 = '';
  htmlString3 = htmlString3 + '<center>';
  htmlString3 = htmlString3 +'<a target="';
  htmlString3 = htmlString3 + LinkTarget3;
  htmlString3 = htmlString3 + '" href="';
  htmlString3 = htmlString3 + ImageLoad3[ImageIndex1][0];
  htmlString3 = htmlString3 + '"><img alt="' + Text3 + '" style="margin-bottom:' + img_MarginBottom + '" width="' + img_Width + '" height="' + img_Height + '" border="' + img_Border + '" src="';                                //  Image border size may be changed here                                //
  htmlString3 = htmlString3 + ImageLoad3[ImageIndex1][1];
  htmlString3 = htmlString3 + '"></a><br>';
  htmlString3 = htmlString3 + ImageLoad3[ImageIndex1][2];
  htmlString3 = htmlString3 + '</center>';

  document.getElementById('MagicImage3').innerHTML = htmlString3;

  if(ImageIndex3 == ImageCount3 - 1)                //  This statement increments image displayed and resets if displaying last image  //
  {
    ImageIndex3= 0;
  }
  else
  {
    ImageIndex3++;
  }

  if(FirstLoad3 == 0)                                                //  Determins if this is the first time function has run.   //
  {
    SlowFinish3();
  }

}
//  End Funtion  //


//  This function sets display rate to user defined speed  //
function SlowFinish3()
{
  clearInterval(QuickStartID3);
  FirstLoad3 = 1;
  setInterval("ImageChange3()", ImageDelay3);
}
//  End Funtion  //



/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



var Text4 = "Laboratory";
var ImageLoad4 =
[
['/laboratory.html','/_img/banner_laboratory_image1.jpg',Text4],
['/laboratory.html','/_img/banner_laboratory_image2.jpg',Text4],
['/laboratory.html','/_img/banner_laboratory_image3.jpg',Text4],
['/laboratory.html','/_img/banner_laboratory_image4.jpg',Text4]
];

var ImageCount4   = 4;                     //  *****  Change this to the total number of images loaded above  *****               //
var ImageDelay4   = 3000;                  //  *****  Set this to the delay interval desired.  5000 = 5 seconds.                  //
var LinkTarget4   = "_self"                //  *****  Defines where you want linked page to open. _self, _blank, _top, etc        //
var ImageIndex4   = 0;                     //  DO NOT ALTER        //
var FirstLoad4    = 0;                     //  DO NOT ALTER        //
var QuickStartID4 = 0;                     //  DO NOT ALTER        //
var htmlString4   = ""                     //  DO NOT ALTER        //
var alt4          = "Laboratory";

//  This function rotates the banner  //
function ImageChange4()
{
  htmlString4 = '';
  htmlString4 = htmlString4 + '<center>';
  htmlString4 = htmlString4 +'<a  target="';
  htmlString4 = htmlString4 + LinkTarget4;
  htmlString4 = htmlString4 + '" href="';
  htmlString4 = htmlString4 + ImageLoad4[ImageIndex1][0];
  htmlString4 = htmlString4 + '"><img alt="' + Text4 + '" style="margin-bottom:' + img_MarginBottom + '" width="' + img_Width + '" height="' + img_Height + '" border="' + img_Border + '" src="';                                //  Image border size may be changed here                                //
  htmlString4 = htmlString4 + ImageLoad4[ImageIndex1][1];
  htmlString4 = htmlString4 + '"></a><br>';
  htmlString4 = htmlString4 + ImageLoad4[ImageIndex1][2];
  htmlString4 = htmlString4 + '</center>';

  document.getElementById('MagicImage4').innerHTML = htmlString4;

  if(ImageIndex4 == ImageCount4 - 1)                //  This statement increments image displayed and resets if displaying last image  //
  {
    ImageIndex4= 0;
  }
  else
  {
    ImageIndex4++;
  }

  if(FirstLoad4 == 0)                                                //  Determins if this is the first time function has run.   //
  {
  SlowFinish4();
  }

}
//  End Funtion  //


//  This function sets display rate to user defined speed  //
function SlowFinish4()
{
  clearInterval(QuickStartID4);
  FirstLoad4 = 1;
  setInterval("ImageChange4()", ImageDelay4);
}
//  End Funtion  //



/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



//  This function ensures first banner is displayted without a delay  //
function  QuickStart()
{
  QuickStartID4=setInterval("ImageChange4()", 10);
  QuickStartID3=setInterval("ImageChange3()", 10);
  QuickStartID2=setInterval("ImageChange2()", 10);
  QuickStartID1=setInterval("ImageChange1()", 10);
}
//  End Funtion  //



QuickStart()
