// *** 
// WalySoft Sistemas - www.walysoft.com.ar
// *** 

var nIdStatus = null;
var nTop = 5;
var nLeft = 0;
var bHintOn = false;
var nHintWidth = 75;
var cDiv = 'helpwin';
var hwSkn = MWJ_findObj( cDiv );

var bWH_NS = (document.layers)? true:false;
var bWH_IE = (document.all)? true:false;

MWJ_monitorMouse( 
	function () {
		if( bHintOn ) 
			MWJ_changePosition( cDiv, 
								MWJ_getMouse[0] - ( nHintWidth / 2 ),
								MWJ_getMouse[1] + 18,
								true
			);
	}
);

function ScrollR()
{ 
	nLeft = nLeft + 20;
	MWJ_changePosition( cDiv, nLeft, nTop, true );
	if( nLeft < 5 ) 
   		nIdStatus = window.setTimeout( 'ScrollR()', 50 );
}

function ScrollL()
{ 
	nLeft = nLeft - 20;
	MWJ_changePosition( cDiv, nLeft, nTop, true );
	if( nLeft > -120 ) 
   		nIdStatus = window.setTimeout( 'ScrollL()', 50 )
   	else
  		MWJ_changeVisibility( cDiv, false );
}

function hintOn(msg,width)
{
  MWJ_changeVisibility( cDiv, false );
  if( nIdStatus != null ) window.clearTimeout( nIdStatus );  

  cEffect = "z-index: 5; progid:DXImageTransform.Microsoft.Fade(duration=0.6)";
  nHintWidth = width;
  
  var content = "<table width=\""+ nHintWidth +"\" class=\"wsTableHint\"";
  content += " style=' filter: progid:DXImageTransform.Microsoft.DropShadow(OffX=5, OffY=5, color=gray, Positive=true) Alpha(style=0,opacity=88)'";
  content += "><TR><TD>";
  content += "&nbsp;"+msg+"&nbsp;"
  content += "</TD></TR></TABLE>"	

  if( hwSkn.style.filter ) {
  	hwSkn.style.filter = cEffect;
  	hwSkn.filters[0].Apply();
  }

  if ( bWH_IE ) 
	hwSkn.innerHTML = content
  else
  if ( bWH_NS ) 
  { 
	hwSkn.document.write(content); 
	hwSkn.document.close();
  }
  else
	hwSkn.innerHTML = content;
  
  MWJ_changeVisibility( cDiv, true );
  if( hwSkn.style.filter ) hwSkn.filters[0].Play();
  
  bHintOn = true;
}

function pop(msg) 
{

// progid:DXImageTransform.Microsoft.

// RandomDissolve(duration=0.6)
// RandomBars(duration=0.6,orientation=horizontal)
// Fade(duration=0.6)
// Pixelate(duration=0.6,maxSquare=10)
// GradientWipe(duration=0.6,motion=reverse)

// Shadow(color=gray,direction=135,strenght=3)
// Glow(Color=red,Strength=8)
// Alpha(style=0,opacity=90)
// Shadow(color=gray,direction=135,strenght=3)
// DropShadow(OffX=5, OffY=5, Color='gray', Positive='true')

MWJ_changeVisibility( cDiv, false );
if( nIdStatus != null ) window.clearTimeout( nIdStatus );  

if( document.body.scrollTop ) 
	nTop = document.body.scrollTop + 5
else
	nTop = 5;

nLeft = -115;
MWJ_changePosition( cDiv, nLeft, nTop, true );

cEffect = "z-index: 5; progid:DXImageTransform.Microsoft.Fade(duration=0.6)";

var content = "<table class=\"wsTableWinHelp\"";
content += " style=' filter: progid:DXImageTransform.Microsoft.DropShadow(OffX=5, OffY=5, color=gray, Positive=true) Alpha(style=0,opacity=88)'>";
content += "<TR><TD class=\"wsCellTitle\" align=\"center\">Ayuda</TD></TR>"
content += "<TR><TD class=\"wsTiny\" align=\"center\">"+msg+"</TD></TR></TABLE>";

  if( hwSkn.style.filter ) {
	hwSkn.style.filter = cEffect;
  	hwSkn.filters[0].Apply();
  }

  if ( bWH_IE ) 
	document.all(cDiv).innerHTML = content
  else
  if ( bWH_NS ) 
  { 
	hwSkn.document.write(content); 
	hwSkn.document.close();
  }
  else
	hwSkn.innerHTML = content;

  MWJ_changeVisibility( cDiv, true );
  if( hwSkn.style.filter ) hwSkn.filters[0].Play();

  if( nIdStatus != null ) window.clearTimeout( nIdStatus );  

  ScrollR();
}

function kill() 
{ 
  if( nIdStatus != null ) window.clearTimeout( nIdStatus );  
  ScrollL();
}

function hintOff() 
{
  bHintOn = false;
  if( nIdStatus != null ) window.clearTimeout( nIdStatus );  
  MWJ_changeVisibility( cDiv, false );
}

function MWJ_findObj( oName, oFrame, oDoc ) {
	if( !oDoc ) { if( oFrame ) { oDoc = oFrame.document; } else { oDoc = window.document; } }
	if( oDoc[oName] ) { return oDoc[oName]; } if( oDoc.all && oDoc.all[oName] ) { return oDoc.all[oName]; }
	if( oDoc.getElementById && oDoc.getElementById(oName) ) { return oDoc.getElementById(oName); }
	for( var x = 0; x < oDoc.forms.length; x++ ) { if( oDoc.forms[x][oName] ) { return oDoc.forms[x][oName]; } }
	for( var x = 0; x < oDoc.anchors.length; x++ ) { if( oDoc.anchors[x].name == oName ) { return oDoc.anchors[x]; } }
	for( var x = 0; document.layers && x < oDoc.layers.length; x++ ) {
		var theOb = MWJ_findObj( oName, null, oDoc.layers[x].document ); if( theOb ) { return theOb; } }
	if( !oFrame && window[oName] ) { return window[oName]; } if( oFrame && oFrame[oName] ) { return oFrame[oName]; }
	for( var x = 0; oFrame && oFrame.frames && x < oFrame.frames.length; x++ ) {
		var theOb = MWJ_findObj( oName, oFrame.frames[x], oFrame.frames[x].document ); if( theOb ) { return theOb; } }
	return null;
}

function MWJ_changeVisibility( oName, oVis, oFrame ) {
	var theDiv = MWJ_findObj( oName, oFrame ); if( !theDiv ) { return; }
	if( theDiv.style ) { theDiv.style.visibility = oVis ? 'visible' : 'hidden'; } else { theDiv.visibility = oVis ? 'show' : 'hide'; }
}

function MWJ_changePosition( oName, oXPos, oYPos, oRel, oFrame ) {
	var theDiv = MWJ_findObj( oName, oFrame ); if( !theDiv ) { return; }
	if( theDiv.style ) { theDiv = theDiv.style; }
	if( typeof( oXPos ) == 'number' ) { theDiv.left = oXPos + ( oRel ? 0 : parseInt( theDiv.left ) ); }
	if( typeof( oYPos ) == 'number' ) { theDiv.top = oYPos + ( oRel ? 0 : parseInt( theDiv.top ) ); }
}

function MWJ_monitorMouse(oFunc) {
	if( document.captureEvents && Event.MOUSEMOVE ) { document.captureEvents( Event.MOUSEMOVE ); }
	window.MWJ_getMouse = [0,0]; window.MWJstoreFunc = oFunc;
	document.onmousemove = function (e) { window.MWJ_getMouse = MWJ_getMouseCoords(e); if( window.MWJstoreFunc ) { window.MWJstoreFunc(); } };
}

function MWJ_getMouseCoords(e) {
	if( !e ) { e = window.event; } if( !e || ( typeof( e.pageX ) != 'number' && typeof( e.clientX ) != 'number' ) ) { return[0,0]; }
	if( typeof( e.pageX ) == 'number' ) { var xcoord = e.pageX; var ycoord = e.pageY; } else {
		var xcoord = e.clientX; var ycoord = e.clientY;
		if( !( ( window.navigator.userAgent.indexOf( 'Opera' ) + 1 ) || ( window.ScriptEngine && ScriptEngine().indexOf( 'InScript' ) + 1 ) || window.navigator.vendor == 'KDE' ) ) {
			if( document.documentElement && ( document.documentElement.scrollTop || document.documentElement.scrollLeft ) ) {
				xcoord += document.documentElement.scrollLeft; ycoord += document.documentElement.scrollTop;
			} else if( document.body && ( document.body.scrollTop || document.body.scrollLeft ) ) {
				xcoord += document.body.scrollLeft; ycoord += document.body.scrollTop;
			} } } return [xcoord,ycoord];
}
