function enviar_contacto(){
	
		if (document.getElementById('contacto').raz_soc.value == "") {
			alert("Por favor ingrese su nombre.");
			document.getElementById('contacto').raz_soc.focus();
			return;
		}
		if (document.getElementById('contacto').mail.value == "" && document.getElementById('contacto').tel.value==""){
			alert("Debe ingresar un teléfono o email de contacto.");
			document.getElementById('contacto').mail.focus();
			return;
		}else{
			if(!(document.getElementById('contacto').mail.value=="")){
				if (!((/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('contacto').mail.value)))){
					alert("Ha ingresado una dirección de correo electrónico no válida.");
					document.getElementById('contacto').mail.focus();
					return;
				}
			}
		}

	document.getElementById('contacto').submit();
}




function enviar_tasacion(){
	
		if (document.getElementById('contacto').raz_soc.value == "") {
			alert("Por favor ingrese su nombre.");
			document.getElementById('contacto').raz_soc.focus();
			return;
		}
		if (document.getElementById('contacto').mail.value == "" && document.getElementById('contacto').tel.value==""){
			alert("Debe ingresar un teléfono o email de contacto.");
			document.getElementById('contacto').mail.focus();
			return;
		}else{
			if(!(document.getElementById('contacto').mail.value=="")){
				if (!((/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('contacto').mail.value)))){
					alert("Ha ingresado una dirección de correo electrónico no válida.");
					document.getElementById('contacto').mail.focus();
					return;
				}
			}
		}

	document.getElementById('contacto').condicion.value=document.getElementById('contacto').con_idPedido[document.getElementById('contacto').con_idPedido.selectedIndex].text;

	document.getElementById('contacto').tipo.value=document.getElementById('contacto').tip_idPedido[document.getElementById('contacto').tip_idPedido.selectedIndex].text;

	
	document.getElementById('contacto').submit();
}


function enviar_buscar(){
	document.getElementById('buscar').submit()
}


function enviar_buscar2(){
	document.getElementById('buscar2').submit()
}

function enviar_buscar3(){
	document.getElementById('buscar3').submit()
}

isNS4 = (document.layers) ? true : false;
isIE4 = (document.all && !document.getElementById) ? true : false;
isIE5 = (document.all && document.getElementById) ? true : false;
isNS6 = (!document.all && document.getElementById) ? true : false;

	function checkEnter(event,form)	{ 	
	var code = 0;
	if (isNS4)
		code = event.which;
	else
		code = event.keyCode;
	if (code==13)
		document.getElementById(form).submit();
		//eval('document.'+form).submit();
	}

	function imprimir_ficha(prp_id,usr){
		window.open("imprimir_ficha.php?usr_id="+usr+"&prp_id="+prp_id,"vent","toolsbar=0,width=600,height=600,scrollbars=0");
	}
	function ampliar_foto(dir,foto){
		window.open("includes/ampliar.php?dir="+dir+"&foto="+foto+"","Foto_Ampliada","toolsbar=0,width=700,height=500,scrollbars=0");
	}
	function abrir_ventana(url){
		window.open(url,"vent","toolsbar=0,width=600,height=600,scrollbars=1");
	}
	

function cambiar_foto(nro_foto,fo_desc,src){
	var nro,nro_desc,celda_actual,src;
	ob_foto=document.getElementById('foto_ppal');
	ob_input=document.getElementById('fo_desc_ppal');
	ob_foto.src=src;
	ob_input.value=fo_desc;
}

function flash(pelicula,width,height){
document.write('<object type="application/x-shockwave-flash" data="' + pelicula + '" width="' + width + '" height="' + height + '">\n');
document.write('<param name="allowScriptAccess" value="sameDomain" />\n');
document.write('<param name="movie" value="' + pelicula + '" />\n');
document.write('<param name="quality" value="high" />\n');
document.write('<param name="bgcolor" value="#ffffff" />\n');
//document.write('<param name="menu" value="false" />\n');
document.write('<param name="wmode" value="transparent" />\n');
document.write('</object>\n');
}

function cargar_select(accion,nom_sel1,nom_sel2,str,form){
			
		if(accion){
			cad="document."+form+"."+nom_sel1+".selectedIndex";
			
			nva=eval(cad);
			
			if(nva!=-1){
					cad="document."+form+"."+nom_sel1+".options["+nva+"]";	
					nva=eval(cad).value;
					
					nva_text=eval(cad).text;
					cad="document."+form+"."+str;
					
					cadena=eval(cad).value;
					
					if(cadena.indexOf(nva+"#")==-1)
					{
						
						cad="document."+form+"."+nom_sel2;
						if(eval(cad).length){
							if(eval(cad+'[0]').text.indexOf("...")!=-1){
								eval(cad+"[0]=null");
							}
						}
						val=eval(cad).length;
						val=nva+"-"+val;
						//alert(nva)
						cad="document."+form+"."+nom_sel2+".options[document."+form+"."+nom_sel2+".options.length]=new Option(nva_text,val)";
						//prp_dom.options [document.formulario.prp_dom.options.length]=new Option(nva,val);
						eval(cad);
						cad="document."+form+"."+str;
						eval(cad).value += nva + "#";
						//alert(eval("document.formulario."+str).value)
					}else{
						alert("Revise su sintaxis o asegurese de no estar repitiendo el item");
					}	
			}else{
				alert("Seleccione un Item para agregar")
			}	
				    						
		}else{
			    var cpto_borrar,e,aux,valor=0;
			    cad="document."+form+"."+str;
			    cadena=eval(cad).value;
			   // alert(document.formulario.prp_dom.selectedIndex)
			    cad="document."+form+"."+nom_sel2+".selectedIndex";
			    if(eval(cad)!=-1){
			    		cad="document."+form+"."+nom_sel2+".options[document."+form+"."+nom_sel2+".selectedIndex]";
			    		borrar=eval(cad).text;
						valor=eval(cad).value;
						cpto_borrar=borrar + "#";  
						//alert(cadena.substring(cadena.indexOf(cpto_borrar,0)));
						cadena2=cadena.substring(0,cadena.indexOf(cpto_borrar,0));
					    cadena3=cadena.substring(cadena.indexOf(cpto_borrar,0) + cpto_borrar.length,cadena.length);
					    str_zon=cadena2 + cadena3;
					    cad="document."+form+"."+str+".value=str_zon";
					    eval(cad);
					    cad="document."+form+"."+nom_sel2+".options[document."+form+"."+nom_sel2+".selectedIndex]=null";
					    eval(cad);	
			    }else{
					alert("Seleccione un Item para quitar")
				}
		}
}