// JavaScript Document

function setIframeContent(pagina){
//Outter div that will encompass the inner iframe	
		var newdiv = document.createElement('div');
		newdiv.id = "nuevoIframe";
		newdiv.style.width = "100%";
		newdiv.style.height = "100%";
		newdiv.style.position = "absolute";
		newdiv.style.left = "0px";
		newdiv.style.top = "0px";
		newdiv.style.paddingTop = "0px";
		//newdiv.style.backgroundImage = "url('../images/framework/share/ShareThisBox2.gif')";
		//newdiv.style.backgroundRepeat = "no-repeat";
		newdiv.innerHTML = '<iframe id="myiframe" name="myiframe" width="100%" height="100%" frameborder="0" allowtransparency="true"></iframe>';
		document.body.appendChild(newdiv);
		//Fix for IE6: append src attribute
		document.getElementById("myiframe").setAttribute("src", pagina);
}
/*
paginaActual="";
function setIframeContent (pagina) {
	paginaActual=pagina;
	setTimeout ("loadPage()", 1000);
}

function loadPage(){
	document.getElementById("myiframe").src = paginaActual;
}

function setIframeProdContentF (id) {
	abc = xmlDoc.getElementsByTagName("submenu");
	
	if (id!="")
	{
		for(i=0;i<abc.length; i++)
		{
			if (abc[i].getAttribute("subpage").toLowerCase() == id.toLowerCase())
			 {	
				document.getElementById("myiframe").src = abc[i].getAttribute("htmlURL");
				break;
			 }
		}
	}
	else
	{	abc = xmlDoc.getElementsByTagName("menu");
		document.getElementById("myiframe").src = abc[1].getAttribute("htmlURL");
	}

}

function setIframeProdContent (id) {
	//alert(id);
     str = "products.htm" + id;
	 window.location.href = "products.htm" + id;
//alert(window.location.href);
   window.location.href = str;
   setTimeout ("wreload()", 1000);

}
function wreload () {
		 window.location.reload();
}
*/


function resizeTop(pos){
	//alert(pos);
	var top = document.getElementById("top");
	
	if(pos==1){
		top.style.width = "195px";
		top.style.height = "390px";
		//alert(pos);
	}else if(pos==2){
		top.style.width = "195px";
		top.style.height = "230px";
		//alert(pos);
	}else{
		top.style.width = "130px";
		top.style.height = "180px";
		//alert(pos);
	}
}

function resize(){ 
	var frame = document.getElementById("iframe");//findObj("iframe"); 
	var top = document.getElementById("top");
	
	if (parseInt(navigator.appVersion)>3) {
		if (navigator.appName=="Netscape") {
			winW = window.innerWidth;
			winH = window.innerHeight;
	}
	if (navigator.appName.indexOf("Microsoft")!=-1) {
			winW = document.body.offsetWidth;
			winH = document.body.offsetHeight;
		}
	}
	
	//var htmlheight = document.body.parentNode.scrollheight; 
	var windowheight = winH;
	frame.style.height = windowheight + "px";
	
	
	
	//alert(windowheight);
	/*
	if ( htmlheight < windowheight )
	{
		document.body.style.height = windowheight + "px";
		frame.style.height = windowheight + "px";
	}
	else
	{
		document.body.style.height = htmlheight + "px";
		frame.style.height = htmlheight + "px";
	}
	*/ 
}


function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

/* abrir divs */

function showDivs(){
	document.getElementById("top").style.visibility = "visible";
	document.getElementById("seo").style.visibility = "visible";
	checkCookie();
}




var browserType;

if (document.layers) {browserType = "nn4"}
if (document.all) {browserType = "ie"}
if (window.navigator.userAgent.toLowerCase().match("gecko")) {
   browserType= "gecko"
}

function cerrarRegistrate() {
  if (browserType == "gecko" )
     document.poppedLayer = 
         eval('document.getElementById("registrate")');
  else if (browserType == "ie")
     document.poppedLayer = 
        eval('document.getElementById("registrate")');
  else
     document.poppedLayer =   
        eval('document.layers["registrate"]');
  document.poppedLayer.style.visibility = "hidden";
}

function mostrarRegistrate() {
  if (browserType == "gecko" )
     document.poppedLayer = 
         eval('document.getElementById("registrate")');
  else if (browserType == "ie")
     document.poppedLayer = 
        eval('document.getElementById("registrate")');
  else
     document.poppedLayer = 
         eval('document.layers["registrate"]');
  document.poppedLayer.style.visibility = "visible";
}

//Cookie
function setCookie(c_name, value, expiredays)
{	
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	
	document.cookie=c_name+ "=" +escape(value);
}

function getCookie(c_name)
{
	if (document.cookie.length>0)
		{
			c_start=document.cookie.indexOf(c_name + "=");

			if (c_start!=-1)
				{ 
					c_start=c_start + c_name.length+1; 
					c_end=document.cookie.indexOf(";",c_start);
					if (c_end==-1) c_end=document.cookie.length;
					return unescape(document.cookie.substring(c_start,c_end));
				} 
		}
	return "";
}
function checkCookie() 
{ 
	var a;
  	a = getCookie("registrate");
  	if (a=="")
  		{
			 mostrarRegistrate();
			
		}
	   return a;
}
