// JavaScript Documento index
var blankImg='img_script/branco.gif';
var WindowOnLoad=function(){
	libleolar.variaveis.javaboyLibREst=true;
	libleolar.variaveis.loadImages = [
				   {compl:true,src:"border_down.png",c:0},
				   {compl:true,src:"border_left.png",c:1},
				   {compl:true,src:"border_left_down.png",c:2},
				   {compl:true,src:"border_left_top.png",c:3},
				   {compl:true,src:"border_right.png",c:4},
				   {compl:true,src:"border_right_down.png",c:5},
				   {compl:true,src:"border_right_top.png",c:6},
				   {compl:true,src:"border_top.png",c:7},
				   {compl:true,src:"notificar.png",c:8},
				   {compl:true,src:"load.gif",c:9},
				   {compl:true,src:"question.gif",c:10},
				   {compl:true,src:"sucess.png",c:11},
				   {compl:true,src:"closelabel.gif",c:12},
				   {compl:true,src:"btnSim.png",c:16},
				   {compl:true,src:"btnNao.png",c:17},
				   {compl:true,src:"process.png",c:18},
				   {compl:true,src:"information.gif",c:18},
				   {compl:true,src:"btn_img_left.png",c:19},
				   {compl:true,src:"btn_img_right.png",c:20},
				   {pathImagem:'img_script/',c:37}
				   ];
	libleolar.__construct();	
	libleolar.funcoes.slideImagemFx();
	if (document.getElementById('boonusPosit')!=null){
		document.getElementById('boonusPosit').style.top =  (libleolar.funcoes.getPosXYElement('positionFileBoonusReferenc').t+40)+'px';
		document.getElementById('boonusPosit').style.left = (libleolar.funcoes.getPosXYElement('positionFileBoonusReferenc').l-62)+'px';
		document.getElementById('boonusPosit').style.display = '';
	}
	try{
	swfobject.embedSWF("libvideo/video_flashvars.swf", "flashcontent", 300, 240, "9.0.0", true, flashvars, params, attributes);
	}catch(es){}
};window.onload=WindowOnLoad;
var libVideo = {
	loadVideoOpen:function(titulo1,titulo2,descricao,url,WinName,linkVideo,GifHomeVide,widthSt,heightSt,autoStart,Config){
		conteudoDefined=(arguments[11]!=undefined?arguments[11]:null);
		var janela=null;
		janela = window.open(url,WinName,Config);
		if (janela){
			janela.document.write('<html><head><title>'+titulo1+'</title>');
			janela.document.write('<style type="text/css">');
			janela.document.write('html{ cursor: default; background-color:#e8e8e8; }');
			janela.document.write('body{ margin:0px; padding:0px; height:100%; }');
			janela.document.write('span.sep{ font-size:16px; }');
			janela.document.write('a.links{ color:#000000; text-decoration:none; }');
			janela.document.write('a.links:hover{ color:#ffffff; background-color: #000000; }');
			janela.document.write('#flashcontent {');
			janela.document.write('	display: block;');
			janela.document.write('	margin-left: auto;');
			janela.document.write('	margin-right: auto;');
			janela.document.write('}');
			janela.document.write('span.feathead{');
			janela.document.write('	font-size: 13px; font-family: Tahoma;');
			janela.document.write('}');
			janela.document.write('span.featbody{');
			janela.document.write('    font-size: 13px; color: #444444; font-family: Tahoma;');
			janela.document.write('}');
			janela.document.write('ul { list-style: square }');
			janela.document.write('</style>');
			/*janela.document.write('<script type="text/javascript" src="video/js/ajax/ajax.js"></script>');
			janela.document.write('<script type="text/javascript" src="video/js/swfobject/swfobject.js"></script>');
			janela.document.write('<script type="text/javascript">');
			janela.document.write('var stageW = '+widthSt+';');
			janela.document.write('var stageH = '+heightSt+';');
			janela.document.write('var flashvars = {};');
			janela.document.write('var params = {};');
			janela.document.write('flashvars.videoPath = "'+linkVideo+'";');
			janela.document.write('flashvars.imagePath = "'+GifHomeVide+'";');
			janela.document.write('flashvars.skinPath = "video/skin/boee_vp_skin.swf";');
			janela.document.write('params.bgcolor = "#000000";');
			janela.document.write('flashvars.autoStartVideo = "false";');
			janela.document.write('flashvars.autoHideControlPanel = "true";');
			janela.document.write('flashvars.autoHideControlPanelTime = "2";');
			janela.document.write('flashvars.autoHideMouse = "true";');
			janela.document.write('flashvars.autoHideMouseTime = "2";');
			janela.document.write('flashvars.logoPath = "video/logo.swf";');
			janela.document.write('flashvars.logoPos = "tr";');
			janela.document.write('flashvars.videoTitle = "'+titulo2+'";');
			janela.document.write('flashvars.videoDescription = "'+descricao+'";');
			janela.document.write('flashvars.videoBufferTime = "5";');
			janela.document.write('flashvars.scaleMode = "aspect";');
			janela.document.write('flashvars.startVolume = "0.6";');
			janela.document.write('flashvars.showTime = "true";');
			janela.document.write('flashvars.timeColor = "0xffffff";');
			janela.document.write('flashvars.lineColor = "0xffffff";');
			janela.document.write('flashvars.volumeLineColor = "0xffffff";');
			janela.document.write('flashvars.showInfoButton = "true";');
			janela.document.write('flashvars.showVolumeButton = "true";');
			janela.document.write('flashvars.showScaleModeButton = "true";');
			janela.document.write('flashvars.showFullScreenButton = "true";');
			janela.document.write('params.allowfullscreen = "true";');
			janela.document.write('params.allowscriptaccess = "always";');
			janela.document.write('var attributes = {};');
			janela.document.write('attributes.id = "flashcontent";');
			janela.document.write('function onBodyLoaded(){swfobject.embedSWF("video/preview.swf", "flashcontent", stageW, stageH, "9.0.0", false, flashvars, params, attributes); }');
			janela.document.write('</script>');*/
			janela.document.write('</head><body>');
			janela.document.write('<table width="100%" height="100%"><tr><td valign="middle" align="center"><div id="MenuDiv"></div><div id="flashcontent"><img src="img_script/load.gif" align="absmiddle"> Carregando Video....</div><br><br><br></td></tr></table>');
			janela.document.write('</body></html>');
			janela.document.close();
			setTimeout(function(){
				//janela.onBodyLoaded();	
			},2000);
		}
		
		/*var janelaVideo = window.open(url,WinName,Config);
		janelaVideo.document.open();
		setTimeout(function(){
		if (conteudoDefined==null){
			janelaVideo.document.write('<html><head><title>'+titulo1+'</title>');
			janelaVideo.document.write('<style type=\'text/css\'>');
			janelaVideo.document.write('html{ cursor: default; background-color:#e8e8e8; }');
			janelaVideo.document.write('body{ margin:0px; padding:0px; height:100%; }');
			janelaVideo.document.write('span.sep{ font-size:16px; }');
			janelaVideo.document.write('a.links{ color:#000000; text-decoration:none; }');
			janelaVideo.document.write('a.links:hover{ color:#ffffff; background-color: #000000; }');
			janelaVideo.document.write('#flashcontent {');
			janelaVideo.document.write('	display: block;');
			janelaVideo.document.write('	margin-left: auto;');
			janelaVideo.document.write('	margin-right: auto;');
			janelaVideo.document.write('}');
			janelaVideo.document.write('span.feathead{');
			janelaVideo.document.write('	font-size: 13px; font-family: Tahoma;');
			janelaVideo.document.write('}');
			janelaVideo.document.write('span.featbody{');
			janelaVideo.document.write('    font-size: 13px; color: #444444; font-family: Tahoma;');
			janelaVideo.document.write('}');
			janelaVideo.document.write('ul { list-style: square }');
			janelaVideo.document.write('</style>');
			janelaVideo.document.write('<script type="text/javascript" src="video/js/ajax/ajax.js"></script>');
			janelaVideo.document.write('<script type="text/javascript" src="video/js/swfobject/swfobject.js"></script>');
			janelaVideo.document.write('<script type="text/javascript">');
			janelaVideo.document.write('var stageW = '+widthSt+';');
			janelaVideo.document.write('var stageH = '+heightSt+';');
			janelaVideo.document.write('var flashvars = {};');
			janelaVideo.document.write('var params = {};');
			janelaVideo.document.write('flashvars.videoPath = "'+linkVideo+'";');
			janelaVideo.document.write('flashvars.imagePath = "'+GifHomeVide+'";');
			janelaVideo.document.write('flashvars.skinPath = "video/skin/boee_vp_skin.swf";');
			janelaVideo.document.write('params.bgcolor = "#000000";');
			janelaVideo.document.write('flashvars.autoStartVideo = "false";');
			janelaVideo.document.write('flashvars.autoHideControlPanel = "true";');
			janelaVideo.document.write('flashvars.autoHideControlPanelTime = "2";');
			janelaVideo.document.write('flashvars.autoHideMouse = "true";');
			janelaVideo.document.write('flashvars.autoHideMouseTime = "2";');
			janelaVideo.document.write('flashvars.logoPath = "video/logo.swf";');
			janelaVideo.document.write('flashvars.logoPos = "tr";');
			janelaVideo.document.write('flashvars.videoTitle = "'+titulo2+'";');
			janelaVideo.document.write('flashvars.videoDescription = "'+descricao+'";');
			janelaVideo.document.write('flashvars.videoBufferTime = "5";');
			janelaVideo.document.write('flashvars.scaleMode = "aspect";');
			janelaVideo.document.write('flashvars.startVolume = "0.6";');
			janelaVideo.document.write('flashvars.showTime = "true";');
			janelaVideo.document.write('flashvars.timeColor = "0xffffff";');
			janelaVideo.document.write('flashvars.lineColor = "0xffffff";');
			janelaVideo.document.write('flashvars.volumeLineColor = "0xffffff";');
			janelaVideo.document.write('flashvars.showInfoButton = "true";');
			janelaVideo.document.write('flashvars.showVolumeButton = "true";');
			janelaVideo.document.write('flashvars.showScaleModeButton = "true";');
			janelaVideo.document.write('flashvars.showFullScreenButton = "true";');
			janelaVideo.document.write('params.allowfullscreen = "true";');
			janelaVideo.document.write('params.allowscriptaccess = "always";');
			janelaVideo.document.write('var attributes = {};');
			janelaVideo.document.write('attributes.id = "flashcontent";');
			janelaVideo.document.write('function onBodyLoaded(){');
			janelaVideo.document.write('	swfobject.embedSWF("video/preview.swf", "flashcontent", stageW, stageH, "9.0.0", false, flashvars, params, attributes);');
			janelaVideo.document.write('}');
			janelaVideo.document.write('</script></head><body onload="onBodyLoaded();"><div id="MenuDiv"></div><div id="flashcontent"></div><br><br><br></body></html>');
		}else{
			janelaVideo.document.write('<html><head><title>'+titulo1+'</title>');
			janelaVideo.document.write('<style type=\'text/css\'>');
			janelaVideo.document.write('html{ cursor: default; background-color:#e8e8e8; }');
			janelaVideo.document.write('body{ margin:0px; padding:0px; height:100%; }');
			janelaVideo.document.write('</style>');
			janelaVideo.document.write('</head><body>');
			janelaVideo.document.write(conteudoDefined);
			janelaVideo.document.write('</body></html>');
		}
		janelaVideo.document.close();},50);*/
	}
}
function insert_text(id,texto){
	var textarea = document.getElementById(id);
	var sel_start = textarea.selectionStart;
	var sel_end   = textarea.selectionEnd;
	if (!isNaN(textarea.selectionStart)){
		var sel_start = textarea.selectionStart;  
        var sel_end = textarea.selectionEnd;  
        mozWrap(textarea, texto, '')  
        textarea.selectionStart = sel_start + texto.length;  
		textarea.selectionEnd = sel_end + texto.length;  	
	}else if (textarea.createTextRange && textarea.caretPos){  
		if (baseHeight != textarea.caretPos.boundingHeight){  
			textarea.focus();  
			storeCaret(textarea);  
		}        
		var caret_pos = textarea.caretPos;  
		caret_pos.text = caret_pos.texto.charAt(caret_pos.texto.length - 1) == ' ' ? caret_pos.text + text + ' ' : caret_pos.text + text;  
	}else //Para quem não é possível inserir, inserimos no final mesmo (IE...)  
	{  
		textarea.value = textarea.value + texto;  
	}
	
}
function mozWrap(txtarea, open, close)  {  
            var selLength = txtarea.textLength;  
            var selStart = txtarea.selectionStart;  
            var selEnd = txtarea.selectionEnd;  
            var scrollTop = txtarea.scrollTop;  
  
            if (selEnd == 1 || selEnd == 2)   
            {  
               selEnd = selLength;  
            }  
            /*S1 tem o texto do começo até a posição do cursor  
			
			<input type="text" id="txtValor" />  
      <input type="button" value="Inserir na posição do cursor" onclick="insereTexto()"/>  
			*/
            var s1 = (txtarea.value).substring(0,selStart);  
              
            //S2 tem o texto selecionado  
            var s2 = (txtarea.value).substring(selStart, selEnd)  
              
            //S3 tem todo o texto selecionado  
            var s3 = (txtarea.value).substring(selEnd, selLength);  
              
            //COloca o texto na textarea. Utiliza a string que estava no início, no meio a string de entrada, depois a seleção seguida da string  
            //de fechamento e por fim o que sobrou após a seleção  
            txtarea.value = s1 + open + s2 + close + s3;           
            txtarea.selectionStart = selEnd + open.length + close.length;  
            txtarea.selectionEnd = txtarea.selectionStart;  
            txtarea.focus();  
            txtarea.scrollTop = scrollTop;  
            return;  
         }  
         /* 
         Insert at Caret position. Code from 
          [url]http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130[/url] 
         */  
         function storeCaret(textEl)  
         {  
               if (textEl.createTextRange)  
               {  
                  textEl.caretPos = document.selection.createRange().duplicate();  
               }  
         }
