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 showCard(){
	document.getElementById('cardimg').style.display = 'block';
}

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 show(pole){
	document.getElementById(pole).style.visibility = 'visible';
}

function hide(pole){
	document.getElementById(pole).style.visibility = 'hidden';
}

function showPrice(cena,kurz,dph,mena,pole){
	var koef = 1;
	var sale = 0;
	if (kurz) koef = 1/kurz;
	
	if (document.getElementById('sale')) if (document.getElementById('sale').value>0) sale = document.getElementById('sale').value;
	
	with (Math){
		if (dph==0) {
			t = ceil((cena*((100-sale)/100))*koef)+" "+mena;
			cena1 = ceil(cena*koef);
		}
		else {
			t = ceil((cena*((100-sale)/100))*koef)+" "+mena+" ("+(ceil(((cena*((100-sale)/100))*koef)*1.20))+"  "+mena+" VAT included)";
			cena1 = ceil(cena*koef);
		} 
	}
	e = document.getElementsByName(pole); 
	//a = document.getElementById('castka'); 
	//alert(e.length);
	if(e.length) { 
	  for(i = 0; i < e.length; i++) 
	    e[i].innerHTML = t; 
	}
	document.getElementById('castka').value = t; 
	document.getElementById('castka_zapati').innerHTML = t; 
	document.getElementById('cena').innerHTML = t; 
	if (document.form.cena_help) document.form.cena_help.value = cena1;
	if (document.form.mena_help) document.form.mena_help.value = mena;
	if (document.form.dph_help) document.form.dph_help.value = dph;
}

function showPriceWithSale(pole){
	var koef = 1;
	
	
	sale = document.getElementById('sale').value;
	price = document.getElementById('cena_help').value;
	dph = document.getElementById('dph_help').value;
	mena = document.getElementById('mena_help').value;
	with (Math){
		if (dph==0){
			t_discount = ceil(price*(((100-sale)/100)))+" "+mena;
			t = ceil(price)+" "+mena;
		}
		else {
			t_discount = ceil(price*(((100-sale)/100)))+" "+mena+" ("+(ceil((price*(((100-sale)/100)))*1.20))+" "+mena+" VAT included)";
			t = ceil(price)+" "+mena+" ("+(ceil((price)*1.20))+" "+mena+" VAT included)";
		} 
	}
	
	e = document.getElementsByName(pole); 
	if(e.length) { 
	  for(i = 0; i < e.length; i++) 
	    e[i].innerHTML = t_discount; 
	}
	document.getElementById('castka_discount').value = t_discount; 
	document.getElementById('castka').value = t; 
	document.getElementById('cena').innerHTML = t_discount; 
	document.getElementById('castka_zapati').innerHTML = t_discount; 
	/*
	*/
}
