function embedFlash (id,width,height,align,src,scale,menu,bgcolor,flashvars,base){

  var objects                 = [];

  objects['id']               = id;
  objects['classid']          = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';
  objects['codebase']         = 'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0';
  objects['width']            = width;
  objects['height']           = height; 
  objects['align']            = align;

  var params                  = [];

  params['allowscriptaccess'] = 'samedomain';
  params['movie']             = src
  params['scale']             = scale;
  params['menu']              = false;
  params['base']              = base
  params['quality']           = 'high'
  params['bgcolor']           = bgcolor;
  params['wmode']             = 'transparent';
  params['flashvars']         = flashvars;

  var embeds                  = [];

  embeds['name']              = objects['id'];
  embeds['src']               = params['movie'];
  embeds['scale']             = params['scale'];
  embeds['menu']              = params['menu'];
  embeds['flashvars']         = params['flashvars'];
  embeds['base']              = params['base'];
  embeds['quality']           = params['quality'];
  embeds['bgcolor']           = params['bgcolor'];
  embeds['allowscriptaccess'] = params['allowscriptaccess'];
  embeds['width']             = objects['width'];
  embeds['height']            = objects['height'];
  embeds['align']             = objects['align'];
  embeds['type']              = 'application/x-shockwave-flash';
  embeds['pluginspage']       = 'http://www.macromedia.com/go/getflashplayer';
  embeds['wmode']             = params['wmode'];

  var objectString;
  var paramString             = '';
  var embedString;

  // Build the object tag
  objectString = '<object ';

  for (var object in objects){
    objectString += object + '="' + objects[object] + '" ';
  }

  objectString += '>\n';
  
  // Build the params
  for (var param in params){
    paramString += '<param name="' + param + '" value="' + params[param] + '" />\n';
  }

  // Build the embed tag   
  embedString = '<embed ';
  
  for (var embed in embeds){
    embedString += embed + '="' + embeds[embed] + '" ';
  }

  embedString += '/>\n';

  // Print the object
  document.write(objectString);
  document.write(paramString);
  document.write(embedString);
  // Close the object
  document.write('</object>\n');
}
/* Ajax */
function Ajax(){
	var xmlhttp=false;
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
		   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
  		}
	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}
/* Doctor */
function mostrarDoctor(idDoctor){
	divListado = document.getElementById('doctor');
	ajax=Ajax();
	ajax.open("GET", "doctor.php?idDoctor="+idDoctor);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==1) {
			divListado.innerHTML = "<div style='text-align:center;'>Cargando Informacion</div>";
		}else if (ajax.readyState==4) {
			divListado.innerHTML = ajax.responseText;
		}
	}
	ajax.send(null)
}
function cerrarDoctor(){
	divListado = document.getElementById('doctor');
	divListado.innerHTML = "";
}
/* Navegacion Tratamientos */
function irA(url){
	window.location="tratamientos-"+url+".php";
}
/* Buscar */
function buscar(){
	buscar=document.formBuscar.palabra;
	if(buscar.value==""){
		alert("Debe escribir una palabra o termino");
		buscar.focus();
	}else{
		window.location="buscar.php?palabra="+buscar.value;
	}
}
function inputIn(campo,texto){
	if(campo.value==texto)campo.value='';
}
function inputOut(campo,texto){
	if(campo.value=="")campo.value=texto;
}
/* Formulario */
function enviarEmail(){
	formulario=document.formContacto;
	if(formulario.nombre.value==""){
		alert("Debe escribir su Nombre");
		formulario.nombre.focus();
	}else if(formulario.email.value==""){
		alert("Debe escribir su Email");
		formulario.email.focus();
	}else if(formulario.email.value.search(/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/ig)){
        alert("Email Invalido");
		formulario.email.value="";
		formulario.email.focus();
    }else if(formulario.ciudad.value==""){
		alert("Debe escribir su Ciudad");
		formulario.ciudad.focus();
	}else if(formulario.pais.value==""){
		alert("Debe escoger su Pais");
		formulario.pais.focus();
	}else if(formulario.comentario.value==""){
		alert("Por favor escribir su mensaje o comentario");
		formulario.comentario.focus();
	}else if(formulario.code.value==""){
		alert("Por favor escribir Codigo de Seguridad CAPTCHA");
		formulario.code.focus();
	}else{
		formulario.submit();
	}
}
