//////////////////////////////////////////////
//											//
//		Copyright 2008/2009, James Clarke 	//
//		- Adnet Communications				//
//											//
//////////////////////////////////////////////


window.addEvent('domready', function(){

		// button array
		var itemFx = new Array;
		//image array
		var slideFx = new Array;

		// description array and Fx Classes
		//var itemIds = $('nav').getElements('div[class=propDesc]');
		//	itemIds.each(function(d){
		//		itemFx.push(new Fx.Style(d, 'opacity', {duration:750}).set(0));
		//	});
		
		// image array and Fx Classes
		var slideIds = $('StockTicker').getElements('div[class=slideshowItem]');
			slideIds.each(function(d){
				slideFx.push(new Fx.Style(d, 'opacity', {duration:750}).set(0));
			});
		
		// button array and Fx Classes
		//var itemLinks = $('numbers').getElements('a[class=numNav]');
		//	itemLinks.each(function(d,i){
		//		d.addEvent('click', function() {
		//			setProj({'num':i});
		//			clearInterval(inty);
		//			d.blur();
		//		});
		//	});
		
		// cursor
		var iLast = -1;
		var Myi = 0;
		
		function setProj(){
			//var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
			var isWebKit = false;
			if(window.devicePixelRatio) isWebKit = true;
			var isIE = false;
			if(document.all) isIE = true;
			
			if(isIE || isWebKit){
				
				if(arguments.length > 0){
					Myi = arguments[0].num;
				}else{
					if(iLast < slideFx.length-1){
							Myi = iLast+1;
					}else{
							Myi = 0;
					}
				}	
				
				
			}else{
				
				if(arguments[0].num != null){
					Myi = arguments[0].num;
				}else{
					if(iLast < slideFx.length-1){
							Myi = iLast+1;
					}else{
							Myi = 0;
					}
				}	
				
			}



			
				slideFx[Myi].start(0,1);
				//itemFx[Myi].start(0,1);
				//itemLinks[Myi].addClass('active');
				
				if(iLast >= 0){
					slideFx[iLast].start(1,0);
				//	itemFx[iLast].start(1,0);
				//	itemLinks[iLast].removeClass('active');
				}
				
				iLast = Myi;
			
		}
				
		// change interval 
		var inty = 0;
		function int(){
			clearInterval(inty);
			inty = setInterval( setProj, 6000 );	
		} 
		
		int();
		var passObj = new Object();
			passObj.num = 0;
		setProj(passObj);
		
		
	}); 