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')){
		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";
	}
}
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)   {
	/*if ((browser == 'Internet Explorer 5') ||(browser == 'Internet Explorer 4')){
		window.open( pagina, titulo ,'width='+ancho+',height='+alto+',toolbar=0, menuBar=1,scrollBars=0 resizable=0');
	} else {*/
		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 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";
}