$(document).ready(function() {
    //OPENS URL NEW WINDOW -(target is not a valid attribute in XHMTL 1.0 Strict)
    $("a.external").attr({ target: "_blank" });





   //ACCORDION
   function accordion(){
	$('.accordion .first-head').addClass('active-head');
	$('.accordion .head').click(function() {
		$('.accordion-content.active').show().removeClass('active');
		$(this).toggleClass('active-head');
		$(this).next().slideToggle('slow');
		return false;
	}).next().hide();
   }
   accordion()
	
	/*$(".accord-item").click(function(event){
		window.location.hash=this.hash;
	});*/
	
	
	function autoAccordion (){
		var url = new String(document.location)
		var hash = (url.indexOf('#'));
			
		if (hash > 0 && hash+1 != url.length){
			var href = (url.slice(hash,url.length));
			var start = (href.indexOf(':'))
			href = (href.slice(start+1,href.length))
			//alert (href);
			
			$('a[href^='+href+']').click( function (){
			});
			
			//$('.accordion h3').accordion().trigger("click")
			
			//$('.accordion h3 '+href+'').accordion().trigger("click");
		}
		
		var currentId = $('.accordion h3').attr('id');
			if (currentId == href)
			  {
			  $('.accordion h3').accordion().trigger("click")
			  }
		
		
		//$('.accordion h3').accordion().trigger("click")
	}
	autoAccordion ()
	
	
	//CASE STUDY
	/*function slideSwitch(){
		$(".case-study-slideshow").addClass("reveal");	
	}*/
	
	$(".case-study-slideshow.behind").fadeIn(17000);
	$(".case-study-slideshow.default-slide").fadeOut(17000);
	
	//sets the time that the class "reveal" is added
	/*$(function() {
		setInterval("slideSwitch()", 5000 );
	});*/
	
	
	
/*function accordOpen() {
}	
	$("a.accord-link").each(function (index) {
		$(this).click(function () {
			var accPath = $(this).attr("href");
			
			return false;
		});
	});*/
	
	//TABS
	
		$('#tabs').tabs({
			event: 'mouseover'
			
		});
		
   
   
 });
 
 
 // -- Added by Ros
function gotoAccordion(objId) 
{
   document.getElementById(objId).className = "accordion-content active";
}



