
function open_window(url)
{
	okno = window.open(url,"nazev","width=600,height=560,menubar=no,toolbar=no,scrollbars=yes,resizable=yes");
	wasOpen = false;
	if (typeof(okno) == "object"){
	wasOpen = true;
	}
	return wasOpen;
}

function open_image(image)
{
	var win=window.open("","Fotografie","width=750,height=550,menubar=no,toolbar=no,scrollbars=yes");
	win.focus();
	win.document.open();
	win.document.write("<html><head><title>Detail fotografie</title></head><body bgcolor='#F5F5F5' background='_images/body_bg.gif'>");
	win.document.write("<table width='100%' height='100%'><tr><td valign='middle' align='center'><a href='javascript:window.close()'><img src='"+image+"' border='0' alt='Kliknutím na obrázek zavřete okno' /></td></tr></table>");
	win.document.write("</body></html>");

}

function open_certificate(image)
{
	var win=window.open("","Certificate","width=620,height=550,menubar=no,toolbar=no,scrollbars=yes");
	win.focus();
	win.document.open();
	win.document.write("<html><head><title>Certificate</title></head><body bgcolor='#C3DFD1'>");
	win.document.write("<table width='100%' height='100%'><tr><td valign='middle' align='center'><a href='javascript:window.close()'><img src='"+image+"' border='0' alt='Kliknutím na obrázek zavřete okno' /></td></tr></table>");
	win.document.write("</body></html>");

}

function open_table(image)
{
	var win=window.open("","Certificate","width=780,height=590,menubar=no,toolbar=no,scrollbars=yes");
	win.focus();
	win.document.open();
	win.document.write("<html><head><title>Table</title></head><body bgcolor='#C3DFD1'>");
	win.document.write("<table width='100%' height='100%'><tr><td valign='middle' align='center'><a href='javascript:window.close()'><img src='_photos/"+image+"' border='0' alt='Kliknutím na obrázek zavřete okno' /></td></tr></table>");
	win.document.write("</body></html>");

}

function check_writeus_form()
{
  with(document.form){
   	if(name.value=="" || text.value=="" || phone.value==""){
		alert("Vyplňte prosím všechny povinné údaje.");
		return false;
	}			
	if((email.value.length<=5) || (email.value.indexOf('@')==-1)) {
		alert("Vaše emailová adresa není zadána správně!")
		return false;
	}
  }
  return true;
}

function switch_menu(id)
	{
	var adv_form=document.getElementById(id);
	if(adv_form.style.display=="none")
		{
		adv_form.style.display="block";
		}
	else
		{
		adv_form.style.display="none";
		}
	}


/*function switch_menu(id)
{   
	var layer_id="tree_layer"+id;
	var tree_item_id="tree_item"+id;
	var category_layer=document.getElementById(layer_id);
	if(category_layer.style.display=="inline")
	{
		category_layer.style.display="none";
		swap_image(tree_item_id);	 
	}
	else
	{
		category_layer.style.display="inline";
		swap_image(tree_item_id);	 
	}
}*/
function swap_image(id)
   {
   image_menu=document.getElementById(id);
   var old_src=image_menu.src;
   var match_string_minus=/minus/;
   var match_string_plus=/plus/;
   if(old_src.search(match_string_minus)!=-1)
     {
	 var temp=old_src;
	 new_src=temp.replace(match_string_minus,"plus");
	 }
   if(old_src.search(match_string_plus)!=-1)
     {
	 var temp=old_src;
	 new_src=temp.replace(match_string_plus,"minus");
	 }	 
   image_menu.src=new_src;
   }

	
function confirm_delete()
{
	confirmation=window.confirm("Opravdu smazat položku objednávky?");
	if(confirmation)
	{
		return true;
	}
	else
	{
		return false;
	}
}

function confirm_logout()
{
	confirmation=window.confirm("Opravdu se chcete odhlásit?");
	if(confirmation)
	{
		return true;
	}
	else
	{
		return false;
	}
}


