function abrir_ventana(name){
	
	ventana = window.open(name, "ventana", "width=5,height=5,dependent=yes,screenX=0,screenY=0,titlebar=no,directories=no,menubars=no,status=no,scrollbars=yes,resizable=no"); 
	if (ventana.opener == null) ventana.opener = self;
}

// Funcion para determinar el tipo de navegador
function Is() {
    var agent = navigator.userAgent.toLowerCase();
    this.major = parseInt(navigator.appVersion);
    this.minor = parseFloat(navigator.appVersion);
    this.ns  = ((agent.indexOf('mozilla')!=-1) && ((agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == -1)));
    this.ns2 = (this.ns && (this.major == 2));
    this.ns3 = (this.ns && (this.major == 3));
    this.ns4b = (this.ns && (this.minor < 4.04));
    this.ns4 = (this.ns && (this.major >= 4));
    this.ie   = (agent.indexOf("msie") != -1);
    this.ie3  = (this.ie && (this.major == 2));
    this.ie4  = (this.ie && (this.major >= 4));
    this.op3 = (agent.indexOf("opera") != -1);
    this.win   = (agent.indexOf("win")!=-1);
    this.mac   = (agent.indexOf("mac")!=-1);
    this.unix  = (agent.indexOf("x11")!=-1);
}

var is = new Is();

// Funcion que invoca el metodo submit adecuado de una forma
// La forma de la llamada es: <A href="" onclick="changeActionAndSubmit('carritoProductos', '../compra/xt_orderform_clearitems.asp'); return false">
function changeActionAndSubmit(form, newAction) {
	document.forms[form].action = newAction;
	document.forms[form].submit();
}

function submitForm(form) {
	document.forms[form].submit();
}

// Funcion que modifica el action de una forma
function changeAction(form, newAction) {
	document.forms[form].action = newAction;
}

// Funcion que modifica los valores de los input de una forma
function changeValue(form, layerName, inputName, newValue) {
	if(is.ns4) {
		if (layerName == "") {
			for (i=0; i < inputName.length; i++) {   
				eval("document['"+form+"']."+inputName[i]+".value = '"+newValue[i]+"'");
			}
			document[form].submit();
		}
		else {
			document[layerName].document[form].tienda.value = "hyper";
			for (i=0; i < inputName.length; i++) {   
				eval("document['"+layerName+"'].document['"+form+"']."+inputName[i]+".value = '"+newValue[i]+"'");
			}
			document[layerName].document[form].submit();
		}
	} else if(is.ie4) {
		for (i=0; i < inputName.length; i++) {   
			eval("document.forms['"+form+"']."+inputName[i]+".value = '"+newValue[i]+"'");
		}
		document.forms[form].submit();
	}
}

function isSelected(anchorName, imgName) {
	var newImg = eval(imgName + "_f2");
	document.anchors[anchorName].href = "";
	document.anchors[anchorName].onclick = "return false";
	document.anchors[anchorName].onmouseover = "return false";
	document.anchors[anchorName].onmouseout = "return false"
	document.images[imgName].src = newImg;
}