/**
* @desc carroussel class
* @author Ramon Ennik
* @copyright Mediaxplosion 2009
*/
function clsCarroussel (p_sPlaceholder, p_iTimeout) {
		
			this.m_sPlaceholder = p_sPlaceholder;
			this.m_iTimeout 	= p_iTimeout;
			this.m_aImages	 	= new Array();
			this.m_aLinks 		= new Array();
			this.m_iPos 		= 0;
			this.m_bAnimate 	= true;
			
			this.init = function() {
				var oObj = document.getElementById(this.m_sPlaceholder);
				var self =  this;
				if (oObj && oObj.hasChildNodes()) {
					for(var i = 0; i < oObj.childNodes.length; i++) {
						if (oObj.childNodes[i].className == "camenu") {
							var oLinksDiv = oObj.childNodes[i];
							var x = 0;  
							for(var j = 0; j < oLinksDiv.childNodes.length; j++) {
								if (oLinksDiv.childNodes[j].tagName == "A") {
									var sx = (x);
									if (x == 0) {
										oLinksDiv.childNodes[j].onmouseover = function(e) { self.m_bAnimate = false; self.setDisplay(0);}
										oLinksDiv.childNodes[j].onmouseout = function(e) { self.m_bAnimate = true;}
									} 
									if (x == 1) {
										oLinksDiv.childNodes[j].onmouseover = function(e) {	self.m_bAnimate = false; self.setDisplay(1);}
										oLinksDiv.childNodes[j].onmouseout = function(e) { self.m_bAnimate = true;} 
									}
									if (x == 2) {
										oLinksDiv.childNodes[j].onmouseover = function(e) {	self.m_bAnimate = false; self.setDisplay(2);}
										oLinksDiv.childNodes[j].onmouseout = function(e) { self.m_bAnimate = true;} 
									}
									if (x == 3) {
										oLinksDiv.childNodes[j].onmouseover = function(e) {	self.m_bAnimate = false; self.setDisplay(3);}
										oLinksDiv.childNodes[j].onmouseout = function(e) { self.m_bAnimate = true; } 
									}
									if (x == 4) {
										oLinksDiv.childNodes[j].onmouseover = function(e) {	self.m_bAnimate = false; self.setDisplay(4);}
										oLinksDiv.childNodes[j].onmouseout = function(e) { self.m_bAnimate = true; } 
									}
									x++; 
									this.m_aLinks[this.m_aLinks.length] = oLinksDiv.childNodes[j];
								}
								
							}
						}
					}
					for(var i = 0; i < oObj.childNodes.length; i++) {
						if (oObj.childNodes[i].className == "image") {
							this.m_aImages[this.m_aImages.length] = oObj.childNodes[i];
						}
					}
				}
				this.moveNext();
				//setInterval( "oCarrouussel.setDisplay(oCarrouussel.m_iPos)", this.m_iTimeout )
				
			}
			
			this.setDisplay = function(p_iIndex) {
				var self = this;
				for(var i = 0; i < this.m_aImages.length; i++) {
					this.m_aImages[i].style.display = 'none';
					//this.m_aLinks[i].className = 'title-' + (i+1).toString();
					var aClass = this.m_aLinks[i].className.split('-');
					this.m_aLinks[i].className = aClass[0] + "-" + aClass[1] + "-" + "inactive";
				}
				if (p_iIndex >= this.m_aImages.length) {
					p_iIndex = 0;
				}
				
				this.m_aImages[p_iIndex].style.display  = '';
				//this.m_aLinks[p_iIndex].className = 'titleactive-'+(p_iIndex+1).toString();
				var aClass = this.m_aLinks[p_iIndex].className.split('-');
				this.m_aLinks[p_iIndex].className = aClass[0] + "-" + aClass[1] + "-" + "active";
				
				this.m_iPos = p_iIndex+1;
			//	setTimout(self.setDisplay(self.m_iPos)), this.m_iTimeout);
				
			}
			
			this.moveNext = function () {
				var self = this;
				if (this.m_bAnimate) { 
					this.setDisplay(this.m_iPos);
				}
				setTimeout(function() { self.moveNext(); }, this.m_iTimeout);
			}
			
			this.init();
		}