/** returns the name of the current document (document.location.href contains URL of form http://domain.tld/path.html) **/
$.urlParam = function(){
       url = document.location.href;

	if (url.lastIndexOf('/') !=-1)
	{
		if (url.indexOf('produktdetails') == -1 && url.indexOf('productdetails') == -1)
		{
			// no product-detail site
			firstpos=location.href.lastIndexOf('/')+1;
			lastpos=location.href.length;
			page=url.substring(firstpos,lastpos);
			if (page.indexOf("html") > 0)
			{
				page = page.substring(0, page.lastIndexOf('.'));
				return page;
			}
		}
		else if (url.indexOf('produktdetails-gummi') > 0 || url.indexOf('productdetails-rubber') > 0)
		{
			// product-detail site
			return "produktdetails-gummi";
		}
		else if (url.indexOf('produktdetails') > 0 || url.indexOf('productdetails') > 0)
		{
			// product-detail site
			return "produktdetails";
		}

      	}	
	return "";
}



// extends the jQuery-Plugin "easyAccordion" to enable hover and active images for slides
$(document).ready(function () {
		// set active slide
		actPage = $.urlParam(); // get active page id
		switch(actPage) {
			case 'polyurea': $('#accordion-1 dl dt:nth-child(3)').addClass("active");
			break;
			case 'kautschuk-und-kunststoffe': $('#accordion-1 dl dt:nth-child(5)').addClass("active");
			break;
			case 'kurse': $('#accordion-1 dl dt:nth-child(7)').addClass("active");
			break;
			case 'produktdetails': $('#accordion-1 dl dt:nth-child(3)').addClass("active");
			break;
			case 'produktdetails-gummi': $('#accordion-1 dl dt:nth-child(5)').addClass("active");
			break;
			default:  $('#accordion-1 dl dt:nth-child(1)').addClass("active");
		}
		

		$('#accordion-1').easyAccordion({ 
			autoStart: false		
		});
		
		
});
