/* * * * * /* * * * * * * * * * * * * * * * * * * * * * *
 *   C A R E N Z A  S C R I P T  F I L E     *
 *                                           *
 *   (c) Copyright 2009 - CARENZA            *
 *   http://www.carenza.nl/                  *
 *                                           *
 * * * * * * * * * * * * * * * * * * * * * * */

$(document).ready(function() {

	$("#contactForm").validate();

	var submenu = document.getElementById("submenu");
	if(links = document.getElementById("menu").getElementsByTagName("a")) {
		loc1 = location.href.lastIndexOf("/");
		loc2 = location.href.lastIndexOf("/",loc1-1);
		foldername = location.href.substring(loc2 + 1, loc1);
		filename = location.href.substring(loc1 + 1);
		if(filename.lastIndexOf("?")>0) filename = filename.substring(0,filename.lastIndexOf("?"));
		gevonden = "NEE";
		for ( var i = 0; i < links.length; i++) {
			//if ( i == 0) alert(links[i].href.length+' '+links[i].href.lastIndexOf("/"));
			//if ( i == 0 && links[i].href.lastIndexOf("/") == links[i].href.length - 2) { links[i].className = "active"; }
			
			if (links[i].href.substring(links[i].href.lastIndexOf("/"),links[i].href.lastIndexOf("/",links[i].href.lastIndexOf("/")-1)+1) == foldername) {
			//if (links[i].href.substring(links[i].href.lastIndexOf("/")+1) == filename) {
				links[i].className = "active"; gevonden="JA"; break;
			}
		}
		if (loc1+1 == location.href.length && gevonden != "JA") { links[0].className = "active"; }
	}
	if(submenu) {
		links2 = submenu.getElementsByTagName("a");
		for (var i=0; i<links2.length; i++) {
			if (links2[i].href.substring(links2[i].href.lastIndexOf("/")+1) == filename) {
				links2[i].className = "active";
			}
		}
	}
	
	if(typeof slider    == 'function') { slider(); }
	if(typeof sliderref == 'function') { sliderref(); }	
	if(foldername == "contact" && filename=="route.html") { googlemaps();}	
	
	$(function() { $('#container-1 > ul').tabs({ selected: 0 }); });


});

function removearrow() {
	var a = document.getElementById("menu").getElementsByTagName("a");
	for (var i=0; i<a.length; i++) { if(a[i].className == "active") { a[i].className="activ"; } }
}
function returnarrow() {
	var a = document.getElementById("menu").getElementsByTagName("a");
	for (var i=0; i<a.length; i++) { if(a[i].className == "activ") { a[i].className="active"; } }
}
	

