function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\s)"+searchClass+"(\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

var tamanio = 0.8125;
var cuerpo;
/* for legacy design (table with class="texto") */
var tamanioLegacy = 12;
var cuerpoLegacy;
function AgrandarTexto () {
	cuerpo = getElementsByClass('col2')[0];
	if (tamanio < 1.2125) {
	  cuerpo.style.fontSize=(tamanio+0.1) + "em";
	  tamanio=(tamanio+0.1);
	}

	/*this doesn't work because of the cascade nature of css, 
	style are redefined for elements inside table.texto */
	var legacyEncontrado = false;
	cuerpoLegacy = getElementsByClass('texto');
	for(var i=0; i < cuerpoLegacy.length; i++) {
		if (tamanioLegacy < 16 && cuerpoLegacy[i].tagName.toLowerCase() == "table") {
			cuerpoLegacy[i].style.fontSize=(tamanioLegacy+1) + "px";
			legacyEncontrado = true;
		}
	}
	if(legacyEncontrado) {
	  tamanioLegacy=(tamanioLegacy+1);
	}
}
function AchicarTexto () {
	cuerpo = getElementsByClass('col2')[0];
	if (tamanio > 0.8125) {
		cuerpo.style.fontSize=(tamanio-0.1) + "em";
		tamanio=(tamanio-0.1);
	}
}

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];}
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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]+"'");
}

function popUp(pagina, nombreVentana, ancho, alto, scroll, resize, stat, menu){
         var winl = (screen.width - ancho) / 2;
         var wint = (screen.height - alto) / 2;
         win=window.open(pagina, nombreVentana,'top='+wint+',left='+winl+',scrollbars=' + scroll + ',resizable=no,width=' + ancho + ',height=' + alto + ',status=' + stat + ',menubar=' + menu);
         if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function tellAFriend(pag){
	window.location.href="mailto:?subject=Encontre%20este%20articulo&body=Te%20envio%20este%20articulo%20que%20encontre%20en%20MujeresdeEmpresa.com.%20Miralo,%20es%20muy%20interesante:%20" + pag;
}

function printPage() {
	if(window.print) {
		window.print();	
	}
}

function getCookie(name) {
	var cookie = " " + document.cookie;
	var search = " " + name + "=";
	var setStr = null;
	var offset = 0;
	var end = 0;
	if (cookie.length > 0) {
		offset = cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = cookie.indexOf(";", offset)
			if (end == -1) {
				end = cookie.length;
			}
			setStr = unescape(cookie.substring(offset, end));
		}
	}
	return(setStr);
}

function getFullYear(d)
{
   var y = d.getYear();

   if (y < 2000) 
   {
        y += 1900
   }

   return y
}

function getMonthName(d)
{
   var theMonth = d.getMonth()
   
   if (theMonth == 0) 
            return "Ene"
   if (theMonth == 1) 
            return "Feb"
   if (theMonth == 2) 
            return "Mar"
   if (theMonth == 3) 
            return "Abr"
   if (theMonth == 4) 
            return "May"
   if (theMonth == 5) 
            return "Jun"
   if (theMonth == 6) 
            return "Jul"
   if (theMonth == 7) 
            return "Ago"
   if (theMonth == 8) 
            return "Sep"
   if (theMonth == 9) 
            return "Oct"
   if (theMonth == 10) 
            return "Nov"
   if (theMonth == 11) 
            return "Dic"
}

function customDateString(oneDate) {
	var theMonth = getMonthName(oneDate)
	var theYear = getFullYear(oneDate)
		
	return oneDate.getDate() + " - "  + theMonth + " - " + theYear
}


/* chequear si obsoletas */
function textClear (input) {
	if ( input.value == input.defaultValue ) {
		input.value = "";
	}
}
/* fin chequear si obsoletas */

function ValidacionLogin(form) {
	var errores='';
	
	// verifico que se haya ingresado algo en los campos requeridos
	if(!form.UserID.value)
	  errores+='- Debe completar el usuario.\n';
	
	if(!form.Password.value)
	  errores+='- Debe completar su contraseña.\n';
	
	//hubo errores?
	if (errores) {
	  alert('Por favor corrija los siguientes errores:\n'+errores);
	  document.MM_returnValue = (errores == '');
	} else {
	  document.MM_returnValue = true;
	}
}

function validacionDirEmpresas(form) {
var errores = '';
	with (form) {
		if(!rz.value && !pc.value && !ac.options[ac.selectedIndex].value && !pais.options[pais.selectedIndex].value)
			errores+='- Elija al menos un criterio de búsqueda.\n';
	}
	if (errores)
		alert('Por favor corrija los siguientes errores:\n'+errores);
	document.MM_returnValue = (errores == '');
}

function validacionDirProductos(form) {
var errores = '';
	with (form) {
		if(!pr.value && !rz.value && !pc.value && !pais.options[pais.selectedIndex].value)
			errores+='- Elija al menos un criterio de búsqueda.\n';
	}
	if (errores)
		alert('Por favor corrija los siguientes errores:\n'+errores);
	document.MM_returnValue = (errores == '');
}

function validacionDirOportunidades(form) {
var errores = '';
	with (form) {
		if(!oc.value && !pc.value && !op.options[op.selectedIndex].value && !pais.options[pais.selectedIndex].value)
			errores+='- Elija al menos un criterio de búsqueda.\n';
	}
	if (errores)
		alert('Por favor corrija los siguientes errores:\n'+errores);
	document.MM_returnValue = (errores == '');
}

//estas funciones tienen que aparecer antes de incluir tabpane.js
function mostrarBusqueda(defaultTabIndex)
{
	for(var i=0; i < 3; i++) {
		if(document.getElementById) {
			if(i == defaultTabIndex) {
				document.getElementById('formBusq' + i).style.display = 'block';
			} else {
				document.getElementById('formBusq' + i).style.display = 'none';
			}
			//alert(document.getElementById('formBusq' + i).style.display);
		}
	}
}

function afterTabSelect(defaultTabIndex)
{
	mostrarBusqueda(defaultTabIndex);
}

function afterSetupAllTabs()
{
	if(tabPane1 != null) {
		//seleccionar tab a mostrar en forma predeterminada
		tabPane1.setSelectedIndex(defaultTabIndex);
		mostrarBusqueda(defaultTabIndex);
	}
}

function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // si es largo...cortarlo!
field.value = field.value.substring(0, maxlimit);
// sino, actualizar el contador
else
countfield.value = maxlimit - field.value.length;
}

function miseccion(){
	history.go(-1);
}

function Ir(link) {
  document.location = link;
}

//no es necesario remover caracteres especiales ya que haloscan los remueve solo
var pageTitleHS = document.title;
function HaloScanDefault() {
	if(typeof(idLegacy) == "undefined") {
		HaloScan(pageTitleHS);
	} else {
		HaloScan(idLegacy);
	}
}

function postCountDefault() {
	if(typeof(idLegacy) == "undefined") {
		postCount(pageTitleHS);
	} else {
		postCount(idLegacy);
	}
}

function HaloScanTBDefault() {
	if(typeof(idLegacy) == "undefined") {
		HaloScanTB(pageTitleHS);
	} else {
		HaloScanTB(idLegacy);
	}
}

function postCountTBDefault() {
	if(typeof(idLegacy) == "undefined") {
		postCountTB(pageTitleHS);
	} else {
		postCountTB(idLegacy);
	}
}

function CommentCount(id) {
	var hs_search = new RegExp('\\W','gi');
	var hs_id = id.replace(hs_search,"_").substr(0, 50);
	id = hs_id;

	var rtrnVal=0;
	if (hs[id]) {
		rtrnVal=hs[id];
	}
	return rtrnVal;
}

function HaloScanIframe(id) {
	var CommentNum=CommentCount(id);
	if (CommentNum >= 0) {
		var hs_search = new RegExp('\\W','gi');
		var hs_id = id.replace(hs_search,"_").substr(0, 50);
		id = hs_id;

		var frameH=580+130*CommentNum;
		var maxH=1000;
		if (frameH > maxH) {
			frameH=maxH;
		}
		var iframeHtml = "<iframe class='comentarios' style='height: "+frameH+"px;' frameborder='0' src='http://www.haloscan.com/comments/schauvin/"+id+"/'></iframe>"
		document.write(iframeHtml);
		//alert(iframeHtml);
	}
}

function HaloScanIframeDefault() {
	if(typeof(idLegacy) == "undefined") {
		HaloScanIframe(pageTitleHS);
	} else {
		HaloScanIframe(idLegacy);
	}
}

function echoTB(id) {
	var hs_search = new RegExp('\\W','gi');
	var hs_id = id.replace(hs_search,"_").substr(0, 50);
	id = hs_id;
	
	var linkHtml = "<a href='http://js-kit.com/trackback/mujeresdeempresa.com/" + id + "' rel='trackback'>Trackback</a>";
	
	linkHtml += "<!-- <rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:trackback='http://madskills.com/public/xml/rss/module/trackback/'>";
	linkHtml += "<rdf:Description rdf:about='http://mujeresdeempresa.com/" + id + "' ";
	linkHtml += "dc:identifier='http://mujeresdeempresa.com/" + id + "' dc:title='" + pageTitleHS + "' ";
	linkHtml += "trackback:ping='http://js-kit.com/trackback/mujeresdeempresa.com/" + id + "' /></rdf:RDF> -->";

	document.write(linkHtml);
	//alert(linkHtml);
}

function echoTBDefault() {
	if(typeof(idLegacy) == "undefined") {
		echoTB(pageTitleHS);
	} else {
		echoTB(idLegacy);
	}
}

function addBookmarklets() {
	var bookmarkletsHTML = "";

	bookmarkletsHTML += "<a href='http://www.facebook.com/share.php?u=" + encodeURIComponent(location.href) + "&amp;title=" + encodeURIComponent(document.title) + "' title='facebook: " + document.title + "' rel='nofollow'><img src='../images/generales/facebook.png' alt='facebook: " + document.title + "'></a>";

	bookmarkletsHTML += "<a href='http://twitter.com/home?status=" + encodeURIComponent(location.href) + "&amp;title=" + encodeURIComponent(document.title) + "' title='twitter: " + document.title + "' rel='nofollow'><img src='../images/generales/twitter.png' alt='twitter: " + document.title + "'></a>";

	bookmarkletsHTML += "<a href='http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=" + encodeURIComponent(location.href) + "&amp;title=" + encodeURIComponent(document.title) + "' title='agregar marcador en google: " + document.title + "' rel='nofollow'><img src='../images/generales/google.png' alt='agregar marcador en google: " + document.title + "'></a>";

	bookmarkletsHTML += "<a href='http://myweb2.search.yahoo.com/myresults/bookmarklet?u=" + encodeURIComponent(location.href) + "&amp;t=" + encodeURIComponent(document.title) + "' title='Y!: " + document.title + "' rel='nofollow'><img src='../images/generales/yahoo.png' alt='Y!: " + document.title + "'></a>";

	bookmarkletsHTML += "<a href='http://www.linkedin.com/shareArticle?mini=true&url=" + encodeURIComponent(location.href) + "&amp;title=" + encodeURIComponent(document.title) + "&amp;summary=&amp;source=Mujeres%20de%20Empresa' title='linkedin: " + document.title + "' rel='nofollow'><img src='../images/generales/linkedin.png' alt='linkedin: " + document.title + "'></a>";


	bookmarkletsHTML += "<a href='http://bitacoras.com/anotaciones/" + encodeURIComponent(location.href) + "' title='votar esta anotación en bitacoras.com: " + document.title + "' rel='nofollow'><img src='../images/generales/bitacoras.png' alt='votar esta anotación en bitacoras.com: " + document.title + "'></a>";

	bookmarkletsHTML += "<a href='http://www.wikio.es/sharethis?url=" + encodeURIComponent(location.href) + "&amp;title=" + encodeURIComponent(document.title) + "' title='wikio: " + document.title + "' rel='nofollow'><img src='../images/generales/wikio.png' alt='wikio: " + document.title + "'></a>";
	
	bookmarkletsHTML += "<a href='http://del.icio.us/post?url=" + encodeURIComponent(location.href) + "&amp;title=" + encodeURIComponent(document.title) + "' title='del.icio.us: " + document.title + "' rel='nofollow'><img src='../images/generales/delicious.png' alt='del.icio.us: " + document.title + "'></a>";

//	bookmarkletsHTML += "<a href='http://www.propeller.com/submit?url=" + encodeURIComponent(location.href) + "&amp;title=" + encodeURIComponent(document.title) + "' title='propeller: " + document.title + "' rel='nofollow'><img src='../images/generales/propeller.png' alt='propeller: " + document.title + "'></a>";

	bookmarkletsHTML += "<a href='http://www.mister-wong.es/index.php?action=addurl&amp;bm_url=" + encodeURIComponent(location.href) + "&amp;bm_description=" + encodeURIComponent(document.title) + "' title='mrwong: " + document.title + "' rel='nofollow'><img src='../images/generales/mrwong.png' alt='mrwong: " + document.title + "'></a>";

	bookmarkletsHTML += "<a href='http://www.stumbleupon.com/submit?url=" + encodeURIComponent(location.href) + "&amp;title=" + encodeURIComponent(document.title) + "' title='stumbleupon: " + document.title + "' rel='nofollow'><img src='../images/generales/stumbleupon.png' alt='stumbleupon: " + document.title + "'></a>";


	bookmarkletsHTML += "<a href='http://meneame.net/submit.php?url=" + encodeURIComponent(location.href) + "' title='meneame: " + document.title + "' rel='nofollow'><img src='../images/generales/meneame.png' alt='meneame: " + document.title + "'></a>";
	
	bookmarkletsHTML += "<a href='http://tec.fresqui.com/post?url=" + encodeURIComponent(location.href) + "' title='fresqui: " + document.title + "' rel='nofollow'><img src='../images/generales/fresqui.png' alt='fresqui: " + document.title + "'></a>";

	bookmarkletsHTML += "<a href='http://www.blogger.com/blog_this.pyra?t=&amp;u=" + encodeURIComponent(location.href) + "&amp;n=" + encodeURIComponent(document.title) + "' title='blogger: " + document.title + "' rel='nofollow'><img src='../images/generales/blogger.png' alt='blogger: " + document.title + "'></a>";


	bookmarkletsHTML += "<a href='http://technorati.com/faves/?add=" + encodeURIComponent(location.href) + "' title='technorati: " + document.title + "' rel='nofollow'><img src='../images/generales/technorati.png' alt='technorati: " + document.title + "'></a>";

	bookmarkletsHTML += "<a href='http://enchilame.com/submit.php?url=" + encodeURIComponent(location.href) + "' title='enchilame: " + document.title + "' rel='nofollow'><img src='../images/generales/enchilame.png' alt='enchilame: " + document.title + "'></a>";

/*
	bookmarkletsHTML += "<a href='http://digg.com/submit?phase=2&amp;url=" + encodeURIComponent(location.href) + "&amp;title=" + encodeURIComponent(document.title) + "' title='digg: " + document.title + "' rel='nofollow'><img src='../images/generales/digg.png' alt='digg: " + document.title + "'></a>";

	bookmarkletsHTML += "<a href='http://www.newsvine.com/_tools/seed&amp;save?u=" + encodeURIComponent(location.href) + "&amp;h=" + encodeURIComponent(document.title) + "' title='newsvine: " + document.title + "' rel='nofollow'><img src='../images/generales/newsvine.png' alt='newsvine: " + document.title + "'></a>";

	bookmarkletsHTML += "<a href='http://ma.gnolia.com/bookmarklet/add?url=" + encodeURIComponent(location.href) + "&amp;title=" + encodeURIComponent(document.title) + "' title='magnolia: " + document.title + "' rel='nofollow'><img src='../images/generales/magnolia.png' alt='magnolia: " + document.title + "'></a>";
*/
	
	document.write(bookmarkletsHTML);
	//alert(bookmarkletsHTML);
}

