function TopLinkDesc( s, info ){ 
	if( s == 1 ) re( ge( 'topinfo' ), info ); 
	else GetLocation( info ); 
}

function GetLocation( loc ){ 
	var str = 'Se encuentra usted en hextra-digital.com / ';
	var i;
	for( i = 0; i < loc.length; i++ ) { 
		str += '<span class=\"location\"><a class=\"s\" href=\"\">' + loc[ i ] + '</a></span>';
		if( i != ( loc.length - 1 ) ) str += ' / ';
	}
	re( ge( 'topinfo' ), str );
}

function GetFeature( id )
{
	var o = new ajaxobject( 'get_feature.php', FeatureCallback, id );

	var showme = document.getElementById( id );
	ajaxobject.prototype.fader = null;
	o.fader = new Fadomatic( showme, 2, 4, 0, 100 );
	o.fader.fadeOut();
	makeRequest( o );
}

function FeatureCallback( obj )
{
    if( obj.notify )
    {
        var response = obj.http_request.responseXML.documentElement;
        var i = gd( response, 'title' );
        var j = gd( response, 'image' );
        var k = gd( response, 'text' );
        re( obj.notify, '<p class=\'infotitle\'>' + i + '</p><img src=\'images/' + j + '\'/><p>' + k + '</p>' );
        obj.fader.fadeIn();
	}
}

function ResizeWindow() {
	//re( "lbbase", "<img src=\"images/snap.png\" />" );
	
	var d = ge( 'lbbase' );
	if( d )
	{		
		d.style.height = '100%';
	}
}

function getAcronym( _id ) {
	var xo = new ajaxobject( 'get_acronym.php?id=' + _id, getAcronymCallback, null );
	xo.makeRequest();
}

function getAcronymCallback( _obj ) {
	var response = _obj.http_request.responseXML.documentElement;
	var acronym = gds( response, 'acronym' );			
	if( acronym.length > 0 ) {
		var tmp = '<div class="infoblock">';
		tmp += '<h1>' + ga( acronym[ 0 ], 'id' ) + ':</h1>';
		tmp += '<p>' + ga( acronym[ 0 ], 'title' ) + '</p>'
		tmp += '<p>' + ga( acronym[ 0 ], 'trans' ) + '</p>'
		tmp += '</div>';
		
		re( ge( 'acronym_info' ), tmp );
	}
}

function snapLoader( _id, _layer ){
	this.id = _id;
	this.layer = _layer;
	this.img = new Image();
}

snapLoader.prototype.start = function(){
	var d = new Date();
	this.img.src = this.id + '?' + d.getTime();
	delete d;
	var thisPtr = this;	
	this.img.onload = function() { snapLoader.prototype.loaded( thisPtr ) };
	this.img.onerror = function() { snapLoader.prototype.error( thisPtr ) };
	this.img.onabort = function() { snapLoader.prototype.abort( thisPtr ) };
}

snapLoader.prototype.loaded = function( _obj ){	
	var t = ge( _obj.layer );	
	if( t ) { 
		t.setAttribute( 'src', _obj.img.src );
		t.setAttribute( 'width', 200 );
		t.setAttribute( 'height', 200 );
	}
}
snapLoader.prototype.error = function( _obj ){
}

snapLoader.prototype.abort = function( _obj ){
}

var snapArray = Array();
function preLoadSnap( _img, _layer ){	
	snapArray[ _layer ] = new snapLoader( _img, _layer );
	snapArray[ _layer ].start();
}