$(document).ready(function() {

						   		$("#LeftMenu img").mouseover(function() {
																  var str = $(this).attr("src");
																  var cls = $(this).attr("class");
																  if (cls != 'sel') {
																	  var str_ar = str.split(".");
																	  $(this).attr("src",str_ar[0]+"_over.gif");
																  }

														  });
								$("#LeftMenu img").mouseout(function() {
																  var str = $(this).attr("src");
																  var cls = $(this).attr("class");
																  if (cls != 'sel') {
	  																  var str_ar = str.split("_over");
																	  $(this).attr("src",str_ar[0]+".gif");
																  }
														  });
								$("#TopMenu img").mouseover(function() {
																  var str = $(this).attr("src");
																  var cls = $(this).attr("class");
																  if (cls != 'sel') {
																	  var str_ar = str.split(".");
																	  $(this).attr("src",str_ar[0]+"_on.gif") 	
																  }

														});
								$("#TopMenu img").mouseout(function() {
																  var str = $(this).attr("src");
																  var cls = $(this).attr("class");
																  if (cls != 'sel') {
																	  var str_ar = str.split("_on");
																	  $(this).attr("src",str_ar[0]+".gif")
																  }
														});
								$("#search, #search1").focus(function() {
																$(this).attr("value",'');
															});
								$("a[class='submenu']").mouseover(function() {
																	   $(this).parent().attr("class","over");
																	   
													    });
								$("a[class='submenu']").mouseout(function() {
																	   $(this).parent().attr("class","none");
														    });
/*								goRand();
								$("#Header1").css("background","url(../../site/images/" + current_image + ") left no-repeat");*/
						   });
function goRand() {
		var rand = Math.floor(Math.random() * num);
		current_image = myImages[rand];
	}
function GoSearch()
{
	var text = $("#search").val();
	document.location.href="../search.ivp?search=" + text;
}
function GoSearch1()
{
	var text = $("#search1").val();
	document.location.href="../search.ivp?search=" + text;
}
function GoSubscribe(addr)
{
	if ($("#fldemail")) {
		var str = $("#fldemail").val();
		document.location.href = addr + str;
	}
}

//-------------------Check Form--------------//
function checkForm(form)
{
	for(var i = 0; i < form.elements.length; i ++)
	{
		var element = form.elements[i];
		
		var check = 0;
		
		if((element.type == "text") || (element.type == "textarea") || (element.type == "radio"))
		{
			check = checkField(element,i, form);
			
			if(check)
				return false;
		}
	}
	
	return true;	
}

function checkField(el,index,form)
{
	var checked=0, id=el.id;
	if (el.type=="radio" && el.title!='') {
		var next_el = el;
		while (next_el.id == el.id){	
			if (next_el.checked) checked = 1;
			index=index+1;
			next_el = form.elements[index];
		}
		if (checked == 0) {
			alert("Не заполнено поле <" + el.title + ">");
			return true;
		}
	}
	if((el.value.length < 1 && el.type !="radio") && el.title!='')
		{
			alert("Не заполнено поле <" + el.title + ">");
			el.focus();
			
			return true;
		}
    return false;
}
