// JavaScript Document
/*'*************************
'Author	: Juan Bustos
'Fecha	: 05/07/2010
'Accion	: se modifica el position de div fondo_negro de absolute a fixed, esto por problemas de resolucion de pantalla.
'**************************/
function alert_ajax(msg,btn){
		document.getElementById('alert_ajax').style.display = ''	
var tbtn;
var msj_alert_ajax;
if(btn == 0){
	tbtn = 'Aceptar';
	}
msj_alert_ajax = msg;
var con_div_alert_ajax;

var Tam = TamVentana();
//alert("Tam[0] = "+Tam[0]+" -- Tam[1] ="+Tam[1])
con_div_alert_ajax = '<div  style="position:fixed; width:' + Tam[0] + 'px; height:' + Tam[1] + 'px; opacity:0.4;filter:alpha(opacity=40); left:0px; top:0px; background-color:#000000; z-index:500" id="fondo_negro"> </div>';

con_div_alert_ajax = con_div_alert_ajax +'<div style="position:relative; top:195px; left:345px; width:0px; height:0px; z-index:501">';
con_div_alert_ajax = con_div_alert_ajax +'    	<div style="position:absolute; width:328px; height:88px; opacity:0.5;filter:alpha(opacity=50);" >'
con_div_alert_ajax = con_div_alert_ajax + '<b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>  	<div style=" width:328px; height:88px; background-color:#C40000;"></div>';
con_div_alert_ajax = con_div_alert_ajax + '<b class="b4"></b><b class="b3"></b><b class="b2"></b><b class="b1"></b>    </div>'
con_div_alert_ajax = con_div_alert_ajax + '</div>'
con_div_alert_ajax = con_div_alert_ajax + '<div style="position:relative; top:201px; left:351px; width:0px; height:0px; z-index:601">'
con_div_alert_ajax = con_div_alert_ajax + '<div style="position:absolute; width:314px; height:84px;" >'
con_div_alert_ajax = con_div_alert_ajax + '<b class="a1"></b><b class="a2"></b><b class="a3"></b><b class="a4"></b>'
con_div_alert_ajax = con_div_alert_ajax + '<div style=" width:314px; height:74px; background-color:#FFF; background-image:url(../img/back_alert.png); background-repeat:no-repeat;">'
con_div_alert_ajax = con_div_alert_ajax + '<div style="color:#333; font-family:Verdana, Geneva, sans-serif; font-size:11px; padding-left:12px; font-weight:bold; height:60px; text-aling:center; float:left;">'
con_div_alert_ajax = con_div_alert_ajax + '<div style="width:290px; float:left;">' + msj_alert_ajax + "</div>";

con_div_alert_ajax = con_div_alert_ajax + '<div id="boton_alert_ajax" style=" margin-top:35px; width:110px; height:25px; margin-left:90px; color:#FFF; text-align:center; font-family:Verdana, Geneva, sans-serif; font-size:14px; line-height:20px; background-image:url(../img/fondo_boton.png); cursor:default;" onclick="acepta_ajax_alert()"  onmouseover="cambia_imagen();" onmouseout="vuelve_imagen();">';
con_div_alert_ajax = con_div_alert_ajax + tbtn;
con_div_alert_ajax = con_div_alert_ajax + '</div></div></div><b class="a4"></b><b class="a3"></b><b class="a2"></b><b class="a1"></b></div></div>';
	colocar(con_div_alert_ajax);
}


function confirm_ajax(msg,btn){
		document.getElementById('alert_ajax').style.display = ''	
var tbtn1;
var tbtn2;
var msj_alert_ajax;
if(btn == 0){
	tbtn1 = 'Si';
	tbtn2 = 'No';
	}
msj_alert_ajax = msg;
var con_div_alert_ajax;

var Tam = TamVentana();

con_div_alert_ajax = '<div  style="position:fixed; width:' + Tam[0] + 'px; height:' + Tam[1] + 'px; opacity:0.4;filter:alpha(opacity=40); left:0px; top:0px; background-color:#000000; z-index:500" id="fondo_negro"> </div>';

con_div_alert_ajax = con_div_alert_ajax +'<div style="position:relative; top:195px; left:345px; width:0px; height:0px; z-index:501">';
con_div_alert_ajax = con_div_alert_ajax +'    	<div style="position:absolute; width:328px; height:88px; opacity:0.5;filter:alpha(opacity=50);" >'
con_div_alert_ajax = con_div_alert_ajax + '<b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>  	<div style=" width:328px; height:88px; background-color:#C40000;"></div>';
con_div_alert_ajax = con_div_alert_ajax + '<b class="b4"></b><b class="b3"></b><b class="b2"></b><b class="b1"></b>    </div>'
con_div_alert_ajax = con_div_alert_ajax + '</div>'
con_div_alert_ajax = con_div_alert_ajax + '<div style="position:relative; top:201px; left:351px; width:0px; height:0px; z-index:601">'
con_div_alert_ajax = con_div_alert_ajax + '<div style="position:absolute; width:314px; height:84px;" >'
con_div_alert_ajax = con_div_alert_ajax + '<b class="a1"></b><b class="a2"></b><b class="a3"></b><b class="a4"></b>'
con_div_alert_ajax = con_div_alert_ajax + '<div style=" width:314px; height:74px; background-color:#FFF; background-image:url(../img/back_alert.png); background-repeat:no-repeat;">'
con_div_alert_ajax = con_div_alert_ajax + '<div style="color:#333; font-family:Verdana, Geneva, sans-serif; font-size:11px; padding-left:12px; font-weight:bold; height:60px; text-aling:center; float:left;">'
con_div_alert_ajax = con_div_alert_ajax + '<div style="width:290px; float:left;">' + msj_alert_ajax + "</div>";

con_div_alert_ajax = con_div_alert_ajax + '<div id="boton_alert_ajax1" style=" margin-top:20px; width:110px; height:25px; margin-left:14px; float:left; color:#FFF; text-align:center; font-family:Verdana, Geneva, sans-serif; font-size:14px; line-height:20px; background-image:url(../img/fondo_boton.png); cursor:default;" onclick="op1_ajax_alert()"  onmouseover="cambia_imagen_con(1);" onmouseout="vuelve_imagen_con(1);">';
con_div_alert_ajax = con_div_alert_ajax + tbtn1;
con_div_alert_ajax = con_div_alert_ajax + '</div>'

con_div_alert_ajax = con_div_alert_ajax + '<div id="boton_alert_ajax2" style=" margin-top:20px; width:110px; height:25px; margin-left:34px; float:left; color:#FFF; text-align:center; font-family:Verdana, Geneva, sans-serif; font-size:14px; line-height:20px; background-image:url(../img/fondo_boton.png); cursor:default;" onclick="op2_ajax_alert()"  onmouseover="cambia_imagen_con(2);" onmouseout="vuelve_imagen_con(2);">';
con_div_alert_ajax = con_div_alert_ajax + tbtn2;
con_div_alert_ajax = con_div_alert_ajax + '</div>'

con_div_alert_ajax = con_div_alert_ajax + '</div></div><b class="a4"></b><b class="a3"></b><b class="a2"></b><b class="a1"></b></div></div>';
	colocar(con_div_alert_ajax);
}



function colocar(con_div_alert_ajax){
var elemento =	$('alert_ajax');
	var efecto_fade = Fx.Tween(elemento);
	elemento.set('opacity',0.0);
	document.getElementById('alert_ajax').innerHTML = con_div_alert_ajax;
	elemento.fade(1.0);
}

function captura_screen_alto(){
var altura;	
//if (document.all) {
altura = document.body.clientHeight;
//}
//else {
//altura = window.innerHeight 
//}	
	
	return altura;
}

function captura_screen_ancho(){
var ancho;	
//if (document.all) {
ancho = document.body.clientWidth;
//}
//else {
//ancho = window.innerWidth
//}	
return ancho;
}

function acepta_ajax_alert(){
//		document.getElementById('alert_ajax').innerHTML = '';
//		document.getElementById('alert_ajax').style.height = 0;
var elemento =	$('alert_ajax');
	var efecto_fade = Fx.Tween(elemento);
	elemento.fade(0.0);
	setTimeout("saca_completamente()",1000); 	
		
	}
function saca_completamente(){
	document.getElementById('alert_ajax').style.display = 'none'
	}
function cambia_imagen(){
//	boton.style.backgroundImage = 'ur(../../img/fondo_boton.png)'; 
	document.getElementById('boton_alert_ajax').style.backgroundImage = 'url(../../img/fondo_boton_hover.png)'
	}
function vuelve_imagen(){
	document.getElementById('boton_alert_ajax').style.backgroundImage = 'url(../../img/fondo_boton.png)'
	}	


function TamVentana() {
  var Tamanyo = [0, 0];
  if (typeof window.innerWidth != 'undefined')
  {
	Tamanyo = [
		window.innerWidth,
        window.innerHeight
    ];
  }
  else if (typeof document.documentElement != 'undefined'
      && typeof document.documentElement.clientWidth !=
      'undefined' && document.documentElement.clientWidth != 0)
  {
	Tamanyo = [
        document.documentElement.clientWidth,
        document.documentElement.clientHeight
    ];
  }
  else   {
		Tamanyo = [
        document.getElementsByTagName('body')[0].clientWidth,
        document.getElementsByTagName('body')[0].clientHeight
    ];
  }
	return Tamanyo;
  
}

function cambia_imagen_con(id_que_boton){
//	boton.style.backgroundImage = 'ur(../../img/fondo_boton.png)'; 
	document.getElementById('boton_alert_ajax'+id_que_boton).style.backgroundImage = 'url(../../img/fondo_boton_hover.png)'
	}
function vuelve_imagen_con(id_que_boton){
	document.getElementById('boton_alert_ajax'+id_que_boton).style.backgroundImage = 'url(../../img/fondo_boton.png)'
	}	
	
function op1_ajax_alert(){
//		document.getElementById('alert_ajax').innerHTML = '';
//		document.getElementById('alert_ajax').style.height = 0;
var elemento =	$('alert_ajax');
	var efecto_fade = Fx.Tween(elemento);
	elemento.fade(0.0);
	setTimeout("saca_completamente()",1000); 	
	respuesta(1);

	}
function op2_ajax_alert(){
//		document.getElementById('alert_ajax').innerHTML = '';
//		document.getElementById('alert_ajax').style.height = 0;
var elemento =	$('alert_ajax');
	var efecto_fade = Fx.Tween(elemento);
	elemento.fade(0.0);
	setTimeout("saca_completamente()",1000); 	
	respuesta(2);

	}
