$(function() {    
	$('tr.even').mouseover(function() {  
       $(this).addClass("overrow").show("slow");  
  } )  
  $('tr.even').mouseout(function() {  
      $(this).removeClass("overrow").show("slow");  
  } ) 	
}) 

function OFlash (file, width, height, bgcolor, mode) { document.write ("<object codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0 height=" + height + " width=" + width + " classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000><PARAM NAME='FlashVars' VALUE=''><PARAM NAME='Movie' VALUE='" + file + "'><PARAM NAME='Src' VALUE='" + file + "'><PARAM NAME='WMode' VALUE='" + mode + "'><PARAM NAME='Play' VALUE='-1'><PARAM NAME='Loop' VALUE='-1'><PARAM NAME='Quality' VALUE='High'><PARAM NAME='SAlign' VALUE=''><PARAM NAME='Menu' VALUE='0'><PARAM NAME='Base' VALUE=''><PARAM NAME='AllowScriptAccess' VALUE='0'><PARAM NAME='Scale' VALUE='ShowAll'><PARAM NAME='DeviceFont' VALUE='0'><PARAM NAME='EmbedMovie' VALUE='0'><PARAM NAME='BGColor' VALUE='" + bgcolor +"'><PARAM NAME='SWRemote' VALUE=''><PARAM NAME='MovieData' VALUE=''><PARAM NAME='SeamlessTabbing' VALUE='1'><PARAM NAME='Profile' VALUE='0'><PARAM NAME='ProfileAddress' VALUE=''><PARAM NAME='ProfilePort' VALUE='0'><embed src='" + file + "' quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='" + width + "' height='" + height +"'  wmode= '"+mode+"'></embed></object>"); }

function popup(page, title) {	
	window.open(page, title, "width=590,height=478,menubar=no,scrollbars=yes");
}

function initValidation (id_form)
{
		
	var correcto = true;	
	// campos requeridos	
																		  
	  $("#"+id_form).find(".required").each(function(i) {
		id = $(this).attr("id");
	    valor=$(this).attr("value");
	    
	   if (valor==undefined){
	   	   mark_field(id,'required');
		   correcto = false;		
	   }else 
	   		unmark_field(id,'required');     
	   });
	  
	  																	  
	  $("#"+id_form).find(":radio.required").each(function(i) {
		name = $(this).attr("name");
	    //alert($("input[@name='"+name+"']:checked").val());
	   if ($("input[@name='"+name+"']:checked").val() == null){
	   	   mark_field(name,'required');
		   correcto = false;		
	   }else 
	   		unmark_field(id,'required');     
	   });
	  
	// campos password iguales	  
	pasw = $("#password").attr("value");		
	repasw = $("#repassword").attr("value");		
	if(pasw != undefined && pasw != ''){
		if (pasw == repasw){
   			unmark_field('password','match_password');  		
	   }else{ 
   		   mark_field('password','match_password');
		   correcto = false;
	   }  	
	}
	   
	  
	 
	// campos email
	$("#"+id_form).find(".valid_email:visible").each(function(i) {	
		id = $(this).attr("id");
	   valor=$(this).attr("value");
	  
	   if (valor!=undefined) {
	  if (!valor.match(/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i)){
	  	mark_field(id,'valid_email');
		correcto = false;
	  }else unmark_field(id,'valid_email');
	   }
	   });
	   
	 // min length
	 $("#"+id_form).find(".min_length:visible").each(function(i) {		
		id = $(this).attr("id");
	   valor=$(this).attr("value");
	  if (valor!=undefined) {
	  if (valor.length<6){
	  	mark_field(id,'min_length');
		correcto = false;
	  }
	   else unmark_field(id,'min_length');
	  }
	   });

	 $("#"+id_form).find(".minimum:visible").each(function(i) {			 
		id = $(this).attr("id");
	   valor=$(this).attr("value");
	  if (valor!=undefined) {
	  	id = $(this).attr("id");
	  	fieldcomp = id.substring(0, id.indexOf('_') );
	  	
	  	valor2=$("#"+fieldcomp).attr("value");
	  
	  	if (parseInt(valor)>parseInt(valor2)){
	  	correcto = false;
	  	mark_field(id,'minimum');
		}
	   else unmark_field(id,'minimum');
	  }
	   }); 	  
	 
	 return correcto;
}

function mark_field (id, type)
{	
	$("#"+id).css("background-color", "#ffffcc");
	$("#error_"+ id + "_" + type).show();
}

function unmark_field (id, type)
{	
	$("#"+id).css("background-color", "#FFFFFF");
	$("#error_"+ id + "_" + type).hide();
}
