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);
		}
	}
}


///nimrod 12_2010//
function search_google(){
    
    var params = $("#q").val();
    if(params == "")
    {
        alert ("no string");
        //$("#google_search_form").text("אנא ציינו טלפון או אימייל כדי שאוכל לחזור אליכם").show();
        return false;    
    }
    else
    {
        //var params = 'חדשות חומרה ישראל'
        var uri="http://www.google.co.il/search?q=" + params + "++site:itportal.co.il";
        //document.write(uri);
        window.location=uri;
        //window.location="http://www.google.com";  
    }    
    
    
    
//window.location = "http://www.google.com";
}

/////
function submitenter(myfield,e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

if (keycode == 13)
   {
   search_google();
   return false;
   }
else
   return true;
}


//////
function submitSearchOnEnter(variable)
{
	//alert("asasasa");
  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
	  alert('num');
	  search_google();

  }
}


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(){
		
		//alert("nimrod");
	//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");
		}
	});
	
});

///////////nimrod ////////////////
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

