/********************************************************************/
//* 
//* Este software queda suscrito a las condiciones de la licencia 
//* que se le presenta para la aceptación de dicho software.
//* En caso contrario, únicamente le concedemos el derecho a utilizar 
//* el software sólo para el uso autorizado del Servicio. 
//* Dicho software y contenido están protegidos por derechos de autor 
//* y otras leyes y tratados sobre propiedad intelectual, 
//* no pudiendo ser copiado, ni manipulado, sin autorización del titular. 
//* Nos reservamos los demás derechos sobre el software. 
//* Grupo Anaya, S.A. posee la titularidad, los derechos de autor 
//*y otros derechos de propiedad intelectual sobre dicho software.
//*
//* (c) Grupo Anaya, S.A.
/********************************************************************/


/********************************************************************/
//** CROSS BROWSING MANAGER
//* Grupo de funciones globales dependientes del navegador/Sist.Op.
//*
//*
/********************************************************************/


function CBM_typeofNavigator()
{


	if ( navigator.appName.indexOf('Microsoft')!=-1)
	{
		if ( navigator.userAgent.indexOf('MSIE 4')!=-1 )
			return 'MSIE4';
		if ( navigator.userAgent.indexOf('MSIE 5')!=-1 )
			return 'MSIE5';
		if ( navigator.userAgent.indexOf('MSIE 6')!=-1 )
			return 'MSIE6';

		return 'MSIE6';

	}

	if ( navigator.appName.indexOf('Netscape')!=-1)
	{
		if ( navigator.userAgent.indexOf('Mozilla/4.')!=-1 )
			return 'NN4';
		if ( navigator.userAgent.indexOf('Netscape/6')!=-1 )
			return 'NN6';
		if ( navigator.userAgent.indexOf('Netscape/7')!=-1 )
			return 'NN7';
		if ( navigator.userAgent.indexOf('Mozilla/5')!=-1 )
			return 'Moz5';


		return 'NN4';


	}



	return 'UNKNOWN';

}







/********************************************************************/
// Obtiene el elemento con el id determinado
// Si el elemento no es unico puede dar un error o null (en Mozilla)
// y por eso hay que utilizar getDocumentCollection
function CBM_getDocumentElement(id)
{

	var OBJ;


 	switch (CBM_typeofNavigator())
 	{
		
		case 'NN4':

			OBJ = document[id];
		break;
		
		
		case 'MSIE4':
		case 'MSIE5':

			OBJ = document.all[id];
		break;
		
		
		case 'MSIE6':
		case 'NN6':
		case 'NN7':
		case 'Moz5':
		
			OBJ = document.getElementById(id);
			
		
		break;
	}


   return OBJ;

}



/********************************************************************/
// Obtiene el elemento con el id determinado
// Si el elemento no es unico puede dar un error o null (en Mozilla)
// y por eso hay que utilizar getDocumentCollection
function CBM_getDocumentCollection(id)
{

	var OBJ;


 	switch (CBM_typeofNavigator())
 	{
		
		case 'NN4':

			OBJ = document[id];
		break;
		
		
		case 'MSIE4':
		case 'MSIE5':

			OBJ = document.all[id];
		break;
		
		
		case 'MSIE6':
		case 'NN6':
		case 'NN7':
		case 'Moz5':
		
			OBJ = document.getElementsByName(id);
			
		
		break;
	}


   return OBJ;

}







/********************************************************************/

function CBM_showLabel (id) 
{


	var objDiv = CBM_getDocumentElement(id);


 	switch (CBM_typeofNavigator())
 	{
		
		case 'NN4':
			if (typeof objDiv.visibility !='undefined') 
				objDiv.visibility="show";
			return false;
		break;
		

		default:
			if (typeof objDiv.style !='undefined') 
				objDiv.style.visibility="visible";
		

	}

	return true;




}


/********************************************************************/

function CBM_hideLabel (id) 
{


	var objDiv = CBM_getDocumentElement(id);



 	switch (CBM_typeofNavigator())
 	{
		
		case 'NN4':
			if (typeof objDiv.visibility !='undefined') 
				objDiv.visibility="hide";
			return false;
		break;
		

		default:
			if (typeof objDiv.style !='undefined') 
				objDiv.style.visibility="hidden";
		

	}

	return true;




}



/********************************************************************/
function CBM_setLabel ( id, msghtml, x0, y0 ) 
{


	if ( typeof x0 != 'undefined' && typeof y0 != 'undefined') 
	{
		xpos = x0;
		ypos = y0;
	}
	else 
	{
		xpos = 0;
		ypos = 0;
	}


	var objDiv = CBM_getDocumentElement(id);


 	switch (CBM_typeofNavigator())
 	{
		
		case 'NN4':
			objDiv.top = ypos;
			objDiv.left = xpos;

			objDiv.document.open();
			objDiv.document.write ( msghtml );
			objDiv.document.close();
		break;
		

		default:
			objDiv.style.top = ypos;
			objDiv.style.left = xpos;

			objDiv.innerHTML = msghtml;	
	}



}







/********************************************************************/


function CBM_refreshImages()
{



 	switch (CBM_typeofNavigator())
 	{
		
		case 'NN6':
		case 'NN7':
		case 'Moz5':
			for (var i=0;i<document.images.length; i++)
				document.images.item(i).src = document.images.item(i).src;
		break;
		

		default:
		

	}


return true;

}





/********************************************************************/


function CBM_moveLabelBy(id, ix, iy)
{


	var objDiv = CBM_getDocumentElement(id);

	objDiv.style.top =  objDiv.offsetTop + iy ;
	objDiv.style.left =  objDiv.offsetLeft + ix  ;



}

/********************************************************************/


function CBM_moveLabelTo(id, x, y)
{


	var objDiv = CBM_getDocumentElement(id);

	objDiv.style.top =  y ;
	objDiv.style.left =  x  ;



}
