
execOnLoad = function() {

 	//an_StartList();
	//ieUpdate();
}
window.onload=execOnLoad;

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 or higher.
 {
 for(var i=0; i<document.images.length; i++)
 {
 var img = document.images[i]
 var imgName = img.src.toUpperCase()
 if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
 {
 var imgID = (img.id) ? "id='" + img.id + "' " : ""
 var imgClass = (img.className) ? "class='" + img.className + "' " : ""
 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
 var imgStyle = "display:inline-block;" + img.style.cssText
 if (img.align == "left") imgStyle = "float:left;" + imgStyle
 if (img.align == "right") imgStyle = "float:right;" + imgStyle
 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
 var strNewHTML = "<span " + imgID + imgClass + imgTitle
 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
 + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
 + "(src=\'" + img.src + "\');\"></span>"
 img.outerHTML = strNewHTML
 i = i-1
 }
 }
 }
 
//window.attachEvent("onload", correctPNG);

//carrito de compras, cambiar cantidades
function crearAjax()
{
    var xmlhttp=false;
     try
    {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e)
    {
        try
        {
               xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
          }
        catch (E)
        {
               xmlhttp = false;
          }
     }

    if (!xmlhttp && typeof XMLHttpRequest!='undefined')
    {
          xmlhttp = new XMLHttpRequest();
    }
    return xmlhttp;
}


function cambiarCantidad(id_carrito_01, cantidad, miSession)
{

	//alert (id_carrito_01);
	//alert (cantidad);

	var content;
    content = document.getElementById('total');

    //Crear objeto de AJAX
    ajax=crearAjax();

    //Enviar información por el metodo GET
    ajax.open("GET", "sistema/script/ajax_cambiar_cantidad.php?id_carrito_01="+id_carrito_01+"&cantidad="+cantidad+"&miSession="+miSession,true);

    ajax.onreadystatechange=function()
    {
        if (ajax.readyState==4)
        {
			//alert (ajax.responseText);
            content.innerHTML = ajax.responseText;
        }
    }
    ajax.send(null);

}

///////menu desplegable
function an_StartList() {
  if (document.all&&document.getElementById && !window.opera) {
    navRoot = document.getElementById("primary-navigation");
    if (navRoot) {
      for (i=0; i<navRoot.childNodes.length; i++) {
   	    node1 = navRoot.childNodes[i];
       	if (node1.nodeName=="UL") {
	      for (j=0; j<node1.childNodes.length; j++) {
    	    node2 = node1.childNodes[j];
        	if (node2.nodeName=="LI") {
	          node2.onmouseover=function() {
    	        this.className+=" over";
        	  }
	          node2.onmouseout=function() {
    	        this.className=this.className.replace(" over", "");
        	  }
    } } } } }



} }
//flash
function ieUpdate(){

	theObjects = document.getElementsByTagName("object");
	for (var i = 0; i < theObjects.length; i++)
	{
		theObjects[i].outerHTML = theObjects[i].outerHTML;
	}

}
//pagina de inicio


function inicio(objk,direccion){
	if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>3)){
		objk.style.behavior="url(#default#homepage)";
		objk.setHomePage(direccion);
	}
	else{
		alert("Su navegador no dispone de esta opción");
	}
}

//pop up

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

/*DESPLEGABLE ADMIN*/
// Copyright 2006-2007 javascript-array.com

var timeout	= 500;
var closetimer	= 0;
var ddmenuitem	= 0;

// open hidden layer
function mopen(id)
{	
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';

}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// close layer when click-out
document.onclick = mclose; 



//CREA ESTILOS
function createCSS(selector, declaration) {
        // test for IE
        var ua = navigator.userAgent.toLowerCase();
        var isIE = (/msie/.test(ua)) && !(/opera/.test(ua)) && (/win/.test(ua));

        // create the style node for all browsers
        var style_node = document.createElement("style");
        style_node.setAttribute("type", "text/css");
        style_node.setAttribute("media", "screen");

        // append a rule for good browsers
        if (!isIE) style_node.appendChild(document.createTextNode(selector + " {" + declaration + "}"));

        // append the style node
        document.getElementsByTagName("head")[0].appendChild(style_node);

        // use alternative methods for IE
        if (isIE && document.styleSheets && document.styleSheets.length > 0) {
                var last_style_node = document.styleSheets[document.styleSheets.length - 1];
                if (typeof(last_style_node.addRule) == "object") last_style_node.addRule(selector, declaration);
        }
};


//carrito de compras, cambiar cantidades WCONTROL 04
function crearAjax4()
{
    var xmlhttp=false;
     try
    {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e)
    {
        try
        {
               xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
          }
        catch (E)
        {
               xmlhttp = false;
          }
     }

    if (!xmlhttp && typeof XMLHttpRequest!='undefined')
    {
          xmlhttp = new XMLHttpRequest();
    }
    return xmlhttp;
}


function cambiarCantidad4(id_carrito, cantidad, miSession)
{

	//alert (id_carrito_01);
	//alert (cantidad);

	var content;
    content = document.getElementById('total');

    //Crear objeto de AJAX
    ajax=crearAjax4();

    //Enviar información por el metodo GET
    ajax.open("GET", "sistema/script/ajax_cambiar_cantidad.php?id_carrito="+id_carrito+"&cantidad="+cantidad+"&miSession="+miSession,true);

    ajax.onreadystatechange=function()
    {
        if (ajax.readyState==4)
        {
			//alert (ajax.responseText);
            content.innerHTML = ajax.responseText;
        }
    }
    ajax.send(null);

}
