var ancho = espacioh();

function espacioh(){
	var espacio = 0;
	if (screen.width>800) {
		espacio=(screen.width-768)/2;
	}
	//alert(espacio);
	return espacio;
}

function dibuja_espaciov()
{
	if (screen.height > 600)
	{
		document.write ("<tr><td height='68' colspan='3'><img width='1' src='images/shim.gif' height='68'></td></tr>")
	}
}

function dibuja_espacioh()
{
	if (screen.width > 800)
	{
		//document.write ("<td bgcolor='#FFFFFF' width='"+ancho+"'><img src='images/shim.gif' width='1' height='1'></td>")
    document.write ("<td bgcolor='#FFFFFF' width='25%'><img src='images/shim.gif' width='1' height='1'></td>")
	}
}

function openPopUpByName(url, name, width, height) {  
  var hwnd = 0;
  hwnd = window.open(url, name, 'width='+width+', height='+height+', titlebar=0, status=0, fullscreen=0, location=0,menubar=0,resizable=0,scrollbars=1, left='+centerH(width)+', top='+centerV(height));
  return hwnd;
}


function openPopUpScroll(url, width, height) {  
  var hwnd = 0;
  hwnd = window.open(url,'','width='+width+', height='+height+', titlebar=0, status=0, fullscreen=0, location=0,menubar=0,resizable=0,scrollbars=1, left='+centerH(width)+', top='+centerV(height));
  return hwnd;
}


//Punto de centrado horizontal
function centerH(w) {
  var left = (screen.width/2)-(w/2);
  return left;
}
//Punto de centrado vertical
function centerV(h) {
  var top = (screen.height/2)-(h/2);
  return top;
}


function openPopUp(url, width, height, options) {  
  var hwnd = 0;
  hwnd = window.open(url,'','width='+width+', height='+height+', titlebar=0, status=0, fullscreen=0, '+options);
  return hwnd;
}

function mailcorrecto(mail) {
	var c1,c2,c3,c4,c5,c6,cf;
	var len,i,error;
		len = mail.length;
		if (len==0) {
			return 0;
		} else {
			i=0;
			c1 = mail.charAt(i);
			cf = mail.charAt(len-1);
			i++;
			if (c1=='@' || c1=='.' || c1==' ' || cf=='@' || cf=='.' || cf==' ') {
				error=0; 
			} else {	
				while (i<len && c2!='@' && c2!=' ') {
					c2 = mail.charAt(i);
					i++;
				}
				if (c2!='@') error=0; 
				else {
					c3 = mail.charAt(i);
					i++;
					if (c3=='@' || c3=='.' || c3==' ') {
						error=0; 
					} else {
						while (i<len && c4!='.' && c4!='@' && c4!=' ') {
							c4 = mail.charAt(i);
							i++;
						}	
						if (c4!='.') error=0; 
						else {
							c5 = mail.charAt(i);
							if (c5!='.' && c5!='@' && c5!=' ') {
								while (i<len && c6!='.' && c6!='@' && c6!=' ') {
									c6 = mail.charAt(i);
									i++;
								}	
								if (c6=='@' || c6==' ') {
									error=0; 
								} else {
									error=1; 
								}
							} else error=0; 
						}
					}
				}	
			}
			return error;
		}	
}

function checkNumber(obj) {
	var puntos=0
	var valid = "0123456789"
	var ok = "si";
	var temp;
	for (var i=0; i<obj.value.length; i++) {
		temp = obj.value.substring(i, i+1);
		if (valid.indexOf(temp)=="-1") {
			obj.value=obj.value.substring(0, i);
			obj.focus();
			return false;
		}
	}
	return true;
}	 

function validar_campos_texto_esp(obj) {
	var puntos=0
	var valid = "abcçdefghijklmnñopqrstuvwxyzABCÇDEFGHIJKLMNÑOPQRSTUVWXYZ "
	var ok = "si";
	var temp;
	for (var i=0; i<obj.value.length; i++) {
		temp = obj.value.substring(i, i+1);
		if (valid.indexOf(temp)=="-1") {
			obj.value=obj.value.substring(0, i);
			obj.focus();
			return false;
		}
	}
	return true;
}	 


