window.addEvent("domready", function(){

	var links = $$("a");
	new SmoothScroll();

	new Accordion($$("#faqlist li h2"), $$("#faqlist li div"));
	
	if($("pen_carousel")) {
		var penList = new Carousel ($("pen_carousel"), { 
			autoStyle: true,
			idPrevious: $("pen_carousel_previous"),
			idNext: $("pen_carousel_next"),
			visibleItems: 10,
			scrollAmount: 50,
			scrollInterval: 500,
			fxTransition: Fx.Transitions.quadOut
		});
		
		var penItemSelector = new ListItemSelector($("pen_carousel"));
		penList.jumpTo(penItemSelector.selectClass("selected"));
	}
	
	new Tips($$(".tooltip"), {
		initialize: function(){
			this.fx = new Fx.Style(this.toolTip, "opacity", {wait: false});
		},
		onHide: function(){
			this.fx.start(0);
		},
		onShow: function(){
			this.fx.start(1);
		},
		offsets:{
			x:10,
			y:10
		}
	});

});

window.addEvent("load", function(){

	if($("pen_carousel")){
		var h = $("penlist_options").getSize().size.y;
		$$(".penImage").each(function(el){
			var img = el.getFirst();
			var imgHeight = img.getSize().size.y;
			var pad = (h - imgHeight) / 2;
			if(pad > 0)
				el.setStyle("margin-top", pad.round() + "px");
		});
	}
	
});

function pageup(e) {
  UAGENT = navigator.userAgent.toUpperCase();
  if (UAGENT.indexOf("MSIE") >=0) { posi = event.y; }
  else { posi = e.pageY; }
  moveObje(posi);
 }
  function moveObje(position) {
  move = position / 15;
  point = parseInt(position - move);
  scrollTo(0,point);
  if (point > 0) { setTimeout("moveObje(point)",15); }
 }
