// JavaScript Document

var images = new Array(
  'revolve/photo1.jpg',
  'revolve/photo6.jpg',
  'revolve/photo7.jpg',
  'revolve/photo13.jpg',
  'revolve/0209.jpg',
  'revolve/0212.jpg',
  'revolve/0407.jpg',
  'revolve/0414.jpg',
  'revolve/0502.jpg',
  'revolve/0509.jpg',
  'revolve/0702.jpg',
  'revolve/0703.jpg',
  'revolve/0716.jpg',
  'revolve/0818.jpg',
  'revolve/1013.jpg',
  'revolve/0216.jpg',
  'revolve/0617.jpg',
  'revolve/0815.jpg',
  'revolve/0613.jpg',
  'revolve/1108.jpg',
  'revolve/1109.jpg',
  'revolve/1019.jpg'
  
);
var imgtitle = new Array(
	'Dr. Kamal Hossain, Senior Advocate, Bangladesh Supreme Court, addressing at a conference on \'Religion, Globalization and Democracy\', organized by  The Institute and the Embassy of the Republic of Italy',
	'Barrister Rokanuddin Mahmud, President, Bangladesh Bar Council, addressing at a conference on \'Religion, Globalization and Democracy\', organized by the Institute and the Embassy of the Republic of Italy',  
	'H.E Mr. Chalermpol Thanchitt, Ambassador of Thailand in Bangladesh, handed over 2 copies of the Thai version of the Holy Quran to the Institute of Hazrat Mohammad SAW in Dhaka to contribute to the Institute\'s collection of the Quran in different languages.',
	'Mr. Anwar Hossain, Former Communication Minister, Govt. of Bangladesh, addressing at a conference on \'Religion, Globalization and Democracy\', organized by  the Institute and the Embassy of the Republic of Italy',
	'Dr. Salehuddin Ahmed, Governor, Bangladesh Bank speaking at the prize giving ceremony of essay competition for the visually impaired, on the topic of \'Prophet Mohammad (SAW) as role model for global peace\' and \'Universal message of Prophet Mohammad (SAW)\' ',
	'H. E. Mr. Paul Tschang In-Num, Ambassador of the Holy See, speaking at the Conference on \'Inter-Religious Cooperation in Peace Making\' jointly organized by the Institute of Hazrat Mohammad (SAW) & The Embassy of the Republic of Italy.',
	'Mr. Shah Mohammed Abul Hussain, Honorable State Minister for Finance and Planning, Govt of Bangladesh, and Chief Guest of the Conference, delivering his speech at the Conference on \'Development of Islamic Banking\' organized by the Institute of Hazrat Mohammad (SAW), at Osmani Memorial Hall, on April 25, 2005.',
	'Mr. Fakhruddin Ahmed, Honorable Governor of Bangladesh Bank, giving his speech at the Conference for the \'Development of Islamic Banking\', organized by the Institute of Hazrat Mohammad (SAW), at Osmani Memorial Hall, on April 25, 2005.',
	'Barrister Moudud Ahmed, Honorable Minister, Ministry of Law, Justice and Parliament Affairs, Govt of Bangladesh, and the Chief Guest of the \'International Islamic Conference for World Peace\', is delivering his speech at the Conference at Osmani Memorial Hall, on December 2, 2004.',
	'H. E. Mr. Pietro Ballero, Ambassador of the Embassy of the Republic of Italy addressing at the conference on \'Religion, Globalization and Democracy\' jointly organized by the Embassy & the Institute of Hazrat Mohammad (SAW).',
	'Editor of Prothom Alo, Mr. Motiur Rahman, addressing at \'All Religion Conference for Global Peace\', organized by the Institute of Hazrat Mohammad (SAW), at the Bangladesh China Friendship Conference Center on October 1, 2004',
	'Mr. Benjamin Marsh from the United States of America, presenting his research paper at the \'All Religion Conference for Global Peace\', organized by the Institute, at the Bangladesh China Friendship Conference Center on October 1, 2004',
	'Dr A K Azad Khan, President of Diabetic Association of Bangladesh, addressing at a seminar on \'Medical Aspects of Islamic Fasting\', jointly organized by the Bangladesh College of General Practitioners and The Institute of Hazrat Mohammad (SAW), on the holy month of Ramadan.',
	'H. E. Ms. Lorraine Barker, High Commissioner of Australia, addressing at a conference, organized by the Institute, marking the International Day of Peace and in support of the UN Charter of Human Rights',
	'H.E. Mr. Ahmed AH Eliman, Ambassador, Embassy of the Great Socialist Peoples\' Libyan Arab Jamahiriya, giving his speech at the essay competition for the visually impaired, organized by the Institute, on the occasion of the Holy and auspicious month of Rabi Ul Awal.',
	'Honorable State Minister for Education, Mr. Ehsanul Hoque Milan, giving prizes among the winners at an essay competition organized by the Institute, on the life of Prophet Mohammad (SAW) for the English Medium School children of Dhaka Metropolitan area',
	'Editor of the Daily Star, Mr. Mahfuz Anam, speaking at the \'All Religion Conference for Global Peace\', organized by the Institute, at the Bangladesh China Friendship Conference Center on October 1, 2004',
	'Barrister Amir Ul Islam, President Bangladesh Supreme Court Bar Association and Senior Advocate Bangladesh Supreme Court, addressing as the Chief Guest at an essay competition for the visually impaired, organized by the Institute of Hazrat Mohammad (SAW), on the occasion of Holy Rabi Ul Awal',
	'H. E. Harry K Thomas Junior, Ambassador of USA to Bangladesh, addressing at \'All Religion Conference for Global Peace\' organized by the Institute, at the Bangladesh China Friendship Conference Center on October 1, 2004',
	'Mr. Golam Quader, Honorable Minister, Ministry of Civil Aviation & Tourism, Govt of Bangladesh and the chief guest giving his speech at the essay competition for the visually impaired, organized by the Institute, on the occasion of the Holy and auspicious month of Rabi Ul Awal.',
	'Brig. General (Retd) Abdul Malik, National Professor and Secretary General of the National Heart foundation Hospital and Research Institute, addressing as the chief guest at the seminar titled \'Dignity and Justice for all of us\', organized by the Institute of Hazrat Mohammad (SAW), to mark the International Day of persons with Disabilities.',
	'United Nations Resident Coordinator, Ms. Renata Dessallien, addressing at a Conference on \'Inter-Religious Cooperation in Peace Making\', organized by the Embassy of the Republic of Italy and the Institute of Hazrat Mohammad (SAW).'

);


var imageWidth = 313;
var imageHeight = 212;
var imageTimeout = 8000;
var nextImage = 1;
var nowIndex = 0;

function addLoadEvent(func) {	
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
 		} else {
				 window.onload = function() {
			if (oldonload) {
				oldonload();
		 	}
			func();
		}
	}
} 

function pageLoad() {

  var el = document.getElementById('fading_image_container');
  while (el.firstChild) { el.removeChild(el.firstChild); }

  el.style.width = imageWidth + 'px';
  el.style.height = imageHeight + 'px';

  for(var i=0; i<images.length; i++) {

    var t = document.createElement('IMG');
    t.setAttribute('src',images[i]);
    t.setAttribute('width',imageWidth);
    t.setAttribute('height',imageHeight);
    t.style.position = 'absolute';
    t.style.visibility = 'hidden';
    el.appendChild(t);

  }

  el.firstChild.style.visibility = 'visible';

  window.setTimeout(startFading, imageTimeout);

}

function fadeImage(el, currentOpacity) {

  currentOpacity += 5;

  if (currentOpacity > 100) {
    setOpacity(el, 100);
    var prevEl = el.previousSibling ? el.previousSibling : el.parentNode.lastChild;
    prevEl.style.visibility = 'hidden';
    el.style.zIndex = 1;
	document.getElementById('fading_title').innerHTML = imgtitle[nowIndex]
    window.setTimeout(startFading, imageTimeout);
  }
  else {
    setOpacity(el, currentOpacity);
    window.setTimeout(function() { fadeImage(el, currentOpacity); }, 50);
  }

}

function startFading() {

  var el = document.getElementById('fading_image_container').childNodes[nextImage];

  el.style.visibility = 'visible';
  el.style.zIndex = 2;
  setOpacity(el, 0);
  fadeImage(el,0);

  nextImage = (nextImage < images.length-1) ? nextImage + 1 : 0;
  nowIndex = nextImage==0? images.length-1:(nextImage-1);

}

function setOpacity(el, opacity) {

	opacity /= 100;

	el.style.opacity = opacity;
	el.style.MozOpacity = opacity;
	el.style.filter = "alpha(opacity=" + (opacity*100) + ")";

}

addLoadEvent( pageLoad ); 
