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 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];}
}
var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;
if (checkIt('konqueror')){
	browser = "Konqueror";
	OS = "Linux";}
else if (checkIt('chrome')) browser = "Chrome"
else if (checkIt('safari')) browser = "Safari"
else if (checkIt('firefox')) browser = "Firefox"
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) browser = "Opera"
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('msie 4')) browser = "Internet Explorer 4"
else if (checkIt('msie 5')) browser = "Internet Explorer 5"
else if (checkIt('msie 6.0')) browser = "Internet Explorer 6"
else if (checkIt('msie 7.0')) browser = "Internet Explorer 7"
else if (checkIt('msie 8.0')) browser = "Internet Explorer 8"
else if (checkIt('msie')) browser = "Internet Explorer"
else if (!checkIt('compatible')){
	browser = "Netscape Navigator"
	version = detect.charAt(8);}
else browser = "An unknown browser";
if (!version) version = detect.charAt(place + thestring.length);
if (!OS){
	if (checkIt('linux')) OS = "Linux";
	else if (checkIt('x11')) OS = "Unix";
	else if (checkIt('mac')) OS = "Mac"
	else if (checkIt('win')) OS = "Windows"
	else OS = "an unknown operating system";
}
function checkIt(string){
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}
function init() {
	if(document.getElementById('serviciosPest')){
		abreSectores('cservicios', 'serviciosPest');
	}
	/*if (document.getElementById('etiquetas')){
		alto = document.getElementById('etiquetas').offsetHeight;
		document.getElementById('siguenos').style.height = alto+"px";
		document.getElementById('boletin').style.height = alto+"px";
		if(browser == 'Internet Explorer 6'){
			altoIE = alto+10;
			document.getElementById('bottomFooter').style.height = altoIE+"px";	
		}
	}*/
	if ((browser == 'Internet Explorer 5') || (browser == 'Internet Explorer 4') || (browser == 'Internet Explorer 6')){
		location.href="cambiaIE.html";
	}
	if ((browser == 'Opera') && (OS == 'Mac')){
		document.getElementById('menuServicios').style.margin = "0 0 0 80px !important";
		document.getElementById('menuCSI').style.paddingTop = "12px";
	}
	if ((browser == 'Safari') && (OS == 'Mac')){
		document.getElementById('menuCSI').style.paddingTop = "14px";
	}
	if(document.getElementById('menuLeft')){
		if(document.getElementById('main').offsetHeight < document.getElementById('menuLeft').offsetHeight) {
			// ES MÁS ALTO MAIN QUE MAIN LEFT?
			alto = document.getElementById('menuLeft').offsetHeight-42;
			document.getElementById('main').style.height = alto+"px";
		}
	}
}
function creaEmbed(pelicula,ancho,alto) {
	cadena='<embed src="' + pelicula + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + ancho + '" height="' + alto + '" wmode="transparent"></embed>'
	document.write(cadena)
}

function miBorde(){
	theObjects = document.getElementsByTagName("object");
	for (var i = 0; i < theObjects.length; i++) {
		theObjects[i].outerHTML = theObjects[i].outerHTML;
	}
}
function muestraVentana(pagina, ancho, alto, titulo)   {
	myLightWindow.activateWindow({href: pagina, params: 'lightwindow_type=external,lightwindow_width='+ancho+',lightwindow_height='+alto, title: titulo});
}
function smallFont(){
    document.getElementById('main').style.fontSize = 9+"px";
}
function bigFont(){
    document.getElementById('main').style.fontSize = 13+"px";
}
function normalFont(){
    document.getElementById('main').style.fontSize = 11+"px";
}
function zoomText (accion){
	obj = document.getElementById('infoContainer')
	tDefault = 12;
	tActual = parseInt(obj.style.fontSize);
	tMasPequenia = 10;
	tMasGrande = 22;
	incremento = 2;
	
	if( accion == "reestablecer" ){
		obj.style.fontSize = tDefault+"px"
	}
	if( accion == "aumentar" && ((tActual+incremento) <= tMasGrande )){
		valor = tActual+incremento;
		obj.style.fontSize = valor+"px"
	}
	if( accion == "disminuir" && ((tActual+incremento) >= tMasPequenia )){
		valor = tActual-incremento;
		obj.style.fontSize = valor+"px"
	}
}
function imprimeContainer(){
    var imprimeContenido = document.getElementById('main');
    var HTMLs = "<html><header><link href='../../include/css/print.css' rel='stylesheet' type='text/css'/></header><body>";
    var ventanaImpresion = window.open(' ', 'popUpImpresion');
    ventanaImpresion.document.write (HTMLs);
    ventanaImpresion.document.write (imprimeContenido.innerHTML);
    ventanaImpresion.document.write ('</body></html>');
    ventanaImpresion.document.close();
    ventanaImpresion.print();
    ventanaImpresion.close();
}
function abreSectores (sector, pest) {
	var btnSector = new Array()
	btnSector[0] = 'serviciosPest'
	btnSector[1] = 'gobiernoPest'
	btnSector[2] = 'financieroPest'
	btnSector[3] = 'telecomPest'
	var divSector = new Array ()
	divSector[0] = 'cservicios' 
	divSector[1] = 'cgobierno' 
	divSector[2] = 'cfinanciero' 
	divSector[3] = 'ctelecomunicaciones' 

	for (i=0; i<btnSector.length; i++){
		document.getElementById(btnSector[i]).style.borderBottom = "1px solid #ccc";
		document.getElementById(btnSector[i]).style.backgroundColor = "#f4f4f4";
		document.getElementById(divSector[i]).style.display = "none";
	}
	document.getElementById(pest).style.borderBottom = "1px solid #fff";
	document.getElementById(pest).style.backgroundColor = "#fff";
	document.getElementById(sector).style.display = "block";
}
function clearTextbox(){
	if ((document.buscame.busca.value == "buscar en grupocsi.com") || (document.buscame.busca.value == "search in grupocsi.com")){
	document.buscame.busca.value = "";
	}
}
/* ESTOS SON PARA VALIDAR EL FORMULARIO DE CONTACTO */
 function validaEnvio() {  
	if (document.form1.name.value.length==0){
       alert("Debe escribir su nombre")
       document.form1.name.focus();
	   document.form1.name.style.background = "#FFF0B3";
    } else {
		if (document.form1.email.value.length==0){
       		alert("Debe escribir un correo electrónico")
       		document.form1.email.focus();
	  		document.form1.email.style.background = "#FFF0B3";
    	} else {
			if (document.form1.comment.value.length==0){
				alert("Por favor, háganos saber en qué podemos ayudarlo")
				document.form1.comment.focus();
				document.form1.comment.style.background = "#FFF0B3";
			} else {
				if ( emailCheck (document.form1.email.value)) {
                  document.form1.submit();
                 } else {
                  document.form1.email.style.background = "#FFF0B3";
                  document.form1.email.focus();
                 } 
			}
		}
	}
 }  
 function emailCheck (emailStr) 
{
    var checkTLD=1;
    var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
    var emailPat=/^(.+)@(.+)$/;
    var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
    var validChars="\[^\\s" + specialChars + "\]";
    var quotedUser="(\"[^\"]*\")";
    var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
    var atom=validChars + '+';
    var word="(" + atom + "|" + quotedUser + ")";
    var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
    var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
    var matchArray=emailStr.match(emailPat);
    if (matchArray==null) 
    {
      alert("El correo electrónico es incorrecto. Por favor verifíquelo");
      return false;
    }
    else
    {
      return true;
    }
}
/* MENU */
var menu=function(){
	var t=15,z=50,s=6,a;
	function dd(n){this.n=n; this.h=[]; this.c=[]}
	dd.prototype.init=function(p,c){
		a=c; var w=document.getElementById(p), s=w.getElementsByTagName('ul'), l=s.length, i=0;
		for(i;i<l;i++){
			var h=s[i].parentNode; this.h[i]=h; this.c[i]=s[i];
			h.onmouseover=new Function(this.n+'.st('+i+',true)');
			h.onmouseout=new Function(this.n+'.st('+i+')');
		}
	}
	dd.prototype.st=function(x,f){
		var c=this.c[x], h=this.h[x], p=h.getElementsByTagName('a')[0];
		clearInterval(c.t); c.style.overflow='hidden';
		if(f){
			p.className+=' '+a;
			if(!c.mh){c.style.display='block'; c.style.height=''; c.mh=c.offsetHeight; c.style.height=0}
			if(c.mh==c.offsetHeight){c.style.overflow='visible'}
			else{c.style.zIndex=z; z++; c.t=setInterval(function(){sl(c,1)},t)}
		}else{p.className=p.className.replace(a,''); c.t=setInterval(function(){sl(c,-1)},t)}
	}
	function sl(c,f){
		var h=c.offsetHeight;
		if((h<=0&&f!=1)||(h>=c.mh&&f==1)){
			if(f==1){c.style.filter=''; c.style.opacity=1; c.style.overflow='visible'}
			clearInterval(c.t); return
		}
		var d=(f==1)?Math.ceil((c.mh-h)/s):Math.ceil(h/s), o=h/c.mh;
		c.style.opacity=o; c.style.filter='alpha(opacity='+(o*100)+')';
		c.style.height=h+(d*f)+'px'
	}
	return{dd:dd}
}();
/* MENU */
