function show_photo(text,file,width,height){
	no=window.open("", "zoom", "left=5, top=5, width="+width+", height="+height+", toolbar=no, location=no, status=no, scrollbars=auto");
	with (no.document)
	{
		open();
		writeln('<body style="margin: 0px;"><a href="javascript:void window.close();"><img src="'+file+'" style="border: 0px;" /></a></body>');
		close();
		no.focus();
	}
}

function openWindow(text,file,width,height,type){
	if (type=='img'){
		no=window.open("", "zoom", "left=5, top=5, width="+width+", height="+height+", toolbar=no, location=no, status=no, scrollbars=auto");
		with (no.document)
		{
			open();
			writeln('<body style="margin: 0px;"><a href="javascript:void window.close();"><img src="'+file+'" alt="'+text+'"style="border: 0px;" /></a></body>');
			close();
			no.focus();
		}
	}
	if (type=='file'){
		window.open(file, "zoom", "left=5, top=5, resizable,toolbar=no, location=no, status=no, scrollbars=yes");
		
		
	}
	return false;
}

function changeImage (url,foto) {
	if (document.getElementById) {
    	//window.alert(foto);    
                document.getElementById('mainphoto').src = url;
                document.getElementById('largephoto').href = foto;
               // photo_id = fotka_id;
        }
        return false;
}

function showLargeImage(url,width,height,type) {
	if (screen.height) {
		screenY = screen.height
		screenX = screen.width
	}
	var top = ((screenY/2)-(height/2));
	var left = ((screenX/2)-(width/2));
	window.open(url,'','resizable=no,status=no,scrollbars=no,width='+width+',height='+height+',top=50,left=50');
	return false;
}

function AddFavorite(linkObj,addUrl,addTitle){
  if (document.all && !window.opera)
  {
    window.external.AddFavorite(addUrl,addTitle);
    return false;
  }
  else if (window.opera && window.print)
  {
    linkObj.title = addTitle;
    return true;
  }
  else if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function'))
  {
    if (window.confirm('Přidat oblíbenou stránku jako nový panel?'))
    {
      window.sidebar.addPanel(addTitle,addUrl,'');
      return false;
    }
  }
  window.alert('Po potvrzení stiskněte CTRL-D,\nstránka bude přidána k vašim oblíbeným odkazům.');
  return false;
}

function changeDisplay(){
	if (document.getElementById('prodej')){
		if (document.getElementById('prodej').selected) {
			document.getElementById('zprostredkovat').selected = 'selected';
			location.replace('http://www.cz-ebay.cz/objednavka-prodej.html');
		}
	}

	for(i = 1; i < 30; i++){
		if (document.getElementById(i)) document.getElementById(i).style.display='none';
	}
	// pri zprostredkovani ukazeme vsechny polozky
	if (document.getElementById('zprostredkovat')){
		if (document.getElementById('24'))  document.getElementById('24').style.display='none';
		if (document.getElementById('zprostredkovat').selected){
			for(i = 1; i < 14; i++){
				if (document.getElementById(i)) document.getElementById(i).style.display='';
			}
			//document.getElementById('uhradit_cenu').checked=true;
			//if (document.getElementById('2'))  document.getElementById('2').style.display='none';
			if (document.getElementById('pobocka').selected) {
				document.getElementById('6').style.display='';
				document.getElementById('7').style.display='';
				document.getElementById('10').style.display='';
				if (document.getElementById('27'))  document.getElementById('27').style.display='';
				if (document.getElementById('28'))  {
					document.getElementById('28').style.display='';
					//document.getElementById('samostatna_zasilka').checked=true;
				}
			}
			if (document.getElementById('direct').selected) {
				document.getElementById('6').style.display='none';
				document.getElementById('7').style.display='none';
				document.getElementById('10').style.display='none';
				document.getElementById('kumulovana_zasilka').checked = false;
			}
			if (document.getElementById('13'))  document.getElementById('13').style.display='none';
			if (document.getElementById('polonez_parcel')){
				if (document.getElementById('polonez_parcel').selected)  {
					document.getElementById('10').style.display='none';
				}
			}
		}
		
		if (document.getElementById('preposlat').selected) {
			for(i = 1; i < 30; i++){
				if (document.getElementById(i)) document.getElementById(i).style.display='none';
			}
			if (document.getElementById('13'))  document.getElementById('13').style.display='';
			if (document.getElementById('11'))  document.getElementById('11').style.display='';
			if (document.getElementById('10'))  document.getElementById('10').style.display='';
			if (document.getElementById('27'))  document.getElementById('27').style.display='';
			if (document.getElementById('28'))  document.getElementById('28').style.display='';
			document.getElementById('6').style.display='';
			document.getElementById('7').style.display='';
			if (document.getElementById('polonez_parcel')){
				if (document.getElementById('polonez_parcel').selected)  {
					document.getElementById('10').style.display='none';
				}
			}
		}
	
		if (document.getElementById('zaplatit')){
			if (document.getElementById('zaplatit').selected) {
				for(i = 1; i < 30; i++){
					if (document.getElementById(i)) document.getElementById(i).style.display='none';
				}
				if (document.getElementById('3'))  document.getElementById('3').style.display='';
				if (document.getElementById('4'))  document.getElementById('4').style.display='';
				if (document.getElementById('11'))  document.getElementById('11').style.display='';
			}
		}
		if (document.getElementById('vozidla').selected) {
			for(i = 1; i < 30; i++){
				if (document.getElementById(i)) document.getElementById(i).style.display='none';
			}
			if (document.getElementById('20'))  document.getElementById('20').style.display='';
			if (document.getElementById('21'))  document.getElementById('21').style.display='';
			if (document.getElementById('22'))  document.getElementById('22').style.display='';
			if (document.getElementById('23'))  document.getElementById('23').style.display='';
			if (document.getElementById('24'))  document.getElementById('24').style.display='';
			if (document.getElementById('25'))  document.getElementById('25').style.display='';
			if (document.getElementById('26'))  document.getElementById('26').style.display='';
			if (document.getElementById('11'))  document.getElementById('11').style.display='';
		}
		
	}
}

function showHelp(text){
	no=window.open("", "zoom", "left=50, top=50, width=500, height=500, toolbar=no, location=no, status=no, scrollbars=auto");
	with (no.document)
	{
		open();
		writeln('<link href="/css/help.css" rel="stylesheet" type="text/css" media="all" /><body style="margin: 0px;">'+text+'"</body>');
		close();
		no.focus();
	}	
	return false;
}

function overCheckBox(id1,id2){
	if (document.getElementById(id1).checked) document.getElementById(id2).checked = false; 
}

function kontrola(){
	// vaha je v lbs
	if (document.getElementById('hmotnost_jednotka').value=='lbs'){
		//if (document.getElementById('doprava_cr_sk').value=='polonez_parcel'){
			if (document.getElementById('hmotnost').value>100){
				alert('Váha může být maximálně 100 Lbs\nPro zaslání zásilky nad 45 Kg (100 Lbs) nás kontaktujte emailem : zakaznik@cz-ebay.cz');
				return false;
			}
		//}
		//else {
		//	if (document.getElementById('hmotnost').value>60) {
		//		alert('Váha může být maximálně 60 Lbs');
		//		return false;
		//	}
		//}
	}
	// vaha je v kg
	else {
		//if (document.getElementById('doprava_cr_sk').value=='polonez_parcel'){
			if (document.getElementById('hmotnost').value>45){
				alert('Váha pro může být maximálně 45 Kg\nPro zaslání zásilky nad 45 Kg (100 Lbs) nás kontaktujte emailem : zakaznik@cz-ebay.cz');
				return false;
			}
		//}
		//else {
		//	if (document.getElementById('hmotnost').value>27) {
		//		alert('Váha může být maximálně 27 Kg');
		//		return false;
		//	}
		//}
	}
	return true;
}

