var codProduto = "21433713";

/*URL = "xml/"+codProduto+".xml"*/
URL = "http://www.submarino.com.br/skins/produto/xml/"+codProduto+".xml"


	var xmlDoc=null; 
	if (window.ActiveXObject){
		xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.async = false;  		
	}
	else if (document.implementation.createDocument){
		xmlDoc=document.implementation.createDocument("","",null);
		xmlDoc.async = true;  		
	}
	else
	{
		alert('Seu browser no suporta esse script');
	}
	if (xmlDoc!=null)
	{		
		xmlDoc.load(URL);
		if (window.ActiveXObject) {
			xml = xmlDoc.getElementsByTagName("produtos");
			build()
		}
		else {
			xmlDoc.onload = function (evt) {
				xml = xmlDoc.getElementsByTagName("produtos");
				build()				
			}
		}	
	}	

function build() {
	
	// div geral
	var target = document.getElementById("content_external"); 
	
			// linha pontilhada
			var div_linepontilhado = document.createElement("div");
				div_linepontilhado.setAttribute("id", "linepontilhado");
			var espaco_linepontilhado = document.createTextNode("");
			div_linepontilhado.appendChild(espaco_linepontilhado); 
	
		// div com todos os conteudos
		var div_conteudoInfoReviews = document.createElement("div");
			div_conteudoInfoReviews.setAttribute("id", "conteudoInfoReviews");
		var espaco_div_conteudoInfoReviews = document.createTextNode("");
		div_conteudoInfoReviews.appendChild(espaco_div_conteudoInfoReviews); 

		// div com video e fotos
		var div_blockInfoReviews = document.createElement("div");
			div_blockInfoReviews.setAttribute("id", "blockInfoReviews");
		var div_productInfo_a = document.createTextNode("");		
		div_blockInfoReviews.appendChild(div_productInfo_a);
	
		// div com fotosInfoReviews
		var div_fotosInfoReviews = document.createElement("div");
			div_fotosInfoReviews.setAttribute("id", "fotosInfoReviews");
		
			div_blockInfoReviews.appendChild(div_fotosInfoReviews);	
			div_conteudoInfoReviews.appendChild(div_blockInfoReviews);			
		
		
// *************************************************************************************************************************
		
		var div_ol_fotos = document.createElement("ol");
		var div_a_fotos = document.createElement("a");
			div_a_fotos.setAttribute("href", "/#light_Content");
			div_a_fotos.setAttribute("class", "lightwindow");
			div_a_fotos.setAttribute("rev", "lightwindow_width=480,lightwindow_height=450");
		div_ol_fotos.appendChild(div_a_fotos);		
		var div_img_fotos = document.createElement("img");
			div_img_fotos.setAttribute("src", xml[0].getElementsByTagName("fotoP1")[0].childNodes[0].nodeValue);
			div_img_fotos.setAttribute("height", "100");
			div_img_fotos.setAttribute("width", "120");
			div_a_fotos.appendChild(div_img_fotos);
			
			
		var div_ol_fotos2 = document.createElement("ol");
		var div_a_fotos2 = document.createElement("a");
			div_a_fotos2.setAttribute("href", "/#light_Content2");
			div_a_fotos2.setAttribute("class", "lightwindow");
			div_a_fotos2.setAttribute("rev", "lightwindow_width=480,lightwindow_height=500");
		div_ol_fotos2.appendChild(div_a_fotos2);		
		var div_img_fotos2 = document.createElement("img");
			div_img_fotos2.setAttribute("src", xml[0].getElementsByTagName("fotoP2")[0].childNodes[0].nodeValue);
			div_img_fotos2.setAttribute("height", "100");
			div_img_fotos2.setAttribute("width", "120");
			div_a_fotos2.appendChild(div_img_fotos2);
			
			
		var div_ol_fotos3 = document.createElement("ol");
		var div_a_fotos3 = document.createElement("a");
			div_a_fotos3.setAttribute("href", "/#light_Content3");
			div_a_fotos3.setAttribute("class", "lightwindow");
			div_a_fotos3.setAttribute("rev", "lightwindow_width=480,lightwindow_height=450");
		div_ol_fotos3.appendChild(div_a_fotos3);		
		var div_img_fotos3 = document.createElement("img");
			div_img_fotos3.setAttribute("height", "100");
			div_img_fotos3.setAttribute("width", "120");
			div_img_fotos3.setAttribute("src", xml[0].getElementsByTagName("fotoP3")[0].childNodes[0].nodeValue);
			div_a_fotos3.appendChild(div_img_fotos3);
			
			
		var div_ol_fotos4 = document.createElement("ol");
		var div_a_fotos4 = document.createElement("a");
			div_a_fotos4.setAttribute("href", "/#light_Content4");
			div_a_fotos4.setAttribute("class", "lightwindow");
			div_a_fotos4.setAttribute("rev", "lightwindow_width=480,lightwindow_height=450");
		div_ol_fotos4.appendChild(div_a_fotos4);		
		var div_img_fotos4 = document.createElement("img");
			div_img_fotos4.setAttribute("height", "100");
			div_img_fotos4.setAttribute("width", "120");
			div_img_fotos4.setAttribute("src", xml[0].getElementsByTagName("fotoP4")[0].childNodes[0].nodeValue);
			div_a_fotos4.appendChild(div_img_fotos4);
			
			
		var div_ol_fotos5 = document.createElement("ol");
		div_ol_fotos5.setAttribute("id", "text");
		var a_foto5 = document.createElement("a");
			a_foto5.setAttribute("href", "/#light_Content");
			a_foto5.setAttribute("class", "lightwindow");
			a_foto5.setAttribute("rev", "lightwindow_width=480,lightwindow_height=450");
		var text_a5 = document.createTextNode("Clique na imagem para ampliar");
		a_foto5.appendChild(text_a5); 
		// div com fotos contem > ol
		div_ol_fotos5.appendChild(a_foto5);
			
			div_fotosInfoReviews.appendChild(div_ol_fotos);
			div_fotosInfoReviews.appendChild(div_ol_fotos2);
			div_fotosInfoReviews.appendChild(div_ol_fotos3);
			div_fotosInfoReviews.appendChild(div_ol_fotos4);
			div_fotosInfoReviews.appendChild(div_ol_fotos5);
		

// *************************************************************************************************************************

		var div_tituloDir = document.createElement("div");
			div_tituloDir.setAttribute("id", "tituloDir");
		
		var a_tituloDir = document.createElement("a");
			a_tituloDir.setAttribute("href", xml[0].getElementsByTagName("linklogoInfo")[0].childNodes[0].nodeValue);
			a_tituloDir.setAttribute("target", "blank");		
		var div_tituloDir_a_img = document.createElement("img");
		div_tituloDir_a_img.setAttribute("src", "http://img.submarino.com.br/skins/produto/img/logo_info_reviews.gif");
		div_tituloDir_a_img.setAttribute("border", "0");		
		div_tituloDir_a_img.setAttribute("alt", "logoInfo");		
		
		a_tituloDir.appendChild(div_tituloDir_a_img);		
		div_tituloDir.appendChild(a_tituloDir); 
		
		
		// T tulo, subttulo esquerda
		var div_tituloEsq = document.createElement("div");
			div_tituloEsq.setAttribute("id", "tituloEsq");
		var div_tituloEsq_span = document.createElement("span");
		var text_span = document.createTextNode(xml[0].getElementsByTagName("tituloInfo")[0].childNodes[0].nodeValue);
		var br = document.createElement("br");
		var text_div_tituloEsq = document.createTextNode(xml[0].getElementsByTagName("subtituloInfo")[0].childNodes[0].nodeValue);
		div_tituloEsq.appendChild(div_tituloEsq_span);
		div_tituloEsq_span.appendChild(text_span);
		div_tituloEsq.appendChild(br);
		div_tituloEsq.appendChild(text_div_tituloEsq);
		
		
		// Primeiro tabela
		var div_tabInfoReviews1 = document.createElement("div");
			div_tabInfoReviews1.setAttribute("id", "tabInfoReviews1");
		
		var div_bordaEsqInfo = document.createElement("div");
			div_bordaEsqInfo.setAttribute("id", "bordaEsqInfo");
		
		var div_avaliacaoInfo = document.createElement("div");
			div_avaliacaoInfo.setAttribute("id", "avaliacaoInfo");
		var div_avaliacaoInfo_span = document.createElement("span");
		var text_span = document.createTextNode(xml[0].getElementsByTagName("avaliacao")[0].childNodes[0].nodeValue);
		var text_div_avaliacaoInfo = document.createTextNode("");
		
		var div_bordaDirInfo = document.createElement("div");
			div_bordaDirInfo.setAttribute("id", "bordaDirInfo");
		
		div_tabInfoReviews1.appendChild(div_bordaEsqInfo);
		div_bordaEsqInfo.appendChild(div_avaliacaoInfo);
		div_avaliacaoInfo.appendChild(div_avaliacaoInfo_span);
		div_avaliacaoInfo_span.appendChild(text_span);
		div_avaliacaoInfo.appendChild(text_div_avaliacaoInfo);
		div_bordaEsqInfo.appendChild(div_bordaDirInfo);
		
		
		// Segunda tabela
		var div_tabInfoReviews2 = document.createElement("div");
			div_tabInfoReviews2.setAttribute("id", "tabInfoReviews2");		
			var div_bordaBox = document.createElement("div");
				div_bordaBox.setAttribute("id", "bordaBox");
					
					var li_Pros = document.createElement("li");
						li_Pros.setAttribute("id", "esqProContra");		
						var text_li_Pros = document.createTextNode("(+) Pros:");					
					var li_Pros_desc = document.createElement("li");
						li_Pros_desc.setAttribute("id", "dirProContra");
						var text_li_Pros_desc = document.createTextNode(xml[0].getElementsByTagName("pros")[0].childNodes[0].nodeValue);

					var li_Contras = document.createElement("li");
						li_Contras.setAttribute("id", "esqProContra");		
						var text_li_Contras = document.createTextNode("(-) Contras:");
					var li_Contras_desc = document.createElement("li");
						li_Contras_desc.setAttribute("id", "dirProContra");
						var text_li_Contras_desc = document.createTextNode(xml[0].getElementsByTagName("contras")[0].childNodes[0].nodeValue);
					
					var li_Concl = document.createElement("li");
						li_Concl.setAttribute("id", "esqProContra");		
						var text_li_Concl = document.createTextNode("Conclusoes:");
					var li_Concl_desc = document.createElement("li");
						li_Concl_desc.setAttribute("id", "dirProContra");
						var text_li_Concl_desc = document.createTextNode(xml[0].getElementsByTagName("conclusoes")[0].childNodes[0].nodeValue);
						
					div_tabInfoReviews2.appendChild(div_bordaBox);
					
					div_bordaBox.appendChild(li_Pros);
						li_Pros.appendChild(text_li_Pros);
					div_bordaBox.appendChild(li_Pros_desc);
						li_Pros_desc.appendChild(text_li_Pros_desc);
		
		
					div_bordaBox.appendChild(li_Contras);
						li_Contras.appendChild(text_li_Contras);
					div_bordaBox.appendChild(li_Contras_desc);
						li_Contras_desc.appendChild(text_li_Contras_desc);
		
		
					div_bordaBox.appendChild(li_Concl);
						li_Concl.appendChild(text_li_Concl);
					div_bordaBox.appendChild(li_Concl_desc);
						li_Concl_desc.appendChild(text_li_Concl_desc);
		
		
		// textão completo
		var tag_p = document.createElement("p");
		var text_p = document.createTextNode(xml[0].getElementsByTagName("textDescricao")[0].childNodes[0].nodeValue);
		var text_p_a = document.createElement("a");
			text_p_a.setAttribute("href", xml[0].getElementsByTagName("linklogoInfo")[0].childNodes[0].nodeValue);
			text_p_a.setAttribute("target", "blank");		
		var text_p_conf = document.createTextNode(" Confira a resenha completa no site da info reviews...");
		tag_p.appendChild(text_p);
		tag_p.appendChild(text_p_a);
		text_p_a.appendChild(text_p_conf);
		
		
		div_conteudoInfoReviews.appendChild(div_tituloDir);
		div_conteudoInfoReviews.appendChild(div_tituloEsq);
		div_conteudoInfoReviews.appendChild(div_tabInfoReviews1);
		div_conteudoInfoReviews.appendChild(div_tabInfoReviews2);
		div_conteudoInfoReviews.appendChild(tag_p);
		
	
	// div geral contem > linha pontilhada, conteudoInfoReviews
	target.appendChild(div_linepontilhado);
	target.appendChild(div_conteudoInfoReviews);

// *************************************************************************************************************************

			var div_1 = document.createElement("div");
				div_1.setAttribute("id", "light_Content");
				div_1.setAttribute("style", "display:none;");
			var div_titulo = document.createElement("div");
				div_titulo.setAttribute("style", "font-size:14px; font-weight:bold; height:30px; color:#81BD02;");
				div_titulo.setAttribute("align", "center");
			var text_titulo = document.createTextNode(xml[0].getElementsByTagName("tituloInfo")[0].childNodes[0].nodeValue);
			var div_img_vert = document.createElement("div");
				div_img_vert.setAttribute("align", "center");
				div_img_vert.setAttribute("id", "infoVert");
			var div_img = document.createElement("img");
				div_img.setAttribute("src",xml[0].getElementsByTagName("fotoG1")[0].childNodes[0].nodeValue);
				
				
				div_1.appendChild(div_titulo);
				div_1.appendChild(div_img_vert);
				div_titulo.appendChild(text_titulo);
				div_img_vert.appendChild(div_img);
		
			
			var div_2 = document.createElement("div");
				div_2.setAttribute("id", "light_Content2");
				div_2.setAttribute("style", "display:none;");
			var div_titulo = document.createElement("div");
				div_titulo.setAttribute("style", "font-size:14px; font-weight:bold; height:30px; color:#81BD02;");
				div_titulo.setAttribute("align", "center");
			var text_titulo = document.createTextNode(xml[0].getElementsByTagName("tituloInfo")[0].childNodes[0].nodeValue);
			var div_img_vert2 = document.createElement("div");
				div_img_vert2.setAttribute("align", "center");
				div_img_vert2.setAttribute("id", "infoVert");
			var div_img2 = document.createElement("img");
				div_img2.setAttribute("src",xml[0].getElementsByTagName("fotoG2")[0].childNodes[0].nodeValue);
				
				
				div_2.appendChild(div_titulo);
				div_2.appendChild(div_img_vert2);
				div_titulo.appendChild(text_titulo);
				div_img_vert2.appendChild(div_img2);
		
	
			var div_3 = document.createElement("div");
				div_3.setAttribute("id", "light_Content3");
				div_3.setAttribute("style", "display:none;");
			var div_titulo = document.createElement("div");
				div_titulo.setAttribute("style", "font-size:14px; font-weight:bold; height:30px; color:#81BD02;");
				div_titulo.setAttribute("align", "center");
			var center = document.createElement("center");
			var text_titulo = document.createTextNode(xml[0].getElementsByTagName("tituloInfo")[0].childNodes[0].nodeValue);
			var div_img_vert3 = document.createElement("div");
				div_img_vert3.setAttribute("align", "center");
				div_img_vert3.setAttribute("id", "infoVert");
			var div_img3 = document.createElement("img");
				div_img3.setAttribute("src",xml[0].getElementsByTagName("fotoG3")[0].childNodes[0].nodeValue);
				
				
				div_3.appendChild(div_titulo);
				div_3.appendChild(div_img_vert3);
				div_titulo.appendChild(text_titulo);
				div_img_vert3.appendChild(div_img3);
		
	
			var div_4 = document.createElement("div");
				div_4.setAttribute("id", "light_Content4");
				div_4.setAttribute("style", "display:none;");
			var div_titulo = document.createElement("div");
				div_titulo.setAttribute("style", "font-size:14px; font-weight:bold; height:30px; color:#81BD02;");
				div_titulo.setAttribute("align", "center");
			var center = document.createElement("center");
			var text_titulo = document.createTextNode(xml[0].getElementsByTagName("tituloInfo")[0].childNodes[0].nodeValue);			
			var div_img_vert4 = document.createElement("div");
				div_img_vert4.setAttribute("align", "center");
				div_img_vert4.setAttribute("id", "infoVert");
			var div_img4 = document.createElement("img");
				div_img4.setAttribute("src",xml[0].getElementsByTagName("fotoG4")[0].childNodes[0].nodeValue);
				
				
				div_4.appendChild(div_titulo);
				div_4.appendChild(div_img_vert4);
				div_titulo.appendChild(text_titulo);
				div_img_vert4.appendChild(div_img4);
		
	
	target.appendChild(div_1);	
	target.appendChild(div_2);	
	target.appendChild(div_3);	
	target.appendChild(div_4);	
	
}
