var ban = 0;
var banCalificacion = 0;
var cantidadCarrito =0;
// Instancia XMLHttpRequest
var xmlHttp = createXmlHttpRequestObject();
// Mostrar error (true) o comportamiento AJAX (false)
var showErrors = true;
// Muestra el estado de Place Order, falso en otro caso
var placingOrder = false;
// Link de la accion del usuario
var actionObject = '';
// Crear un XMLHttpRequest instancia
function createXmlHttpRequestObject(){
    // Objeto XMLHttpRequest
    var xmlHttp;
    // Crear el objecto XMLHttpRequest
    try {
        // Create native XMLHttpRequest object
        xmlHttp = new XMLHttpRequest();
    } catch(e) {
        // Asumir Explorer 6 o menor
        var XmlHttpVersions = new Array("MSXML2.XMLHTTP.6.0", "MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP");
        // Buscar la version
        for (i = 0; i < XmlHttpVersions.length && !xmlHttp; i++){
            try{
                // Intentamos crear el objeto
                xmlHttp = new ActiveXObject(XmlHttpVersions[i]);
            }
            catch (e) {} // Ignorar el error potencial
        }
    }

    // Devuelvo el objeto XMLHttpRequest creado satisfactoriamente
    if (xmlHttp){
        return xmlHttp;
    }
    // Si un error aparece lo paso a la funcion
    else{
        handleError("Error creando el objeto XMLHttpRequest.");
    }
}

// Muestro un mensaje de error o un comportamiento non-AJAX
function handleError($message){
    // Ignoro el error si es false
    if (showErrors){
        alert("Error encontrado: \n" + $message);
        return false;
    }
    // Comportamiento non-AJAX
    else if (!actionObject.tagName){
        return true;
    }
    // Comportamiento non-AJAX
    else if (actionObject.tagName == 'A'){
        window.location = actionObject.href;
    }
    // Comportamiento non-AJAX
    else if (actionObject.tagName == 'FORM'){
        actionObject.submit();
    }
}
/******************************************************/
//FUNCIONES CARRITO DE COMPRAS VENTANA PEQUEÑA
// Agregar un producto al Shopping cart
function addProductToCart(formEntra,selSize,sucur){
    params = '';
	varerror = 0;
	//alert(bodega)
	
	if(selSize!="none"){	
	
		try{
			selectSize = document.getElementById(selSize);
			sucursal = document.getElementById("Sucursal").value;
			if(selectSize.value==0){
				varerror =1;
				alert("Por favor seleccione la talla");
			}else{
				params += '&' + selectSize.name + '=' + selectSize.value + '&Sucursal=' + sucursal
			}
		}catch (e){
		
		}
	
	}else{
		varerror =1;
	}
	
	if(varerror!=1){
		//alert(params)
		form = document.getElementById(formEntra);
		// Vuelvo al form clasico si no existe el objeto XMLHttpRequest
		if (!xmlHttp){
			form.submit();
			return true;
		}
		// Crear la URL del request
		request = form.action + '&AjaxRequest';
		// alert("ENTRO "+params)
		// Conectarse al servidor
		try{
		// Continuar si el objeto no esta ocupado
			if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0){
				// Enviar la peticion				
				xmlHttp.open("POST", request, true);
				xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
				xmlHttp.send(params);
				xmlHttp.onreadystatechange = addToCartStateChange;
			}
		}catch (e){
			// Muestro el error si existe
			handleError(e.toString());
		}
	}
}

function addProductToWishList(producto, ruta){
	request = ruta + 'add-wish-list/';
	params = "product_id=" + producto;
	try{
	// Continuar si el objeto no esta ocupado
		if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0){
			// Enviar la peticion
			xmlHttp.open("post", request, true);
			xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			xmlHttp.send(params);
			xmlHttp.onreadystatechange = function(){
				if (xmlHttp.readyState==4){
					var results = xmlHttp.responseText;
					if(results=="OK"){
						alert("Your selection has been added");
						document.getElementById('aRemoveToWish').style.display = "block";
						document.getElementById('aAddToWish').style.display = "none";
					}else{
						alert(results);
					}
				}
			}
		}
	}catch (e){
		// Muestro el error si existe
		handleError(e.toString());
	}
}

// Funcion que me manda los correos al administrador
function sendEmailAdmin(ruta){
	request = ruta + 'email-admin/';
	params = "variable=variable";
	try{
	// Continuar si el objeto no esta ocupado
		if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0){
			// Enviar la peticion
			xmlHttp.open("post", request, true);
			xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			xmlHttp.send(params);
			xmlHttp.onreadystatechange = function(){
				if (xmlHttp.readyState==4){
					var results = xmlHttp.responseText;
					//alert(results);
					document.formAuto.submit();
				}
			}
		}
	}catch (e){
		document.formAuto.submit();
		//alert("Error");
		// Muestro el error si existe
		handleError(e.toString());
	}
}

function addToNewsLeter(ruta){
	request = ruta + 'add_news_leter/';
	email = document.getElementById('emailNewsLeter');
	params = "email=" + email.value;
	try{
	// Continuar si el objeto no esta ocupado
		if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0){
			// Enviar la peticion
			xmlHttp.open("post", request, true);
			xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			xmlHttp.send(params);
			xmlHttp.onreadystatechange = function(){
				if (xmlHttp.readyState==4){
					var results = xmlHttp.responseText;
					if(results=="OK"){
						alert("You were successfully added to our subscribers database");
					}else{
						alert(results);
					}
				}
			}
		}
	}catch (e){
		// Muestro el error si existe
		handleError(e.toString());
	}
}

function removeProductToWishList(producto, ruta){
	request = ruta + 'remove-wish-list/';
	params = "product_id=" + producto;
	try{
	// Continuar si el objeto no esta ocupado
		if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0){
			// Enviar la peticion
			xmlHttp.open("post", request, true);
			xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			xmlHttp.send(params);
			xmlHttp.onreadystatechange = function(){
				if (xmlHttp.readyState==4){
					var results = xmlHttp.responseText;
					if(results=="OK"){
						alert("Erased");
						document.getElementById('aRemoveToWish').style.display = "none";
						document.getElementById('aAddToWish').style.display = "block";
					}else{
						alert(results);
					}
				}
			}
		}
	}catch (e){
		// Muestro el error si existe
		handleError(e.toString());
	}
}

function validarSaleAlert(Email, ruta){
	var msg = "" ;
	
	textoEmail = document.getElementById(Email);
	
	if(trim(textoEmail.value)==0){msg = "Llena Email\n";}

	if(msg!=""){alert(msg);return false}
	else {
		request = ruta + 'sale-alert/';
		params = "email=" + textoEmail.value ;
		try{
		// Continuar si el objeto no esta ocupado
			if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0){
				// Enviar la peticion
				xmlHttp.open("post", request, true);
				xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
				xmlHttp.send(params);
				xmlHttp.onreadystatechange = function(){
					if (xmlHttp.readyState==4){
						var results = xmlHttp.responseText;
						alert(results);
					}
				}
			}
		}catch (e){
			// Muestro el error si existe
			handleError(e.toString());
		}
	}
}

function validarLogin(textEmail,textPass, ruta, redirect){
	var msg = "" ;
	
	textoEmail = document.getElementById(textEmail);
	textoPass = document.getElementById(textPass);
	
	if(trim(textoEmail.value)==0){msg = "Please enter your email\n";}
	if(trim(textoPass.value)==0){msg += "Please enter your password\n";}
	if(msg!=""){alert(msg);return false}
	else {
		request = ruta + 'login/';
		params="ruta=" + document.formLogin.action + "&email=" + textoEmail.value + "&password=" + textoPass.value;
		try{
		// Continuar si el objeto no esta ocupado
			if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0){
				// Enviar la peticion
				xmlHttp.open("post", request, true);
				xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
				xmlHttp.send(params);
				xmlHttp.onreadystatechange = function(){
					if (xmlHttp.readyState==4){
						var results = xmlHttp.responseText;
						if(results=="reload"){
							document.location = redirect;
						}else{
							alert(results);
						}
					}
				}
			}
		}catch (e){
			// Muestro el error si existe
			handleError(e.toString());
		}
	}
}


// Funcio que me regarga la pagina del producto y me muestra la nueva imagen
function newImgPro(ruta,id){
	if(id==0){
		document.location = ruta;
	}else{
		redirect = ruta + "img-" + id + "/";
		document.location = redirect;
	}
}

// Funcio que me hace un redirect de direccion
function hacerRedirect(ruta){
	//alert(ruta);
	document.location = ruta;
}


/******************************************************/
//FUNCIONES CARRITO DE COMPRAS VENTANA PEQUEÑA
// Funcion para recibir la respuesta
function addToCartStateChange(){
    // Leemos la respuesta cuando el estado es 4
    if (xmlHttp.readyState == 4){
        // Continuo si el HTTP status es OK
        if (xmlHttp.status == 200){
            try {
                //funcion para mostrar que se agrego
                updateCartSummary();
            }
            catch (e){
                handleError(e.toString());
            }
        }else{
            handleError(xmlHttp.statusText);
        }
    }
}

/******************************************************/
//FUNCIONES CARRITO DE COMPRAS VENTANA PEQUEÑA
// Agregar el producto al carrito
function updateCartSummary(){
    // Leo la respuest
    //alert("llego respuesta"+xmlHttp.responseText)
    
    response = xmlHttp.responseText;
    // Si existe un error lo muestro
    if (response.indexOf("ERRNO") >= 0 || response.indexOf("error") >= 0) {
        handleError(response);
        alert("error")
    }else{
		
		divCartSum = document.getElementById("cart-summary");
		divCartSum.style.display = "inline"
		mostrarDiv("cart-summary")
		cant = document.getElementById("numeroProductos").innerHTML 
		cantidadCarrito = parseInt(cant)+1;
		actualizaNumeroCarrito(cantidadCarrito)
        divCartSum.innerHTML = response;
		window.scrollTo(0,0);
		
    }
    
}

function ocultarCartSum(){
	divCartSum = document.getElementById("cart-summary");
	divCartSum.style.display = "none";
}

function actualizaNumeroCarrito(cantidad){
	cantidadCarrito = cantidad;
	document.getElementById("numeroProductos").innerHTML = cantidadCarrito;
}

/******************************************************/
//FUNCIONES DETALLES CARRITO DE COMPRAS
// Called on shopping cart update actions
function executeCartAction(obj){
	if (placingOrder)
        return true;
	// Mostrar el mensaje "Actualizando..."
    // Volvemos al classic submit si no soporta AJAX
    if (!xmlHttp)
        return true;

    // Referencia al objeto
    actionObject = obj;
	// Inicializar variables
    response = '';
    params = '';
    // Si click el link entonces enviamos el request
    if (obj.tagName == 'A'){
        url = obj.href + '&AjaxRequest';
    }
    // oBtenemos los elementos enviados en el form
    else {
        url = obj.action + '&AjaxRequest';
        formElements = obj.getElementsByTagName('INPUT');

        if (formElements){
            for (i = 0; i < formElements.length; i++){
                if (formElements[i].name != 'place_order'){
                    params += '&' + formElements[i].name + '=';
                    params += encodeURIComponent(formElements[i].value);
                }
            }
        }
    }
	
	
    // Conectar al servidor
    try {
        // Miramos is no esta ocupado
        if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0){
            xmlHttp.open("POST", url, true);
            xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
            xmlHttp.onreadystatechange = cartActionStateChange;
            xmlHttp.send(params);
        }
    }
    catch (e){
        // Manejo de errores
        handleError(e.toString());
    }
    // Para el envio del clasico submit si ajax lo logro
    return false;
}


// Respuesta del servidro
function cartActionStateChange(){
    if (xmlHttp.readyState == 4){
        // Continuar solo si el estatus es "OK"
        if (xmlHttp.status == 200){
            try {
                // Leer la respuesta
                response = xmlHttp.responseText;
                // Si hubo error
                if (response.indexOf("ERRNO") >= 0 || response.indexOf("error") >= 0){
                    handleError(response);
                }else{
                    // Actualizo el carro
                    document.getElementById("contents").innerHTML = response;
					
                    // Escondo el mensaje de "Actualizando..."
                    //document.getElementById('updating').style.display = 'none';
                 }
            } catch (e) {
                // Manejo de errores
                handleError(e.toString());
            }
        }else{
            // Manejo de errores
            handleError(xmlHttp.statusText);
        }
    }
}

function mostrarLogin(){
	divcon = document.getElementById("divMascara");
	divcon.style.display = "block";
	mostrarDivHasta('divMascara' , 65);
}

function mostrarSaleAlert(){
	ban=3;
	divconsale = document.getElementById("divMascara");
	divconsale.style.display = "block";
	mostrarDivHasta('divMascara' , 65);
}

function ocultarLogin(){
	document.getElementById("divMascara").style.display = "none";
	document.getElementById("bodyPrincipal").style.overflowY = "visible";
}

function ocultarDivsMascara(){
	document.getElementById("divMascara").style.display = "none";
	document.getElementById("divSaleAlert").style.display="none";
}

function ocultarSaleAlert(){
	document.getElementById("divMascara").style.display = "none";
	document.getElementById("divSaleAlert").style.display="none";
}

/*
function ocultarSizeChart(){
	document.getElementById("divMascara").style.display = "none";
	document.getElementById("bodyPrincipal").style.overflowY = "visible";
	document.getElementById("divSizeChart").style.display="none";
}

function mostrarSizeChart(ruta){
	divconlogin = document.getElementById("divMascara");
	document.getElementById("imgTitleSizeChart").innerHTML = '<img src="' + ruta + 'img/title_size_chart.jpg" border="0" align="left"/>';
	document.getElementById("imgSizeChart").innerHTML = '<img src="' + ruta + 'img/size_chart.jpg" border="0" align="left"/>';
	divconlogin.style.display = "block";
	ban = 1;
	mostrarDivHasta('divMascara' , 65);
}
*/
/************************************************
FUNCIONES DE VENTANA PEQUEÑA DE COPMPRA
************************************************/
var opacidad=0;
var hilo;

function mostrarDiv(id) {
	clearInterval(hilo);
	opacidad=100;
	document.getElementById(id).style.opacity=".1";
	document.getElementById(id).style.filter="alpha(opacity=100)";
	hilo=setInterval("hacerOpaco('"+id+"')",7);
}

function hacerOpaco( id ) {
	opacidad++;
	opacidadFireFox=opacidad/100;
	document.getElementById(id).style.opacity=opacidadFireFox;
	document.getElementById(id).style.filter="alpha(opacity="+opacidad+")";
	if (opacidad>99) {
		clearInterval(hilo);
		document.getElementById(id).style.opacity="1";
		document.getElementById(id).style.filter="alpha(opacity=100)";
		opacidad=100;
		clearInterval(hilo);
		return;
	}
}

function hacerOpacoHasta( id , hasta) {
	opacidad+=5;
	//opacidad = 100;
	opacidadFireFox=opacidad/100;
	document.getElementById(id).style.opacity=opacidadFireFox;
	document.getElementById(id).style.filter="alpha(opacity="+opacidad+")";
	if (opacidad>hasta) {
		//document.getElementById("bodyPrincipal").style.overflowY = "hidden";
		if(ban==0){
			document.getElementById("divLogin").style.display="block";
		}else if(ban==3){
			document.getElementById("divSaleAlert").style.display="block";
		}else{
			document.getElementById("divSizeChart").style.display="block";
		}
		clearInterval(hilo);
		ban=0;
		return;
	}
}

function mostrarDivHasta(id, hasta) {
	clearInterval(hilo);
	opacidad=1;
	document.getElementById(id).style.opacity=".0";
	document.getElementById(id).style.filter="alpha(opacity=0)";
	hilo=setInterval("hacerOpacoHasta('"+id+"', "+hasta+")",7);
}

/*Funcion que me devuelve el numero de caracteres - blancos de una cadena*/
function trim(cadena){
	var nuevacadena="";
	nuevacadena=cadena.replace(/\ /g,"");
	return nuevacadena.length;
}

/*****************************************************
Cambiamos las estrellas segun el mousemove
*****************************************************/
var estado_estrellas=false;
var estrellaSeleccionada =0;
function selstar(val,ruta) {
	var x=0;
	if(banCalificacion==0){
		for(x=0;x<=val;x++)	{
			document['star'+x].src=ruta+"img/estrella_llena.png";
		}
	}
}
function remstar(val,ruta){
	var x=0;
	if(banCalificacion==0){
		if(estado_estrellas == false){
			for(x=0;x<=val;x++){
				document['star'+x].src=ruta+"img/estrella_vacia.png";
			}
		}else{
			for(x=0;x<=3;x++){
				document['star'+x].src=ruta+"img/estrella_vacia.png";
			}
			for(x=0;x<=estrellaSeleccionada;x++){
				document['star'+x].src=ruta+"img/estrella_llena.png";
			}
		}
	}
}
function valorStar(val,ruta,productId){
	var x=0;
	if(banCalificacion==0){
		estado_estrellas = true;
		estrellaSeleccionada = val;
		//document.getElementById('valorCalificaion').value = val + 1;
		for(x=0;x<=estrellaSeleccionada;x++){
			document['star'+x].src=ruta+"img/estrella_llena.png";
		}
		agregarCalificacion(ruta,productId);
	}
	
}

function validarComentario(){
	var msg="";
	textoComentario = document.getElementById('textRecomendacion');
	if(trim(textoComentario.value)==0){msg += "The comment field is empty\n";}
	if(msg!=""){alert(msg);return false;}
	else return true;
}

function agregarCalificacion(ruta,productId){
	
	
	if(banCalificacion==0){
		banCalificacion=1;
		calificacion = estrellaSeleccionada + 1;
		request = ruta + 'add-calification/';
		//alert(request)
		params = "calificacion=" + calificacion + "&productoID=" + productId;
		
		try{
		// Continuar si el objeto no esta ocupado
			if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0){
				// Enviar la peticion
				xmlHttp.open("post", request, true);
				xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
				xmlHttp.send(params);
				xmlHttp.onreadystatechange = function(){
					if (xmlHttp.readyState==4){
						
						var results = xmlHttp.responseText.split("|");
						if(results[0]=="si"){
							document.getElementById('divEstrellas').innerHTML = results[1];
							document.getElementById('divNumeroVotos').innerHTML = results[2];
							//document.forms['enviar'].submit();
						}else{
							//alert(results);
						}
					}
				}
			}
		}catch (e){
			//alert("Error");
			// Muestro el error si existe
			handleError(e.toString());
		}
		
	}else{alert("Ya hizo su votación");}
}


/* devolver fedex */
function fedexChecout(ruta, direccion, ciudad, region, codigo_postal, pais){
	request = ruta + 'traer-fedex/';
	alert(request)
	params = "tipofedex=&direccion=" + direccion + "&ciudad=" + ciudad + "&region=" + region + "&codigo_postal=" + codigo_postal + "&pais=" + pais;
	try{
	// Continuar si el objeto no esta ocupado
		if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0){
			// Enviar la peticion
			xmlHttp.open("post", request, true);
			xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			xmlHttp.send(params);
			xmlHttp.onreadystatechange = function(){
				if (xmlHttp.readyState==4){
					var results = xmlHttp.responseText.split("|");
					if(results[0]=="si"){
						alert("traigo fedex: " + results[1]);
						//document.forms['enviar'].submit();
					}else{
						alert(results);
					}
				}
			}
		}
	}catch (e){
		alert("Error");
		// Muestro el error si existe
		handleError(e.toString());
	}
}

//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
function ver_zoom(){
	document.getElementById("ima_producto_normal").style.display = "none";
	document.getElementById("ima_producto_zoom").style.display = "block";
	document.getElementById("ima_size_chart").style.display = "none";
}

function no_zoom(){
	document.getElementById("ima_producto_normal").style.display = "block";
	document.getElementById("ima_producto_zoom").style.display = "none";
	document.getElementById("ima_size_chart").style.display = "none";
}

function ver_size_chart(){
	document.getElementById("ima_producto_normal").style.display = "none";
	document.getElementById("ima_producto_zoom").style.display = "none";
	document.getElementById("ima_size_chart").style.display = "block";
}

function ocultarSizeChart(){
	document.getElementById("ima_producto_normal").style.display = "block";
	document.getElementById("ima_producto_zoom").style.display = "none";
	document.getElementById("ima_size_chart").style.display = "none";
}

function TraerTipo(ruta,cat,id){
	//alert(ruta)
	document.getElementById('tipo').style.display='inline';
	divResultado = document.getElementById('tipo');
	datos=ruta+'consultasAjax.php?cat=' + cat + '&id='+id+'&id_tipo=tipo';
	
	ajax=nuevoAjax();
	ajax.open("GET", datos);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//alert(ajax.responseText)
			divResultado.innerHTML = ajax.responseText
			
		}
	}
	ajax.send(null)
}

function TraerProducBuss(ruta,cat,id){
	//alert(id)
	document.getElementById('divBusiness').style.display='inline';
	divResultado = document.getElementById('divBusiness');
	datos=ruta+'consultasAjax.php?cat=' + cat + '&id='+id+'&Business=Business';
	
	ajax=nuevoAjax();
	ajax.open("GET", datos);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//alert(ajax.responseText)
			divResultado.innerHTML = ajax.responseText
			
		}
	}
	ajax.send(null)
}

function Pagina(ruta,cat,pag){
	//alert(pag)
	//document.getElementById('contenido').style.display='inline';
	divResultado = document.getElementById('productos');
	datos=ruta+'consultasAjax.php?cat='+cat+'&pag='+pag;
	
	ajax=nuevoAjax();
	ajax.open("GET", datos);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//alert(ajax.responseText)
			divResultado.innerHTML = ajax.responseText;
			
		}
	}
	ajax.send(null)
}

function Designers(ruta,cat,designer){
	//alert(ruta)
	divResultado = document.getElementById('designers')
	datos=ruta+'consultasAjax.php?cat='+cat+'&designer='+designer;
	
	ajax=nuevoAjax();
	ajax.open("GET", datos);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			alert(ajax.responseText)
			 document.getElementById('designers').innerHTML = ajax.responseText;
			 			
		}
	}
	ajax.send(null)
}

function Brands(ruta,cat,brands){
	//alert(ruta)	
	datos=ruta+'consultasAjax.php?cat='+cat+'&brands='+brands;
	
	ajax=nuevoAjax();
	ajax.open("GET", datos);
	
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//alert(ajax.responseText)
			document.getElementById('brands').innerHTML = ajax.responseText;
			
		}
	}
	ajax.send(null)
}

function img(ruta,id){
	//alert(id)
	datos=ruta+'consultasAjax.php?id='+id+'&tipo=imgn';
	ajax=nuevoAjax();
	ajax.open("GET", datos);
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	
	ajax.onreadystatechange=function(){		
		if (ajax.readyState==4) {
			//alert(ajax.responseText)
			document.getElementById('divImg').innerHTML = ajax.responseText;
		}
	}
	ajax.send(null)			
}
