
function toggleDiv(divid, imgid){
	
	var img;
	
	img = document.getElementById(imgid);
  
  if(document.getElementById(divid).style.display == 'none'){
    document.getElementById(divid).style.display = 'block';
    img.src = 'imagenes/layout/sidemenu_collapse_button_on.jpg';
  }else{
    document.getElementById(divid).style.display = 'none';
    img.src = 'imagenes/layout/sidemenu_collapse_button_off.jpg';
  }
    
}

function loadPhoto(id_product, num) {
	var ajax = new GLM.AJAX();
	ajax.onError = errorHandler2;
	ajax.callPage("/ajax_gallery.php",photoLoaded,"POST","notfirst=true&id_product="+id_product+"&num="+num);
}

function errorHandler2(error) {
	alert(error.name);
	alert(error.message);
}

function photoLoaded(response) {
	var div = document.getElementById('photo_gallery_container');
	div.innerHTML = response;
}

function toggleDivNoImg(divid) {
	if(document.getElementById(divid).style.display == 'none'){
    document.getElementById(divid).style.display = 'block';
  }else{
    document.getElementById(divid).style.display = 'none';
  }
}

function incInt(inputId) {
	
	var inputElement = document.getElementById(inputId);
	inputElement.value = parseInt(inputElement.value)+1;
}

function decInt(inputId) {
	
	var inputElement = document.getElementById(inputId);
	if (parseInt(inputElement.value) > 1) {
		inputElement.value = parseInt(inputElement.value)-1;
	}
}