function visualizar(id,precio){

	document.getElementById(id+"_Visualizar").innerHTML=precio*document.getElementById(id+"_Cantidad").value;

}

function lanzar(nombre)

{

	document.forms[nombre].submit();

}

function reverse(id){

	if(document.getElementById(id).style.display == 'none'){

		document.getElementById(id).style.display = 'block';

	}

	else{

		document.getElementById(id).style.display = 'none';

	}

}
function plegar(id){
	
	
	document.getElementById(id).style.display = 'none';
	
	}
function desplegar(id){document.getElementById(id).style.display = 'block';}
function viajar(destino){

	document.location.href = destino;

}

function cambio_forma(id,datos){

	if(id==1){

		document.getElementById(datos+'_0').style.display = 'none';

		document.getElementById(datos+'_1').style.display = 'block';

	} else {

		document.getElementById(datos+'_1').style.display = 'none';

		document.getElementById(datos+'_0').style.display = 'block';

	}

}



 function popup(pag,ancho,alto)

{

	window.open(url+"modulos/popup.php?src="+url+pag,null,"width="+ancho+",height="+alto+",status=no");

}
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=400');");
}
 function popup_ayuda()

{
popUp('ayuda/ayuda.html')
document.location.href = document.location.href
}

function objetus() {

         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 enviar(_URL_,_values_send,recargar){

 		_objetus=objetus()

        _objetus.open("GET",_URL_+_values_send,true);

        _objetus.onreadystatechange=function() {

                 if (_objetus.readyState==1)

                 {

                         (_target.innerHTML=='')?(_target.innerHTML="Cargando"):null;

                 }

                else if(_objetus.readyState==4)

                 {

                        if(_objetus.status==200){

							if (recargar){

								document.location.href = location.href

							} else {

	                              _target.innerHTML = _objetus.responseText;

								  if (_target.innerHTML=="recargar") document.location.href = url+"index.php"

							}

						}

                 }



         }

         _objetus.send(null);

 }

 function carrito(id,tipo,exe,extra)

 {				

	recargar=0

	if(extra!=1)extra=0;

	_URL_=url+"ajaxcarrito.php?"

	_target=document.getElementById('bloque_carrito')

  _values_send="opcion="+exe+"&id="+id+"&tipo="+tipo+"&extra="+extra

	

	if (exe=="agregar"){

		_values_send+="&cantidad="+1;

	}

	enviar(_URL_,_values_send,recargar)

 }

  function carrito2(id,tipo,exe,extra)

 {				

	recargar=0

	if(extra!=1)extra=0;

	if(exe=="envio")extra=document.getElementById('tipopago').value;

	

	_URL_=url+"ajaxcarrito2.php?"

	_target=document.getElementById('grancarrito')

  _values_send="opcion="+exe+"&id="+id+"&tipo="+tipo+"&extra="+extra

	

	if (exe=="agregar"){

		_values_send+="&cantidad="+1;

	}

	enviar(_URL_,_values_send,recargar)

 }

 function actualizarcantidad(id,tipo,cantidad,extra){

	var cantidad2;

	cantidad2=prompt("Introduzca la cantidad que desea adquirir:",cantidad);

	cantidad2 = parseInt(cantidad2)

	if (isNaN(cantidad2))cantidad2=null;	

	if (!(cantidad2==cantidad || cantidad2==null)){

		_URL_=url+"ajaxcarrito2.php?"

		_target=document.getElementById('grancarrito')

   	    _values_send="opcion=mod&id="+id+"&tipo="+tipo+"&cantidad="+cantidad2
		enviar(_URL_,_values_send,recargar)

	}

 }

 function actualizarcantidada0(id,extra){

		_URL_=url+"ajaxcarrito.php?"

		_target=document.getElementById('bloque_carrito')

   	    _values_send="opcion=mod&id="+id+"&cantidad=0&extra="+extra

		enviar(_URL_,_values_send,recargar)

 }

 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];}

}