function PopupPic(sPicURL) { 
	 window.open( "http://www.tiendasnivalis.com/tienda/admin/popup.htm?"+sPicURL, "",  
     "resizable=1,HEIGHT=200,WIDTH=200"); 
} 

function neva_pop(url,name,options){
	var ContextWindow = window.open(url,name,options);
	ContextWindow.opener = this;
	ContextWindow.focus();
}


function alta_en_cat(valor){

cat = valor.value;

document.location.href="lista_prod_cat.php?id_cat=" + cat;

}//function

function solonumeros(){
	if (event.keyCode < 48 || event.keyCode > 57) 	event.returnValue=false;
}//function

function block_campo(){
	event.returnValue=false;
}//function



sortitems = 1;

function move(fbox,tbox) {
for(var i=0; i<fbox.options.length; i++) {
if(fbox.options[i].selected && fbox.options[i].value != "") {
var no = new Option();
no.value = fbox.options[i].value;
no.text = fbox.options[i].text;
tbox.options[tbox.options.length] = no;
fbox.options[i].value = "";
fbox.options[i].text = "";
   }
}

BumpUp(fbox);
if (sortitems) SortD(tbox);
}
function BumpUp(box)  {
for(var i=0; i<box.options.length; i++) {
if(box.options[i].value == "")  {
for(var j=i; j<box.options.length-1; j++)  {
box.options[j].value = box.options[j+1].value;
box.options[j].text = box.options[j+1].text;
}
var ln = i;
break;
   }
}
if(ln < box.options.length)  {
box.options.length -= 1;
BumpUp(box);
   }
}

function sendInfo(formVar,box) {
	formVar.length = 0;
    var strValue = new String();
    for(var i=0; i<box.length; i++) {
        strValue += box[i].value;
        if (i < box.length-1) {
            strValue += "_";
        }
    }
    formVar.value = strValue;
} // function

function sendInfo2(formVar,box) {
	formVar.length = 0;
    var strValue = new String();
	var permiso = false;
    for(var i=0; i<box.length; i++) {
		if (box[i].selected){
			strValue += box[i].value;
			if (i < box.length) {
				strValue += "-";
				permiso = true;
			} // if
		} // if
    } // for
	if(permiso == true){
		formVar.value = strValue;
	}else{
		alert("Elija uno o más objetos");
		return false;
	} // if
} // function

function SortD(box)  {
var temp_opts = new Array();
var temp = new Object();
for(var i=0; i<box.options.length; i++)  {
temp_opts[i] = box.options[i];
}
for(var x=0; x<temp_opts.length-1; x++)  {
for(var y=(x+1); y<temp_opts.length; y++)  {
if(temp_opts[x].text > temp_opts[y].text)  {
temp = temp_opts[x].text;
temp_opts[x].text = temp_opts[y].text;
temp_opts[y].text = temp;
temp = temp_opts[x].value;
temp_opts[x].value = temp_opts[y].value;
temp_opts[y].value = temp;
      }
   }
}
for(var i=0; i<box.options.length; i++)  {
box.options[i].value = temp_opts[i].value;
box.options[i].text = temp_opts[i].text;
   }
}

function validar_reparaciones(){

	if (document.forms['reparaciones_form'].elements['nombre'].value == '') {alert("Necesitamos su nombre y apellidos");return false;}
	if (document.forms['reparaciones_form'].elements['direccion'].value == '') {alert("Necesitamos su dirección de recogida");return false;}
	if (document.forms['reparaciones_form'].elements['telefono'].value == '') {alert("Necesitamos un teléfono de contacto");return false;}
	if (document.forms['reparaciones_form'].elements['email'].value == '') {alert("Necesitamos su email de contacto");return false;}

}//function	
