// JavaScript Document
var rotation = new Array();
var today = new Date();
var theQuotes = new Array();
var thePics = new Array();
var oldPics = new Array();
var numofPics = 18;
var counter = 0;

while (counter <= numofPics)
{
	thePics[counter] =  "http://www.iemcal.com/images/homepic/col" + counter + ".jpg";
	// generate null quotes for all images, just in case
	theQuotes[counter] = "&nbsp;<br>&nbsp;";
	oldPics[counter] = 0;
	counter++;
}

rotation[0] = 1;
rotation[1] = 2;
rotation[2] = 3;
rotation[3] = 4;
rotation[4] = 5;
rotation[5] = 6;
rotation[6] = 7;
rotation[7] = 8;
rotation[8] = 9;
rotation[9] = 10;
rotation[10] = 11;
rotation[11] = 12;
rotation[12] = 13;
rotation[13] = 14;
rotation[14] = 15;
rotation[15] = 16;
rotation[16] = 17;
rotation[17] = 18;
rotation[18] = 1;
rotation[19] = 2;
rotation[20] = 3;
rotation[21] = 4;
rotation[22] = 5;
rotation[23] = 6;
rotation[24] = 7;
rotation[25] = 8;
rotation[26] = 9;
rotation[27] = 10;
rotation[28] = 11;
rotation[29] = 12;
rotation[30] = 13;
rotation[31] = 14;
rotation[32] = 15;
rotation[33] = 16;
rotation[34] = 17;
rotation[35] = 18;
rotation[36] = 1;
rotation[37] = 2;
rotation[38] = 3;
rotation[39] = 4;
rotation[40] = 5;
rotation[41] = 6;
rotation[42] = 7;
rotation[43] = 8;
rotation[44] = 9;
rotation[45] = 10;
rotation[46] = 11;
rotation[47] = 12;
rotation[48] = 13;
rotation[49] = 14;
rotation[50] = 15;
rotation[51] = 16;
rotation[52] = 17;
rotation[53] = 18;
rotation[54] = 1;
rotation[55] = 2;
rotation[56] = 3;
rotation[57] = 4;
rotation[58] = 5;
rotation[59] = 6;


theQuotes[0] = "&nbsp;<br>&nbsp;";
theQuotes[1] = "IEM Students grabbed the Microsoft(R & D) job offer<br>with a pay pacakage of 9.2 lacs per annum";
theQuotes[2] = "IEM Student performing at intra college fest Invigoration08<br>&nbsp;";
theQuotes[3] = "IEM Students attending seminar<br>&nbsp;";
theQuotes[4] = "IEM students in Industrial Tour<br>&nbsp;";
theQuotes[5] = "A moment of social work activities by IEM<br>&nbsp;";
theQuotes[6] = "College Band performing at stage<br>&nbsp;";
theQuotes[7] = "Our Director delivering speech in a seminar<br>&nbsp;";
theQuotes[8] = "Panel discussion on  Crimilisation of Indian Politics  - a myth or fact? <br> organised by IEM";
theQuotes[9] = "Panel discussion on United Nations became a mock mourner <br> organised by IEM";
theQuotes[10] = "IEM tournament<br>&nbsp;";
theQuotes[11] = "IEM student attending Pre Placement Talk<br>&nbsp;";
theQuotes[12] = "IEM student attending Pre Placement Talk<br>&nbsp;";
theQuotes[13] = "Three of our students were semifinalists in ICPC ACM,2007<br>the International Coding Competition";
theQuotes[14] = "A mobile robotics platform has been built in the Institute which will provide as a research platform for AI<br>human robot interaction, computer vision etc.";
theQuotes[15] = "A talking listening and seeing robot has been built in the institute.<br>&nbsp;";
theQuotes[16] = "Three students were the finalists in the coding competition<br>Overnite'2008 held in IIT,Kharagpur";
theQuotes[17] = "Our students were the finalists in the robotics competition<br>in Shaastra'2007 held in IIT,Chennai";
theQuotes[18] = "our students stood first in the robotics competetion<br>in Kshitij'2007 held in IIT,Kharagpur";

oldPics[1] = 1;
oldPics[3] = 1;
oldPics[8] = 1;
oldPics[9] = 1;
oldPics[12] = 1;
oldPics[14] = 1;
oldPics[18] = 1;
oldPics[19] = 1;
oldPics[23] = 1;
oldPics[25] = 1;
oldPics[29] = 1;
oldPics[32] = 1;
oldPics[33] = 1;
oldPics[40] = 1;
oldPics[47] = 1;
oldPics[48] = 1;
oldPics[61] = 1;
oldPics[62] = 1;
oldPics[71] = 1;
oldPics[77] = 1;


function galleryImage(which) {
  document.write(
    '<table class="homepageimage">',
    '<caption align="bottom">', theQuotes[which], '</caption>',
    '<tr><td>',
    '<img src="', thePics[which], '" alt="An image from our gallery">',
    '</td></tr>',
    '</table>'
  );
}

function randomImage() {
  galleryImage(rotation[today.getSeconds()]);
}

function allImages() {
  var count = 0;
  document.write(
    '<div style="position:absolute;',
    ' left:0px;',
    ' top:0px; ',
    ' width:415px;',
    ' height:100%;',
    ' overflow:auto;">',
    'Current Rotation<br>'
  );
  while (count <= 9) {
    document.write(
      '<table>',
      '<caption align="right">:',
      '0',
      count, '&nbsp;&rarr;&nbsp;#', rotation[count], '</caption>',
      '<tr><td>',
      '<img src="', thePics[rotation[count]], '" alt="An image from our gallery">',
      '</td></tr>',
      '</table>'
    );
    count++;
  }
  while (count <= 59) {
    document.write(
      '<table>',
      '<caption align="right">:',
      count, '&nbsp;&rarr;&nbsp;#', rotation[count], '</caption>',
      '<tr><td>',
      '<img src="', thePics[rotation[count]], '" alt="An image from our gallery">',
      '</td></tr>',
      '</table>'
    );
    count++;
  }
  document.write(
    '</div>',
    '<div style="position:absolute;',
    ' left:415px;',
    ' top:0px; ',
    ' width:350px;',
    ' height:100%;',
    ' overflow:auto;">',
    'All images<br>'
  );
  count = 0;
  while (count <= numofPics) {
//    if (oldPics[count] != 1) {
      document.write('<div style="float:right">', count, '</div>');
      galleryImage(count);
//    }
    count++;
  }
  document.write(
    '</div>'
  );
}

