/*
 *
 * GoldenAlerta
 * Desenvolvedor: Fernando Arroyo
 * GoldenLight [ fernando.arroyo@goldenlight.biz ]
 * 06.08.2009
 *
 */

	var GoldenAlerta=function(Parametros){
		
		/*
		 * Parametros - GoldenAlerta
		 * 
		 * Confirmado - Fun��o
		 * Confirma��o - Texto Confirma��o
		 * Mensagem - Texto 
		 * 
		 */
		
		this.Executar=function(){

			GoldenAlertaTelaFundo		=document.createElement("div");
			GoldenAlertaTelaConfirmacao	=document.createElement("div");
			GoldenAlertaMensagem		=document.createElement("div");
			GoldenAlertaLinkConfirmacao	=document.createElement("a");
			GoldenAlertaConfirmacao		=document.createElement("span");
			GoldenAlertaBotoes			=document.createElement("div");
			
			GoldenAlertaTelaFundo.setAttribute("id","__GoldenAlertaTelaFundo__");
			GoldenAlertaTelaFundo.style.zIndex="9999";
			GoldenAlertaTelaFundo.style.display="block";
			GoldenAlertaTelaFundo.style.position="fixed";
			GoldenAlertaTelaFundo.style.top="0px";
			GoldenAlertaTelaFundo.style.left="0px";
			GoldenAlertaTelaFundo.style.backgroundColor="#000000";
			GoldenAlertaTelaFundo.style.opacity="0.5";
			GoldenAlertaTelaFundo.style.filter="alpha(opacity=50)";
			GoldenAlertaTelaFundo.style.width=document.body.clientWidth+"px";
			GoldenAlertaTelaFundo.style.height=document.body.clientHeight+"px";
			document.body.appendChild(GoldenAlertaTelaFundo);

            GoldenAlertaMensagem.id="__GoldenAlertaMensagem__";
			GoldenAlertaMensagem.innerHTML=Parametros.Mensagem;
			GoldenAlertaConfirmacao.innerHTML=Parametros.Confirmacao;
			GoldenAlertaLinkConfirmacao.appendChild(GoldenAlertaConfirmacao);
			GoldenAlertaLinkConfirmacao.setAttribute("href","javascript:void(0);");

			GoldenAlertaLinkConfirmacao.onclick = function(){
				Parametros.Confirmado();
				if (document.getElementById("__GoldenAlerta__")) {
					$('#__GoldenAlerta__').animate({
						 left:(-(screen.width))
					}
					,600
					,"swing"
					,function(){
						$('#__GoldenAlertaTelaFundo__').remove();
						$('#__GoldenAlerta__').remove();
					})
				}
			};

			GoldenAlertaLinkConfirmacao.style.color="#000000";
			GoldenAlertaLinkConfirmacao.style.fontWeight="bolder";
			GoldenAlertaLinkConfirmacao.style.textDecoration="none";
			GoldenAlertaBotoes.appendChild(GoldenAlertaLinkConfirmacao);
			with(GoldenAlertaConfirmacao.style){
				display="inline-block";
				position="relative";
				marginTop="10px";
				border="1px solid #d8d8d8";
				marginLeft="10px";
				paddingLeft="5px"
				paddingRight="5px"
			}
			with(GoldenAlertaBotoes.style){
				display="block";
				position="relative";
				float = "right";
				marginTop="10px";
				marginLeft="330px";
				padding="10px";
				fontSize="12px";
 			}
            GoldenAlertaBotoes.id="__GoldenAlertaBotao__";
			with(GoldenAlertaTelaConfirmacao){
				id="__GoldenAlerta__";
				style.zIndex=999999;
				style.display="block";
				style.position="fixed";
				style.top=((screen.height-300)/2)+"px";
				style.left=((screen.width)*2)+"px";
				style.width="400px";
//				style.height="66px";
				style.fontFamily="Verdana";
				style.backgroundImage= "url("+window["CaminhoRaiz"]+"/images/popFundo_enviada.gif)";
				style.border= "1px solid #d8d8d8";
				appendChild(GoldenAlertaMensagem);
				appendChild(GoldenAlertaBotoes);
			}
			with(GoldenAlertaMensagem.style){
				position="relative";
				float="left";
				padding="10px";
				fontSize="12px";
			}
			document.body.appendChild(GoldenAlertaTelaConfirmacao);
			GoldenAlertaLinkConfirmacao.focus();
			$('#__GoldenAlerta__').animate({
				 left:((screen.width-400)/2)
			}
			,600
			,"swing"
			,function(){
			})
		}
		if ( (!document.getElementById("__GoldenAlerta__")) ) {
			this.Executar();
		}
		document.getElementById("__GoldenAlertaTelaFundo__").onmousedown=function(){
			if (document.getElementById("__GoldenAlerta__")) {
				$('#__GoldenAlerta__').animate({
					 left:(-(screen.width))
				}
				,600
				,"swing"
				,function(){
					$('#__GoldenAlertaTelaFundo__').remove();
					$('#__GoldenAlerta__').remove();
				})
			}
		}
	}