	function modAjax()
    {
    	var ajax;
    	try
      	{
        	ajax = new ActiveXObject("Microsoft.XMLHTTP");
	     	return ajax;
      	}
      	catch(e)
      	{
        	try
	     	{
	        	ajax = new ActiveXObject("Msxml2.XMLHTTP");
		    	return ajax;
	     	}
	     	catch(ex)
	     	{
	        	try
		    	{
		       		ajax = new XMLHttpRequest();
			   		return ajax;
		    	}
		    	catch(exc)
		    	{
		       		//alert("Este browser nï¿½o recursos para o uso do ajax");
			   		ajax = null;
			   		return ajax;
		    	}
	     	}
      	}
   	}

	var contimgGd = new Array(2);

    function xmlCarregaVideo(id, tempo)
   	{ 
	
   		var ajax = modAjax();
		var conteudo = document.getElementById('totalVideo');
			conteudo.innerHTML = '';
		
	  	ajax.open("GET", "http://www.sambabusiness.com.br/sambabiz/xml/videos.xml" , true);
		
	  	ajax.onreadystatechange = function()
	  	{
			if(ajax.readyState == 4)
		 	{
				if(ajax.status == 200)
            	{
					var arquivoXML = ajax.responseXML;
					
					var tagvideo = arquivoXML.getElementsByTagName("video").item(id);
					var convideo = tagvideo.firstChild.data;
					var tagtitulo = arquivoXML.getElementsByTagName("titulo").item(id);
					var conttitulo = tagtitulo.firstChild.data;
					var tagtexto = arquivoXML.getElementsByTagName("texto").item(id);
					var conttexto = tagtexto.firstChild.data;
					/*var tagLink = arquivoXML.getElementsByTagName("link").item(id);
					var conLink = tagLink.firstChild.data;*/
	
					
					function carregaDados()
					{
						var titulo = document.createElement('h2');
							titulo.setAttribute('id','tituloPopup');
							titulo.appendChild(document.createTextNode(conttitulo))
						
						var videoGd = document.createElement('div');
							videoGd.setAttribute('id','imgGdPopup');
						
						var texto = document.createElement('p');
							texto.setAttribute((document.all ? 'className' : 'class'), 'txtAzul');
							texto.appendChild(document.createTextNode(conttexto))
												
						conteudo.appendChild(titulo);
						conteudo.appendChild(videoGd);
						conteudo.appendChild(texto);
						
						if (convideo == 'AssineSamba')
						{
							var txtRodape = document.createElement('span');
							txtRodape.setAttribute((document.all ? 'className' : 'class'), 'txtAzul rodapeVideo');
							txtRodape.appendChild(document.createTextNode('O aparecimento do seu website em mecanismos de busca como o Google® demoram alguns dias até o seu website ser indexado.'));
							conteudo.appendChild(txtRodape);
						}
						
						
						$("#video").show();
						carregaVideo(convideo);
						
					}

					if (tempo == 'undefined' || tempo == null || tempo == '')
					{
						carregaDados();
					}
					else
					{
						var timer = tempo + 3000;
						//alert(timer);
						setTimeout(carregaDados, (document.all)  ? timer : tempo);
					}
				}   
		 	}
	  	}
	  	ajax.send(null);
   	}
	
	function carregaVideo(video)
	{
		document.getElementById('loadingGif').innerHTML = '<object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="22" height="22"><param name="movie" value="/sambabiz/images/loading.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="swfversion" value="6.0.65.0" /><!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. --><param name="expressinstall" value="/sambabiz/js/expressInstall.swf" /><!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. --><!--[if !IE]>--><object type="application/x-shockwave-flash" data="/sambabiz/images/loading.swf" width="22" height="22"><!--<![endif]--><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="swfversion" value="6.0.65.0" /><param name="expressinstall" value="/sambabiz/js/expressInstall.swf" /><!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. --><div><h4>Content on this page requires a newer version of Adobe Flash Player.</h4><p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p></div><!--[if !IE]>--></object><!--<![endif]--></object>';
		
		
		document.getElementById('imgGdPopup').innerHTML = '<object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="502" height="279" style="visibility:visible"><param name="movie" value="/sambabiz/videos/'+video+'.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="swfversion" value="6.0.65.0" /><!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. --><param name="expressinstall" value="/sambabiz/js/expressInstall.swf" /><!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. --><!--[if !IE]>--><object type="application/x-shockwave-flash" data="/sambabiz/videos/'+video+'.swf" width="502" height="279"><!--<![endif]--><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="swfversion" value="6.0.65.0" /><param name="expressinstall" value="/sambabiz/js/expressInstall.swf" /><!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. --><div style="text-align:center;">Para Visualizar corretamente o conteúdo desta página,<br> instale o Adobe&reg; Flash Player<br><br><br><a href="http://www.adobe.com/go/getflashplayer" style="margin:0; display:inline"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Instalar Adobe Flash player" width="112" height="33" /></a></div><!--[if !IE]>--></object><!--<![endif]--></object>';
	}
	
	function limpaVideo()
	{
		fadeOutSamba('video', 0.1);
		hideSamba('video', 'n', 1700);
		hideSamba('divFundoGeral', 'n', 1700);
		htmlSamba('totalVideo', '', 1200)
		htmlSamba('loadingGif', '')
	}
