var IndiceOfertaActual = 1;
function PaginacionOferta(IndiceOferta){
	document.getElementById('Oferta_'+IndiceOfertaActual).style.display = 'none'
	document.getElementById('Oferta_'+IndiceOferta).style.display = 'block'
	IndiceOfertaActual = IndiceOferta;
}

var TotalOfertas;
function PaginacionOfertaSolo(IndiceOferta){
	if(IndiceOferta == TotalOfertas+1){
		IndiceOferta = 1;
	}
	PaginacionOferta(IndiceOferta);
	TempIndiceOfertaActual = IndiceOfertaActual + 1;
	setTimeout("PaginacionOfertaSolo("+TempIndiceOfertaActual+")", 5000);
}
if(TotalOfertas!='')
setTimeout("PaginacionOfertaSolo(2)", 5000);



var IndiceNovedadActual = 1;
function PaginacionNovedad(IndiceNovedad){
	document.getElementById('Novedades_'+IndiceNovedadActual).style.display = 'none'
	document.getElementById('Novedades_'+IndiceNovedad).style.display = 'block'
	IndiceNovedadActual = IndiceNovedad;
}

var TotalNovedades;
function PaginacionNovedadSolo(IndiceNovedad){
	if(IndiceNovedad == TotalNovedades+1){
		IndiceNovedad = 1;
	}
	PaginacionNovedad(IndiceNovedad);
	TempIndiceNovedadActual = IndiceNovedadActual + 1;
	setTimeout("PaginacionNovedadSolo("+TempIndiceNovedadActual+")", 5000);
}

if(TotalNovedades!='')
setTimeout("PaginacionNovedadSolo(2)", 5000);


var IndiceMasCompradaActual = 1;
function PaginacionMasComprada(IndiceMasComprada){
	document.getElementById('MasCompradas_'+IndiceMasCompradaActual).style.display = 'none'
	document.getElementById('MasCompradas_'+IndiceMasComprada).style.display = 'block'
	IndiceMasCompradaActual = IndiceMasComprada;
}
var TotalMasCompradas;
function PaginacionMasCompradaSolo(IndiceMasComprada){
	if(IndiceMasComprada == TotalMasCompradas+1){
		IndiceMasComprada = 1;
	}
	PaginacionMasComprada(IndiceMasComprada);
	TempIndiceMasCompradaActual = IndiceMasCompradaActual + 1;
	setTimeout("PaginacionMasCompradaSolo("+TempIndiceMasCompradaActual+")", 5000);
}

if(TotalMasCompradas!='')
setTimeout("PaginacionMasCompradaSolo(2)", 5000);

function send_email(){
	var dale=1;	
	//validando el contro reason_contact - Motivo de contacto
	if(document.getElementById('reason_contact').value=="0"){
		dale=0;
		document.getElementById('reason_contact').focus();
		return;
	}else{
		dale=1;
	}
	//validando el contro txt_nom - Nombre
	if(document.getElementById('name').value==""){
		dale=0;
		document.getElementById('name').focus();
		document.getElementById('name').style.backgroundColor = "#046489";
		document.getElementById('name').style.color = "#FFF";
		return;
	}else{
		document.getElementById('name').style.backgroundColor = "#FFF";
		document.getElementById('name').style.color = "#000";
		dale=1;
	}
	//validando el contro txt_ape - apellidos
	if(document.getElementById('las_name').value==""){
		dale=0;
		document.getElementById('las_name').focus();
		document.getElementById('las_name').style.backgroundColor = "#046489";
		document.getElementById('las_name').style.color = "#FFF";
		return;
	}else{
		document.getElementById('las_name').style.backgroundColor = "#FFF";
		document.getElementById('las_name').style.color = "#000";
		dale=1;
	}
	//validando el contro txt_email - Correo
	if(document.getElementById('email').value==""){
		dale=0;
		document.getElementById('email').focus();
		document.getElementById('email').style.backgroundColor = "#046489";
		document.getElementById('email').style.color = "#FFF";
		return;
	}else{
		 if(document.getElementById('email').value.indexOf("@")==-1 || document.getElementById('email').value.indexOf(".")==-1){
			dale=0;
			document.getElementById('email').focus();
			document.getElementById('email').style.backgroundColor = "#046489";
			document.getElementById('email').style.color = "#FFF";
			return;
		}else{
			document.getElementById('email').style.backgroundColor = "#FFF";
			document.getElementById('email').style.color = "#000";
			dale=1;
		}
	}
	
	//validando el contro slct_pais - Pais
	if(document.getElementById('country').value==""){
		dale=0;
		document.getElementById('country').focus();
		return;
	}else{
		dale=1;
	}	

	//validando el contro city - ciudad	
	if(document.getElementById('city').value==""){
		dale=0;
		document.getElementById('city').focus();
		document.getElementById('city').style.backgroundColor = "#046489";
		document.getElementById('city').style.color = "#FFF";
		return;
	}else{
		document.getElementById('city').style.backgroundColor = "#FFF";
		document.getElementById('city').style.color = "#000";
		dale=1;
	}
	//validando el contro txt_fono - Telefono
	if(document.getElementById('phone').value==""){
		dale=0;
		document.getElementById('phone').focus();
		document.getElementById('phone').style.backgroundColor = "#046489";
		document.getElementById('phone').style.color = "#FFF";
		return;
	}else{
		var valid = "*-0123456789" 
		var ok = "yes"; 
		var temp; 
		for (var i=0; i<document.getElementById('phone').value.length; i++) { 
			temp = "" + document.getElementById('phone').value.substring(i, i+1); 
			if (valid.indexOf(temp) == -1) ok = "no"; 
		} 
		if (ok == "no") { 
			dale=0;
			document.getElementById('phone').focus();
			document.getElementById('phone').style.backgroundColor = "#046489";
			document.getElementById('phone').style.color = "#FFF";
			return;
		 }else{
			document.getElementById('phone').style.backgroundColor = "#FFF";
			document.getElementById('phone').style.color = "#000";
			dale=1
		}
	} 

	//validando el contro as_company_knew - Analisis publicitario
	if(document.getElementById('as_company_knew').value==0){
		dale=0;
		document.getElementById('as_company_knew').focus();
		return;
	}else{
		dale=1;
	}	
	
	
	//validando el contro txt_msj - Mensaje
	if(document.getElementById('enquiry').value==""){
		dale=0;
		document.getElementById('enquiry').focus();
		document.getElementById('enquiry').style.backgroundColor = "#046489";
		document.getElementById('enquiry').style.color = "#FFF";
		return;
	}else{
		document.getElementById('enquiry').style.backgroundColor = "#FFF";
		document.getElementById('enquiry').style.color = "#000";
		dale=1;
	}
	//validando el contro visual_verify_code - Codigo de seguridad
	if(document.contact_us.visual_verify_code.value==""){
		dale=0;
		document.contact_us.visual_verify_code.focus();
		document.contact_us.visual_verify_code.style.backgroundColor = "#046489";
		document.contact_us.visual_verify_code.style.color = "#FFF";
		return;
	}else{
		document.contact_us.visual_verify_code.style.backgroundColor = "#FFF";
		document.contact_us.visual_verify_code.style.color = "#000";
		dale=1;
	}	
	if(document.contact_us.visual_verify_code.value!=document.contact_us.valor_codigo.value){
		dale=0;
		document.contact_us.visual_verify_code.focus();
		document.contact_us.visual_verify_code.style.backgroundColor = "#046489";
		document.contact_us.visual_verify_code.style.color = "#FFF";
		return;
	}else{
		document.contact_us.visual_verify_code.style.backgroundColor = "#FFF";
		document.contact_us.visual_verify_code.style.color = "#000";
		dale=1;
	}
	//si todos los datos han sido ingresados entra a la condicion
	if(dale==1){
		document.contact_us.activa_envio.value=1;
		//document.contact_us.action="<? echo tep_href_link(FILENAME_CONTACT_US, 'action=send')?>";
		document.contact_us.submit();
	}
}

function LimpiaInput(el){
	if(el.defaultValue==el.value)
	el.value = '';
}


var IdSubCategoriaActual = 0;
function MuestaSubsubcateoria(IdSubCategoria){
	document.getElementById('subcate_'+IdSubCategoria).style.display = 'block'
	document.getElementById("Vineta"+IdSubCategoria).src = 'images/disenio/VinetaSinDespliegaCate.jpg';	
	if(IdSubCategoriaActual != 0){
		document.getElementById('subcate_'+IdSubCategoriaActual).style.display = 'none'
		document.getElementById("Vineta"+IdSubCategoriaActual).src = 'images/disenio/VinetaDespliegaCate.jpg';	
		IdSubCategoriaActual = 0;
	}else{
	IdSubCategoriaActual = IdSubCategoria;
	}

}

function SerDistribuidor(){
	if(document.getElementById('register_reseller').checked){	
		document.getElementById('sec_register_reseller').style.display = 'block';
	}else{
		document.getElementById('sec_register_reseller').style.display = 'none';
		document.getElementById('file_register_reseller').value = '';
		document.getElementById('company_tax_id').value = '';
		
	}	
}

