function CountLeft(field, count, max) {
 if (field.value.length > max)
 field.value = field.value.substring(0, max);
 else
 count.value = max - field.value.length;
 }
 
 
 function verify() {
var themessage = "You are required to complete the following fields:\n";
if (document.form.email.value=="") {
themessage = themessage + " - Email\n";
}
if (document.form.sifra.value=="") {
themessage = themessage + " - Password\n";
}
if (themessage == "You are required to complete the following fields: ") {
document.form.submit();
}
else {
alert(themessage);
return false;
   }
}

//-----------------------------------------------------------------REGISTRACIJA NOVOG USERA EN
function Provera_newuser_en()
{
if(window.document.singup.uslovi.value == "No" )
	{
		alert("Please read the terms and confirm if you agree! \n From the drop-down menu, click YES \n Thank you!");
		window.document.singup.uslovi.focus();
		return false;
	}
	
if(window.document.singup.email.value == "" || window.document.singup.email.value.indexOf("@")==-1)
	{
		alert("Please enter your email address \n");
		window.document.singup.email.focus();
		return false;
	}
if(window.document.singup.sifra1.value == "")
	{
		alert("Please enter your password.");
		window.document.singup.sifra1.focus();
		return false;
	}
if(window.document.singup.sifra1.value !== window.document.singup.sifra2.value)
	{
		alert("Passwords does not match, please re-enter passwords.");
		window.document.singup.sifra1.focus();
		return false;
	}	
if(window.document.singup.ime_prezime.value == "")
	{
		alert("Please enter your name and surname.");
		window.document.singup.ime_prezime.focus();
		return false;
	}
if(window.document.singup.drzava.value == "Izaberi državu!")
	{
		alert("Please select a country.");
		window.document.singup.drzava.focus();
		return false;
	}
if(window.document.singup.mesto.value == "")
	{
		alert("Please select a place.");
		window.document.singup.mesto.focus();
		return false;
	}
if(window.document.singup.kor.value == 0 && window.document.singup.firma.value == 0)
	{
		alert("Please pick at least one: User or Company");
		window.document.singup.firma.focus();
		return false;
	}


window.document.singup.sifra1.value = MD5(window.document.singup.sifra1.value);
return true;
}

//-----------------------------------------------------------------Sifra MD5
function sifraMD5()
{
window.document.forma.sifra.value = MD5(window.document.forma.sifra.value);
return true;
}
//-----------------------------------------------------------------PROMENA Sifre MD5
function promena_sifraMD5()
{
if(window.document.forma.nova1.value !== window.document.forma.nova2.value)
{
	alert("Passwords does not match, please re-enter passwords.");
	window.document.forma.nova1.focus();
	return false;
}
window.document.forma.nova1.value = MD5(window.document.forma.nova1.value);
window.document.forma.nova2.value = MD5(window.document.forma.nova2.value);
window.document.forma.stara.value = MD5(window.document.forma.stara.value);
return true;
}
//-----------------------------------------------------------------Ubacivanje novo linka EN
function Provera_add_link_en()
{

if(window.document.addlink.ema.value == "" || window.document.addlink.ema.value.indexOf("@")==-1)
	{
		alert("You have not properly entered email.");
		window.document.addlink.ema.focus();
		return false;
	}
if(window.document.addlink.web.value == "")
	{
		alert("You did not enter your website address.");
		window.document.addlink.web.focus();
		return false;
	}	
if(window.document.addlink.opi.value == "")
	{
		alert("You did not enter your site description.");
		window.document.addlink.opi.focus();
		return false;
	}
if(window.document.addlink.url.value == "")
	{
		alert("Please enter the URL where our link or banner \n can be found.");
		window.document.addlink.url.focus();
		return false;
	}

return true;
}
//-----------------------------------------------------EDITOR TEXTRA-----------------------
tinyMCE.init({
	// General options
	forced_root_block : false, 	// ISKLJUCUJE <P> 
    force_br_newlines : true,	// ISKLJUCUJE <P> 
    force_p_newlines : false,	// ISKLJUCUJE <P> 
	mode : "textareas",
	theme : "advanced",
	plugins : "safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager",

	// Theme options
	theme_advanced_buttons1 :"bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,undo,redo,",
	theme_advanced_buttons2 : "",
	theme_advanced_buttons3 : "",
	theme_advanced_buttons4 : "",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_statusbar_location : "bottom",
	theme_advanced_resizing : true,

	// Example content CSS (should be your site CSS)
	content_css : "css/example.css",

	// Drop lists for link/image/media/template dialogs
	template_external_list_url : "js/template_list.js",
	external_link_list_url : "js/link_list.js",
	external_image_list_url : "js/image_list.js",
	media_external_list_url : "js/media_list.js",

	// Replace values for the template plugin
	template_replace_values : {
		username : "Some User",
		staffid : "991234"
	}
});
//-----------------------------------------------------OTVARANJE PROZRA-----------------------
function prozor( page, width, height, top, left ) { 
				var yes		= 1; 
				var no		= 0; 
				var menubar     = no;  
				var scrollbars  = yes; 
				var locationbar = no;  
				var directories = no;  
				var resizable   = no;  
				var statusbar   = no;  
				var toolbar     = no;  
			 
				features = "" + 
					"width=" + width + "," + 
					"height=" + height + "," + 
					"top=" + top + "," + 
					"left=" + left + ""; 
				features += "" + 
					(menubar ? ",menubars" : "") + 
					(scrollbars ? ",scrollbars" : "") + 
					(locationbar ? ",location" : "") + 
					(directories ? ",directories" : "") + 
					(resizable ? ",resizable" : "") + 
					(statusbar ? ",status" : "") + 
					(toolbar ? ",toolbar" : ""); 
			 
				window.open( page, 'fullPopup', features ); 
			} 
			
//-----------------------------------------------------IZRACUNAVANJE VISINE SLIKE-----------------------

			
			
			
