  $(document).ready(function(){  
     
       //$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)  
     
     $("ul.topnav li.palvelut").hover(function() { //When trigger is clicked...  
   
         //Following events are applied to the subnav itself (moving subnav up and down)  
         $(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click  
   
         $(this).parent().hover(function() {  
         }, function(){  
             $(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up  
         });  
   
         //Following events are applied to the trigger (Hover events for the trigger)  
         }).hover(function() {  
             $(this).addClass("subhover"); //On hover over, add class "subhover"  
         }, function(){  //On Hover Out  
             $(this).removeClass("subhover"); //On hover out, remove class "subhover"  
     });

	$(function() {
		var error = false;
		
		$('.error').hide();
		$(".send").click(function() {
			var error = false;
			var $fields = $("#formi :checked").size();
	        if ($fields < 1) {
				$("label#subject_error").show();
				error = true;
			}
			
			if ($("input#name").val() == "") {
				$("label#name_error").show();
				$("input#name").focus();
				error = true;
			}
			if ($("textarea#text").val() == "") {
				$("label#text_error").show();
				$("textarea#text").focus();
				error = true;
			}
			if ($("input#tel").val() == "") {
				$("label#tel_error").show();
				$("input#tel").focus();
				error = true;
			}
			if ($("input#email").val() == "") {
				$("label#email_error").show();
				$("input#email").focus();
				error = true;
			}
			
			if (error == true) {
				return false;
			}
			
 		});
 	});
});  

function getObject(obj) {
  var theObj;
  if(document.all) {
    if(typeof obj=="string") {
      return document.all(obj);
    } else {
      return obj.style;
    }
  }
  if(document.getElementById) {
    if(typeof obj=="string") {
      return document.getElementById(obj);
    } else {
      return obj.style;
    }
  }
  return null;
}

// Count characters.
function CountChars(input,field,text,chars) {
  var inputObj=getObject(input);
  var fieldObj=getObject(field);
  var lenght=chars - inputObj.value.length;
  if(lenght <= 0) {
    lenght=0;
    text='<span class="disable"> '+text+' </span>';
    inputObj.value=inputObj.value.substr(0,chars);
  }
  fieldObj.innerHTML = text.replace("{CHAR}",lenght);
}
-->
