//saco blancos al principio y al final
function trim(cadena)
   {cadena = cadena.replace(/^\s+/, '');
    cadena = cadena.replace(/\s+$/, '');
	return cadena;}
//-------------------------------------------------------------------------//
//valido si la cadena es un email
function validarEmail(valor) { 
  valor = trim(valor);
  if(valor == '') return true;
  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)){
    return true
  } else {
    return false;
  }
}
//-------------------------------------------------------------------------//	

function eval_comentario(){
	var cad = "";
	var bool = false;
	var oSpanError = document.getElementById("span_errores");
	var oName = document.getElementById("nombre");
	var oEmail = document.getElementById("email");
	var oDesarrollo = document.getElementById("desarrollo");

	if(trim(oName.value) == ""){
		cad += "Debe ingresar su nombre<br>";
		bool = true;
	}	
	if(!validarEmail(trim(oEmail.value)) || trim(oEmail.value) == ''){
		cad += "El email est&aacute; vac&iacute;o o no contiene un formato correcto<br>";
		bool = true;		
	}	
	if(trim(oDesarrollo.value) == ""){
		cad += "Debe ingresar su comentario<br>";
		bool = true;
	}	
	
	if(bool){
		oSpanError.style.display = "block";
		oSpanError.innerHTML = cad;
		
		return false;
	}
	else	return true;
}
//-------------------------------------------------------------------------//
function cambiarThumbs(src_img,pie){
	
	var img = document.getElementById("foto_gr");
	img.src = src_img;
	document.getElementById("pie_foto_gr").innerHTML = pie;

}
//-------------------------------------------------------------------------//
function scrollActive(action){
	var oIframeDIV = top.frames["frameScroll"].document.getElementById("iframeDIV");//accedo al html contenido en el iframe
	var leftScroll = oIframeDIV.style.left;//posición actual del html contenido por iframe
	var widthScroll = oIframeDIV.style.width//ancho del html contenido por iframe
	//var cantBlocks = document.getElementById("cant_blocks_scroll").value;//cantidad de bloques contenidos en el scroll
	var anchoVariable = 100;//ancho de cada bloque interno a mostrar en el scroll

	//var anchoTotal = anchoVariable*(cantBlocks-2);//ancho total del html contenido en el iframe

	var realLeft = leftScroll.split("px");
	var realWidth = widthScroll.split("px");
	var anchoTotal = realWidth[0]-(anchoVariable*2);//ancho total del html contenido en el iframe

	if(action=='f'){//forward
		if(realLeft[0] >= -(anchoTotal)){
			oIframeDIV.style.left = (realLeft[0]-anchoVariable) + "px";
		}
	}
	else{//back
		if(realLeft[0] < 0 && action=='b'){
			oIframeDIV.style.left = (realLeft[0]-(-anchoVariable)) + "px";
		}
	}
}