function slide($num) { //slider of banco de ideas
	var $slideList=$("ul.historicoSlideList");
	var $current=parseInt($slideList.css("left"));
	$slideList.animate({left:0-$num*500},600,'linear')
	
	$("ul.ctrlList li").removeClass("selected"); //add and removes class "select" of the bullets
	$("ul.ctrlList li#ctrlItm"+$num).addClass("selected");
}
function validateForm() { //form validation function	
	var $errors =0;
	var regEmail = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	var regNum = /^([0-9\-\.])/;
	$(".reqValidateTxt").each(function(){ //validates if text was written
		if ($(this).val()=="" || $(this).val()==" " ) {
			$errors++;
			$("div.errorMsg").show();
		}
	});
	$(".reqValidateEmail").each(function(){ //validate if input valid Email address
		email=$(this).val();
		$(".reqValidateEmail").each(function(){
			if (regEmail.test(email)==false) {
				$errors++;
				$("div.errorMsg").show();
			}
		});
	});
	$(".reqValidateNum").each(function(){	//validate if valid number
		num=$(this).val();
			if (regNum.test(num)==false) {
				$errors++;
				$("div.errorMsg").show();
			}
	});
	 if ($errors == 0)
        return true;
    else {
        return false;
    }
}

$(document).ready(function(){

	var $radioBox= $("input:radio").wrap('<span class="radioStyleN"></span>'); //style radio elements in forms by adding a styled span as container and hidding the actual element
	$radioBox.css("visibility","hidden");
	$radioBox.parent().click(function(){
		$radioBox.parent().each(function(){
			$(this).removeClass("radioStyleA").addClass("radioStyleN");
		});
		$(this).children().attr('checked', true);
		$(this).removeClass("radioStyleN").addClass("radioStyleA");
	});
	
	var $file1= $("input.materias").wrap('<span class="anexar"></span>'); //styles File Upload fields
	var $file2= $("input.registro").wrap('<span class="anexar"></span>');
	$file1.css("opacity","0");
	$file1.change(function() {
		var $val1=$file1.val();
		$("div.fileVal1").html($val1);
	});
	$file2.css("opacity","0");
	$file2.change(function() {
		var $val2=$file2.val();
		$("div.fileVal2").html($val2);
	});
});
