/********************************************************************************/
/*                                                                              */
/* Plataforma e-ducativa.  Version 7.02.03-6 - Argentina                        */
/*                                                                              */
/* Copyright (c) 1998-2008 de e-ducativa Educación Virtual S.A.                 */
/*                                                                              */
/********************************************************************************/
// Layer desplazable para ventanas.
// UTILIZADO EN: location.cgi

var dragapproved=false
var minrestore=0
var initialwidth,initialheight
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all

function iecompattest(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function drag_drop(e){
if (ie5&&dragapproved&&event.button==1){
document.getElementById("dwindow").style.left=tempx+event.clientX-offsetx+"px"
document.getElementById("dwindow").style.top=tempy+event.clientY-offsety+"px"
}
else if (ns6&&dragapproved){
document.getElementById("dwindow").style.left=tempx+e.clientX-offsetx+"px"
document.getElementById("dwindow").style.top=tempy+e.clientY-offsety+"px"
}
}

function loadwindow(width,height){
var w = screen.width;
var l = parseInt((w-400)/2);
document.getElementById("dwindow").style.display=''
document.getElementById("dwindow").style.width=initialwidth=width+"px"
//document.getElementById("dwindow").style.height=initialheight=height+"px"
//alert(document.getElementById("dwindow").style.height)
document.getElementById("dwindow").style.left=l;
document.getElementById("dwindow").style.top=ns6? window.pageYOffset*1+130+"px" : iecompattest().scrollTop*1+130+"px"
}

// Cerrar ventanas
// UTILIZADO EN: location.cgi correlativas.cgi

function closeit(parametro){
	document.getElementById("dwindow").style.display="none";
	if (parametro == 1) {
	    window.open("","_parent","");
		setTimeout('window.close()',500);
//		window.opener='';
//		window.close();
	}

}

// Deshabilitar click derecho en links y archivos
// UTILIZADO EN: links.cgi archivos.cgi y templates de programa

// la variable clickmessage esta en cada uno de los cgis
function disableclick(e) {
	if (document.all) {
		if (event.button==2||event.button==3) {
			if ((event.srcElement.tagName=="A") && (event.srcElement.name.indexOf("linkcontenido") >=0 )){
				alert(clickmessage);
				return false;
			}
		}
	} else if (document.layers) {
		if (e.which == 3) {
			alert(clickmessage);
			return false;
		}
	} else if (document.getElementById){
		if ((e.which==3 && e.target.tagName=="A") && (e.target.name.indexOf("linkcontenido") >= 0)){
			alert(clickmessage)
			return false
		}
	}
}

function associatelinks(){
	for(i=0;i<document.links.length;i++) {
		if (document.links[i].name.indexOf("linkcontenido") >= 0) {
			document.links[i].onmousedown=disableclick;
		}
	}
}


function small_window(myurl, ventana_x, ventana_y) {
    var winl = (screen.width - ventana_x) / 2;
    var wint = (screen.height - ventana_y) / 2;
    var props = 'scrollBars=yes,resizable=yes,toolbar=no,menubar=no,location=no,directories=no,width='+ventana_x
                +',height='+ventana_y+',top='+wint+',left='+winl;

    var uri = myurl.split(/[?#]/);
    if( uri[1] ){
        var query = uri[1].toQueryParams();
        query['id_curso'] = id_grupo;
        uri[1] = $H(query).toQueryString();
    }
    myurl = uri[0] +'?'+uri[1]+ (uri[2] ? '#'+uri[2] : '' );

    var newWindow = window.open(myurl, "microsite", props);
    newWindow.focus();
}


if (document.all) {
	document.onmousedown=disableclick
} else if (document.getElementById) {
	window.onclick=disableclick
} else if (document.layers) {
	associatelinks()
}

