//abrir foto grande
function fotoGrande(theURL,winName,features){
  	var _W=window.open(theURL,winName,features);
 	_W.focus();
    _W.moveTo(100,100);
}

// Configuracion de Cuadro de Informacion de Procesos
function spanOver(este,po){
 	if(po=="over"){	este.className='spanover'; }
	else{ este.className=''; }
}

/*function InfoDivDone(mensaje){
		InfoDiv(true,mensaje);
		setTimeout("InfoDiv(false,'');",2000);
}

function InfoDivCarga(mensaje){
	document.getElementById('divinfo').className='divinfoCargando';
	document.getElementById('divinfo').innerHTML=mensaje+'...';
}

function InfoDiv(que,mensaje){
	if(que==true){
	document.getElementById('divinfo').className='divinfoActivo';
	document.getElementById('divinfo').innerHTML=mensaje;
	}else{
		document.getElementById('divinfo').className='divinfoInactivo';		
		document.getElementById('divinfo').innerHTML='';
	}
}*/

//funcion para eliminar la foto de usuario
function borrarIMG(id){
	if(confirm("ATENCIÓN: Esta acción no se puede deshacer\nConfirme que desea eliminar esta imagen")){
	//InfoDivCarga("Eliminando");
	xajax_borrarImg(id);
	}
}

//funcion de cambio de imagen del iframe
function FotoCambiada(id,ancho,alto,nombre){
	cancelarCambiarFoto(id);
	r='<span style="position:absolute" id="ampliarimg"><a href="javascript:borrarIMG('+id+');" title="Eliminar imagen"><img src="images/borrar_img.gif" border="0" /></a></span><span style="position:absolute" id="cambiar_img_'+id+'"></span><span id="div" onmouseover="spanOver(this,\'over\')" onmouseout="spanOver(this,\'out\')"><img src="imagenes/'+nombre+'" border="0" title="Click para cambiar" onclick="cambiarImagen('+id+');" class="picuser"/></span>';
	document.getElementById('img_principal').innerHTML=r;
	//InfoDivDone('La imagen fué cambiada');
}

//funcion para cancelar el cambio de foto de usuario
function cancelarCambiarFoto(id){
	document.getElementById('cambiar_img_'+id).innerHTML='';
}

//funcion para agregar foto de usuario
function agregarImagen(id){
	document.getElementById('cambiar_img_'+id).innerHTML='<table class="contorno" width="270" bgcolor="#151A20"><tr><td class="celdaencabezado" bgcolor="#151A20"><img src="images/filenew.gif" border="0" />  <span class="iframetitle">Agregar imagen</span></td></tr><tr><td><iframe src="iframe.cambiarimg.php?id='+id+'" width="270" height="70" frameborder="0" id="iframefoto" name="iframefoto"></iframe></td></tr></table>';
}

//funcion para cambiar la foto de usuario
function cambiarImagen(id){
	document.getElementById('cambiar_img_'+id).innerHTML='<table class="contorno" width="270" bgcolor="#151A20"><tr><td class="celdaencabezado" bgcolor="#151A20"><img src="images/filenew.gif" border="0" />  <span class="iframetitle">Cambiar imagen</span></td></tr><tr><td><iframe src="iframe.cambiarimg.php?id='+id+'" width="270" height="70" frameborder="0" id="iframefoto" name="iframefoto"></iframe></td></tr></table>';
}

//funcion para cambiar la foto de usuario
function cambiarImagen2(id){
	document.getElementById('cambiar_img_'+id).innerHTML='<table class="contorno" width="270" bgcolor="#151A20"><tr><td class="celdaencabezado" bgcolor="#151A20"><img src="images/refresh.png" border="0" />  <span class="iframetitle">Cambiar imagen</span></td></tr><tr><td><iframe src="iframe.cambiardisenio.php?id='+id+'" width="270" height="70" frameborder="0" id="iframefoto" name="iframefoto"></iframe></td></tr></table>';
}

//funcion de cambio de imagen del iframe
function FotoCambiada2(id,ancho,alto,nombre){
	cancelarCambiarFoto(id);
	/*r='<span style="position:absolute; padding-top:3px; padding-left:3px; padding-right:3px; padding-bottom:3px;" id="participar"><a href="#" title="Enviar este diseño a Participar"><img src="images/heart.png" onclick="if(confirm(\'Estas seguro de mandar tu diseño a participar?\')){xajax_manda_participa('+id+');}"  border="0" /></a>&nbsp;<a href="javascript:cambiarImagen2('+id+');" title="Modificar Diseño"><img src="images/refresh.png" border="0" /></a></span><a href="detallescritica.php?id='+id+'"><img class="nuevo" src="imagenes/'+nombre+'" title="Ver detalles de este diseño"/></a>';*/
	r='<span style="position:absolute;" id="pendiente"><img src="images/ribonpendiente.png" border="0" /></span><img class="nuevo" src="imagenes/'+nombre+'" title="Pendiente de Aprobacion"/></span>';
	
	document.getElementById('cont_div' + id).innerHTML=r;
	//InfoDivDone('La imagen fué cambiada');
}

//funcion de visualizacion de secciones en mi cuenta
function mostrar(n) {
	for (i=0; i<4; i++) {
		document.getElementById('capa'+i).style.display='none';
		document.getElementById('v'+i).style.background='url(images/btncuentaout.png)';
		document.getElementById('img'+i).src='images/cuenta'+i+'out.png';		
	}
	document.getElementById('capa'+n).style.display='block';
	document.getElementById('v'+n).style.background='url(images/btncuentaover.png)';
	document.getElementById('img'+n).src='images/cuenta'+n+'over.png';	
}

//funcion de visualizacion de secciones en mi perfil
function ver(n){
	for(i=0; i<3; i++){
		document.getElementById('capa'+i).style.display='none';
		document.getElementById('v'+i).style.background='url(images/btncuentaout.png)';
		document.getElementById('img'+i).src='images/perfil'+i+'out.png';
	}
	document.getElementById('capa'+n).style.display='block';
	document.getElementById('v'+n).style.background='url(images/btncuentaover.png)';
	document.getElementById('img'+n).src='images/perfil'+n+'over.png';
}

//funcion para redireccionar el mensaje de gracias por subir un diseño
function redirectimage(){
    window.location = "micuenta.php";
}

//funcion para chekar email
function checkmail(obj){
		//(obj != '') ? alert("tu email es: "+obj) : alert("escribe un email");
		xajax_checkmail(obj);
}

//funciones para cargar paises, estados y ciudades automaticamente
function callEstados(pais){
	if(registro.estados.type == "selectone"){
		xajax_paises(pais,(registro.estados.options.length-1));
	}else{
		xajax_paises(pais,0);
	}
	return false;
}

function callEstados_2(pais){
	if(registro2.estados2.type == "selectone"){
		
		xajax_paises(pais,(registro2.estados2.options.length-1));
		
	}else{
		//alert('x2');
		xajax_paises(pais,0);
	}
	return false;
}

function callCuidades_2(estado){
	if(registro2.ciudad.type == "selectone"){
		xajax_ciudades(estado,(registro2.ciudad_2.options.length-1));
	}else{
		xajax_ciudades(estado,0);
	}
	return false;
}
					
function callCuidades(estado){
	if(registro.ciudad.type == "selectone"){
		xajax_ciudades(estado,(registro.ciudad.options.length-1));
	}else{
		xajax_ciudades(estado,0);
	}
	return false;
}

function callEstados2(pais){
	if(xajax.$('estados0').type == "selectone"){
		xajax_paisesDE(pais,(xajax.$('estados0').options.length-1));
	}else{
		xajax_paisesDE(pais,0);
	}
	return false;
	}

function callCuidades2(estado){
	if(xajax.$('ciudad0').type == "selectone"){
		xajax_ciudadesDE(estado,(xajax.$('ciudad0').options.length-1));
	}else{
		xajax_ciudadesDE(estado,0);
	}
	return false;
}

function passValues(){
	/*var dir1 = xajax.$('callenumero').value;
	var dir2 = xajax.$('colonia').value;
	var dir3 = xajax.$('cp').value;
	var dir4 = xajax.$('telefono').value;
	
	xajax.$('callenumero0').value = dir1;
	xajax.$('colonia0').value = dir2;
	xajax.$('cp0').value = dir3;
	xajax.$('tel0').value = dir4;*/
	
	xajax.$('pais0').options[xajax.$('pais').selectedIndex].selected=true;
	
	if(xajax.$('estados0').type == "selectone"){
		xajax_ChangeEstadosAuto(xajax.$('pais0').value,(xajax.$('estados0').options.length-1));
	}else{
		xajax_ChangeEstadosAuto(xajax.$('pais0').value,0);
	}
}

//---------------------
//funcion agregar producto al carrito
/*function agrega(){
	xajax_addToCart(xajax.getFormValues('Frm_PDet'),'');
}*/

function MDM_openWindow(theURL,winName,features,WidthPopup,HeightPopup){
	var _W=window.open(theURL,winName,features);
	_W.focus();
	WidthPopup = parseInt(WidthPopup);
	HeightPopup = parseInt(HeightPopup);
	iz=(screen.width-WidthPopup) / 2;
    de=(screen.height-HeightPopup) / 2;
    _W.moveTo(iz,de);
}