// JavaScript Document

function lineaChange(pos) { //funcion para cambiar los colores en las lineas en el home
	switch(pos) {
		case 1: var fondo = document.getElementById("linea_foods");
				var limg = document.getElementById("pic_foods");
				var tit = document.getElementById("tit_foods");
				
				if(fondo.className=='fondo_linea_dos') {
					fondo.className = 'fondo_linea_uno';
					limg.src=limg.src.substring(0,limg.src.indexOf('_off.jpg'))+'.jpg';
					tit.src=tit.src.substring(0,tit.src.indexOf('_off.gif'))+'.gif';
				}
				else { 
					fondo.className = 'fondo_linea_dos';
					limg.src=limg.src.substring(0,limg.src.indexOf('.jpg'))+'_off.jpg';
					tit.src=tit.src.substring(0,tit.src.indexOf('.gif'))+'_off.gif';
				}
				
				break;
		case 2: var fondo = document.getElementById("linea_agro");
				var limg = document.getElementById("pic_agro");
				var tit = document.getElementById("tit_agro");
				
				if(fondo.className=='fondo_linea_dos') {
					fondo.className = 'fondo_linea_uno';
					limg.src=limg.src.substring(0,limg.src.indexOf('_off.jpg'))+'.jpg';
					tit.src=tit.src.substring(0,tit.src.indexOf('_off.gif'))+'.gif';
				}
				else { 
					fondo.className = 'fondo_linea_dos';
					limg.src=limg.src.substring(0,limg.src.indexOf('.jpg'))+'_off.jpg';
					tit.src=tit.src.substring(0,tit.src.indexOf('.gif'))+'_off.gif';
				}
				break;
		case 3: var fondo = document.getElementById("linea_indu");
				var limg = document.getElementById("pic_indu");
				var tit = document.getElementById("tit_indu");
				
				if(fondo.className=='fondo_linea_dos') {
					fondo.className = 'fondo_linea_uno';
					limg.src=limg.src.substring(0,limg.src.indexOf('_off.jpg'))+'.jpg';
					tit.src=tit.src.substring(0,tit.src.indexOf('_off.gif'))+'.gif';
				}
				else { 
					fondo.className = 'fondo_linea_dos';
					limg.src=limg.src.substring(0,limg.src.indexOf('.jpg'))+'_off.jpg';
					tit.src=tit.src.substring(0,tit.src.indexOf('.gif'))+'_off.gif';
				}
				break;
				
	}
}
function openWindowCenter(pUrl,pTitle,w,h) { 
	var findLeft = document.body.offsetWidth/2;
	var findTop = document.body.offsetHeight/2;
	
	findLeft -= w/2
	findTop -= h/2;	
	var winprops = 'height='+h+',width='+w+',top='+findTop+',left='+findLeft+'resizable=0'	

	window.open(pUrl,pTitle,"",winprops)
	
}


function showProducts(catID, paction){
	document.forms[0].categoryID.value = catID;
	document.forms[0].action = paction;
	document.forms[0].submit(); 
}

function viewDetProduct(url,title) {

	popupsc(url,title,520,415);
}

function showQA(q,total) { 
	var rpta = document.getElementById('r'+q);

	for (var i=0; i<total; i++) { 
		var rptat = document.getElementById('r'+i);
		rptat.className='detalle_rpta_invi';
	}
	
	rpta.className='detalle_rpta_vis';
}

function login() {
	//var frm = document.getElementById('frmLogin');
	if (document.getElementById('txtUser').value == '') {
		alert('Ingrese su usuario');
		document.getElementById('txtUser').focus();
		return false;
	} else if (document.getElementById('txtPass').value == '') {
		alert('Ingrese su password');
		document.getElementById('txtPass').focus();
		return false;
	}
	document.getElementById('general').task.value = 'mLogin';
	document.getElementById('general').target = '_self';
	document.getElementById('general').action = location.href + '/login';
	document.getElementById('general').submit();
}