
///////////////////////////////////////
//funcion que previsualiza una imagen del cliente en la imagen id=id del objeto imagen, string=path
///////////////////////////////////////
function setImage_(id,string){
	preview_frame.document.getElementById(id).src = 'File:\/\/' + string;
}
///////////////////////////////////////
//Abre una imagen en el navegador de las dimenciones de la imagen
///////////////////////////////////////
function openImag(file){
	window.open("pop_img.php?f=" + file,"_blank","toolbar=no, location=no, directories=no, menubar=no, status=no, scrollbars=no, resizable=yes width=20, height=20")
}
///////////////////////////////////////
//Abre una pagina en el navegador de las dimenciones que se indiquen sin barras de herramientas
///////////////////////////////////////
function openWin(file,width,height){
	window.open(file,"_blank","toolbar=no, location=no, directories=no, menubar=no, status=no, scrollbars=no, resizable=no, width=" + width + ", height=" + height)
}
///////////////////////////////////////
//Abre una pagina en el navegador de las dimenciones que se indiquen sin barras de herramientas
///////////////////////////////////////
function openWinScroll(file,width,height){
	window.open(file,"_blank","toolbar=no, location=no, directories=no, menubar=no, status=no, scrollbars=yes, resizable=no, width=" + width + ", height=" + height)
}
///////////////////////////////////////
// Imprime la pagina
///////////////////////////////////////
<!-- Begin
function printPage() {
	if (window.print) {
		agree = confirm('¿Quieres imprimir la página?')
		if (agree) window.print()
	}
}
////////////////////////////////////////
// genera un numero 
///////////////////////////////////////

function llave(){

	var mydate=new Date();
	return mydate.getTime(); 
}

///////////////////////////////////////
//Manda mail para invitar
///////////////////////////////////////
function invita(){
	openWin("invita.php?Email=" + document.getElementById("mail").value,200,170)
	document.getElementById("mail").value="Escribe el e-mail";
}
///////////////////////////////////////
//Abre el album de inmagenes
///////////////////////////////////////
function album(){
	openWin("album.php",800,600)
}
///////////////////////////////////////
//Conexion a radio
///////////////////////////////////////

function radio(){
	openWin("http://www.enfoquenoticias.com.mx/v2/radio.php?rep=MIL",450,300);
}
function radio1(){
	openWin("http://www.enfoquenoticias.com.mx/v2/radio.php?rep=STEREOCIEN",450,300);
}
function radio2(){
	openWin("http://www.enfoquenoticias.com.mx/v2/radio.php?rep=MIL",450,300);
}

///////////////////////////////////////
// Validador de mails ... NO FUNCIONA EN MAC
///////////////////////////////////////

function isMail(e_mail_send){

	if(e_mail_send!=null && e_mail_send!=""){
		
		var arroba = e_mail_send.split("@");
		var punto = e_mail_send.split(".");
			
		if(arroba[1]==null){
			return false;
		}
		if(punto[1]==null){
			return false;
		}
	
		return true;
	}
	else
		return false;

}


///////////////////////////////////////
// Previsualizacion de imagenes en tiempo real
///////////////////////////////////////

  // width to resize large images to
var maxWidth=100;
  // height to resize large images to
var maxHeight=100;
  // valid file types
var fileTypes=["jpg","jpeg"];
  // the id of the preview image tag
var outImage="previewField";
  // what to display when the image is not valid
var defaultPic="spacer.gif";

/***** funciones *****/

function preview(what,where){
	var source=what.value;
  	var ext=source.substring(source.lastIndexOf(".")+1,source.length).toLowerCase();
	for (var i=0; i<fileTypes.length; i++)
		if (fileTypes[i]==ext) break;
	    globalPic=new Image();
		if (i<fileTypes.length) globalPic.src=source;
		else {
			globalPic.src=defaultPic;
		    alert("No es una imagen valida\nPorfavor selecciona una imagen con extención:\n\n"+fileTypes.join(", "));
		}
		setTimeout("applyChanges()",200);
		if(where!=null && where!=""){
			outImage=where
		}
}

var globalPic;

function applyChanges(){
  var field=document.getElementById(outImage);
  var x=parseInt(globalPic.width);
  var y=parseInt(globalPic.height);
  if (x>maxWidth) {
    y*=maxWidth/x;
    x=maxWidth;
  }
  if (y>maxHeight) {
    x*=maxHeight/y;
    y=maxHeight;
  }
  field.style.display=(x<1 || y<1)?"none":"";
  field.src=globalPic.src;
  field.width=x;
  field.height=y;
}

//  End -->
