function Imprimir_Experto()
{	
	var prtContent = document.getElementById('divPrint');
	var WinPrint = window.open('','','letf=0,top=0,width=500,height=500,menubar=1,titlebar=1,toolbar=1,resizable=1,scrollbars=1,status=1');

	WinPrint.document.write(prtContent.innerHTML);
	WinPrint.focus();
	//WinPrint.print();
	//WinPrint.close();
}

function Abrir_Curso(Curso) {
	//var QueVentana = window.open('http://www.cepade.es/Formacion/fr_cursos.asp?nombre=' + Curso, 'VentanaCurso','');
	var QueVentana = window.open("http://www.cepade.es/Formacion/vercursoscesta.asp?nombre='" + Curso + "'", "VentanaCurso"+Curso,"");
	document.write("<br> ----------------------------" + Curso + "---------------------------- <br><br><br><br>");
	var prtContent = QueVentana.document.getElementById('divPrint');
	document.write(prtContent.innerHTML);
	QueVentana.close();
}

function Imprimir()
{	
	var prtContent = document.getElementById('divPrint');	
	var WinPrint = window.open('','','letf=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,status=0');					
	var prtTitulo = '<font style="FONT-SIZE: 20pt; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: underline">';		
	if (document.getElementById('h_programa') != null)
	{
		prtTitulo = prtTitulo + document.getElementById('h_programa').innerHTML;
	}
	if (document.getElementById('h_titulo') != null)
	{
		prtTitulo = prtTitulo + document.getElementById('h_titulo').innerHTML;
	}
	prtTitulo = prtTitulo + '</font>';
	var aux = '';	
	if (document.getElementById('lblImporte') != null)
	{
		var prtImporte = "<BR>Importe:" + document.getElementById('lblImporte').innerHTML;
		aux = prtImporte;
	}
	if (document.getElementById('lblDescuento') != null)
	{
		var prtDescuento = "<BR>Descuento:" + document.getElementById('lblDescuento').innerHTML;
		aux = aux + prtDescuento;
	}
	if (document.getElementById('lblTotal') != null)
	{
		var prtTotal = "<BR>Total:" + document.getElementById('lblTotal').innerHTML;
		aux = aux + prtTotal;
	}
	
	var texto_ECTS = '(*)Un cr&eacute;dito ECTS equivale a 27 horas de trabajo acad&eacute;mico por parte del alumno';
	WinPrint.document.write(prtTitulo + '<BR><BR>' + prtContent.innerHTML + aux + '<BR><BR>' + texto_ECTS);	
	WinPrint.document.close();		
	WinPrint.focus();
	WinPrint.print();
	WinPrint.close();		
}

function MM_openBrWindow(theURL,winName,features) { //v2.0	
  objNuevaVentana = window.open(theURL,winName,features);
  objNuevaVentana.focus();
}

function UpdatePopUpFromField(Top,Left,Width,Height,HtmlFieldId,UpdatedPopUp)
{
	var Html;
	var HtmlFieldControl;

	HtmlFieldControl						= document.getElementById(HtmlFieldId);
	Html									= HtmlFieldControl.value;
	UpdatedPopUp.document.body.innerHTML	= Html; 
	if (UpdatedPopUp.document.styleSheets.length == 0)
	{
		for (i=0;i != document.styleSheets.length ;i++)
		{
			UpdatedPopUp.document.createStyleSheet(document.styleSheets[i].href);
		}
	}
	UpdatedPopUp.show(Left, Top, Width, Height, document.body);
}
function CreatePopUpFromField(Top,Left,Width,Height,HtmlFieldId)
{
	var ReturnedValue						= window.createPopup();
	var Html;
	var HtmlFieldControl;
	HtmlFieldControl						= document.getElementById(HtmlFieldId);
	Html									= HtmlFieldControl.value;
	ReturnedValue.document.body.innerHTML	= Html; 
	if (ReturnedValue.document.styleSheets.length == 0)
	{
		for (i=0;i != document.styleSheets.length ;i++)
		{
			ReturnedValue.document.createStyleSheet(document.styleSheets[i].href);
		}
	}
	ReturnedValue.show(Left, Top, Width, Height, document.body);
	return ReturnedValue;
}
function CreatePopUp(Top,Left,Width,Height,Html)
{
	var ReturnedValue						= window.createPopup();
	ReturnedValue.document.body.innerHTML	= Html; 
	if (ReturnedValue.document.styleSheets.length == 0)
	{
		for (i=0;i != document.styleSheets.length ;i++)
		{
			ReturnedValue.document.createStyleSheet(document.styleSheets[i].href);
		}
	}
	ReturnedValue.show(Left, Top, Width, Height, document.body);
	return ReturnedValue;
}
function OpenWindowOnCurrentExplorer(name_, width_, height_, page_) 
{
	strURL = page_;
	strWidth = width_;
	strHeight = height_;
	//Calculate screen values and center 
	iPosX = Math.round((window.screen.availWidth - strWidth)/2);
	iPosY = Math.round((window.screen.availHeight - strHeight)/2);
	window.resizeTo(strWidth,strHeight);
	window.moveTo(iPosX,iPosY);
	//Calculate navigation url
	window.navigate(page_);
}	
function OpenWindow(name_, width_, height_, page_) 
{
	strURL = page_;
	strWidth = width_;
	strHeight = height_;
	
	//Calculate screen values and center the popup
	iPosX = Math.round((window.screen.availWidth - strWidth)/2);
	iPosY = Math.round((window.screen.availHeight - strHeight)/2);
	
	window.open(strURL ,name_, 'height=' + strHeight + ', width=' + strWidth + ', status=yes,  toolbar=no, menubar=no, location=no, scrollbars=yes, top=' + iPosY + ', left=' + iPosX);	
}	

function OpenDialogWindow(name_, width_, height_, page_) 
{
	var strURL;
	var strWidth;
	var strHeight;
	var returnedVelue;
	strURL = page_;
	strWidth = width_;
	strHeight = height_;
	//Calculate screen values and center the popup
	iPosX = Math.round((window.screen.availWidth - strWidth)/2);
	iPosY = Math.round((window.screen.availHeight - strHeight)/2);
	//window.showModalDialog(strURL ,window,'dialogHeight:' + strHeight + '; dialogWidth:' + strWidth);	
	returnedVelue = window.showModalDialog(strURL ,'','dialogHeight:' + strHeight + '; dialogWidth:' + strWidth);	
	return returnedVelue;	
}		

function OpenDialog(name_, width_, height_, page_) 
{
	strURL = page_;
	strWidth = width_;
	strHeight = height_;
	
	//Calculate screen values and center the popup
	iPosX = Math.round((window.screen.availWidth - strWidth)/2);
	iPosY = Math.round((window.screen.availHeight - strHeight)/2);
	
	//'dialogHeight:' + strHeight + ', dialogWidth:' + strWidth + ', status=yes,  toolbar=no, menubar=no, location=no, scrollbars=yes, top=' + iPosY + ', left=' + iPosX);
	window.showModalDialog(strURL,window,'dialogHeight:' + strHeight + ';dialogWidth:' + strWidth);
	//window.open(strURL ,name_, 'height=' + strHeight + ', width=' + strWidth + ', status=yes,  toolbar=no, menubar=no, location=no, scrollbars=yes, top=' + iPosY + ', left=' + iPosX);	
}
function RefreshFrame(url,frame)
{
	for (var i=0;i!= window.frames.length;i++)
	{
		if (window.frames.item(i).name == frame)
		{
			window.frames.item(i).location.href = url;
		}
	} 
}		
function PrintFrame(frame)
{
	for (var i=0;i!= window.frames.length;i++)
	{
		if (window.frames.item(i).name == frame)
		{
			window.frames.item(i).window.PrintPreview();
		}
	} 
}	
function Refresh()
{
	for (var i=0;i!= window.frames.length;i++)
	{
		window.frames.item(i).window.location.href = window.frames.item(i).window.location.href;
	} 
	window.location.href = window.location.href;
}	

function DisableComboValue(obj, value)
{
	document.all(obj).selectedIndex = value;
}

function DisableRadioButtonValue(obj, RadioButtonValue)
{
	var items;
	var text;
	
	var bEncrontrado;
	items = document.getElementById(obj).all;
	bEncontrado=false;
	
	for(var i=0;i<items.length;i++)
	{
		if (items[i].tagName == "INPUT")
		{
			if (items[i].value==RadioButtonValue)
			{
				items[i].checked=true;
				break;
			}
		}
	}
}

function DisableCheckBoxValue(obj, value)
{
	document.all(obj).checked = value;
}

//Function que habilita o deshabilita la columna de checkbox de un datagrid
function select_deselect(chkVal, idVal, posMainElement) 
{ 	
	var frm = document.forms[0]
	// Loop through all elements
	for (i=0; i<frm.length; i++) 
	{
		if (idVal.indexOf ('chkAllEliminar') != -1) 
		{
			// Check if main checkbox is checked, then select or deselect datagrid checkboxes 
			if (frm.elements[i].id.indexOf('Eliminar') != -1) 
			{
				if(chkVal == true) 
				{	 
					frm.elements[i].checked = true;
				} 
				else 
				{					
					frm.elements[i].checked = false;
				}
			}
			else
			{
				frm.elements[i].checked = false;
			}
			// Work here with the Item Template's multiple checkboxes
		} 			
		else if (idVal.indexOf ('chkEliminar') != -1) 
		{
			// Check if any of the checkboxes are not checked, and then uncheck top select all checkbox
			if(frm.elements[i].checked == false) 
			{
				frm.elements[posMainElement].checked = false; //Uncheck main select all checkbox
			}
		}
	}
}

//Funcion que muestra un tooltip en un dropdownlist
function MostrarTooltip(idObject,posX,posY) 
{ 					
	var obj = document.getElementById(idObject); 
	document.getElementById("tooltip").innerHTML = obj.options[obj.selectedIndex].text;
	if(obj.options[obj.selectedIndex].value !="") 
	{
		//Formato Tooltip 
 		document.getElementById("tooltip").style.zIndex = 9999999; 
  		document.getElementById("tooltip").style.display = "inline"; 
  		document.getElementById("tooltip").style.position = "absolute"; 
 		document.getElementById("tooltip").style.border =  "ActiveBorder  1px	solid"  ; 
		document.getElementById("tooltip").style.padding =   "3px";
		document.getElementById("tooltip").style.fontSize =  "10px"; 
		document.getElementById("tooltip").style.fontFamily = "Arial,Verdana"; 
		document.getElementById("tooltip").style.backgroundColor = "LemonChiffon"; 
		document.getElementById("tooltip").style.top = posY;
		document.getElementById(idObject).offsetTop + document.getElementById(idObject).offsetHeight + "px";   
		document.getElementById("tooltip").style.left =	posX;			    
	}      
} 

//Funcion que Oculta un tooltip en un dropdownlist
function OcultarTooltip( )
{ 
	document.getElementById("tooltip").style.display = "none"; 
}

//Funcion que comprueba el EMAIL
function checkMail(cadena) {
debugger;
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(cadena))
		return true;
	else {
		alert("La direcci&amp;oacute;n de email es incorrecta.");
		return false;
	}
}

//Muestra un reloj al realizar una acción
function CursorWait()
{			
	//var RUTA_IMAGEN = VirtualPath + "/Imagenes/Comun/";	
	document.body.style.cursor = "wait";//RUTA_IMAGEN + "reloj.ico";
}