$(document).ready(function(){

$.each( $("div.onAccordionContent"), function(i, n){
	$(n).before($(n).children("h2:first-child").addClass("onAccHead"));
	if ($(n).hasClass('open')) {
	  $(n).prev(".onAccHead").addClass("selected");
	  }
	  else {
	        $(n).addClass("hide");
	  }
});

$(".onAccordion").children("h2:first-child").addClass("first");
	
  $(".onAccHead").click(function() {
    $(this).addClass("current");
    $.each( $(this).parent(".onAccordion").children(".selected:not('.current')"), function(i, n){
      $(n).next("div").animate({ height: 'toggle', opacity: 'toggle'},{duration: 300,
        complete:function(){ 
          $(n).parent(".onAccordion").children(".onAccHead:not('.current')").removeClass("selected");
      } });
    });
    $(this).next("div").animate({ height: 'toggle', opacity: 'toggle'},{duration: 300, 
      complete:function(){
        $(this).prev(".onAccHead").toggleClass("selected");  
        $(this).prev(".onAccHead").removeClass("current");
    } });
  });


$('#marquee marquee').marquee('pointer').mouseover(function () {
 $(this).trigger('stop');
 }).mouseout(function () {
 $(this).trigger('start');
 }).mousemove(function (event) {
 if ($(this).data('drag') == true) {
 this.scrollLeft = $(this).data('scrollX') + ($(this).data('x') - event.clientX);
 }
 }).mousedown(function (event) {
 $(this).data('drag', true).data('x', event.clientX).data('scrollX', this.scrollLeft);
 }).mouseup(function () {
 $(this).data('drag', false);
}); 

});
