
var texta="",textb="",textc="",textd="";
var text2="";
var text01="  BTL  <br>  Event branding  <br>  Advertainment  <br>  Artvertising  <br>  Multimedia proyects  <br>  In-Outdoor activities  <br>  Installations  <br>  Guerrilla Marketing  <br>  Visual Merchandising  ";
var text02="  Strategy  <br>  Branding  <br>  Corporate Identity  <br>  Advertising  <br>  Brand Inside  <br>  New Media  <br>  Interactive  <br>  Research  <br>  CSR  ";
var text03="  Online Branding  <br>  Visual Branding  <br>  Motion graphics  <br>  Multimedia  <br>  Graphic Design  <br>  3D Illustration  <br>  Illustration  <br>  Concept art  ";
var text04="  Character Design  <br>  Illustration  <br>  Web Games  <br>  Toy Design  <br>  Animation  ";
var text10="<div id='we'><h1>Nueva Conciencia</h1><br><h1>Nueva Cultura</h1><br><h2>Nuevo Circo</h2><div></div><p>&nbsp;Hoy las marcas compiten por un espacio ya no en la mente<br>&nbsp;sino en las emociones de las personas.</p><div></div><p>&nbsp;Desarrolla tu nueva conciencia.<br />&nbsp;Crea tu nueva cultura.<br />&nbsp;Forma tu nuevo circo.</p><div></div><h3>Bienvenido</h3><div></div><span class='textwe02'>&nbsp;La sostenibilidad de una marca se sustenta en los vínculos emocionales que establece:<div></div>&nbsp;Una gran filosofía que se comparte, un mensaje de valor adecuado y transparente;<br>&nbsp;y un lenguaje agradable y desenfadado. Son estas conexiones emocionales genuinas<br>&nbsp;las que atraen a los públicos, comunidades y redes que viven dentro.</span><div></div><h3><a href='javascript:void();'  onClick='cargarContenido(\"team.php\",\"team\")'>Directores</a></h3><div></div><span id='team'></span><div></div><h3><a href='javascript:void();' onClick='cargarContenido(\"awards.php\",\"awards\")'>Premios y Publicaciones</a></h3><div></div><span id='awards'></span><div></div><br /><br /><br /></div><a href='#top' title='subir' style='position: fixed; bottom:10px; left:730px;'><img src='imagenes/go_top.gif' alt='Subir' border='0' />";
var text20="<p>&#160;Newcircus es una Agencia Interactiva enfocada&#160;<br />&#160;en Marketing Digital, Branding Estratégico y BTL&#160;<br />&#160;establecida en Perú.&#160;<br />&#160;¡Bienvenidos!&#160;</p>";
var text30="";
var delaya=50,delayb=50,delayc=50,delayd=50;
var delay2=50;
var currentChara=0,currentCharb=0,currentCharc=0,currentChard=0;
var currentChar2=0,currentChar3=0;
var identa,identb,identc,identd;
var ident2;
var aumentoa,aumentob,aumentoc,aumentod;
var aumento2;
var destinationa="[no definido]",destinationb="[no definido]",destinationc="[no definido]",destinationd="[no definido]";
var destination2="[no definido]";

function typea()
{
  if (document.getElementById)
  {
    var desta=document.getElementById(destinationa);
    if (desta)// && desta.innerHTML)
    {
	  
	  if (texta.charAt(currentChara)=='<') {
		aumentoa = texta.indexOf('>', currentChara) - currentChara + 1;
		currentChara+=aumentoa;
	  } else
	  { 
	  	currentChara+=1;
	  }
	  
      desta.innerHTML=texta.substr(0, currentChara);
      //desta.innerHTML+=texta[currentChar-1];
	  
      if (currentChara>texta.length)
      {
        currentChara=0;
		startTypingb(0,text02, 10, 'destino02');
      }
      else
      {
        identa = setTimeout("typea()", delaya);
      }
    }
  }
}
function typeb()
{
  if (document.getElementById)
  {
    var destb=document.getElementById(destinationb);
    if (destb)// && destb.innerHTML)
    {
		
	  if (textb.charAt(currentCharb)=='<') {
		aumentob = textb.indexOf('>', currentCharb) - currentCharb + 1;
		currentCharb+=aumentob;
	  } else
	  { 
	  	currentCharb+=1;
	  }
		
      destb.innerHTML=textb.substr(0, currentCharb);
      //destb.innerHTML+=textb[currentCharb-1];
	  
      if (currentCharb>textb.length)
      {
        currentCharb=0;
		startTypingc(0,text03, 10, 'destino03');
      }
      else
      {
        identb = setTimeout("typeb()", delayb);
      }
    }
  }
}

function typec()
{
  if (document.getElementById)
  {
    var destc=document.getElementById(destinationc);
    if (destc)// && destc.innerHTML)
    {
		
	  if (textc.charAt(currentCharc)=='<') {
		aumentoc = textc.indexOf('>', currentCharc) - currentCharc + 1;
		currentCharc+=aumentoc;
	  } else
	  { 
	  	currentCharc+=1;
	  }
		
      destc.innerHTML=textc.substr(0, currentCharc);
      //destc.innerHTML+=textc[currentCharc-1];
	  
      if (currentCharc>textc.length)
      {
        currentCharc=0;
		startTypingd(0,text04, 10, 'destino04');
      }
      else
      {
        identc = setTimeout("typec()", delayc);
      }
    }
  }
}
function typed()
{
  if (document.getElementById)
  {
    var destd=document.getElementById(destinationd);
    if (destd)// && destd.innerHTML)
    {
		
	  if (textd.charAt(currentChard)=='<') {
		aumentod = textd.indexOf('>', currentChard) - currentChard + 1;
		currentChard+=aumentod;
	  } else
	  { 
	  	currentChard+=1;
	  }
		
      destd.innerHTML=textd.substr(0, currentChard);
      //destd.innerHTML+=textd[currentChard-1];
	  
      if (currentChard>textd.length)
      {
        currentChard=0;
      }
      else
      {
        identd = setTimeout("typed()", delayd);
      }
    }
  }
}
function type2()
{
  if (document.getElementById)
  {
    var dest2=document.getElementById(destination2);
    if (dest2)// && dest.innerHTML)
    {
		
	  if (text2.charAt(currentChar2)=='<') {
		aumento2 = text2.indexOf('>', currentChar2) - currentChar2 + 1;
		currentChar2+=aumento2;
	  } else if (text2.charAt(currentChar2)=='&' && text2.charAt(currentChar2+1)=='#') {
		aumento2 = text2.indexOf(';', currentChar2) - currentChar2 + 1;
		currentChar2+=aumento2;
	  } else
	  { 
	  	currentChar2+=1;
	  }

		
      dest2.innerHTML=text2.substr(0, currentChar2);
      //dest.innerHTML+=text[currentChar-1];
	  
      if (currentChar2>text2.length)
      {
        currentChar2=0;
        //ident = setTimeout("type()", 5000);
      }
      else
      {
        ident2 = setTimeout("type2()", delay2);
      }
    }
  }
}
function typeDirecto2()
{
  if (document.getElementById)
  {
    var dest2=document.getElementById(destination2);
    if (dest2)// && dest.innerHTML)
    { dest2.innerHTML=text2; }
  }
}
function notype(destino)
{
  if (document.getElementById)
  {
    var dest=document.getElementById(destino);
    if (dest)// && dest.innerHTML)
    {
      dest.innerHTML="";
    }
  }
}

function startTypinga(inicara,textParama, delayParama, destinationParama)
{
  clearTimeout(identa);
  texta=textParama;
  delaya=delayParama;
  currentChara=inicara;
  destinationa=destinationParama;
  typea();
}
function startTypingb(inicarb,textParamb, delayParamb, destinationParamb)
{
  clearTimeout(identb);
  textb=textParamb;
  delayb=delayParamb;
  currentCharb=inicarb;
  destinationb=destinationParamb;
  typeb();
}
function startTypingc(inicarc,textParamc, delayParamc, destinationParamc)
{
  clearTimeout(identc);
  textc=textParamc;
  delayc=delayParamc;
  currentCharc=inicarc;
  destinationc=destinationParamc;
  typec();
}
function startTypingd(inicard,textParamd, delayParamd, destinationParamd)
{
  clearTimeout(identd);
  textd=textParamd;
  delayd=delayParamd;
  currentChard=inicard;
  destinationd=destinationParamd;
  typed();
}
function startTyping2(textParam2, delayParam2, destinationParam2)
{
  clearTimeout(ident2);
  text2=textParam2;
  delay2=delayParam2;
  currentChar2=0;
  destination2=destinationParam2;
  type2();
}
function startTypingDirecto2(textParam2, destinationParam2)
{
  clearTimeout(ident2);
  text2=textParam2;
  destination2=destinationParam2;
  typeDirecto2();
}
function stopTyping(destinationParam, tipoident) //por corregir el segundo param no hace caso.
{
  clearTimeout(tipoident);
  destination=destinationParam;
  notype(destination);
}
function stopTyping2(destinationParam)
{
  clearTimeout(ident2);
  destination=destinationParam;
  notype(destination);
}







function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}



function limpiarcampo(obj) {
	if (obj.defaultValue==obj.value) {
		obj.value = '';
	} else if (obj.value==''){
		obj.value = obj.defaultValue;	
	}
}

function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function ltrim(stringToTrim) {
	return stringToTrim.replace(/^\s+/,"");
}
function rtrim(stringToTrim) {
	return stringToTrim.replace(/\s+$/,"");
}

function enviarComentario(paginacoment,lugarcoment) {
	actioncoment = document.formcoment.action.value;
	idpostcoment = document.formcoment.id.value;
	nomcoment = document.formcoment.name.value;
	emailcoment = document.formcoment.email.value;
	websitecoment = document.formcoment.website.value;
	detailcoment = document.formcoment.comment.value;
	// validar primero email
	if (trim(nomcoment)=='' || trim(nomcoment)=='Tu Nombre (*)') {
		alert('ingrese nombre válido'); document.formcoment.name.focus() ; return;
	}
	
	var bb=/^[^@\s]+@[^@\.\s]+(\.[^@\.\s]+)+$/
	if (bb.test(emailcoment)) {
	} else {
		alert('email no válido');
		document.formcoment.email.focus(); return;
	}
	if (trim(websitecoment)=='' || trim(websitecoment)=='Tu Sitio Web') {
		websitecoment = '';
	}
	if (trim(detailcoment)=='' || trim(detailcoment)=='Tu Comentario (*)') {
		alert('ingrese comentario'); document.formcoment.comment.focus() ; return;
	}
	// envia datos por post
	recibeid(paginacoment,'g=1','id='+idpostcoment+'&action='+actioncoment+'&name='+nomcoment+'&email='+emailcoment+'&website='+websitecoment+'&comment='+detailcoment+'',lugarcoment);
}

function enviarContacto(paginacontact,lugarcontact) {
	actioncontact = document.formcontacto.action.value;
	nomcontact = document.formcontacto.name.value;
	emailcontact = document.formcontacto.email.value;
	phonecontact = document.formcontacto.phone.value;
	companycontact = document.formcontacto.company.value;
	subjectcontact = document.formcontacto.subject.value;
	detailcontact = document.formcontacto.detail.value;
	// validar primero email
	if (trim(nomcontact)=='' || trim(nomcontact)=='Name*') {
		alert('ingrese nombre'); document.formcontacto.name.focus() ; return;
	}
	
	var bb=/^[^@\s]+@[^@\.\s]+(\.[^@\.\s]+)+$/
	if (bb.test(emailcontact)) {
	} else {
		alert('email no válido');
		document.formcontacto.email.focus(); return;
	}
	if (trim(phonecontact)=='' || trim(phonecontact)=='Phone') {
		phonecontact = '';
	}
	if (trim(companycontact)=='' || trim(companycontact)=='Company') {
		companycontact = '';
	}
	if (trim(subjectcontact)=='' || trim(subjectcontact)=='Subject*') {
		alert('ingrese asunto'); document.formcontacto.subject.focus() ; return;
	}
	if (trim(detailcontact)=='' || trim(detailcontact)=='Message*') {
		alert('ingrese mensaje'); document.formcontacto.detail.focus() ; return;
	}
	recibeid(paginacontact,'g=1','action='+actioncontact+'&name='+nomcontact+'&email='+emailcontact+'&phone='+phonecontact+'&company='+companycontact+'&subject='+subjectcontact+'&detail='+detailcontact+'',lugarcontact);
}

function vermenucol() {
	document.getElementById("area01").style.visibility = "visible";
	document.getElementById("area01").style.display = "inline";
	document.getElementById("area02").style.visibility = "visible";
	document.getElementById("area02").style.display = "inline";
	document.getElementById("area03").style.visibility = "visible";
	document.getElementById("area03").style.display = "inline";
	document.getElementById("area04").style.visibility = "visible";
	document.getElementById("area04").style.display = "inline";
	document.getElementById("mainmsg2").style.visibility = "visible";
	document.getElementById("mainmsg2").style.display = "inline";
	document.getElementById("mainmsg").style.display = "none";
	clearTimeout(identa);
	clearTimeout(identb);
	clearTimeout(identc);
	clearTimeout(identd);
	stopTyping('destino01','identa'); stopTyping('destino02','identb');
	stopTyping('destino03','identc'); stopTyping('destino04','identd');
	startTypinga(0,text01, 10, 'destino01');
	
}
function ocultarmenucol() {
	document.getElementById("area01").style.display = "none";
	document.getElementById("area02").style.display = "none";
	document.getElementById("area03").style.display = "none";
	document.getElementById("area04").style.display = "none";
	document.getElementById("mainmsg2").style.display = "none";
	document.getElementById("mainmsg").style.visibility = "visible";
	document.getElementById("mainmsg").style.display = "inline";
}