
	function confirmation( text, element ) {
	  
		var answer = confirm(text);
		if (answer){
			window.location = element.href;
		}
		
		return false;
	
	}
	
	function js_autoheight( what_element , new_height ){
		
		 $(what_element).each(function (i) {
		       thisHeight = $(this).height();
			   if( thisHeight < new_height ){ $(this).height(new_height); }
		  });
		
	}
	
	
	function js_remove_border_from_lists( what_element , remove_class ){

		 $(what_element).each(function (i) {
		       thisHeight = $(this).height();
			   if( i && (i % 5 == 0) ){ $(this).removeClass( remove_class ); }
		  });
		  
		$(what_element).filter(':last').removeClass( remove_class );
		
	}
	

	function js_maxheight_autoheight( what_element ){
		
		max_height = 0;
		
		$(what_element).each(function (i) {
		       thisHeight = $(this).height();
			   if( thisHeight > max_height ){ max_height = thisHeight; }
		});	

		$(what_element).css('height', max_height);
		
	}

	function validateContact( lang ){
		
	   prazno = "";
	   
		switch( lang ){
		
			case "hr":
			   if (document.form_contact.ime.value == "") prazno = prazno + "\n- Vaše ime";
			   if (document.form_contact.email.value == "") prazno = prazno + "\n- Vašu e-mail adresu";
			   if (document.form_contact.poruka.value == "") prazno = prazno + "\n- Poruku";
			   if (prazno != "")
				  alert("Molimo popunite sljedeće podatke:" + prazno)
			   else
				   document.form_contact.submit();
				break;
			
			case "en":
			   if (document.form_contact.ime.value == "") prazno = prazno + "\n- Vaše ime";
			   if (document.form_contact.email.value == "") prazno = prazno + "\n- Vašu e-mail adresu";
			   if (document.form_contact.poruka.value == "") prazno = prazno + "\n- Poruku";
			   if (prazno != "")
				  alert("Molimo popunite sljedeće podatke:" + prazno)
			   else
				   document.form_contact.submit();
				break;
		
		}
	
		
	}
	
	function validate_popup_price( lang ){
		
	   prazno = "";
	
	   switch( lang ){
		
			case "hr":
				   if (document.form_popup_upit_cijene.ime_i_prezime.value == "") prazno = prazno + "\n- Vaše ime i prezime";
				   if (prazno != "")
					  alert("Molimo popunite sljedeće podatke:" + prazno)
				   else
					   $('#popup_cijena_mailsend').submit();	
				break;
				
			case "en":
				   if (document.form_popup_upit_cijene.ime_i_prezime.value == "") prazno = prazno + "\n- Vaše ime i prezime";
				   if (prazno != "")
					  alert("Molimo popunite sljedeće podatke:" + prazno)
				   else
					   $('#popup_cijena_mailsend').submit();	
				break;
				
			default:
				break;
		
	   }
		
	}
	
	
	
	function validate_popup_katalog( lang ){
		
	   prazno = "";
	
	   switch( lang ){
		
			case "hr":
				   if (document.form_popup_katalog.ime_i_prezime.value == "") prazno = prazno + "\n- Vaše ime i prezime";
				   if (prazno != "")
					  alert("Molimo popunite sljedeće podatke:" + prazno)
				   else
					   $('#popup_katalog_mailsend').submit();	
				break;
				
			case "en":
				   if (document.form_popup_katalog.ime_i_prezime.value == "") prazno = prazno + "\n- Vaše ime i prezime";
				   if (prazno != "")
					  alert("Molimo popunite sljedeće podatke:" + prazno)
				   else
					   $('#popup_katalog_mailsend').submit();	
				break;
				
			default:
				break;
		
	   }	
		
	}
	
	
	function validate_popup_preporuci( lang ){
		
	   prazno = "";
	
	   switch( lang ){
		
			case "hr":
				   if (document.form_popup_preporuci.email.value == "") prazno = prazno + "\n- E-mail";
				   if (prazno != "")
					  alert("Molimo popunite sljedeće podatke:" + prazno)
				   else
					   $('#popup_preporuci_mailsend').submit();	
				break;
				
			case "en":
				   if (document.form_popup_preporuci.email.value == "") prazno = prazno + "\n- E-mail";
				   if (prazno != "")
					  alert("Molimo popunite sljedeće podatke:" + prazno)
				   else
					   $('#popup_preporuci_mailsend').submit();	
				break;
				
			default:
				break;
		
	   }
		
	}
	
	
	
	function news_ul_li_height(){
		
		li_height = 0;
		
		$("UL.section_list LI").each(function(IntCounter){
			
			if( $(this).height() >li_height ){ li_height = $(this).height(); }
			
		});
		
		$("UL.section_list LI").css('height' , li_height);
		
		// alert(li_height);
		
	}
	
	
	function animate_print_email_buttons(){
		
		$("#tools_email , #tools_text_email,  .tools_text_print , #tools_share , #tools_text_share").mouseover(function(){
		
			if( (this.id) == "tools_email" || (this.id) == "tools_text_email" ){
				
				// email button
				$(this).text("E-MAIL");
				
			}
			else if( (this.id) == "tools_share" || (this.id) == "#tools_text_share" ){
				
				// email button
				$(this).text("SHARE THIS");
				
			}
			else if( (this.className) == "tools_text_print" ){
				
				// print button
				$(this).text("PRINT");
				
			}
			
		}).mouseout(function(){
			
			if( (this.id) == "tools_email" || (this.id) == "tools_text_email"  ){
				
				// email button
				$(this).text("E");
				
			}
			else if( (this.id) == "tools_share" || (this.id) == "#tools_text_share" ){
				
				// email button
				$(this).text("S");
				
			}
			else if( (this.className) == "tools_text_print" ){
				
				// print button
				$(this).text("P");
				
			}
	      
	    });

		
	}
	
	
	
	function replace_empty_Ps(){
		
		$("DIV.text_page P").each(function(){
		
			if( this.innerHTML == "&nbsp;" ){ $(this).after('<div class="p_separator"><!----></div>').remove();  }
			
		});
		
	}
	
	
	
	function add_back_to_top_link(){
		
		title = document.title;
		title = title.split('| ');
		document_location = d_location = document.location.href;
		document_location = document_location.split("#");
		document_location = document_location[0];
		d_location = d_location.split('/');
		lang = d_location[3];
		
		back_text = "";

		switch( lang ){
			
			case "hr": back_text = "Povratak na vrh"; break;
			case "en": back_text = "Back to top"; break;
			
			default: break;
			
		}
	
		$("DIV.text_page P:not(.izvor)").append('<br><a href="#top" class="back_to_top_link">' + back_text + '</a>');
		
	}
	
	
	
	function switcher_replace_product_image(){
		
		// find all small images
		$("A.replace_product_image").click(function(){
			
			url_big_image = this.href;
			
			//new_big_image = '<a href="' + url_big_image + '" class="lightbox"><img src="' + url_big_image + '" alt="" title="" width="" height=""></a>';
			new_big_image = '<img src="' + url_big_image + '" alt="" title="" width="325" height="244">';
			
			$("DIV.main_pic").html(new_big_image);
			
			return false;
			
		});
		
	}
