$(document).ready(function(){

	if ($("a[rel^='photo']").length >= 1) {
		$("a[rel^='photo']").prettyPhoto({
			animationSpeed: 'fast', /* fast/slow/normal */
			padding: 0, /* padding for each side of the picture */
			opacity: 0.8, /* Value betwee 0 and 1 */
			showTitle: true, /* true/false */
			allowresize: true, /* true/false */
			counter_separator_label: ' ze ' /* The separator for the gallery counter 1 "of" 2 */
		});
	};
});

$(document).ready(function(){
	var resizeButtonHtml = '<br /><a onclick="switchFullTable(this, event)" href="javascript:void(0)" class="hand vio" title="Zobrazit všechny parametry">Zobrazit všechny parametry</a>';
	$('#Tab1Text').append(resizeButtonHtml)
});


function IsHodnoceni(hodnoc){

var sAdresa; //zkoumaná adresa
var nPosition; //pozice mřížky
var nAdresaLength; //počet znaků v adrese
var sResult; //výsledek


sAdresa = escape(document.location);
nAdresaLength = sAdresa.length; //počet znaků v adrese (číslo)
nPosition = sAdresa.lastIndexOf('%23'); //pozice mřížky (číslo)
sResult = sAdresa.substring(nPosition+3,nAdresaLength); //výsledný řetězec
if (sResult == "hodnoceni") showTab(document.getElementById('Tab'+hodnoc),5);
}

function showTab (idTab, countTab){
	var i
	for (i=1; i<=countTab; i++) {
		$('#Tab'+i).removeClass(); //document.getElementById('Tab'+i).className='';
		$('#Tab'+i+'Text').removeClass('visible'); //document.getElementById('Tab'+i+'Text').className='desTable';
	}
	$(idTab).addClass('desActive'); //idTab.className='desActive';
	$('#'+idTab.id+'Text').addClass('visible'); //document.getElementById(idTab.id+'Text').className+=' visible';
}


function showDiv (checkbox, div) {	
	if (checkbox.checked) {
		document.getElementById(div).className+=' visible'
	}
	else {
		document.getElementById(div).className='desText'
	}
}

function setColor (color) {
	document.getElementById(color).style.color="black";
	document.getElementById(color).value="";
}

function switchFullTable (sender, args) {
	if (document.getElementById('tableProp').className=='overDivTable') {
		document.getElementById('tableProp').className='overDivTableFull';
		$(sender).attr('title', 'Skrýt parametry');
		$(sender).html('Skrýt parametry');
	}
	else {
		document.getElementById('tableProp').className='overDivTable';
		$(sender).attr('title', 'Zobrazit všechny parametry');
		$(sender).html('Zobrazit všechny parametry');
	}
}


function showReComment(on, parentNo, index) {

	var contentItem = $('#content' + index)
	var ancestorItem = $('#content' + parentNo)
	var recommendItem = $('#reComment')

	
	if (on == 1) {
	
		recommendItem
			.html(ancestorItem.html())
			.css('top', contentItem.position().top - recommendItem.height() - 30)
			.css('left', contentItem.position().left)
			.show('slow');
			
	} else if (on == 0) {
	
		recommendItem
			.html('')
			.hide('show');
			
	}
}


function OfferListener(sender, args) {
	var form1 = sender.form;

	$.post(
		args.url,
		$(form1).find(":input").serializeArray(),
		function(data){
			$("#showChoodeFiltr").html(data);
		}
	);

	return false;
}


function splitorder() {
	message = ""
	if ($('#split-order:checked').length >= 1) {
		message = "Rozdělit objednávku <hr />" + $('#basket_Message').val();
	} else {
		message = $('#basket_Message').val();
	}
	$('#basket_Message').val(message)
	
	return true;
}




