///FUNCIONES PARA INSERTAR SWF EN LAS WEBS
function embedFlash(ubicacion,pelicula,ancho,alto){
	  document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+ancho+'" height="'+alto+'">');
		document.write('<param name="movie" value="'+ubicacion+pelicula+'.swf" />');
		document.write('<param name="quality" value="high" />');
		document.write('<param name="wmode" value="transparent" />');
		document.write('<embed src="'+ubicacion+pelicula+'.swf" width="'+ancho+'" height="'+alto+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent"></embed>');
	  document.write('</object>');
}

function embedflv(ubicacion,pelicula,ancho,alto){
	  document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+ancho+'" height="'+alto+'">');
		document.write('<param name="movie" value="'+ubicacion+pelicula+'" />');
		document.write('<param name="quality" value="high" />');
		document.write('<param name="wmode" value="transparent" />');
		document.write('<embed src="'+ubicacion+pelicula+'.swf" width="'+ancho+'" height="'+alto+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent"></embed>');
	  document.write('</object>');
}

///MENU DE SALTO
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

//Agregar a favoritos
function agregar(){
   if ((navigator.appName=="Microsoft Internet Explorer") && 
         (parseInt(navigator.appVersion)>=4)) {
      var url="http://www.flow-tekindustrialservice.com/"; 
      var titulo="Flow Tek - Idustrial Service";
      window.external.AddFavorite(url,titulo);
   } else { 
      if(navigator.appName == "Netscape") 
         alert("Presione Crtl+D para agregar este sitio en sus Bookmarks"); 
   }
}

//VALIDAR BUSCADOR
function fSearch() {
  if (document.fsearch.q.value == '') {
    alert('Por favor ingrese una busqueda');
    document.fsearch.q.focus();
    return false;
    }
	
  return true;
}

//VALIDAR RECUPERAR PASS
function frPass() {
  if (document.frpass.rpass.value == '') {
	document.getElementById("getrpass").innerHTML = "* Introduce la dirección de e-mail ";
    document.frpass.rpass.focus();
    return false;
    }
	document.getElementById("getrpass").innerHTML = "";
  return true;
}

//Validar Formulario
function fContact() {
  var filter=/^[A-Za-z][A-Za-z0-9_]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
  
  if (document.forms01.nombre.value == '') {
    //alert('Por favor ingrese su nombre');
	document.getElementById("getnombre").innerHTML = "* Ingrese su nombre";
	document.getElementById("getemail").innerHTML = "";
	document.getElementById("getremail").innerHTML = "";
    document.forms01.nombre.focus();
    return false;
  }

  if (document.forms01.email.value == '') {
    //alert('Por favor ingrese su dirección de email');
	document.getElementById("getemail").innerHTML = "* Ingrese su email";
	document.getElementById("getnombre").innerHTML = "";
	document.getElementById("getremail").innerHTML = "";
    document.forms01.email.focus();
    return false;
  }
  
  if (!filter.test(document.forms01.email.value)) {
	//alert("Por favor ingrese un email válido.");
	document.getElementById("getremail").innerHTML = "* Ingrese un email válido";
	document.getElementById("getnombre").innerHTML = "";
	document.getElementById("getemail").innerHTML = "";
	document.forms01.email.focus();
	return false;
  }
  return true;
}

//VALIDAR EMAIL DE FORMULARIO
function ValidarCpEval() {
  var filter=/^[A-Za-z][A-Za-z0-9_]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
  
  //DATOS DE IDENTIFICACIÓN
  if (document.cpEval.email.value == '') {
    alert('Por favor ingrese su dirección de email');
    document.cpEval.email.focus();
    return false;
  }else{
	  if (!filter.test(document.cpEval.email.value)) {
		  alert("Por favor ingrese un email válido.");
		  document.cpEval.email.focus();
		  return false;
	  }
  }
  
  if (document.cpEval.password.value == '') {
    alert('Por favor cree una contraseña');
    document.cpEval.password.focus();
	return false;
  }else{
	  if(document.cpEval.password.value.length<8){
		  alert('Por favor ingrese 8 digitos como mínimo');
		  document.cpEval.password.focus();
		  return false;
	  }else{
		  if (document.cpEval.rpassword.value == '') {
			  alert('Por favor confirme su contraseña');
			  document.cpEval.rpassword.focus();
			  return false;
		  }else{
			  if (document.cpEval.rpassword.value != document.cpEval.password.value) {
				  alert('Las contraseñas no coinciden');
				  document.cpEval.rpassword.focus();
				  return false;
			  }
		  }
	  }
  }
  
  //DATOS PERSONALES telefono_fijo
  if (document.cpEval.nombre.value == '') {
    alert('Por favor ingrese su nombre');
    document.cpEval.nombre.focus();
	return false;
  }else{
	  if (document.cpEval.apellidos.value == '') {
		  alert('Por favor ingrese sus apellidos');
		  document.cpEval.apellidos.focus();
		  return false;
	  }
  }
  
  if (document.cpEval.telefono_fijo.value == '') {
	alert('Por favor ingrese un número teléfonico de contacto');
	document.cpEval.telefono_fijo.focus();
	return false;
  }
  
  //DATOS DE LA EMPRESA
  if (document.cpEval.empresa.value == '') {
    alert('Por favor ingrese el nombre de su empresa o comercio');
    document.cpEval.empresa.focus();
	return false;
  }
  
  if (document.cpEval.directorio.value == '') {
    alert('Por favor ingrese un directorio');
    document.cpEval.directorio.focus();
	return false;
  }
  
  if (document.cpEval.pais.value == '') {
    alert('Por favor ingrese un país');
    document.cpEval.pais.focus();
	return false;
  }else{
	  if (document.cpEval.direccion.value == '') {
		  alert('Por favor ingrese la dirección');
		  document.cpEval.direccion.focus();
		  return false;
	  }else{
		  if (document.cpEval.ciudad.value == '') {
			  alert('Por favor ingrese la ciudad');
			  document.cpEval.ciudad.focus();
			  return false;
		  }else{
			  if (document.cpEval.departamento.value == '') {
				  alert('Por favor ingrese el departamento');
				  document.cpEval.departamento.focus();
				  return false;
			  }
		  }
	  }
  }
  
  if (document.cpEval.correoventas.value == '') {
    alert('Por favor ingrese un correo');
    document.cpEval.correoventas.focus();
	return false;
  }else{
	  if (!filter.test(document.cpEval.correoventas.value)) {
		  alert("Por favor ingrese un correo válido.");
		  document.cpEval.correoventas.focus();
		  return false;
	  }
  }
  
  return true;
}

//VETANA POPUP
//ABRIR VENTANA POPUP
function Open_w(theURL,w,h,winName,vscroll) { 
//var winName2="mititulo"
var windowprops ="top=100,left=100,toolbar=yes,location=no,status=no, menubar=no,scrollbars="+ vscroll +", resizable=no,width=" + w + ",height=" + h;

window.open(theURL,winName,windowprops); 
}

function Open_chat(theURL,w,h,winName,vscroll) { 
//var winName2="mititulo"
var windowprops ="top=100,left=100,toolbar=no,location=no,status=no, menubar=no,scrollbars="+ vscroll +", resizable=no,width=" + w + ",height=" + h;

window.open(theURL,winName,windowprops); 
}
