function goURL( page) {
	
	dir = location.href.substring(0,location.href.lastIndexOf('\/'));	
	window.location = page;
}

function gocURL( page , flag) {
	if (confirm(flag)) {
		window.location = page;
	}
}


function gopURL( page, frame) {
	
	
	
	if (frame == "-1" || frame == null)
		eval("window.parent.location ='"+page+"'");
	else
		eval("window.parent."+frame+".location ='"+page+"'");		
}

function goURLSSL( page) {
	host = location.host;
	pathname = location.pathname;
	search = location.search;
	dir = pathname.substring(0,pathname.lastIndexOf('\/'));	
	window.location = "https://"+host+"/"+dir+"/"+page;
}


function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function ltrim(stringToTrim) {
	return stringToTrim.replace(/^\s+/,"");
}
function rtrim(stringToTrim) {
	return stringToTrim.replace(/\s+$/,"");
}


function goLogout(page) {
    window.location = page;    
    
    parent.window.close();
}

function openDocPopup(direccion){
    windowWidth = 900;
    windowHeight = 600;
    myleft=(screen.width)?(screen.width-windowWidth)/2:100;
    mytop=(screen.height)?(screen.height-windowHeight)/2:100;    
    
    openGenPopup(direccion, 0, 0, 0, 1, 0, 1, 1, windowWidth, windowHeight, myleft, mytop, 1);
}


function openPopup(direccion,w,h){
    windowWidth = w;
    windowHeight = h;
    myleft=(screen.width)?(screen.width-windowWidth)/2:100;
    mytop=(screen.height)?(screen.height-windowHeight)/2:100;    
    
    openGenPopup(direccion, 0, 0, 0, 1, 0, 1, 1, windowWidth, windowHeight, myleft, mytop, 1);
}

function openGenPopup(direccion, pantallacompleta, herramientas, direcciones, estado, barramenu, barrascroll, cambiatamano, ancho, alto, izquierda, arriba, sustituir){
     var opciones = "fullscreen=" + pantallacompleta +
                 ",toolbar=" + herramientas +
                 ",location=" + direcciones +
                 ",status=" + estado +
                 ",menubar=" + barramenu +
                 ",scrollbars=" + barrascroll +
                 ",resizable=" + cambiatamano +
                 ",width=" + ancho +
                 ",height=" + alto +
                 ",left=" + izquierda +
                 ",top=" + arriba;
     var ventana = window.open(direccion,"SIED",opciones,sustituir);

}                     


function popup(url,name,windowWidth,windowHeight){
    
    myleft=(screen.width)?(screen.width-windowWidth)/2:100;
    
    mytop=(screen.height)?(screen.height-windowHeight)/2:100;
    
    properties = "width="+windowWidth+",height="+windowHeight+",scrollbars=yes, top="+mytop+",left="+myleft;
    
    window.open(url,name,properties)
}


