﻿function dosearch(root,query)
{
	window.location.href=root+"Search/"+query+".html";
}
function hitEnter(e, action)
{
	var keynum;
	
	if(window.event) // IE
	{
		keynum = e.keyCode;
	}
	else if(e.which) // Netscape/Firefox/Opera
	{
		keynum = e.which;
	}
	if (keynum == 13){
		action.submit();
		return false;
	}
	return true;
}
function doSearchHitEnter(e, root, query)
{
	var keynum;
	
	if(window.event) // IE
	{
		keynum = e.keyCode;
	}
	else if(e.which) // Netscape/Firefox/Opera
	{
		keynum = e.which;
	}
	if (keynum == 13){
		window.location.href=root+"Search/"+query+".html";
		return false;
	}
	return true;
}

function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}

function dosearch(root,query)
	{
		window.location.href=root+"Search/"+query+".html";
	}
    	function doSearchHitEnter(e, root, query)
    	{
	   	var keynum;
        	
	    	if(window.event) // IE
	    	{
		   	keynum = e.keyCode;
	    	}
	    	else if(e.which) // Netscape/Firefox/Opera
	    	{
		   	keynum = e.which;
	    	}
	    	if (keynum == 13){
		   	window.location.href=root+"Search/"+query+".html";
		   	return false;
	   	}
	   	return true;
    	}




	function mouseOver(idx, idx2)
	{
			mouseOut();
			document.getElementById(idx).style.display = 'block';
			document.getElementById(idx2).className = 'over';
	}
	
	function mouseOut()
	{
		for (var i = 1; i < 6; i++){
			if((document.getElementById('text' + i)) != null){
				document.getElementById('text' + i).style.display = 'none';
			}
		}
	}
	function mouseOutLink(idx)
	{
		
			if((document.getElementById(idx)) != null){
				document.getElementById(idx).className = '';
			}
		
	}
	
	function isEmail(string)
	{
		if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
		return true;
		else
		return false;
	}
	function adresaValida()
	{
		var sw = 0;
		if ((isEmail(document.getElementById('email').value) == false)&&(sw==0))
		{
			alert('Va rugam sa introduceti o adresa de e-mail valida! \n');
			sw=1;
			return false;
		}
		return true;
	}
	
	    function Nume()
	{
		var sw = 0;
		if (((document.getElementById('nume').value == null) || (document.getElementById('nume').value == ""))&&(sw==0))
		{
			alert('Va rugam sa introduceti numele! \n');
			sw=1;
			return false;
		}
			if (((document.getElementById('mesaj').value == null) || (document.getElementById('mesaj').value == ""))&&(sw==0))
		{
			alert('Va rugam sa introduceti un comentariu! \n');
			sw=1;
			return false;
		}
		else{
		return true;
		}
	}
	
	    function Nume2()
	{
		var sw = 0;
		if (((document.getElementById('nume').value == null) || (document.getElementById('nume').value == "") || (document.getElementById('nume').value == "Nume"))&&(sw==0))
		{
			alert('Va rugam sa introduceti numele! \n');
			sw=1;
			return false;
		}
			if (((document.getElementById('mesaj').value == null) || (document.getElementById('mesaj').value == "")||(document.getElementById('mesaj').value == "Mesaj"))&&(sw==0))
		{
			alert('Va rugam sa introduceti un comentariu! \n');
			sw=1;
			return false;
		}
		else{
		return true;
		}
	}
	
	function changeSelect(url)
	{
		document.location.href=url;
	}