// JavaScript Document
function accPopup(theURL,winName,features) {
		newwindow=window.open(theURL,winName,features);
		if (window.focus) {newwindow.focus()}
		return false;
}

function showHide(targ) {
	if (document.getElementById) {
		targ1 = document.getElementById("c_"+targ);
		targ2 = document.getElementById(targ).firstChild;
		if (targ1.className=='hidden') {
			targ1.className='shownInline';
			targ2.title = 'Weinporträt ausblenden';
		} else {
			targ1.className='hidden';
			targ2.title = 'Weinporträt einblenden';
		}
		//return false;
	}
}

function showHideA(callerId) {
	if (window.curActItem) { 
	new Effect.BlindUp("c_"+window.curActId, {duration: 1}); }
	if (window.curActId!=callerId) {
	targ = document.getElementById("c_"+callerId);
	targ1 = document.getElementById(callerId);
	targ2 = targ1.getElementsByTagName('a');
	targ2[0].blur();
	window.curActItem = targ;
	window.curActId = callerId;
	//window.curActItem.className = 'shownInline';
	new Effect.BlindDown("c_"+callerId, {duration: 1});
	} else {
	window.curActId = null;
	window.curActItem = null;
	}	
}

function showNamedCopy() {
	if (window.location.hash&&window.location.hash!="#pyramide") {
		showHideA(window.location.hash.substring(1));
	}
}

function accImgPopup(theURL,theW,theH) {
		if (typeof imgWin!='undefined') imgWin.close();
		var theT = ',top='+(Math.floor((screen.availHeight-eval(theH)-10)/2));
		var theL = ',left='+(Math.floor((screen.availWidth-eval(theW))/2));
		var features = 'width='+theW+',height='+theH+theT+theL;
		newWindow=window.open(theURL,'imgWin',features);
		newWindow.document.open();
		newWindow.document.write('<html><head><title>Weingut Rudloff</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><style>body{margin:0;padding:0;}</style></head><body onblur="self.close();">'); 
		newWindow.document.write('<a href="javascript:self.close();"><img src="'+theURL+'" width="'+theW+'" height="'+theH+'" galleryimg="no" id="theImg" border="0"></a>');
		newWindow.document.write('</body></html>');
		newWindow.document.close();
		if (window.focus) {newWindow.focus()}
		return false;
}

$(document).ready(function(){
	
	$('.tab-nav li').click(function(){
		var i = $(this).attr('id').replace(/tab-nav-item/,''); 
		$('.tab-nav li').removeClass('selected-tab');
		$(this).addClass('selected-tab');
		$('.tab-content>div').hide();
		$('.tab-content #tab-content-item'+i).show();
	});


	/*
	
	$('.tab-nav li').click(function(){
		var i = $(this).attr('id').replace(/tab-nav-item/,'');
		$('.tab-nav li').removeClass('selected');
		$(this).addClass('selected');
		$('.tab-content>div').hide();
		$('.tab-content #tab-content-item'+i).show();
	});
	
	
	
	$('.tab-content ul').each(function() {
		if ($(this).find('li').length>4) {
			var c = Math.round($(this).find('li').length/2)-1;
			$(this).after('<ul class="col-2"></ul>');
			var count = 0;
			$(this).find('li').each(function(){
				if (count>c) {
					var l = $(this).clone();
					$(this).parents('div').find('ul.col-2').append(l);
					$(this).remove();
				}
				count++;
			});
			var w = $(this).parents('.tab-content').width()/2;
			$(this).parent().find('ul').width(w);
		}
	});

	*/

});



