

function Activar(id) {
	window.setTimeout("ObrirRecurs('" + id + "')", 500)	;
	return true;
}

function ObrirRecurs(id) {
	var ie4 = document.all;
	if (ie4) {	
		/*whereto = "http://www.doctorials.net:8080/tunnel/sakai-chef-tool/chef-content?pid=" + id + "&panel=Main";*/
		whereto = "http://cv.udl.es/portal/tool/"+ id + "?panel=Main";
		wnd = window.open(whereto,'Recursos','toolbar=no,scrollbars=no,resizable=no,menubar=no,status=no,directories=no,location=no,width=100,height=100')
		wnd.close();
	}
	return true;
}

function ObrirCourier(curs, id) {
	var ie4 = document.all;
	
	if (ie4) {	
		whereto = "http://www.doctorials.net:8080/tunnel/sakai-chef-tool/courier?site=" + curs + "&page=" + id + "&auto=courier";
		wnd = window.open(whereto,'Courier','toolbar=no,scrollbars=no,resizable=no,menubar=no,status=no,directories=no,location=no,width=100,height=100')
		wnd.close();
	}
	return true;
}



function setFocus(elements)
{
	if(typeof elements == "undefined")
	{
		return;
	}

	var focal_point = document;
	for(var i = 0; i < elements.length; i++)
	{
		if(focal_point.getElementById(elements[i]))
		{
			focal_point = focal_point.getElementById(elements[i]);
		}
		
		if(focal_point.contentDocument)
		{
			focal_point = focal_point.contentDocument;
		}
		else if(focal_point.contentWindow)
		{
			focal_point = focal_point.contentWindow;
			if(focal_point.document)
			{
				focal_point = focal_point.document;
			}
		}
		else
		{
			break;
		}
	}
	
	if(focal_point && focal_point.focus)
	{
		focal_point.focus();
	}
}

function ajustarDiv(nomDiv) {
//		alert("divtext.height: " + document.getElementById("divtext").style.height);
		myHeight = windowHeight();
//		alert("windowHeight: " + myHeight);	
		document.getElementById(nomDiv).style.height= (myHeight - 250) + "px";
		
		return true;
	}

	function windowHeight() {
	  var myHeight = 0;
	  if( typeof( window.innerHeight ) == 'number' ) {
		//Non-IE
		myHeight = window.innerHeight;
	  } else if( document.documentElement && ( document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myHeight = document.documentElement.clientHeight;
	  } else if( document.body && ( document.body.clientHeight ) ) {
		//IE 4 compatible
		myHeight = document.body.clientHeight;
	  }
	return myHeight;
}

function updCourier(dd, ic)
{
	//alert("updCourier:" + dd + ", " + ic);
	/*
	if (ic) return;

	if (dd)
	{
		parent.updCourier(false, false);
		return;
	}

	if ((!courierRunning) && (window.courier) && (window.courier.location.toString().length > 1))
	{
		courierRunning = true;
		window.courier.location.replace(window.courier.location);
	}
	*/
}

