function classBox(classIn, id){
	if(classIn == 1){

		document.getElementById('class-' + id + '-4').style.backgroundColor = '#161616';

	}else if(classIn == 2){

		document.getElementById('class-' + id + '-4').style.backgroundColor = '#000000';

	}
}
function classMenu(){

	var object = document.getElementById('menupad');
	var img = document.getElementById('menu_img');

	if(object.style.visibility == 'visible'){
		object.style.visibility = 'hidden';
		img.src = '/img/menu.gif';
	}else{
		object.style.visibility = 'visible';
		img.src = '/img/menu_open.gif';
	}

}

$(document).ready(function() {
 
	function show() {
		var menu = $('body');
		menu.children(".actions").slideDown();
	}

	function hide() { 
		var menu = $('body');
		menu.children(".actions").slideUp();
	}

	$(".hover-menu").hoverIntent({
		sensitivity: 1, // number = sensitivity threshold (must be 1 or higher)
		interval: 50,   // number = milliseconds for onMouseOver polling interval
		over: show,     // function = onMouseOver callback (required)
		timeout: 300   // number = milliseconds delay before onMouseOut
	});

	$(".actions").hoverIntent({
		out: hide       // function = onMouseOut callback (required)
	});

	$(".subMenu").mouseover(function () {
		// $(".subcat").show("slow");
		document.getElementById('subcatNew').style.visibility = 'visible';
	});

	$("#submenu").mouseleave(function () {
		// $(".subcat").show("slow");
		document.getElementById('submenu').style.visibility = 'hidden';
	});

	$("#footer").mouseleave(function () {
		// $(".subcat").show("slow");
		document.getElementById('submenu').style.visibility = 'hidden';
	});

	$(".closeSubcat").mouseover(function () {
		//$(".subcat").hide("slow");
		document.getElementById('subcatNew').style.visibility = 'hidden';
	});

	$("#openSubmenu").mouseover(function () {
		// $("#submenu").slideDown("slow");
		document.getElementById('submenu').style.visibility = 'visible';
	});

	$(".closeSubmenu").mouseover(function () {
		// $("#submenu").slideUp("slow");
		document.getElementById('submenu').style.visibility = 'hidden';
	});

});

function validm(form,id){

	var error = false;

	if(form.name.value==""){
		if(id == 1 || id == 0){
			document.getElementById('name').style.backgroundColor = "#CC0000";
			error = true;
		}
	}else{
		document.getElementById('name').style.backgroundColor = "#FFFFFF";
	}

	if(form.email.value=="" || checkmail(form.email.value) == false){
		if(id == 2 || id == 0){
			document.getElementById('email').style.backgroundColor = "#CC0000";
			error = true;
		}
	}else{
		document.getElementById('email').style.backgroundColor = "#FFFFFF";
	}

	if(form.phone.value==""){
		if(id == 3 || id == 0){
			document.getElementById('phone').style.backgroundColor = "#CC0000";
			error = true;
		}
	}else{
		document.getElementById('phone').style.backgroundColor = "#FFFFFF";
	}

	if(form.message.value==""){
		if(id == 5 || id == 0){
			document.getElementById('message').style.backgroundColor = "#CC0000";
			error = true;
		}
	}else{
		document.getElementById('message').style.backgroundColor = "#FFFFFF";
	}

	if(error == false && id == 0){
		document.contactform.submit();
	}
}

function checkmail(value) {
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	if (!value.match(reg)) {
		return false;
	}
}
