function FormValidation() {
	var send = true;
	$(".required").each(function(key, value) {
		if ($(value).val().length == 0) {
			this.style.border = "1px #9E1111 solid";
			send = false;
		}
	});
	return (send == true) ? true : false;
}

function Check(url) {
	if (confirm("האם אתה בטוח שברצונך לבצע פעולה זו?")) {
		window.location = url;
	}
}

function radioValue(radioNodeList) {
	for (var i = radioNodeList.length - 1; i > -1; i--) {
		if (radioNodeList[i].checked) {
			return radioNodeList[i].value;
		}
	}
	return false;
}

function targetBlank (url) {
  blankWin = window.open(url,'_blank','menubar=yes,toolbar=yes,location=yes,directories=yes,fullscreen=no,titlebar=yes,hotkeys=yes,status=yes,scrollbars=yes,resizable=yes');
}

function Search(type) {
	if (document.getElementById("q").value == "") {
		document.getElementById("q").style.background = "#CD5C5C";
		document.getElementById("q").focus();
	}
	else {
				/*
				if (type == 'google') {
					targetBlank('http://www.google.co.il/search?hl=iw&q='+encodeURIComponent(document.getElementById("q").value));
				}
				else {
										  */
					window.location = 'index.php?module=search&act=display&q='+encodeURIComponent(document.getElementById("q").value);
				//}
		}
}

function submitSearchOnEnter(variable)
{
  var keyCode;

  //get whatever key was just pressed
  //try to account for different methods of getting
  //event keys depending on implementation
  if(window.event)
  {
      keyCode = window.event.keyCode;
  }
  else if(variable)
  {
      keyCode = variable.which;
  }

  //if the key was the enter key, perform the necessary function
  if(keyCode == 13) //13 = enter key
  {
      //here is where you process the form item or call a function to do that
      Search('site'); //call search
  }
}


function bookmarksite(title,url){
	if (window.sidebar) // firefox
		window.sidebar.addPanel(title, url, "");
	else if(window.opera && window.print){ // opera
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	}
	else if(document.all)// ie
		window.external.AddFavorite(url, title);
}

$(document).ready(function(){
	document.getElementById('q').onkeyup = submitSearchOnEnter;

	/*$(".big_menu").hover(
		function () {
			elemId = $(this).attr("id");
			$("#small_"+elemId).fadeIn(500);
		},
		function () {
			elemId = $(this).attr("id");
			$("#small_"+elemId).fadeOut(500);
		}
	);
	$(".sub_menus").hover(
		function () {
			//alert(1);
			$(this).fadeIn(1);
			//elemId = $(this).attr("id");
			//$("#small_"+elemId).fadeIn(500);
		},
		function () {
			//elemId = $(this).attr("id");
			$(this).fadeOut(500);
		}
	);*/
	
	//idsArray = new Array (1, 2);
	$(".big_menu").mouseover(function() {
		for (i=1;i<=idsArray.length;i++) {
			$("#small_"+i).css("display","none");
		}
		elemId = $(this).attr("id");
		$("#small_"+elemId).css("display","block");
	});
	/*$(".nav_hidden").mouseout(function() {
		for (i=1;i<=idsArray.length;i++) {
			$("#small_"+i).css("display","none");
		}
	});*/
	
});

