/**
 * nav.js
 */

function contentNav(id, operator) {
	if (operator == '-') {
		var nextId = parseInt(id)-1;
		if (nextId == 1) {
			$('#contentNav .prev img').attr('src', 'img/arrow_left_inactive.png');
		} else {
			$('#contentNav .next img').attr('src', 'img/arrow_right.png');
		}
	} else if (operator == '+') {
		var nextId = parseInt(id)+1;
		if (nextId == 5) {
			$('#contentNav .next img').attr('src', 'img/arrow_right_inactive.png');
		} else {
			$('#contentNav .prev img').attr('src', 'img/arrow_left.png');
		}
	}
	if (nextId) {
		$('#nav li').removeClass('active');
		$('li#contentNav_'+nextId).addClass('active');
		$('#contentBox_'+id).hide();
		$('#contentBox_'+nextId).show();
	}

}

function diskoNav(id, operator) {
	if (operator == '-') {
		var nextId = parseInt(id)-1;
		if (nextId == 1) {
			$('#diskoNav .prev img').attr('src', 'img/arrow_left_inactive.png');
		} else {
			$('#diskoNav .next img').attr('src', 'img/arrow_right.png');
		}
	} else if (operator == '+') {
		var nextId = parseInt(id)+1;
		if (nextId == 10) {
			$('#diskoNav .next img').attr('src', 'img/arrow_right_inactive.png');
		} else {
			$('#diskoNav .prev img').attr('src', 'img/arrow_left.png');
		}
	}
	if (nextId) {
		$('#navDiskografie li').removeClass('active');
		$('li#diskoNav_'+nextId).addClass('active');
		$('#diskoBox_'+id).hide();
		$('#diskoBox_'+nextId).show();
	}

}


$(document).ready(function() {
	
	/**
	 * Kontakt
	 */
	var kontaktOpen = false;
	$('#kontakt a').click(function() {
		if (kontaktOpen == false) {
			$('#kontaktBox').fadeIn();
			kontaktOpen = true;
		} else {
			$('#kontaktBox').fadeOut();
			kontaktOpen = false;
		}
		return false;
	});
	
	/**
	 * Vitea
	 */
	$('#vitea p').mouseover(function() {
		$('#viteaBox').fadeIn();
	});
	$('#vitea p').mouseout(function() {
		$('#viteaBox').fadeOut();
	});
	
	/**
	 * Referenzen
	 */
	$('#referenzen p').mouseover(function() {
		$('#referenzenBox').fadeIn();
	});
	$('#referenzen p').mouseout(function() {
		$('#referenzenBox').fadeOut();
	});
	
	
	/**
	 * Content Nav
	 */
	$('#nav li').click(function() {
		var checkId = $('#nav li.active').attr('id').replace('contentNav_', '');
		var id = $(this).attr('id').replace('contentNav_', '');
		if (checkId != id) {
			$('#contentNav .prev img').attr('src', 'img/arrow_left.png');
			$('#contentNav .next img').attr('src', 'img/arrow_right.png');
			if (id == 5) {
				$('#contentNav .next img').attr('src', 'img/arrow_right_inactive.png');
			}
			if (id == 1) {
				$('#contentNav .prev img').attr('src', 'img/arrow_left_inactive.png');
			}
			$('#nav li').removeClass('active');
			$(this).addClass('active');
			$('#contentBox_'+checkId).hide();
			$('#contentBox_'+id).show();
		}
		return false;
	});
	
	$('#contentNav a.prev').click(function() {
		var id = $('#nav li.active').attr('id').replace('contentNav_', '');
		if (id == 1) {
			return false;
		}
		contentNav(id, '-');
		return false;
	});
	$('#contentNav a.prev').mouseover(function() {
		var id = $('#nav li.active').attr('id').replace('contentNav_', '');
		if (id != 1) {
			$('#contentNav .prev img').attr('src', 'img/arrow_left_rollover.png');
		}
		return false;
	});
	$('#contentNav a.prev').mouseout(function() {
		var id = $('#nav li.active').attr('id').replace('contentNav_', '');
		if (id == 1) {
			$('#contentNav .prev img').attr('src', 'img/arrow_left_inactive.png');
		} else {
			$('#contentNav .prev img').attr('src', 'img/arrow_left.png');
		}
		return false;
	});
	
	
	$('#contentNav a.next').click(function() {
		var id = $('#nav li.active').attr('id').replace('contentNav_', '');
		if (id == 5) {
			return false;
		}
		contentNav(id, '+');
		return false;
	});
	$('#contentNav a.next').mouseover(function() {
		var id = $('#nav li.active').attr('id').replace('contentNav_', '');
		if (id != 5) {
			$('#contentNav .next img').attr('src', 'img/arrow_right_rollover.png');
		}
		return false;
	});
	$('#contentNav a.next').mouseout(function() {
		var id = $('#nav li.active').attr('id').replace('contentNav_', '');
		if (id == 5) {
			$('#contentNav .next img').attr('src', 'img/arrow_right_inactive.png');
		} else {
			$('#contentNav .next img').attr('src', 'img/arrow_right.png');
		}
		return false;
	});
	
	
	/**
	 * Diskografie Nav
	 */
	$('#navDiskografie li').click(function() {
		var checkId = $('#navDiskografie li.active').attr('id').replace('diskoNav_', '');
		var id = $(this).attr('id').replace('diskoNav_', '');
		if (checkId != id) {
			$('#diskoNav .prev img').attr('src', 'img/arrow_left.png');
			$('#diskoNav .next img').attr('src', 'img/arrow_right.png');
			if (id == 10) {
				$('#diskoNav .next img').attr('src', 'img/arrow_right_inactive.png');
			}
			if (id == 1) {
				$('#diskoNav .prev img').attr('src', 'img/arrow_left_inactive.png');
			}
			$('#navDiskografie li').removeClass('active');
			$(this).addClass('active');
			$('#diskoBox_'+checkId).hide();
			$('#diskoBox_'+id).show();
		}
		return false;
	});
	
	$('#diskoNav a.prev').click(function() {
		var id = $('#navDiskografie li.active').attr('id').replace('diskoNav_', '');
		if (id == 1) {
			return false;
		}
		diskoNav(id, '-');
		return false;
	});
	$('#diskoNav a.prev').mouseover(function() {
		var id = $('#navDiskografie li.active').attr('id').replace('diskoNav_', '');
		if (id != 1) {
			$('#diskoNav .prev img').attr('src', 'img/arrow_left_rollover.png');
		}
		return false;
	});
	$('#diskoNav a.prev').mouseout(function() {
		var id = $('#navDiskografie li.active').attr('id').replace('diskoNav_', '');
		if (id == 1) {
			$('#diskoNav .prev img').attr('src', 'img/arrow_left_inactive.png');
		} else {
			$('#diskoNav .prev img').attr('src', 'img/arrow_left.png');
		}
		return false;
	});
	
	
	$('#diskoNav a.next').click(function() {
		var id = $('#navDiskografie li.active').attr('id').replace('diskoNav_', '');
		if (id == 10) {
			return false;
		}
		diskoNav(id, '+');
		return false;
	});
	$('#diskoNav a.next').mouseover(function() {
		var id = $('#navDiskografie li.active').attr('id').replace('diskoNav_', '');
		if (id != 10) {
			$('#diskoNav .next img').attr('src', 'img/arrow_right_rollover.png');
		}
		return false;
	});
	$('#diskoNav a.next').mouseout(function() {
		var id = $('#navDiskografie li.active').attr('id').replace('diskoNav_', '');
		if (id == 10) {
			$('#diskoNav .next img').attr('src', 'img/arrow_right_inactive.png');
		} else {
			$('#diskoNav .next img').attr('src', 'img/arrow_right.png');
		}
		return false;
	});

	
	
});
