// JavaScript Document
//SET GLOBALS
//var canvaswidth = 970;
var canvaswidth = 921;
var subnavwidth = '210px';
var timer = 200;
var wheretostartleftalign = 5;
var effectDuration = .2;
var thirdlevelduration = .2;
var topoffsetID = 'header_wrapper';

//NAVIGATION HOLDER
var MainNav = new Array();

function initNavEvents()
{
	//init ids
	var mainnav = null;
	var subnav = null;
	for(var a=0; a<MainNav.length; a++)
	{
		MainNav[a].submenu.style.width = subnavwidth;
	}

	//init main nav events
	for(var a=0; a<MainNav.length; a++)
	{				  
		function showsub(event, obj) 
		{
			clearTimeout(obj.outtimer);
			clearTimeout(obj.subnavtimer);
			obj.overtimer = setTimeout(function () {		
					
					
					
					if(obj.submenu.style.display != 'block')
					{
						new Effect.BlindDown(obj.submenu,
						{
							duration: effectDuration,
							beforeStart: function ()
							{
								obj.submenu.style.visibility = 'visible';
								obj.submenu.style.display = 'none'; 
								obj.submenu.style.zIndex= '100';
							},
							afterFinish: function ()
							{
								//obj.submenu.style.visibility = 'visible';
								//obj.submenu.style.display = 'block'; 
							}
						});
					}
			}, timer);
			   
		} 
		MainNav[a].parentItem.observe('mouseover', showsub.bindAsEventListener(this, MainNav[a]));   
		
		function hidesub(event, obj)
		{
			clearTimeout(obj.overtimer);
			obj.parentItem.className = '';
			obj.outtimer = setTimeout(function () {
					if(obj.submenu.style.display != 'none')
					{
						new Effect.BlindUp(obj.submenu, 
						{
							duration:effectDuration,
							beforeStart: function ()
							{

								obj.submenu.style.zIndex= '0'; 
							},
							afterFinish: function ()
							{
								obj.submenu.style.visibility = 'hidden';
								obj.submenu.style.display = 'none';
							}
						});
					}
			}, timer);
		} 
		MainNav[a].parentItem.observe('mouseout', hidesub.bindAsEventListener(this, MainNav[a]));
	}
	
	//init submenu events
	for(var a=0; a<MainNav.length; a++)
	{
		if(MainNav[a].submenu)
		{
			function showsubmenu(event, obj) 
			{    
				obj.submenu.style.visibility = 'visible';
				obj.submenu.style.display = 'block';
				clearTimeout(obj.subnavtimer);
				clearTimeout(obj.outtimer);
			} 
			MainNav[a].submenu.observe('mouseover', showsubmenu.bindAsEventListener(this, MainNav[a]));   

			function hidesubmenu(event, obj) 
			{   
				obj.subnavtimer = setTimeout(function () {
					new Effect.BlindUp(obj.submenu, 
						{
							duration:effectDuration,
							beforeStart: function ()
							{
							},
							afterFinish: function ()
							{
								obj.parentItem.className = '';
								obj.submenu.style.visibility = 'hidden';
								obj.submenu.style.display = 'none'; 
							}
						});
				}, timer);
			} 
			MainNav[a].submenu.observe('mouseout', hidesubmenu.bindAsEventListener(this, MainNav[a]));
		}
				
	}

	//ini thirdnavs events
	for(var y=0; y<MainNav.length; y++)
	{
		for(var m=0; m<MainNav[y].thirdLvL.length; m++)
		{
			if(MainNav[y].thirdLvL[m].thirdmenuNode)
			{
				
				function showthirdsub(event, obj)
				{    
					clearTimeout(obj.thirdmenuouttimer);
					obj.thirdparentItem.style.backgroundColor =  '#a21411';
					obj.thirdmenuovertimer = setTimeout(function () {
						if(obj.thirdmenuNode.style.visibility != 'visible')
						{
							new Effect.BlindDown(obj.thirdmenuNode, 
							{
								duration: thirdlevelduration,
								scaleX:	true,
								scaleY: true,
								beforeStart: function ()
								{
									obj.thirdmenuNode.style.visibility = 'visible';
									obj.thirdmenuNode.style.display = 'none';
									obj.thirdmenuNode.style.zIndex= '100';
								},
								afterFinish: function ()
								{
									obj.thirdmenuNode.style.visibility = 'visible';
									obj.thirdmenuNode.style.display = 'block'; 
								}
							});
						}
					}, timer);					   
				} 
				MainNav[y].thirdLvL[m].thirdparentItem.observe('mouseover', showthirdsub.bindAsEventListener(this, MainNav[y].thirdLvL[m]));  
				
				
				function hidethirdsub(event, obj) 
				{    
					clearTimeout(obj.thirdmenuovertimer);
					obj.thirdparentItem.style.backgroundColor =  '#000000';
					obj.thirdmenuouttimer = setTimeout(function () {
							if(obj.thirdmenuNode.style.display != 'none')
							{
								new Effect.BlindUp(obj.thirdmenuNode, 
								{
									duration: thirdlevelduration,
									scaleX:	true,
									scaleY: true,
									beforeStart: function ()
									{
										obj.thirdmenuNode.style.zIndex= '0'; 
									},
									afterFinish: function ()
									{
										obj.thirdmenuNode.style.visibility = 'hidden';
										obj.thirdmenuNode.style.display = 'none';
									}
								});
							}
					}, timer);
				}
				MainNav[y].thirdLvL[m].thirdparentItem.observe('mouseout', hidethirdsub.bindAsEventListener(this, MainNav[y].thirdLvL[m]));
				

				function showthirdsubmenu(event, obj) 
				{      
					obj.thirdparentItem.style.backgroundColor =  '#a21411';
					clearTimeout(obj.thirdmenuouttimer);
					//clearTimeout(thirdobj.thirdmenuovertimer);
					//clearTimeout(thirdobj.thirdmenuovertimer2);
				} 
				MainNav[y].thirdLvL[m].thirdmenuNode.observe('mouseover', showthirdsubmenu.bindAsEventListener(this, MainNav[y].thirdLvL[m]));  
				
				
				function hidethirdsubmenu(event, obj)
				{    

					obj.thirdmenuouttimer = setTimeout(function () {
							if(obj.thirdmenuNode.style.display != 'none')
							{
								new Effect.BlindUp(obj.thirdmenuNode, 
								{
									duration: thirdlevelduration,
									scaleX:	true,
									scaleY: true,
									beforeStart: function ()
									{
										obj.thirdmenuNode.style.zIndex= '0'; 
										obj.thirdparentItem.style.backgroundColor =  '#000000';
									},
									afterFinish: function ()
									{
										obj.thirdmenuNode.style.visibility = 'hidden';
										obj.thirdmenuNode.style.display = 'none'; 
									}
								});
							}
					}, timer);
				}
				MainNav[y].thirdLvL[m].thirdmenuNode.observe('mouseout', hidethirdsubmenu.bindAsEventListener(this, MainNav[y].thirdLvL[m]));  

			}
		}	
	}
	
}

function setSubnavLeft(index)
{
	var mainnav_items = $$('#main_nav a', '#sidebar a');
	var leftoffset = null;
	var pageDim = $('body').getDimensions();
	if(pageDim.width < canvaswidth) { pageDim.width = canvaswidth; }
	var pageMiddle = pageDim.width/2;
	var canvasleft = pageMiddle + canvaswidth/2;
	
	var navwidths = new Array();
	
	for(var a=0; a < mainnav_items.length; a++)
	{	
		var temp = mainnav_items[a].getWidth();
		navwidths.push(temp);
	}
	navwidths.reverse() 
	var temp = 0;
	var rightoffset = 0;
	for(var a=0; a < (navwidths.length-index); a++)
	{
		temp = temp + navwidths[a];
	if(a > (navwidths.length-wheretostartleftalign-1))
		{
			rightoffset = 0;
		}
		else
		{
			rightoffset = navwidths[a] - parseInt(subnavwidth) - 1;
		}
	}
	canvasleft = canvasleft - temp + rightoffset-1;
	return canvasleft;
}


function reposNav()
{
	//alert(MainNav.length);
	var mainnav_items = $('main_nav').getElementsByTagName('a');
	for(var i=0; i < mainnav_items.length; i++)
	{
		if(MainNav[i])
			MainNav[i].submenu.style.left = setSubnavLeft(i) + 'px';
	}
	
	for(var i=0; i < MainNav.length; i++)
	{
		for(var r=0; r < MainNav[i].thirdLvL.length; r++)
		{
			if(i >= wheretostartleftalign)
			{
				MainNav[i].thirdLvL[r].thirdmenuNode.style.left = -MainNav[i].thirdLvL[r].thirdmenuleft -2 + 'px';
			}
			else
			{
				MainNav[i].thirdLvL[r].thirdmenuNode.style.left = MainNav[i].thirdLvL[r].thirdmenuleft + 'px';	
			}

			MainNav[i].thirdLvL[r].thirdmenuNode.style.top = MainNav[i].thirdLvL[r].thirdmenutop + 'px';
		}
	}
}

function initNavPos()
{
	$('subnav_wrapper').style.top = $('header_wrapper').getHeight() -1 + 'px';
	//Main Nav Items Array
	var mainnav_items = $('main_nav').getElementsByTagName('a');

	//Get 2ndLevel subnav and put node references in array
	for(var i=0; i < mainnav_items.length; i++)
	{
		var mainsubnav = {
			parentItem : null,
			submenu : null,
			submenuleft : null,
			overtimer : null,
			outtimer : null,
			subnavtimer : null
		}
		
		//look for subnav wrapper
		var subnavID = mainnav_items[i].id + '_subnav';

		if($(subnavID))
		{
			$(subnavID).cleanWhitespace();
			mainsubnav.parentItem = mainnav_items[i];
			mainsubnav.submenu = $(subnavID);

			if($(subnavID).getElementsByTagName('div'))
			{
				var subnavitems = $(subnavID).childElements();
				var temp = new Array();
				var top = 0;
				for(var q=0; q<subnavitems.length; q++)
				{
					if(subnavitems[q].nextSibling)
					{
						if(subnavitems[q].nextSibling.nodeName == 'DIV')
						{
							subnavitems[q].id = 'subnav_third';
							//subnavitems[q].onclick = function () {return false; }
							//subnavitems[q].onclick  = function (e)
								//{return false; }	
							//if (subnavitems[q].captureEvents) subnavitems[q].captureEvents(Event.ONCLICK);

							var thirdsubnav = {
								thirdparentItem : subnavitems[q],
								thirdmenuNode : subnavitems[q].nextSibling,
								thirdmenuleft : parseInt(subnavwidth),
								thirdmenutop : top,
								thirdmenuovertimer : 'null2',
								thirdmenuouttimer : null,
								thirdmenuouttimer2 : null
							}
							temp.push(thirdsubnav);
						}
						if(subnavitems[q].nodeName == 'A')
						{
							top = top + subnavitems[q].getHeight();
						}

					}
				}
				mainsubnav.thirdLvL = temp;
			}

			MainNav.push(mainsubnav);
			
		}
	}
	
}

function initcart()
{
	var cartbtn = $('cartbtn');
	var lbtn = $('cbtn');
	
	lbtn.onmouseout = function (e)
	{
		if (!e) var e = window.event;
		cartbtn.src='http://www.embarcadero.com/images/cart.gif';
	}
	if (lbtn.captureEvents) lbtn.captureEvents(Event.ONMOUSEOUT);

	lbtn.onmouseover = function (e)
	{
		if (!e) var e = window.event;
		cartbtn.src='http://www.embarcadero.com/images/cart_hover.gif';
	}
	if (lbtn.captureEvents) lbtn.captureEvents(Event.ONMOUSEOVER);
}

function prepmainnav()
{
	var widths = [195, 180, 135, 135, 125, 150];
  //var widths = [148, 152];

	var menu = $('horiz-menu');
	removeWhitespace(menu);
	var mainnavnodes = menu.firstChild.childNodes;
	//alert(mainnavnodes.length);
	var mainnav = new Array();
	for(var i=0; i<mainnavnodes.length; i++)
	{
		//alert(mainnavnodes[i].innerHTML);
		mainnav.push(mainnavnodes[i].firstChild);

		var subnav = mainnavnodes[i].childNodes;
		//alert(subnav.length);
		if(subnav.length >= 1)
		{
			//alert(subnav[1].innerHTML)
			var temp = mainnav[i].getElementsByTagName('span');
			var subnavdiv = document.createElement('div');
			subnavdiv.id= temp[0].innerHTML+'_subnav';
			subnavdiv.className = 'subnav';
				
			if(subnav[1])
			{
			var prop = subnav[1].childNodes;

			for(var q = 0; q < prop.length; q++)
			{
				//has third
				if(prop[q].className.replace('active ','') == 'item353')
				{
					prop[q].firstChild.style.backgroundColor = '#cc0000';	
				}
				prop[q].firstChild.className = null;
				if(prop[q].firstChild.getAttribute('href') == '' || prop[q].firstChild.getAttribute('href') == null)
				{
					prop[q].firstChild.setAttribute('href', '#');
				}
				subnavdiv.appendChild(prop[q].firstChild);
				var test = prop[q].getElementsByTagName('ul');

				if(test.length > 0)
				{
					var thirdnavdiv = document.createElement('div');
					thirdnavdiv.className = 'thirdsubnav';
					var thirdnav = prop[q].getElementsByTagName('a');
					var thirdnavarray = new Array();
					for(var a = 0; a<thirdnav.length; a++)
					{
						thirdnavarray.push(thirdnav[a]);
					}
					for(var ac = 0; ac<thirdnavarray.length; ac++)
					{
						thirdnavdiv.appendChild(thirdnavarray[ac]);
					}

					subnavdiv.appendChild(thirdnavdiv);
				}

			}
			$('subnav_wrapper').appendChild(subnavdiv);
			}
			//alert($('subnav_wrapper').innerHTML);
		}
		
	}
	for(var i=0; i<mainnav.length; i++)
	{
		var temp = mainnav[i].getElementsByTagName('span');
		mainnav[i].id = temp[0].innerHTML;
		mainnav[i].style.width = widths[i] - 86 + 'px';
		$('main_nav').appendChild(mainnav[i]);
	}
	
	$('body').removeChild(menu);
}

// Function to remove white spaces from nodes
function removeWhitespace(node) 
{
	var loopIndex;
	
	for (loopIndex = 0; loopIndex < node.childNodes.length; 
	  loopIndex++) {
	
	  var currentNode = node.childNodes[loopIndex];
	
	  if (currentNode.nodeType == 1) {
		removeWhitespace(currentNode);
	  }

	  if (((/^\s+$/.test(currentNode.nodeValue))) &&   
		(currentNode.nodeType == 3)) {
		  node.removeChild(node.childNodes[loopIndex--]);
	  }
	}
}


function initNav()
{

	prepmainnav();
	initNavPos();
	reposNav();
	initNavEvents();
	initselectcountry();
	if($('cartbtn') && $('cbtn'))
		initcart();

}
function setCookie_country(name,value,expiredays)
{
    var exdate=new Date();
    exdate.setDate(exdate.getDate()+expiredays);
    document.cookie=name + "=" + escape(value) +
    ((expiredays==null) ? "" : ";expires=" + exdate.toGMTString()) + ";path=/";
}

function getLanguage(strg)
{
	var splitted = strg.split('/');

	if(splitted[3].length == 2)
	{
		if(splitted[3] != 'en' && splitted[3] != null)
		{
			return splitted[3];
		}
		else
		{
			return 'en';
		}
	}
	else
	{
		return 'en';	
	}
}

function gotocountry()
{
	//alert('test');
	var selectNode = $('select_country');
	var dropdopwnNode = $('select_country_options');
	var dropdownlis = dropdopwnNode.getElementsByTagName('li');
	
	var cookievalue = null;	
	var languagevalue = null;
	var url = null;	
	for(var s = 0; s < dropdownlis.length; s++)
	{
		if(dropdownlis[s].className == 'selected')
		{
			cookievalue = dropdownlis[s].innerHTML;
			languagevalue = getLanguage(dropdownlis[s].id);
			url = dropdownlis[s].id;
		}
	}
	if(selectNode.value != '/')
	{
		//alert(selectNode.value);
		if(url)
		{
			setCookie_country('jfcookie[lang]',languagevalue,1);
			//alert(languagevalue);
			setCookie_country('b_language',cookievalue,1);
			//alert(cookievalue);
			window.location.href = url;
		}

	}
	else
	{
		setCookie_country('jfcookie[lang]','en',1);
	}

	
}

function initselectcountry()
{
	if($('select_country'))
	{
			new Autocompleter.SelectBox('select_country', {submit : 'selectcountry_form'});	
	}
}

function initfilters()
{
	if($('filter'))
	{
	var filters = $('filter').getElementsByTagName('select');
	for(var i=0; i<filters.length; i++)
	{
		filters[i].onchange = function (e)
		{
			if (!e) var e = window.event;
			$('filter').submit();
		}
		if (filters[i].captureEvents) filters[i].captureEvents(Event.ONCHANGE);


	}
	}
}

// Copyright (c) 2006 - 2008 Gabriel Lanzani (http://www.glanzani.com.ar)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// SEE CHANGELOG FOR A COMPLETE CHANGES OVERVIEW
// VERSION 0.4

Autocompleter.SelectBox = Class.create();
Autocompleter.SelectBox.prototype = Object.extend(new Autocompleter.Base(), {
  initialize: function(select, options) {
	this.element = "<input type=\"text\" id=\"" + $(select).id + "_combo\" />"
	new Insertion.Before(select, this.element)
	var inputClasses = Element.classNames(select);

	this.update = "<div id=\"" + $(select).id + "_options\" class=\"" + inputClasses + "\"></div>"
	new Insertion.Before(select, this.update)

    this.baseInitialize($(select).id + "_combo", $(select).id + "_options", options);
    this.select = select;
	this.selectOptions = [];

	$(this.element.id).setAttribute('readonly','readonly');
	this.element.readOnly = true;

	if(this.options.debug) var debugText = 'Debug input ' + this.element.id + ' and div ' + this.update.id + ' created, Autocompleter.Base() initialized\r\n';
	if(!this.options.debug)Element.hide(select);
	Element.addClassName(this.element.id, this.options.css) ;

	var optionList = $(this.select).getElementsByTagName('option');
	var nodes = $A(optionList);

	for(i=0; i<nodes.length;i++){
		this.selectOptions.push("<li id=\"" + nodes[i].value + "\">" + nodes[i].innerHTML + '</li>');
		if (nodes[i].getAttribute("selected")) this.element.value = nodes[i].innerHTML;
		
		if(this.options.debug) debugText += 'option ' + nodes[i].innerHTML + ' added to '+ this.update.id + "\r\n";
	}
	
	Event.observe(this.element, "click", this.activate.bindAsEventListener(this));
	
	if ($(select).selectedIndex >= 0)this.element.value = $(select).options[$(select).selectedIndex].innerHTML;

	var self = this;
	this.options.afterUpdateElement = function(text, li) {
		$('select_country_combo').blur();
		var optionList = $(select).getElementsByTagName('option');
		var nodes = $A(optionList);

		var opt = nodes.find( function(node){
			return (node.value == li.id);
		});
		$(select).selectedIndex=opt.index;

		if(self.options.redirect) document.location.href = opt.value;
		if(self.options.submit != '') $(self.options.submit).submit();
	}
	
	if(this.options.debug) alert(debugText);
  },

  getUpdatedChoices: function() {
  		this.updateChoices(this.setValues());
  },

  setValues : function(){

		return ("<ul>" + this.selectOptions.join('') + "</ul>");
  },
  
  setOptions: function(options) {
    this.options = Object.extend({
		//MORE OPTIONS TO EXTEND THIS CLASS
		submit		: false, //form Id to submit after change 
		redirect	: false, // redirects to option value
		debug		: false, //show alerts with information
		css			: 'combo'	 //css class for new element 
	}, options || {});
  }
})

<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=1,width=920,height=670,left = 190,top = 199.5');");
}
// End -->


function setupernav()
{
	urltest = location.href;
	baseurl = '/images/misc/er-none.gif';
	//setup overactions
	var wrapper = $('er-background');
	var links = wrapper.getElementsByTagName('a');
	for(var i=0; i < links.length; i++)
	{
		if(urltest.indexOf(links[i].getAttribute('href')) != -1)
		{	
			baseurl = links[i].getAttribute('rel');
		}
		links[i].onmouseover = function (e)
		{
			 wrapper.style.backgroundImage = 'url(' + this.getAttribute('rel') + ')';
		}		
		if (links[i].captureEvents) links[i].captureEvents(Event.ONMOUSEOVER);
		
		links[i].onmouseout = function (e)
		{
			 wrapper.style.backgroundImage = ('url('+baseurl+')');
		}
		if (links[i].captureEvents) links[i].captureEvents(Event.ONMOUSEOUT);
	}
	wrapper.style.backgroundImage = 'url(' + baseurl + ')';
}

function getCookie( name ) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
		return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ';', len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}

function setCookie( name, value, expires, path, domain, secure ) {

	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires ) {
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = name+'='+escape( value ) +
		( ( expires ) ? ';expires='+expires_date.toGMTString() : '' ) + //expires.toGMTString()
		( ( path ) ? ';path=' + path : '' ) +
		( ( domain ) ? ';domain=' + domain : '' ) +
		( ( secure ) ? ';secure' : '' );
}

function deleteCookie( name, path, domain ) {
	if ( getCookie( name ) ) document.cookie = name + '=' +
			( ( path ) ? ';path=' + path : '') +
			( ( domain ) ? ';domain=' + domain : '' ) +
			';expires=Thu, 01-Jan-1970 00:00:01 GMT';
}



function verticalScroller(id, height) {
	this.container = $(id);
	this.items = null;
	this.height = height;
	this.timer = null;
	this.currentindex = 0;
	this.init = function() {
		this.items = $$('#'+id+' .qoute');
		for(var i=0; i<this.items.length; i++)
		{
		   this.items[i].setStyle({
			  height : this.height+'px',
			  top : this.height+'px'
			});
		} 
		this.items[0].style.top = '0px';	
		this.items[0].show();	
		//this.next.bind(this);
		this.timer = new PeriodicalExecuter(this.next.bindAsEventListener(this), 5);
	}
	this.next = function()
	{
		if(this.currentindex == this.items.length-1)
		{
			this.next = 0;	
		}
		else if(this.currentindex > this.items.length-1)
		{
			this.currentindex = 0;
			this.next = this.currentindex +1;
		}
		else
		{
			this.next = this.currentindex +1;	
		}
		
		//this.items[this.previous].hide();
		
		var currentNode = this.items[this.currentindex];
		new Effect.Morph(currentNode, { 
			beforeStart: function () { 
					//$(previous_contentpage).style.left = '0px';
					//$(previous_contentpage).style.display = 'block';
					//alert(previousNode.innerHTML);
					currentNode.show();
					currentNode.style.top = '0px';
				},
			afterFinish: function () {
					//$(previous_contentpage).style.left = '970px';
					//$(previous_contentpage).style.display = 'none';
					
				},
			style: 'top:-'+this.height+'px;',
			duration: 1
			});
		var nextNode = this.items[this.next];
		//alert(previous_contentpage);
		new Effect.Morph(nextNode , { 
			beforeStart: function () { 
					//$(previous_contentpage).style.left = '0px';
					//$(previous_contentpage).style.display = 'block';
					//alert(currentNode.innerHTML);
					nextNode.show();
					nextNode.style.top = '200px';
				},
			afterFinish: function () {
					//$(previous_contentpage).style.left = '970px';
					//$(previous_contentpage).style.display = 'none';
					
				},
			style: 'top:0px;', 
			duration: 1
			});

		this.currentindex++;
	}
	this.halt = function () {
		this.timer.stop();
	}
	this.start = function () {
		this.timer = new PeriodicalExecuter(this.next.bindAsEventListener(this), 5);
	}
	
}

