//alert("Hello");
	// <![CDATA[
	
	// -----------------------------------------------------------------------------------
	// 
	// This page coded by Scott Upton
	// http://www.uptonic.com | http://www.couloir.org
	//
	// This work is licensed under a Creative Commons License
	// Attribution-ShareAlike 2.0
	// http://creativecommons.org/licenses/by-sa/2.0/
	//
	// Associated API copyright 2002, Travis Beckham (www.squidfingers.com)
	//
	// -----------------------------------------------------------------------------------
	// --- version date: 04/30/05 ------------------------------------------------------
	
	//var photoDir = "images/"; // Location of photos for gallery
	var photoDir = ""; 
	var borderSize = 6;	 // = 2x CSS border size
	
	// get current photo id from URL
	var thisURL = document.location.href;
	var splitURL = thisURL.split("#");
	//var photoId = splitURL[1] - 1;
	var photoId = splitURL[1];				//changes done on 24th october
	// if no id in query string then set to 0
	photoId = (!photoId)? 0:photoId;
		
	// Define each photo's name, height, width, and caption
	var photoArray = new Array();
	var photoNum;
	var wNew;
	var hNew;
	var newPhoto;
function arraycontent()
{	
	 sp=new Array();
	 caption=new Array();
	 divelement=document.getElementById("imageContent");
	 spanarray=divelement.getElementsByTagName("span");
	 spanarray1=document.getElementsByTagName("span");
	//alert(spanarray.length);
	//alert(spanarray1.length);
	for(var i=0;i<spanarray.length;i++)
		{
		//	alert("inside span array.....");
			sp[i]=spanarray[i].innerHTML;
			//alert(spanarray[i].innerHTML);
		}
		
	 divarray=divelement.getElementsByTagName("div");
	//alert(divarray.length);
	for(var i=0;i<divarray.length;i++)
		{	
			//alert("inside span array.....1");
			//sp[i]=spanarray[i].innerHTML;
			caption[i]=divarray[i].innerHTML;
			//alert(divarray[i].innerHTML);			
			//alert(caption[i]);
		}

}	
function delaydata()
{	
	arraycontent();
//alert("inside delaydata()...");
	//alert("Step 1 Begins");
	/* photoArray = new Array(
			new Array("3.jpg", "500", "280", "Door 3 - Click on the image to view previous or next image"),
			new Array("2.jpg", "425", "319", "Door 2 - Click on the image to view previous or next image"),             
			new Array("1.jpg", "700", "260", "Door 1 - Click on the image to view previous or next image")
							);*/
		for(var i=0;i<sp.length;i++)
		{
			//alert(spArray[i]);
		}
		for(var i=0;i<caption.length;i++)
		{
			//alert(capArray[i]);
		}
/*		var temp1=new Array("3.jpg", "500", "280", "Door 3 - Click on the image to view previous or next image");
		var temp2=new Array("2.jpg", "500", "280", "Door 3 - Click on the image to view previous or next image");
		var temp3=new Array("1.jpg", "500", "280", "Door 3 - Click on the image to view previous or next image");
		//photoArray = new Array(temp1,temp2,temp3);*/
//		tempphotoArray = new Array(temp1,temp2,temp3);
	//	photoArray = tempphotoArray;
		var tempphotoArray=new Array();
		for(var i=0;i<sp.length;i++)
		{
			tempphotoArray[i]=new Array(sp[i],"500","280",caption[i]);
			//alert(tempphotoArray[i]);
		}
	 photoArray = tempphotoArray;
	// Number of photos in this gallery
	photoNum = photoArray.length;
	//alert(photoNum);
	//alert("photoId="+photoId);
	//alert("photoArray[photoId][1]"+photoArray[photoId][1]);
	wNew = photoArray[photoId][1];
	hNew = photoArray[photoId][2];
	//newPhoto = photoDir + photoArray[photoId][0];
	newPhoto = photoArray[photoId][0];
	//alert("newPhoto="+newPhoto);
	API = new Detect();
	//alert(photoArray[photoId][3]);

	////////////////////////////////////////////////////////////////////////////////////////////
	API.Container		= new HTMLobj('Container');
		//alert("API.Container="+API.Container);
		API.Photo			= new HTMLobj('Photo');
		API.PhotoContainer	= new HTMLobj('PhotoContainer');
		API.LinkContainer	= new HTMLobj('LinkContainer');
		API.PrevLink		= new HTMLobj('PrevLink');
		API.NextLink		= new HTMLobj('NextLink');
		API.CaptionBlock	= new HTMLobj('CaptionBlock');
		API.Counter			= new HTMLobj('Counter');
		API.Caption			= new HTMLobj('Caption');
//		alert(API.Caption);
		API.LoadImg			= new HTMLobj('LoadImg');
	API.Caption.setInnerHtml(photoArray[photoId][3]);		
		// Show initial photo
		cyclePhoto(photoId);
		///////////////////////////////////////////////////////////////////////////////////////////

}
	// Create access to 'Detect' object and a place to put instances of 'HTMLobj'
	//API = new Detect();
	
	// CREATE INSTANCES & LOAD
/*	function loadAPI()
	//loadAPI = function()
	{	API = new Detect();										//changes done 
		alert("Step 2 Begins");
		//alert("Hello Success");
		//alert("API Loaded Successfully...");
		// Instantiate HTMLobj
		API.Container		= new HTMLobj('Container');
		//alert("API.Container="+API.Container);
		API.Photo			= new HTMLobj('Photo');
		API.PhotoContainer	= new HTMLobj('PhotoContainer');
		API.LinkContainer	= new HTMLobj('LinkContainer');
		API.PrevLink		= new HTMLobj('PrevLink');
		API.NextLink		= new HTMLobj('NextLink');
		API.CaptionBlock	= new HTMLobj('CaptionBlock');
		API.Counter			= new HTMLobj('Counter');
		API.Caption			= new HTMLobj('Caption');
//		alert(API.Caption);
		API.LoadImg			= new HTMLobj('LoadImg');
		
		// Show initial photo
		cyclePhoto(photoId);
	}*/
//	onload = loadAPI;
	
	// Fade in photo when it is loaded from the server
	initFade = function()
	{
		//alert("Step 3 Begins");
		// Show PhotoContainer again
		API.PhotoContainer.show();
		
		// Be certain the tween is complete before fading, too
		var fade_timer = setInterval('startFade()', 1000);
						
		// Fade photo in when ready and clear listener
		startFade = function()
		{
			//alert("Step 4 Begins");
			if(API.Container._tweenRunning == false)
			{
				clearInterval(fade_timer);
				
				// Be certain fade is done running before allowing next/previous links to work
				// This avoids rapid fade-in when users click next/previous links in quick succession
				var adv_timer = setInterval('permitNextPrev()', 500);
				
				// Permit next/previous links to function normally when fade is completed
				permitNextPrev = function()
				{
					//alert("Step 5 Begins");
					if(API.Photo._fadeRunning == false)
					{
						clearInterval(adv_timer);
						
						// Only show links if there is more than one photo in array
						if(photoNum > 1)
						{
							API.LinkContainer.displayShow();
							document.getElementById('NextLink').onclick = nextPhoto;
							document.getElementById('PrevLink').onclick = prevPhoto;
						}
					} 
					else
					{
						return;
					}
				}
				// Swap out loading animation to spare CPU cycles when hidden anyway
				API.LoadImg.setSrc("../images/slideshow/start.gif");
				
				// Show caption again
				API.CaptionBlock.show();
				
				// Fade photo in
				API.Photo.fadeIn(0,15,33);
			} 
			else 
			{
				return;
			}
		}
	}
	
	// Prevent next/previous
	falsify = function()
	{
		//alert("Step 6 Begins");
		return false;
	}
	
	// Go to next photo
	nextPhoto = function()
	{
		//alert("Step 7 Begins");
		// Go to next photo
		if(photoId == (photoArray.length - 1))
		{	//alert("next photo if "+photoId);
			photoId = 0;
		} 
		else
		{
			//alert("next photo else "+photoId);
			photoId++;
		}
		cyclePhoto(photoId);
	}
	
	// Go to previous photo
	prevPhoto = function()
	{
		//alert("Step 8 Begins");
		// If at start, go back to end
		if(photoId == 0)
		{
			//alert("previous photo if "+photoId);
			photoId = photoArray.length - 1;
		}
		else 
		{
			//alert("previous photo else "+photoId);
			photoId--;
		}
		cyclePhoto(photoId);
	}
	
	// Alter class of elements
	changeElementClass = function(objId,setClass) 
	{
		//alert("Step 9 Begins");
		document.getElementById(objId).className = setClass;
	}
	
	// Function to load subsequent photos in gallery
	cyclePhoto = function(photoId)
	{
		//alert("photoid="+photoId);
				
		// Swap in loading animation
		API.LoadImg.setSrc("../images/slideshow/loading_ani2.gif");
		
		// Hide link container if it is not already hidden
		API.LinkContainer.displayHide();
		
		// Hide photo container and caption temporarily
		API.Photo.hide();
		API.Photo.setOpacity(0);
		API.CaptionBlock.hide();
		
		// Get dimensions of photo
		 wNew = photoArray[photoId][1];
		 hNew = photoArray[photoId][2];
		
		// Start tween on a delay
		var wCur = API.Container.getWidth() - borderSize;
		var hCur = API.Container.getHeight() - borderSize;
		
		// Begin tweening on a short timer
		setTimeout('API.Container.tweenTo(easeInQuad, ['+wCur+', '+hCur+'], ['+wNew+','+hNew+'], 7)',500);
		setTimeout('API.LinkContainer.sizeTo('+wNew+','+hNew+')',500);
		setTimeout('API.PrevLink.sizeTo('+wNew/2+','+hNew+')',500);
		setTimeout('API.NextLink.sizeTo('+wNew/2+','+hNew+')',500);
		setTimeout('API.CaptionBlock.sizeTo('+wNew+',18)',500);
		
		// Get new photo source
/*		var newPhoto = photoDir + photoArray[photoId][0];*/
		
		// Set source, width, and height of new photo
		//newPhoto = photoDir + photoArray[photoId][0];		//newphoto taken
		newPhoto = photoArray[photoId][0];
		
		API.Photo.setSrc(newPhoto);		
		API.Photo.sizeTo(wNew,hNew);
		
		// Set links to new targets based on photoId
		API.NextLink.setHref("#" + (photoId+1));
		API.PrevLink.setHref("#" + (photoId+1));
		API.Counter.setInnerHtml((photoId+1)+" of "+photoNum+" |");
//		API.Caption.setInnerHtml(photoArray[photoId][3]);
		
		// Event listeners for onload and onclick events
		document.getElementById('Photo').onload = initFade;
		
		// Block next/previous links until permitNextPrev() has fired
		document.getElementById('NextLink').onclick = falsify;
		document.getElementById('PrevLink').onclick = falsify;
	}
	// ]]>