/// SCRIPT CREADO EN ALTIMEA
var loadstatustext="En train de charger"
onload=function() 
{

	divTransparente=document.getElementById("transparencia");
	divMensaje=document.getElementById("transparenciaMensaje");
	preCarga("./images/ok.gif", "./images/loading.gif", "./images/error.gif");
}

function preCarga()
{
	imagenes=new Array();
	for(i=0; i<arguments.length; i++)
	{
		imagenes[i]=document.createElement("img");
		imagenes[i].src=arguments[i];
	}
}
/// MENSAJE DE TRANSPARENCIA

function ocultaMensaje()
{
	divTransparente.style.display="none";
}

function muestraMensaje(mensaje,img)
{
	//img=loading,error,ok,help
	switch(img) {
	  case 'error' :{ image='<img src="'+TEMPLATE_DIR+'/images/error.gif" alt=""><br>'; break; }
	  case 'ok' : { image='<img src="'+TEMPLATE_DIR+'/images/ok.gif" alt=""><br>'; break; }
	  case 'help' :{ image='<img src="'+TEMPLATE_DIR+'/images/help.gif" alt=""><br>'; break; }
	  case 'loading' : { image='<img src="'+TEMPLATE_DIR+'/images/loading.gif" alt=""><br>'; break; }
	  default: { image='<img src="'+TEMPLATE_DIR+'/images/loading.gif" alt=""><br>'; }
	}
	divTransparente=document.getElementById("transparencia");
	divMensaje=document.getElementById("transparenciaMensaje");
	
	divMensaje.innerHTML=image+mensaje;
	
	divTransparente.style.display="block";
}


function createREQ() {
try {
     req = new XMLHttpRequest(); /* p.e. Firefox */
     } catch(err1) {
       try {
       req = new ActiveXObject('Msxml2.XMLHTTP'); /* algunas versiones IE */
       } catch (err2) {
         try {
         req = new ActiveXObject("Microsoft.XMLHTTP"); /* algunas versiones IE */
         } catch (err3) {
          req = false;
         }
       }
     }
     return req;
}
function requestGET(url, query, req) {
myRand=parseInt(Math.random()*99999999);
req.open("GET",url+'?'+'query'+'&rand='+myRand,true);
req.send(null);
}
function requestPOST(url, query, req) {
req.open("POST", url,true);
req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
//alert(query);
req.send(query);
}
function doCallback(callback,item) {
eval(callback + '(item)');
}

function doAjax(url,query,callback,reqtype,getxml) {
// crea la instancia del objeto XMLHTTPRequest

//document.getElementById('preload').innerHTML=loadstatustext
var myreq = createREQ();
myreq.onreadystatechange = function() {
if(myreq.readyState == 4) {
   if(myreq.status == 200) {
      var item = myreq.responseText;
      if(getxml==1) {
         item = myreq.responseXML;
      }
      doCallback(callback, item);
    }
  }
}
if(reqtype=='post') {
requestPOST(url,query,myreq);
} else {
requestGET(url,query,myreq);
}
}
//############################### he aqui comienza el tabs */
var peticion = false; 
function ObtenerDatos(datos,divID,query) { 
var peticion = createREQ();
if(peticion) {
     var obj = document.getElementById(divID); 
	 obj.innerHTML =loadstatustext;    
     peticion.onreadystatechange = function()  { 
          if (peticion.readyState == 4) { 
               obj.innerHTML = peticion.responseText;
							 if(datos == "fmodificar_producto.php") getPresents();
          } 
     }
	 //llamando la funcion para hacer la petion del GET
	 requestPOST(datos,query,peticion);
}
}

function CambiarEstilo(id) {
	var elementosMenu = getElementsByClassName(document, "li", "activo");
	for (k = 0; k< elementosMenu.length; k++) {
	elementosMenu[k].className = "inactivo";
	}
	var identity=document.getElementById(id);
	identity.className="activo";
}


function getElementsByClassName(oElm, strTagName, strClassName){
    var arrElements = (strTagName == "*" && document.all)? document.all : oElm.getElementsByTagName(strTagName);
    var arrReturnElements = new Array();
    strClassName = strClassName.replace(/\-/g, "\\-");
    var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
    var oElement;
    for(var i=0; i<arrElements.length; i++){
        oElement = arrElements[i];      
        if(oRegExp.test(oElement.className)){
            arrReturnElements.push(oElement);
        }   
    }
    return (arrReturnElements)
}

//########################################### MESCLANDO VALIDATOR CON  AJAX
function validaFormulario(ruta){
var propControl = new Array();
debecontar=0;
contar=0;
validar=0;
vacios=0;
	for(var i=0; i<ruta.elements.length; i++){
		controlAct=ruta.elements[i];
		if(ruta.elements[i].title.indexOf("*")!=-1){//si existe * entonces valida datos del control actual
			propControl = ruta.elements[i].title.split("*");
			//alert(propControl[1]);
			if(propControl[1].indexOf("r")!= -1){//si es diferente de -1 entonces es un control requerido
				if(controlAct.value=="" || controlAct.value=="0"){
					alert("Le champ \""+propControl[0]+"\" est obligatoire");
					controlAct.focus();
					return false;
					break;
				}
			}
			if(propControl[1].indexOf("m")!= -1){//si es diferente de -1 entonces se debe validar el email
				if(emailCheck(controlAct.value)==0){
					alert("Votre email n'est pas valide");
					controlAct.focus();
					return false;
					break;
				}
			}if(propControl[1].indexOf("c")!= -1){
				debecontar=1;
				contar=contar+1;
				if(controlAct.value==""){
					vacios=vacios+1;
					if(contar==1){
						kontrol=controlAct;
						nombreKontrol=propControl[0];
					}
				}				
			}			
			if(propControl[1].indexOf("f")!= -1){
				if(checkDecimals(controlAct)==0){
					alert("Le champ "+propControl[0]+" ne doit pas contenir de caractères alphanumériques");
					controlAct.focus();
					controlAct.select();
					return false;
					break;
				}else{
					num=roundOff(controlAct.value, 2);
					//alert(num);
				}				
			}
			if(propControl[1].indexOf("p1")!= -1){//hay un "campo password"
				password1=controlAct.value;
			}
			if(propControl[1].indexOf("p2")!= -1){//hay un campo "repetir password"
				password2=controlAct.value;
				validar=1;
				ctrlRep=controlAct;
			}
		}
	}
	if(validar==1){
		if(password1!=password2){
			alert('Vous n\’avez pas retapé correctement votre mot de passe');
			ctrlRep.focus();
			ctrlRep.select();
			return false;
		}
	}
	if(debecontar==1){
		if(contar==vacios){
			alert('Les champs "'+nombreKontrol+'" ne peuvent être vides ');
			kontrol.focus();
			return false;
		}
	}
}

function roundOff(value, precision){
value = "" + value //convert value to string
precision = parseInt(precision);
var whole = "" + Math.round(value * Math.pow(10, precision));
var decPoint = whole.length - precision;

	if(decPoint != 0){
		result = whole.substring(0, decPoint);
		result += ".";
		result += whole.substring(decPoint, whole.length);
	}else{
		result = whole;
	}
	return result;
}


function checkDecimals(fieldName) {
decallowed = 2;  // cuantos decimales se desea
fieldValue=fieldName.value;
	if(fieldValue.length>=1){
		if (isNaN(fieldValue) || fieldValue == "") {
			return 0;
		}
		else {
			if (fieldValue.indexOf('.') == -1) 
				fieldValue += ".";
			dectext = fieldValue.substring(fieldValue.indexOf('.')+1, fieldValue.length);
	
			if (dectext.length > decallowed){
				return 0;
	      	}else {
			return 1;
	      	}
		}
	}else{
		return 1;
	}
}


function emailCheck (emailStr) {
if(emailStr.length>=1){
var emailPat=/^(.+)@(.+)$/
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
var validChars="\[^\\s" + specialChars + "\]"
var quotedUser="(\"[^\"]*\")"
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
var atom=validChars + '+'
var word="(" + atom + "|" + quotedUser + ")"
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")

var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
	return 0;
}
var user=matchArray[1]
var domain=matchArray[2]

if (user.match(userPat)==null) {
	return 0;
}

var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
		return 0;
	    }
    }
	return 1;
}

var domainArray=domain.match(domainPat)
if (domainArray==null) {
	return 0;
}
var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
   return 0;
}

if (len<2) {
   return 0;
}

}else{
	return 1;
}

}



function listado_busqueda(xml_pueblos){
ocultaMensaje();
 document.getElementById('paginacion').innerHTML=xml_pueblos;
 addTableRolloverEffect('myTable','tableRollOverEffect1','tableRowClickEffect1');
}
function Pagina(nropagina){
	//alert(nropagina);
		/*dato=document.frmbusqueda;
		cadenaFormulario=enviarFormulario(dato);*/
		muestraMensaje(texto,'loading');
		doAjax('index.php'+nropagina,nropagina ,'listado_busqueda','post','0');
}
///validar 
function validar_tipos(val){
	ruta=document.frm_contact;
	id=val.value
	for(var i=0; i<ruta.elements.length; i++){
		controlAct=ruta.elements[i];
		if(ruta.elements[i].title.indexOf("tipos")!=-1){//si existe * entonces valida datos del control actual
		
			controlAct.disabled=1;
			
		}
	}
	document.getElementById(id).disabled =0;
}
//volcando asociados
function dependiente_user(xml_pueblos)
{
  selec=document.getElementById('asociado');
  while (selec.hasChildNodes()) {
         selec.removeChild(selec.firstChild);
      }
 var numero=xml_pueblos.getElementsByTagName("pueblo").length;;
 for(i=0;i<numero;i++) {
 	var nombre_pueblo = xml_pueblos.getElementsByTagName("pueblo")[i].childNodes[1].firstChild.nodeValue;
	 var id_pueblo = xml_pueblos.getElementsByTagName("pueblo")[i].childNodes[0].firstChild.nodeValue;
	var nodo_texto = document .createTextNode(nombre_pueblo);
    var nuevo_option = document.createElement('option');
	nuevo_option.appendChild(nodo_texto);
    selec.appendChild(nuevo_option);
	nuevo_option.setAttribute("value",id_pueblo);
 }
  // Eliminamos todos los options del select de los pueblos que pudieran ver.
  selec2=document.getElementById('disponible');
  while (selec2.hasChildNodes()){ selec2.removeChild(selec2.firstChild);}
 var numero2=xml_pueblos.getElementsByTagName("pueblo2").length;;
 for(ii=0;ii<numero2;ii++) {
 	var nombre_pueblo2 = xml_pueblos.getElementsByTagName("pueblo2")[ii].childNodes[1].firstChild.nodeValue;
	 var id_pueblo2 = xml_pueblos.getElementsByTagName("pueblo2")[ii].childNodes[0].firstChild.nodeValue;
	var nodo_texto2 = document .createTextNode(nombre_pueblo2);
    var nuevo_option2 = document.createElement('option');
	nuevo_option2.appendChild(nodo_texto2);
    selec2.appendChild(nuevo_option2);
	nuevo_option2.setAttribute("value",id_pueblo2);
 }
 document.getElementById('preload').innerHTML="";
}
function llamada_user(volcar,idproducto,lista){
idcategoria=document.formu.cblista.value;
total=document.getElementById(lista).length;
j=0;cadena_id="";
for(i=0;i<document.getElementById(lista).length;i++){
		if(document.getElementById(lista).options[i].selected==true){
			sep=(j==0?"":"*");
			cadena_id+=sep+document.getElementById(lista).options[i].value;
			j++;
		}
}
	if(j!=0)
	 doAjax('dependientes_producto.php','id=' + cadena_id + '& idproducto=' + idproducto + '& volcar=' + volcar + '& idcategoria=' + idcategoria,'dependiente_user','post','1');
}
/////  mostrar colores 
function responde_ajax_tallas(xml_pueblos)
{	
 limpiar_lista('taille_slt','');
 var numero=xml_pueblos.getElementsByTagName("pueblo").length;;
 for(i=0;i<numero;i++) {
 var nombre_pueblo = xml_pueblos.getElementsByTagName("pueblo")[i].childNodes[1].firstChild.nodeValue;
 var id_pueblo = xml_pueblos.getElementsByTagName("pueblo")[i].childNodes[0].firstChild.nodeValue;
 var nodo_texto = document .createTextNode(nombre_pueblo);
 var nuevo_option = document.createElement('option');
	nuevo_option.appendChild(nodo_texto);
    selec.appendChild(nuevo_option);
	nuevo_option.setAttribute("value",id_pueblo);
 }
 ocultaMensaje();
}
function ajax_tallas(color,idproducto,idioma,nulltxt){
	limpiar_lista('txt_cantidad', PDET_VOTRE_QUANTITE);
	limpiar_lista('culot_slt', PDET_VOTRE_CULOT);
	limpiar_lista('lumens_slt', PDET_VOTRE_LUMENS);
	if(color){
	 muestraMensaje(texto,'loading');
	 doAjax('./include/ajax_xml_tallas.php','color=' + color + '& idproducto=' + idproducto + '&idioma=' + idioma +'&nulltxt='+nulltxt,'responde_ajax_tallas','post','1');
	}
}

/* [ culot ajax functions ] */
	function ajax_culot(potencia,idproducto,idioma,nulltxt)
	{
		limpiar_lista('lumens_slt', PDET_VOTRE_LUMENS);
		limpiar_lista('txt_cantidad', PDET_VOTRE_QUANTITE);
		if(potencia)
		{
			muestraMensaje(texto,'loading');
			doAjax('./include/ajax_xml_culot.php','potencia=' + potencia + '&idproducto=' + idproducto + '&idioma=' + idioma + '&nulltxt=' + nulltxt, 'responde_ajax_culot', 'post', '1');
		}
	}
	
	function responde_ajax_culot(xml)
	{
		limpiar_lista('culot_slt', '');
		
		var element = xml.getElementsByTagName("item");
		var numero = element.length;
		
		for(i=0; i<numero; i++)
		{
			var nombre = element[i].childNodes[1].firstChild.nodeValue;
			var id = element[i].childNodes[0].firstChild.nodeValue;
			
			var nodo = document.createTextNode(nombre);
			var option = document.createElement('option');
			
			var select = document.getElementById("culot_slt");
			option.appendChild(nodo);
			select.appendChild(option);
			option.setAttribute("value", id);
		}
		
		ocultaMensaje();
	}	
/* [ /culot ajax functions ] */

/* [ lumens ajax functions ] */
	function ajax_lumens(culot,idproducto,idioma,nulltxt)
	{
		limpiar_lista('txt_cantidad', PDET_VOTRE_QUANTITE);
		if(culot)
		{
			muestraMensaje(texto,'loading');
			doAjax('./include/ajax_xml_lumens.php','culot=' + culot + '&idproducto=' + idproducto + '&idioma=' + idioma + '&nulltxt=' + nulltxt, 'responde_ajax_lumens', 'post', '1');
		}
	}
	
	function responde_ajax_lumens(xml)
	{
		limpiar_lista('lumens_slt', '');
		
		var element = xml.getElementsByTagName("item");
		var numero = element.length;
		
		for(i=0; i<numero; i++)
		{
			var nombre = element[i].childNodes[1].firstChild.nodeValue;
			var id = element[i].childNodes[0].firstChild.nodeValue;
			
			var nodo = document.createTextNode(nombre);
			var option = document.createElement('option');
			
			var select = document.getElementById("lumens_slt");
			option.appendChild(nodo);
			select.appendChild(option);
			option.setAttribute("value", id);
		}
		
		ocultaMensaje();
	}	
/* [ /lumens ajax functions ] */


function limpiar_lista(id_campo, nulltxt){
  selec=document.getElementById(id_campo);
	if(selec)
	{
  	while (selec.hasChildNodes()) {
			selec.removeChild(selec.firstChild);
		}
	}
	
	if(nulltxt != "")
	{
		var nodo = document.createTextNode(nulltxt);
		var option = document.createElement('option');
		
		option.appendChild(nodo);
		selec.appendChild(option);
		option.setAttribute("value", "");
	}
}
//// FUNCION CONTROLA LA CANTIDAD DE LOS PRODUSTOS 
function responde_ajax_cantidad(xml_pueblos)
{	
  valor=0;
 limpiar_lista('txt_cantidad',PDET_VOTRE_QUANTITE);
 var numero=xml_pueblos.getElementsByTagName("item").length;;
 for(i=0;i<numero;i++) {
 var valor = xml_pueblos.getElementsByTagName("item")[i].childNodes[0].firstChild.nodeValue;
 }
 listar_cantidad(valor);
 
 var price=xml_pueblos.getElementsByTagName("price")[0].childNodes[0].firstChild.nodeValue;
 jQuery('#price_detail').html(price);
 
 ocultaMensaje();
}
function ajax_cantidad(idproducto,showstock,idioma,carid,userid){
	muestraMensaje(texto,'loading');
	if (showstock==1){
		var form_cart = document.frm_carro;
		present_id = form_cart.present_slt.options[form_cart.present_slt.selectedIndex].value;
		
		var cadena = 'idproducto=' + idproducto;
		cadena+= '&presentId=' + present_id;
		cadena+= '&showstock=' + showstock +'&idioma=' + idioma +'&carid=' + carid;
		
		if(idproducto)
		 doAjax('./include/ajax_xml_cantidad.php',cadena,'responde_ajax_cantidad','post','1');
	}else{
		
		listar_cantidad(10); 
		ocultaMensaje();
	}
}

function ajax_precio(present_id, product_id)
{
	muestraMensaje(texto,'loading');
	jQuery.ajax({
			url: "./include/ajax_xml_precio.php",
			type: "POST",
			data: "present_id=" + present_id + "&product_id=" + product_id,
			success: function(data)
			{
				if(data != false)
				{
					jQuery('#price_detail').html(data);
					ocultaMensaje();
				}
			}
	});
}

function listar_cantidad(cadena){
 selec=document.getElementById('txt_cantidad');
  if(cadena>10){
	 cadena=10; 
	}
 for(i=1;i<=cadena;i++) {
	var nodo_texto = document .createTextNode(i);// nombre
    var nuevo_option = document.createElement('option');
	nuevo_option.appendChild(nodo_texto);
    selec.appendChild(nuevo_option);
	nuevo_option.setAttribute("value",i);//valor
 }
}
function validar_carro(null_txt){
	form = document.frm_carro;
	if ($('present_slt').value>0 && $('txt_cantidad').value> 0)
	{
		jQuery.ajax({
				url: "./include/ajax_check_stock.php",
				type: "POST",
				data: "quantity=" + jQuery('#txt_cantidad').val() + "&present_id=" + jQuery('#present_slt').val(),
				success: function(data){
					/*if(data == "true")
					{
						form.action = "./include/all_process.php";
						form.submit();
					}
					else
					{
						message(HOME_STOCK_INSUFFISANT,'error',2000,1);
					}*/
					
					form.action = "./include/all_process.php";
					form.submit();
				}
		});	
	}
	else
	{
		message(null_txt,'error',2000,1);
	}
}

function create_txt_pago(carid){
	get='process_content=create_txt_pago&carid=' + carid ;
	if(carid){
	  doAjax('./include/all_process.php',get,'responde_create_txt_pago','post','1');	
	}else{
	 return false;
	}
}
function responde_create_txt_pago(responde)
{
	var user_type = jQuery('#usrtype').val();
	var set_advancement = jQuery('#set_advancement').val();
	
	if(set_advancement != undefined)
	{
		 	//alert('es profesional');
		if(jQuery('#set_advancement').val() == 1)
		{
			jQuery('#payment_type_email').remove();
			//alert('30%');
		}
		else
		{
			jQuery('#payment_type_paypal').remove();
			//alert('solo enviar');
		}
	}
	else
	{
			//alert('es particular');
			
	}
	
	//return false;
	
	form = document.frm_inscripcion;
	form.action = "./pago/pago.php";
	form.submit();
}

/*function end_cart(carid, setAdvancement){
	
	if(setAdvancement == 1)
	{
		jQuery('#set_advancement').val(1);
	}
	else if(setAdvancement == 2) //to send mail (professional)
	{
		jQuery('#send_email').val(1);
	}
	
	jQuery.ajax({
			url:"./include/ajax_end_cart.php",
			type:"POST",
			dataType:"json",
			data:"cart_id=" + jQuery('#user_cart_id').val(),
			beforeSend:function()
			{
				muestraMensaje(texto,'loading');
			},
			success:function(data)
			{
				ocultaMensaje();
				var pass = data.pass;
				if(pass == false)
				{
					var items = data.items;
					for(var i=0; i<items.length; i++)
					{
						var elem = jQuery("#row_item_" + items[i]);
						elem.css({backgroundColor: '#FFDDDD'});
						
						jQuery('#invalid_stock').show(50);
					}
				}
				else
				{
					create_txt_pago(carid);
				}
			}			
	});
//
///	
}*/

function verify_stock(){
	
	jQuery.ajax({
			url:"./include/ajax_end_cart.php",
			type:"POST",
			dataType:"json",
			data:"cart_id=" + jQuery('#user_cart_id').val(),
			beforeSend:function()
			{
				muestraMensaje(texto,'loading');
			},
			success:function(data)
			{
				ocultaMensaje();
				var pass = data.pass;
				if(pass == false)
				{
					var items = data.items;
					for(var i=0; i<items.length; i++)
					{
						var elem = jQuery("#row_item_" + items[i]);
						elem.css({backgroundColor: '#FFDDDD'});
						
						jQuery('#invalid_stock').show(50);						
					}
				}
				
				jQuery('#buttons_opt').css({ display:'' });
			}			
	});
//
///	
}

function end_cart(carid, setAdvancement){
	
	if(setAdvancement == 1)
	{
		jQuery('#set_advancement').val(1);
	}
	else if(setAdvancement == 2) //to send mail (professional)
	{
		jQuery('#send_email').val(1);
	}
	
	create_txt_pago(carid);
}

function radio_button_checker(form){
	var radio_choice = -1;
	if(form.pagos!=null){//si existe
		if(form.pagos.length==undefined){
			radio_choice = form.pagos.value;
		}else{
			for(counter = 0; counter < form.pagos.length; counter++){
				if(form.pagos[counter].checked){
					radio_choice = form.pagos[counter].value; 
				}
			}
		}
	}
	return radio_choice;
}
//###############trabajando con las listas  categorias
function llamada_categorias(idproducto){
	idcategoria=document.formu.cblista.value;	
	doAjax('combo_categorias.php','idcategoria=' + idcategoria + '& idproducto=' + idproducto,'dependiente_categorias','post','1');
}
 //aqui se  recupera la informacion  del xml 
 function dependiente_categorias(xml_pueblos)
{
  selec=document.getElementById('disponible');
  while (selec.hasChildNodes()) {
         selec.removeChild(selec.firstChild);
      }
 var numero=xml_pueblos.getElementsByTagName("categoria").length;;
 for(i=0;i<numero;i++) {
 	var nombre_pueblo = xml_pueblos.getElementsByTagName("categoria")[i].childNodes[1].firstChild.nodeValue;
	 var id_pueblo = xml_pueblos.getElementsByTagName("categoria")[i].childNodes[0].firstChild.nodeValue;
	var nodo_texto = document .createTextNode(nombre_pueblo);
    var nuevo_option = document.createElement('option');
	nuevo_option.appendChild(nodo_texto);
    selec.appendChild(nuevo_option);
	nuevo_option.setAttribute("value",id_pueblo);
 }
 document.getElementById('preload').innerHTML="";
}
function message(msg,img,time,get){
	if(get==0){
		ocultaMensaje();
	}else{
		muestraMensaje(msg,img);
		setTimeout("message('','','',0)",time);
	}
}
function recalculer_commandes(userid,carid){
	form=document.frm_inscripcion;
	partner =  form.txt_codepartner.value;
	get='userid=' + userid + '& carid=' + carid + '& partner=' + partner;
	if(partner!="")
	doAjax('./include/ajax_xml_partner.php',get,'responde_recalculer_commandes','post','1');	
}
function responde_recalculer_commandes(xml)
{	
  var valor = xml.getElementsByTagName("valor")[0].firstChild.nodeValue;
  if(valor==0)
   message(COMM_ALERT_CODE_DESCUENTO,'error',2000,1);
   else
   document.frm_inscripcion.submit();
}
function funtion_descuento(carid){
	form=document.frm_inscripcion;
	if(form.elimDesc.checked==true){
		document.getElementById('txt_codepartner').disabled=false;
	}else{
		document.getElementById('txt_codepartner').disabled=true;
		document.getElementById('txt_codepartner').value="";
		document.getElementById('elimDesc').value=carid;
		document.getElementById('btn_reculcular').href="javascript:document.getElementById('elimDesc').checked=true;document.frm_inscripcion.submit();";
	}
}

