
//Funcion Favoritos---------------
function nuevofavorito(pagina,descripcion){
if ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4)) {
var url=pagina;
var titulo=descripcion;
window.external.AddFavorite(url,titulo);
}
else {
if(navigator.appName == "Netscape") 
alert ("Press Crtl+D to add this site in your Bookmarks o Favoritos");
}
}
//---------------------

//Flip simple--------------
function flip_simple(capa)
  		{
				
    		current=(document.getElementById(capa).style.display == 'none') ? 'block' : 'none';
    		document.getElementById(capa).style.display = current;
			
  		}
		
function flip_estilos(capa1,capa2,capa3,capa4)
  		{
			
    		document.getElementById('colores').style.display = capa1;
    		document.getElementById('textos').style.display = capa2;
    		document.getElementById('vinculos').style.display = capa3;
    		document.getElementById('distribucion').style.display = capa4;
			
  		}
		
//---FUNCIONES PARA EL SELECTOR

function color_capa(propiedad)
{
//document.getElementById('fondo_color').style.background-color = document.getElementById('fondo_color_oculto').value;

document.getElementById(propiedad+'_capa').style.background = document.getElementById(propiedad).value;
}

function cambiar_imgs(imagen1,imagen2,imagen3,imagen4){
	
	window.document['uno'].src=imagen1;
	window.document['dos'].src=imagen2;
	window.document['tres'].src=imagen3;
	window.document['cuatro'].src=imagen4;
	
}

function copia_portapapeles(){ 
   document.form1.area.select() 
   window.clipboardData.setData("Text", document.form1.area.value);
} 


//------------FIN DE LAS FUNCIONES PARA EL SELECTOR DE COLOR

//-------------ESTAMOS SEGUROS DE BORRAR???

function borrar(){
if (confirm("¿Estas seguro de que quieres borrar?"))
return true;
else
return false;
}

function masSelecciones(){ 
	existe=false;
	var ajax = document.nuevo.id_categoria;
	var nue_sel = document.getElementById('selecciones[]');
    var indice = ajax.selectedIndex; 
    var valor = ajax.options[indice].value; 
    var texto = ajax.options[indice].text; 
	var nue_opc = new Option(texto,valor);
	if (nue_sel.options.length>0){
		var i=0;
		for (i=0;i<nue_sel.options.length;i++){
			if(nue_sel.options[i].value==valor){
			existe=true	
			}
		}
	}
	if (existe==false){
    nue_sel.options[nue_sel.options.length]=nue_opc;
	}
} 

function menosSelecciones(){ 
	var nue_sel = document.getElementById('selecciones[]');
    var indice = nue_sel.selectedIndex; 
    var valor = nue_sel.options[indice]=null
} 

function envioOpciones(){
	var nue_sel = document.getElementById('selecciones[]');
	var i;
	for (i=0;i<nue_sel.options.length;i++){
			nue_sel.options[i].selected=true;
	}
document.nuevo.submit()
}

function precio_categorias(){
	var nue_sel = document.getElementById('selecciones[]');
	var maximo;
	var valorinicial;
	var valorsumado=0;
	var coste=0;
	var radios = document.nuevo.precio_tipo;
	var i;
	for (i=0;i<radios.length;i++){
			if (radios[i].checked==true)
			{
				coste=radios[i].value
			}
	}
	
	if (coste==29){
		valorinicial=29;
		maximo=3;
	}else{
		valorinicial=350;
		maximo=10;
	}
		if (maximo<nue_sel.options.length){
		valorsumado = (nue_sel.options.length - maximo)*10;
		}
		document.nuevo.precio_final.value=valorinicial + valorsumado;
		document.nuevo.precio_pantalla.value=valorinicial + valorsumado;
}
