function okno(nazev,w,h)	{	//otevri okno o velikost w,h
	var w=window.open("http://www.bijoux-trend.cz/foto.php?obr="+nazev,"_blank","width="+w+",height="+h+",menubar=no");
	if (w) {
		w.focus();
		return true;
	}
	else return false;
}

function okno2(nazev)	{	//otevri okno o velikost w,h
	var w=window.open(nazev,"_blank","width=940,height=600,scrollbars=yes,resizable=yes");
	if (w) {
		w.focus();
		return true;
	}
	else return false;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function setCheckedValue(radioObj, newValue) {
	if(!radioObj)
		return;
	var radioLength = radioObj.length;
	if(radioLength == undefined) {
		radioObj.checked = (radioObj.value == newValue.toString());
		return;
	}
	for(var i = 0; i < radioLength; i++) {
		radioObj[i].checked = false;
		if(radioObj[i].value == newValue.toString()) {
			radioObj[i].checked = true;
		}
	}
}

function getCheckedValue(radioObj) {
	if(!radioObj)
		return;	
	var radioLength = radioObj.length;
	if(radioLength == undefined) {
		radioObj.checked = (radioObj.value == newValue.toString());
		return;
	}
	for(var i = 0; i < radioLength; i++) {
		if (radioObj[i].checked) return radioObj[i].value;
	} 
}

function pokladna(IDstat,IDplatba,jazyk) {	//
	var OBJstat=document.getElementById(IDstat);
	var stat=OBJstat[OBJstat.selectedIndex].value;
	if (stat!='Česká republika') {	//mimo CR jen kartou
		document.forms['form2'].elements['platba'].disabled=true;
		document.forms['form2'].elements['platba'].disabled=true;
		if (document.getElementById('platba1')!=null) document.getElementById('platba1').style.display='none';
		if (document.getElementById('platba2')!=null) document.getElementById('platba2').style.display='none';
		if (document.getElementById('platba7')!=null) document.getElementById('platba7').style.display='none';
		setCheckedValue(document.forms['form2'].elements['platba'],'3');
		if (document.getElementById('doprava1')!=null) document.getElementById('doprava1').style.display='none';
		if (document.getElementById('doprava6')!=null) document.getElementById('doprava6').style.display='none';
		if (document.getElementById('doprava5')!=null) document.getElementById('doprava5').style.display='inline';
		if (stat!='Slovenská republika') {
			if (document.getElementById('doprava3')!=null) document.getElementById('doprava3').style.display='none';
			if (document.getElementById('doprava2')!=null) document.getElementById('doprava2').style.display='inline';
			if (document.getElementById('doprava7')!=null) document.getElementById('doprava7').style.display='inline';			
		}
		else {
			if (document.getElementById('doprava3')!=null) document.getElementById('doprava3').style.display='inline';
			if (document.getElementById('doprava2')!=null) document.getElementById('doprava2').style.display='none';
			if (document.getElementById('doprava7')!=null) document.getElementById('doprava7').style.display='none';
		}
	} 
	else if (jazyk=='cz') {
		document.forms['form2'].elements['platba'].disabled=false;
		document.forms['form2'].elements['platba'].disabled=false;
		if (document.getElementById('platba1')!=null) document.getElementById('platba1').style.display='inline';
		if (document.getElementById('platba2')!=null) document.getElementById('platba2').style.display='inline';
		if (document.getElementById('platba7')!=null) document.getElementById('platba7').style.display='inline';
		setCheckedValue(document.forms['form2'].elements['platba'],'2');		
		if (document.getElementById('doprava1')!=null) document.getElementById('doprava1').style.display='inline';
		if (document.getElementById('doprava6')!=null) document.getElementById('doprava6').style.display='inline';
		if (document.getElementById('doprava3')!=null) document.getElementById('doprava2').style.display='none';
		if (document.getElementById('doprava2')!=null) document.getElementById('doprava3').style.display='none';
		if (document.getElementById('doprava5')!=null) document.getElementById('doprava5').style.display='none';
		if (document.getElementById('doprava7')!=null) document.getElementById('doprava7').style.display='none';		
	}

	if (stat!='Česká republika') setCheckedValue(document.forms['form2'].elements['doprava'],'2');
	if (stat=='Slovenská republika') setCheckedValue(document.forms['form2'].elements['doprava'],'3');
	if (stat=='Česká republika' && jazyk=='cz') setCheckedValue(document.forms['form2'].elements['doprava'],'1');
}

$(document).ready(function () {	
	$('#right_slideX').click(function(){	//vysuvny panel
		if ($('#right_slideX').css('right')=='-220px') $('#right_slideX').animate({"right": "0"},'slow');
		else $('#right_slideX').animate({"right": "-220px"},'slow');
	});

	$('.bijoux a, .pokladna a').imgPreview({
		containerID: 'imgPreviewWithStyles',
		/* Change srcAttr to rel: */
		srcAttr: 'rel',
		imgCSS: {
			// Limit preview size:
			height: 240
		},
		// When container is shown:
		onShow: function(link){
			$('<span>' + $(link).attr('title') + '</span>').appendTo(this);
		},
		// When container hides: 
		onHide: function(link){
			$('span', this).remove();
		}
	});

	

});
