
function AbrirCentro(url,nompopup,popW,popH,scroll,resizable){
	w = screen.availWidth;
	h = screen.availHeight;
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;
	window.open(url,nompopup,'width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos + ',resizable=' + resizable + ',scrollbars=' + scroll );
}

function myFocus(element) {
 if (element.value == element.defaultValue) {
   element.value = '';
 }
}
function myBlur(element) {
 if (element.value == '') {
   element.value = element.defaultValue;
 }
}


startList = function() {

	// code for IE
	if(!document.body.currentStyle) return;
	var subs = document.getElementsByName('submenu');
	for(var i=0; i<subs.length; i++) {
		var li = subs[i].parentNode;
		if(li && li.lastChild.style) {
			li.onmouseover = function() {
				this.lastChild.style.visibility = 'visible';
			}
			li.onmouseout = function() {
				this.lastChild.style.visibility = 'hidden';
			}
		}
	}
}

window.onload=startList;

function entrar()
{
	form = document.frmartek;	
	form.action="login.php";
	form.method="post";
	
	if (form.usuario.value=="")
	{	
		alert('Por favor ingresa tu usuario');
		form.usuario.focus();		
	}	
	else if (form.password.value=="")
	{	
		alert('Por favor ingresa tu password');
		form.password.focus();		
	}	
	else {
		form.submit();
	}	
}

function textCounter(field,cntfield,maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
cntfield.value = maxlimit - field.value.length;
}


function checkEnter(e){ //e is event object passed from function invocation

	form = document.frmartek;	
	form.action="resultados.php";
	form.method="post";
	
	var characterCode; //literal character code will be stored in this variable

	if(e && e.which){ //if which property of event object is supported (NN4)
		e = e;
		characterCode = e.which; //character code is contained in NN4's which property
	}
	else{
		e = event;
		characterCode = e.keyCode; //character code is contained in IE's keyCode property
	}
	
	if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
		//document.forms[0].submit() //submit the form
		form.submit();
		return false;
	}
	else{
		return true;
	}
	

}

