			/*****************
			Javascript for home page Image additions and transition functions		
			
			******************/
			/**** documentation to maintain the code ::
			 Changes to make to all more images(uptil 6 images for now)			 
			
			1. Add an entry in this array
			   LinksArray[3] = "example.html";
			2. Change limit variable to number of Images - 1 in item_rotateDir(direction) and item_rotate() functions
				eg. var limit = 2;
			
			
			Changes to be done to add more than 6 images
			1. Add new entry in the LinksArray array
				eg.  LinksArray[7] ="example.html";
			2. Change limit variable to number of Images - 1 in item_rotateDir(direction) and item_rotate() functions
				eg var limit = 6;
			
			**********************/
			
			// Time Interval for changing the images
			var interval_time = 30000;  
			// Number of Image Items
            var item_count = 12;
            var item_interval;
			// Cursors for transitioning between images
            var old_item = 0;
            var current_item = 0;
			
			var startTimerId = 0;
			// Start with PicNum 1
			var picNum = 1;		
		
			// set the limit
			var limit = 11;
		
		// array for links for Home Page Images .. 
		// currently we have only 2 images so only two links for now
		var LinksArray = new Array();
		LinksArray[1] = "about/news/donPorterNSF2012.html";
		LinksArray[2] = "about/news/ychoi.html";
		LinksArray[3] = "about/news/realitydeckPage.html";
		LinksArray[4] = "about/news/ProgrammingContest2011.html";
		LinksArray[5] = "about/news/Startup2011.html";
		LinksArray[6] = "about/news/sn.html";
		LinksArray[7] = "about/news/cdda.html";
		LinksArray[8] = "about/news/hearsay.html";
		LinksArray[9] = "about/news/energy.html";
		LinksArray[10] = "about/news/trends.html";
		LinksArray[11] = "about/news/nrc2010.html";
		LinksArray[12] = "about/news/ibm_vasily.html";
		LinksArray[13] = "";
		
		// Execute it when home page loaded completely
            $(document).ready(function() {
				// To find out number of items
                item_count = $("div.slideshow-item").size();

                $("div.slideshow-item").each(function(i) {
                    $(this).hide();
                }); 

				// Fade in the first item
	        $("div.slideshow-item:eq(" + current_item + ")").fadeIn("fast");
            item_interval = setInterval(item_rotate, interval_time); // time in milliseconds
            });
			

			// Function to rotate the home page images in left or right direction
		
				
			function item_rotateDir(direction) {
				//var limit = 4;
				var temp = current_item + direction;
				if (temp < 0)
					temp = item_count-1;
				if (temp > item_count-1)
					temp = 0;
                current_item = temp;
				// Fade out the old image
                $("div.slideshow-item:eq(" + old_item + ")").fadeOut(1000, function() {
                    $("div.slideshow-item:eq(" + current_item + ")").fadeIn("fast");
                });
				
                old_item = current_item;
            }
           
		// To rotate the image items
            function item_rotate() {	
			
                current_item = (old_item + 1) % item_count;
				
                $("div.slideshow-item:eq(" + old_item + ")").fadeOut("slow", function() {
                    $("div.slideshow-item:eq(" + current_item + ")").fadeIn("slow");
                });
                old_item = current_item;
				
            }
			
			// to get today's date in the required format
			function mdy(todaysdate) {
				//calls the function mdy why to get our date
				return todaysdate.getMonth()+1+"/"+todaysdate.getDate()+"/"+todaysdate.getFullYear()
        	}
		
			// to change the profile .. not used right now
			function changeProfile(direction)
			{
				var element = document.getElementById("img1");
				var linkElement = document.getElementById("LinkImage1");
				if (element.filters)
				{
					element.style.filter="blendTrans(duration=1)";
					element.filters.blendTrans.Apply();
				}
				picNum = picNum + direction;
				/* as we have just two images so rotate between 2 images*/
				if (picNum < 1)
					picNum = 2;
				if (picNum > 2)
					picNum = 1;				
				element.src = "images/npic" + picNum + ".jpg";
				/* to get related links for the home page image*/
				linkElement.href = LinksArray[picNum];
				if (element.filters) element.filters.blendTrans.Play();	
			}
	
			// to set the absolute positions of the strip
			function setStrip()
				{
					var element = document.getElementById("strip");
					var headelement = document.getElementById("slideshow-container");
					element.style.left = headelement.offsetLeft + 'px';
					// to set the opacity and z-index for the strip
					element.style.zIndex = 10;
					element.style.opacity = 0.45;
					element.style.filter =  "alpha(opacity=" + parseFloat(45) + ")";
					 if( typeof( element.offsetParent ) != 'undefined' ) 
						for(var Xpos = 0 ; headelement; headelement = 	headelement.offsetParent ) 
						  Xpos += headelement.offsetLeft;    
					
					// to set the left of strip 
					element.style.left = Xpos +'px';
					
					// if browser is IE then do below 
					if(navigator.appName =="Microsoft Internet Explorer") {
						document.getElementById("slideshow-container").style.top = "10px";
						document.getElementById("strip").style.top = document.getElementById("strip").offsetTop - 1 +"px" ;		
						document.getElementById("blank").style.height = "10px";
					}
					else
					{
						document.getElementById("blank").style.height = "40px";
					}
					
					
				}
			// to change the position of strip when window is resized
			window.onresize = function(event) {
				setStrip();
			}



