19/07/2006// ************************************************************************<br/>
// Solus S.A. Script Library<br/>
// Java Script utilities for client<br/>
// Copyright(c)2003 Solus S.A. All Rights Reserved.<br/>
// <B>Do not modify in design view. Switch to source view.</B><br/>
// ************************************************************************<br/>
// <br/>
// ************************************************************************<br/>
//	Author: Jerónimo Vargas ^_^ V<br/>
//	Date:	2001<br/>
// ************************************************************************<br/>
// <script>

// Removes checkboxes and radio buttons border
//window.attachEvent( "onload", styleInput );
if( navigator.appName!="Netscape" )
	window.attachEvent( "onload", styleMimic );
else
	window.addEventListener( "load", styleMimic,false );
//---------------------------------------------------------------------------------------
// Expands or contracts the next row of a table
function rollUpRow( oTD )
{
	
	if( sURLImageRollUp == "" )		sURLImageRollUp		= findStyleModifierValue( "td.rollUp", "background" ); //"/images/roll_up.gif";
	if( sURLImageRollDown == "" )	sURLImageRollDown	= findStyleModifierValue( "td.rollDown", "background" ); //"/images/roll_up.gif";
	
	oParent		= oTD.parentElement
	oChildren	= oParent.nextSibling;
	
	if (oChildren.currentStyle.display == "none")
	{
		oChildren.style.display	= "block";
		oTD.style.background	= sURLImageRollUp;

		for( i = 0; i < oParent.cells.length; i ++ )
			oParent.cells[i].style.borderWidth = "0px";
	}
	else
	{
		oChildren.style.display	= "none";
		oTD.style.background	= sURLImageRollDown;

		for( i = 0; i < oParent.cells.length; i ++ )
			oParent.cells[i].style.borderWidth = "1px";
	}
}	

//---------------------------------------------------------------------------------------
// Finds the modifier value of a style selector in the Stylesheets collection

function getStyleModifierValue( sSelector, sModifier )
{
	for( i = 0; i < document.styleSheets.length ; i ++ )
	{
		for( j = 0; j < document.styleSheets[i].imports.length; j ++ )
			for( k = 0; k < document.styleSheets[i].imports[j].rules.length; k ++ )
				if( document.styleSheets[i].imports[j].rules[k].selectorText.toLowerCase() == sSelector.toLowerCase())
					return document.styleSheets[i].imports[j].rules[k].style[sModifier];

		for( k = 0; k < document.styleSheets[i].rules.length; k ++ )
			if( document.styleSheets[i].rules[k].selectorText.toLowerCase() == sSelector.toLowerCase())
				return document.styleSheets[i].rules[k].style[sModifier];
	}
}

//---------------------------------------------------------------------------------------
// prints the html contents of a tag (default tag ID: "printableArea")
function printArea( sID )
{
	if( ! sID ) sID = "printableArea";

	var PrintWindow	= window.open( "about:blank", "printableArea" );
	var sHTML		= document.all[ sID ].outerHTML;

	while( PrintWindow.document.readyState != "complete" )
		continue;

	try
	{
		for( i = 0; i < document.styleSheets.length; i ++ )
		{
			if( document.styleSheets[i].href == "" )
				
				with( oStyle = PrintWindow.document.createStyleSheet() )
				{
					cssText = document.styleSheets[i].cssText;
					disabled = false;
				}

			else
				PrintWindow.document.createStyleSheet( document.styleSheets[i].href );
		}
		
		with( oStyle = PrintWindow.document.createStyleSheet() )
		{
			cssText = "#commandList, .noPrint {display: none;}";
			disabled = false;
		}
	}
	catch( oError )
	{
		if( ! confirm( "Style sheets could not be applied, continue loading?" ) ) 
			return;
	}
	
	PrintWindow.document.body.innerHTML = sHTML;

	var oDivs = PrintWindow.document.getElementsByTagName("DIV");
	for( i = 0; i < oDivs.length; i ++ )
		oDivs[i].style.overflow = "visible";
	
	PrintWindow.print();
	//PrintWindow.close();
}

//---------------------------------------------------------------------------------------
//Checks all checkboxes contained in a form, table, div or body tag.
function checkAll( oCheck )
{
	var	oParent=oCheck.parentNode.parentNode.parentNode.parentNode;

	for( i=1; i < oParent.rows.length; i++ ){
		oParent.rows[i].cells[0].childNodes[0].checked=oCheck.checked;
	}

	/*while( ! oParent )
	{
		oTemp = oTemp.parentNode;
		
		if( oTemp.tagName.toLowerCase() == "body" || oTemp.tagName.toLowerCase() == "form" || oTemp.tagName.toLowerCase() == "div" )	
			oParent = oTemp;
	}
	
	var colInput = oTemp.getElementsByTagName("input");

	for( i = 0; i < colInput.length; i ++ )
		
		if( colInput[i].type.toLowerCase() == "checkbox" )
			
			colInput[i].checked = oCheck.checked;*/
}

//---------------------------------------------------------------------------------------
//removes border and width form checkboxes and options
function styleInput()
{
	oInputs = document.getElementsByTagName("INPUT");

	for( i = 0; i < oInputs.length; i ++ )
	{
		oInput = oInputs[i];

		switch( oInput.type )
		{
			case "checkbox":
				oInput.style.border	= "none";
				oInput.style.width	= "18px";
				break;

			case "radio":
				oInput.style.border	= "none";
				oInput.style.width	= "18px";
				break;
			
			case "image":
				oInput.style.border	= "none";
				oInput.style.width	= "auto";
				break;
		}
	}
}

//---------------------------------------------------------------------------------------
// attachs events to the mimic tags.
function styleMimic()
{
	mimic_apply( document.getElementsByTagName("SPAN") );
	mimic_apply( document.getElementsByTagName("B") );
}

//---------------------------------------------------------------------------------------
// Mimic style functions
function mimic_apply( oElements )
{
	for( i = 0; i < oElements.length; i ++ )
	{
		if( oElements[ i ].className == "mimic" )
		{
			oElements[ i ].tabIndex = 0;
			
			if( navigator.appName!="Netscape" ){
				oElements[ i ].attachEvent( "onmousemove",	mimic_highlight );
				oElements[ i ].attachEvent( "onmouseout",	mimic_restore   );
				oElements[ i ].attachEvent( "onfocus",		mimic_highlight );
				oElements[ i ].attachEvent( "onblur",		mimic_restore   );
				oElements[ i ].attachEvent( "onkeydown",	mimic_click     );
			}else{
				oElements[ i ].addEventListener( "mousemove",	mimic_highlight, false );
				oElements[ i ].addEventListener( "mouseout",	mimic_restore,   false );
				oElements[ i ].addEventListener( "focus",		mimic_highlight, false );
				oElements[ i ].addEventListener( "blur",		mimic_restore,   false );
				oElements[ i ].addEventListener( "keydown",		mimic_click,     false );
			}
		}
	}
	
}

function mimic_highlight(evt)
{
	if ( !evt ) evt = window.event;
	var oElement = (evt.target) ? evt.target : evt.srcElement;

	oElement.style.textDecoration = 'underline'; 
	window.status = oElement.innerText;
}

function mimic_restore(evt)
{
	if ( !evt ) evt = window.event;
	var oElement = (evt.target) ? evt.target : evt.srcElement;

	oElement.style.textDecoration = "none";
	window.status = "";
}

function mimic_click(evt)
{		
	if ( !evt ) evt = window.event;
	var oElement = (evt.target) ? evt.target : evt.srcElement;

	while( oElement.className != "mimic" )
		oElement = oElement.parentElement;
	
	if( oElement )
		if( evt.keyCode == 13 )
		{
			oElement.click(); 
			evt.returnValue = 0;
		}
}

//---------------------------------------------------------------------------------------
// Escapes also the "+" char.

function escapex( sData )
{
	return escape( sData ).replace( "+", "%2B" ).replace( "_", "%5F" )
}

//---------------------------------------------------------------------------------------
// check for checked element in a list
function checkCount( sControl )
{
    var colInput = document.main.elements[ sControl ];

	if( typeof( colInput ) != 'undefined' )
	{
		if ( typeof( colInput.value ) == 'undefined' )
		{
			for( ilen = 0; ilen < colInput.length; ilen ++ )
			{
				if( colInput[ilen].checked )
			    {
			        return true;
			        break;
			    }
			}
		}
		else
		{
			if( colInput.checked )
			{
				return true;
			}
		}
	}
}

function checkCountControl( oControl )
{
    var colInput = oControl ;
			
    if( typeof( colInput ) != 'undefined' )
	{
		if ( typeof( colInput.value ) == 'undefined' )
		{
			for( ilen = 0; ilen < colInput.length; ilen ++ )
			{
			    if( colInput[ilen].checked )
			    {
			        return true;
			        break;
			    }
			}
		}
		else
		{
			if( colInput.checked )
			{
				return true;
			}
		}
	}
}


//---------------------------------------------------------------------------------------
// check for checked element in a list
function checkCountNumber( sControl, iCant )
{
	var colInput = document.main.elements[ sControl ];
	var i;
	i = 0;
    if( typeof( colInput ) != 'undefined' )
	{
		if ( typeof( colInput.value ) == 'undefined' )
		{
			for( ilen = 0; ilen < colInput.length; ilen ++ )
			{
			    if( colInput[ilen].checked )
					i++;
			}
		}
		else
		{
			if( colInput.checked  && iCant == 1)
			{
				return true;
			}
		}
		if (i == iCant)
			return true;
		else
			return false;
	}
}

if( document.getElementById("gridHead") )
{
	var gdridHeadTop = document.getElementById("gridHead").offsetTop;
	if( navigator.appName!="Netscape" )
		window.attachEvent( "onscroll", scrollGridHead );
	else
		window.addEventListener( "onscroll", scrollGridHead,false );
}
		
function scrollGridHead()
{
	var offset = document.body.scrollTop - gdridHeadTop;
		document.getElementById("gridHead").style.top = ( offset > 0 ? offset : 0 );
}

// ************************************************************************
// End of Code
// ************************************************************************

