function popupdinamico (nombre) {
	var ruta='/publico/popupdinamico.pl?';
	windowHandle=window.open(ruta+nombre, '_Imagen', 'width=480,height=200,scrollbars=0,resizable=1,toolbar=0,personalbar=0,menubar=0,status=0' );
	windowHandle.focus();
	return(false);
}

function popup(enlace,ancho,alto){
	return (false);
}



/* PARA LAS FILAS DE LA TABLA, APAREZCAN CON COLOR DE FONDO */

function hasClass(obj) {
     var result = false;
     if (obj.getAttributeNode("class") != null) {
         result = obj.getAttributeNode("class").value;
     }
     return result;
}



function stripe(id) {
    var even = false;
    var evenColor = arguments[1] ? arguments[1] : "#fff";
    var oddColor = arguments[2] ? arguments[2] : "#eee";
  	var table = document.getElementById(id);
    if (! table) { return; }
    var tbodies = table.getElementsByTagName("tbody");
    for (var h = 0; h < tbodies.length; h++) {
      var trs = tbodies[h].getElementsByTagName("tr");
      for (var i = 0; i < trs.length; i++) {
        if (! hasClass(trs[i]) && ! trs[i].style.backgroundColor) {
          var tds = trs[i].getElementsByTagName("td");
          for (var j = 0; j < tds.length; j++) {
            var mytd = tds[j];
            //if (! hasClass(mytd) && ! mytd.style.backgroundColor) {
              mytd.style.backgroundColor = even ? evenColor : oddColor;
              //mytd.style.border = 'outset 1 #bbbbbb';
            //}
          }
        }
        even =  ! even;
      }
    }
  }
//eliminar parpadeo en backgrounds en iExplorer
try {
document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}


//abre en nueva ventana los enlaces con class="nuevaVentana"
function agregarBlank() {
	arrayAs = document.getElementsByTagName('a');
	for (var index = 0; index < arrayAs.length; ++index) {
		var item = arrayAs[index];
		if (item.className == 'nuevaVentana'){
			item.onclick = function (){
				ventanaNueva = window.open(this.href,'nueva');
				ventanaNueva.focus();
				return false;
			}
		}
	}
}


/*COOKIES EN JQUERY*/
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};

$(function() {
	$('.lb	a').lightBox({fixedNavigation:true});
});
