var $j = jQuery.noConflict();

$j(document).ready(function(){
																									 
	$j('#platno').innerfade({
		animationtype: 'fade',
		speed: 750,
		timeout: 10000,
		type: 'random',
		containerheight: '219px'
	});
	
	$j("table > tr:even, table > tbody > tr:even").addClass("odd");
	
	$j(".form").validate({
	  errorElement: "em",
	  errorPlacement: function(error, element) {
			error.insertAfter(element.next("span"));
		},
		rules: {
			content: "required",
			ch: "deset",
			name: "required",
			email: {
				email: true,
				required: true
			}
		},
		messages: {
			content: "Prosíme, zadejte Váš dotaz.",
			name: "Prosíme, zadejte Váše jméno.",
			email: "Prosíme, zadejte správnou e-mailovou adresu."
		}
	});
	
	$j.validator.addMethod("deset", function(value) {
		return value == "deset";
	}, 'Prosíme, zadejte "deset" bez uvozovek.');
	
});

var reNonBlank=/[\S]/;
var reEMail=/^\w[\w\-\.]+\@\w[\w\-]+(\.[\w\-]+)+$/;

function _checkIt(re, field, msg) {
  if (typeof(field.length)!="undefined") {
    if (field.length==0) {
      return true;
    }
    if (typeof(field.options)!="undefined") {
      if (re.test(field.value)) {
        return true;
      }
    }
    else {
      for (var i=0; i<field.length; i++) {
        if (field[i].checked) {
          return true;
        }
      }
    }
  }
  else {
    if (field.type=="checkbox" || field.type=="radio") {
      if (field.checked) {
        return true;
      }
    }
    else if (re.test(field.value)) {
      return true;
    }
  }

  alert(msg);
  if (typeof(field.select)!="undefined") {
    field.select();
  }
  if (typeof(field.focus)!="undefined") {
    field.focus();
  }

  return false;
}
function goodEMail(field, msg) {
  return _checkIt(reEMail, field, msg);
}
function nonBlank(field, msg) {
  return _checkIt(reNonBlank, field, msg);
}