
function confirmReset()
{
	return confirm('Искате ли да изчистите формата?')
}

function confirmDelete(uri)
{
	if (confirm('Искате ли да изтриете?')) {
		window.location=uri;
	}
}

/**
 * Example usage:
 * onsubmit="javascript:return checkForm(this, {'newsDate':{'req':'Дата'},'newsDescription':{'req':'Описание'},'newsText':{'req':'Текст'}});"
 */
function checkForm(form, inventory)
{
	// 'req'	- value.length > 0
	// 'mail'	- is valid email
	// 'minLen'	- <= 
	// 'maxLen'	- >=
 
	for (x in inventory) {
		for (y in inventory[x]) {
			var e = eval('form.' + x);
			switch (y) {
				case 'req' :
					if ((typeof(e.value.length) != "undefined") && (e.value.length <= 0)) {
		e.setAttribute("autocomplete","off");
						e.focus();
		e.setAttribute("autocomplete","on");
						alert("Полето '" + inventory[x][y] + "' е задължително! Моля попълнете неговата стойност!");
						return false;
					}
					break;
				case 'mail' :
					if (!validateAsEmail(e.value)) {
		e.setAttribute("autocomplete","off");
						e.focus();
		e.setAttribute("autocomplete","on");
						alert("Полето '" + inventory[x][y] + "' е задължително! Моля попълнете коректна стойност!");
						return false;
					}
					break;
				case 'minLen' :
				case 'maxLen' :
				default:
					break;
			}
		}
	}

	return true;
}


function checkForm_bg_BG(form, inventory)
{
	// 'req'	- value.length > 0
	// 'mail'	- is valid email
	// 'minLen'	- <= 
	// 'maxLen'	- >=
 
	for (x in inventory) {
		for (y in inventory[x]) {
			var e = eval('form.' + x);
			switch (y) {
				case 'req' :
					if ((typeof(e.value.length) != "undefined") && (e.value.length <= 0)) {
		e.setAttribute("autocomplete","off");
						e.focus();
		e.setAttribute("autocomplete","on");
						alert("Полето '" + inventory[x][y] + "' е задължително! Моля попълнете неговата стойност!");
						return false;
					}
					break;
				case 'mail' :
					if (!validateAsEmail(e.value)) {
		e.setAttribute("autocomplete","off");
						e.focus();
		e.setAttribute("autocomplete","on");
						alert("Полето '" + inventory[x][y] + "' е задължително! Моля попълнете коректна стойност!");
						return false;
					}
					break;
				case 'minLen' :
				case 'maxLen' :
				default:
					break;
			}
		}
	}

	return true;
}


function checkForm_en_US(form, inventory)
{
	// 'req'	- value.length > 0
	// 'mail'	- is valid email
	// 'minLen'	- <= 
	// 'maxLen'	- >=
 
	for (x in inventory) {
		for (y in inventory[x]) {
			var e = eval('form.' + x);
			switch (y) {
				case 'req' :
					if ((typeof(e.value.length) != "undefined") && (e.value.length <= 0)) {
		e.setAttribute("autocomplete","off");
						e.focus();
		e.setAttribute("autocomplete","on");
						alert("The field '" + inventory[x][y] + "' is required! Please fill in the value!");
						return false;
					}
					break;
				case 'mail' :
					if (!validateAsEmail(e.value)) {
		e.setAttribute("autocomplete","off");
						e.focus();
		e.setAttribute("autocomplete","on");
						alert("The field '" + inventory[x][y] + "' is required! Please fill in correct value!");
						return false;
					}
					break;
				case 'minLen' :
				case 'maxLen' :
				default:
					break;
			}
		}
	}

	return true;
}


function player(movieName)
{
	playerPath = '\/flash\/player.swf';
	if (window.ActiveXObject) {
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
		document.write(' codebase="http://download.macromedia.com');
		document.write('/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"');
		document.write(' width="275" height="270" id="player">');
		document.write('<param name="movie" value="' + playerPath + '"\/>');
		document.write('<param name="quality" value="high"\/>');
		document.write('<param name="swliveconnect" value="true"\/>');
		document.write('<param name="FlashVars" value="flvName=' + movieName + '"\/>');
		document.write('<param name="wmode" value="transparent"\/>');
		document.write('<\/object>');
	} else {
		document.write('<object id="player" data="' + playerPath + '"');
		document.write(' type="application/x-shockwave-flash"');
		document.write(' width="275" height="270">');
		document.write('<param name="movie" value="' + playerPath + '"\/>');
		document.write('<param name="quality" value="high"\/>');
		document.write('<param name="swliveconnect" value="true"\/>');
		document.write('<param name="FlashVars" value="flvName=' + movieName + '"\/>');
		document.write('<param name="wmode" value="transparent"\/>');
		document.write('<\/object>'); 
	}
}