$(document).ready(function(){
	//init
	$('#rotatingImages').cycle('fade');
	
	$('.accordion').addClass('accordionEnabled');
	
	$('a.anchor').remove().prependTo('body');

	var myFile = document.location.toString();
	if (myFile.match('#')) { // the URL contains an anchor
	  // click the navigation item corresponding to the anchor
	  var myAnchor = '.' + myFile.split('#')[1];
	  $(myAnchor).addClass('active');
	}

	$('.accordion').hSlides({
		totalWidth: 790, 
		totalHeight: 236, 
		minPanelWidth: 65, 
		maxPanelWidth: 335,
		speed: 500,
		eventHandler: 'hover',
		panelSelector: 'div',
		activeClass: 'active'

	});
	

	$('a.showPortfolio').click(function(){

	  $('#portfolio').load('portfolio-' + $(this).attr('rel') + '.html', function(){
		$('#portfolio').slideDown().expose();
		$('#portfolio ul').jqGalViewII({getUrlBy:1,fullSizePath:'images/portfolio/gallery/'});
		$('.close').click(function(){
		  $('#portfolio').slideUp();
		  $.unexpose();
		  return false;
		});
		return false;
	  });
	  return false;
	});
});