		
var ns4 = (document.layers)? 1 : 0;
var ie = (document.all)? 1 : 0;
var usr = navigator.userAgent;
var objns6 = ( usr.indexOf( 'Gecko' ) != -1 ) ? 1 : 0;
var ns6 = ( ( document.getElementById ) && ( objns6 ) ) ? 1 : 0;
var isMac = ( navigator.userAgent.indexOf( 'Mac' ) != -1 );
var brsr = ( navigator.appName.indexOf( "Netscape" ) != -1 );

 if (document.images){
                toc1on = new Image();
                toc1on.src = "main_archivos/a_1_on.gif";
                toc2on = new Image();
                toc2on.src = "main_archivos/a_2_on.gif";
                toc3on = new Image();
                toc3on.src = "main_archivos/a_3_on.gif";
	            toc4on = new Image();
                toc4on.src = "main_archivos/a_4_on.gif";
                toc5on = new Image();
                toc5on.src = "main_archivos/a_5_on.gif";

                toc6on = new Image();
                toc6on.src = "main_archivos/b_about_on.gif";
                toc7on = new Image();
                toc7on.src = "main_archivos/b_dealer_on.gif";
	            toc8on = new Image();
                toc8on.src = "main_archivos/b_support_on.gif";
                toc9on = new Image();
                toc9on.src = "main_archivos/b_events_on.gif";
                toc10on = new Image();
                toc10on.src = "main_archivos/b_store_on.gif";
				toc11on = new Image();
                toc11on.src = "main_archivos/b_community_on.gif";

			
                toc20on = new Image();
                toc20on.src = "main_archivos/b_button_on.gif";
				
                toc25on = new Image();
                toc25on.src = "main_archivos/a_6_on.gif";	
	
                toc50on = new Image();
                toc50on.src = "main_archivos/scroll_left_on.gif";	
                toc51on = new Image();
                toc51on.src = "main_archivos/scroll_right_on.gif";	
				
			    toc1off = new Image();
                toc1off.src = "main_archivos/a_1_off.gif";
                toc2off = new Image();
                toc2off.src = "main_archivos/a_2_off.gif";
                toc3off = new Image();
                toc3off.src = "main_archivos/a_3_off.gif";
	            toc4off = new Image();
                toc4off.src = "main_archivos/a_4_off.gif";
                toc5off = new Image();
                toc5off.src = "main_archivos/a_5_off.gif";
				
				
                toc6off = new Image();
                toc6off.src = "main_archivos/b_about_off.gif";
                toc7off = new Image();
                toc7off.src = "main_archivos/b_dealer_off.gif";
                toc8off = new Image();
                toc8off.src = "main_archivos/b_support_off.gif";
                toc9off = new Image();
                toc9off.src = "main_archivos/b_events_off.gif";
                toc10off = new Image();
                toc10off.src = "main_archivos/b_store_off.gif";
                toc11off = new Image();
                toc11off.src = "main_archivos/b_community_off.gif";

				
                toc20off = new Image();
                toc20off.src = "main_archivos/b_button_off.gif";
				
                toc25off = new Image();
                toc25off.src = "main_archivos/a_6_off.gif";
				
                toc50off = new Image();
                toc50off.src = "main_archivos/scroll_left_off.gif";
                toc51off = new Image();
                toc51off.src = "main_archivos/scroll_right_off.gif";
				
				scrupoff = new Image();
				scrupoff.src = "main_archivos/newsarrowup_off.gif";
				scrupon = new Image();
				scrupon.src = "main_archivos/newsarrowup_on.gif";
				scrdnoff = new Image();
				scrdnoff.src = "main_archivos/newsarrowdown_off.gif";
				scrdnon = new Image();
				scrdnon.src = "main_archivos/newsarrowdown_on.gif";
         }

function img_act(imgName) {
        if (document.images) {
                imgOn = eval(imgName + "on.src");
                document [imgName].src = imgOn;
        }}

function img_inact(imgName) {
        if (document.images) {
                imgOff = eval(imgName + "off.src");
                document [imgName].src = imgOff;
        }}
function openWin( windowURL, windowName, windowFeatures ) { 
                return window.open( windowURL, windowName, windowFeatures ) ; 
        } 

var homePage = 0;
var dimensScreen = screen.width ;

if ( document.images ) {

	toc1on = new Image();
	toc1on.src = "main_archivos/a_1_on.gif";
	toc2on = new Image();
	toc2on.src = "main_archivos/a_2_on.gif";
	toc3on = new Image();
	toc3on.src = "main_archivos/a_3_on.gif";
	toc4on = new Image();
	toc4on.src = "main_archivos/a_4_on.gif";
	toc5on = new Image();
	toc5on.src = "main_archivos/a_5_on.gif";
	
	toc6on = new Image();
	toc6on.src = "main_archivos/b_about_on.gif";
	toc7on = new Image();
	toc7on.src = "main_archivos/b_dealer_on.gif";
	toc8on = new Image();
	toc8on.src = "main_archivos/b_support_on.gif";
	toc9on = new Image();
	toc9on.src = "main_archivos/b_events_on.gif";
	toc10on = new Image();
	toc10on.src = "main_archivos/b_store_on.gif";
	toc11on = new Image();
	toc11on.src = "main_archivos/b_community_on.gif";
	
	toc20on = new Image();
	toc20on.src = "main_archivos/b_button_on.gif";
	
	toc25on = new Image();
	toc25on.src = "main_archivos/a_6_on.gif";	
	
	toc1off = new Image();
	toc1off.src = "main_archivos/a_1_off.gif";
	toc2off = new Image();
	toc2off.src = "main_archivos/a_2_off.gif";
	toc3off = new Image();
	toc3off.src = "main_archivos/a_3_off.gif";
	toc4off = new Image();
	toc4off.src = "main_archivos/a_4_off.gif";
	toc5off = new Image();
	toc5off.src = "main_archivos/a_5_off.gif";
				
	toc6off = new Image();
	toc6off.src = "main_archivos/b_about_off.gif";
	toc7off = new Image();
	toc7off.src = "main_archivos/b_dealer_off.gif";
	toc8off = new Image();
	toc8off.src = "main_archivos/b_support_off.gif";
	toc9off = new Image();
	toc9off.src = "main_archivos/b_events_off.gif";
	toc10off = new Image();
	toc10off.src = "main_archivos/b_store_off.gif";
	toc11off = new Image();
	toc11off.src = "main_archivos/b_community_off.gif";
				
	toc20off = new Image();
	toc20off.src = "main_archivos/b_button_off.gif";
	
	toc25off = new Image();
    toc25off.src = "main_archivos/a_6_off.gif";
}

var img_ar = new Array();
img_ar[0] = new Image();
img_ar[0].src = "main_archivos/a_1_off.gif";
img_ar[1] = new Image();
img_ar[1].src = "main_archivos/a_1_on.gif";
img_ar[2] = new Image();
img_ar[2].src = "main_archivos/a_2_off.gif";
img_ar[3] = new Image();
img_ar[3].src = "main_archivos/a_2_on.gif";
img_ar[4] = new Image();
img_ar[4].src = "main_archivos/a_3_off.gif";
img_ar[5] = new Image();
img_ar[5].src = "main_archivos/a_3_on.gif";
img_ar[6] = new Image();
img_ar[6].src = "main_archivos/a_4_off.gif";
img_ar[7] = new Image();
img_ar[7].src = "main_archivos/a_4_on.gif";
img_ar[8] = new Image();
img_ar[8].src =  "main_archivos/a_5_off.gif";
img_ar[9] = new Image();
img_ar[9].src =  "main_archivos/a_5_on.gif";
 
function img_act( imgName ) 
{
	if ( document.images ) {
		imgOn = eval( imgName + "on.src" );
		document[imgName].src = imgOn;
	}
}

function img_inact( imgName ) {
	if ( document.images ) {
		imgOff = eval( imgName + "off.src" );
		document[imgName].src = imgOff;
	}
}

function swap_img(lyr_id , id , ar_id){
	if ( ( ie ) || ( ns6 ) )
		document.images[id].src = img_ar[ar_id].src;
	if ( ns4 )
		document.layers[lyr_id].document.images[id].src = img_ar[ar_id].src;
}
	
var moveArray = new Array( -115, -100, -80, -55, -35, -15, 0 );
var s_pos = 0;
var vrCount = 0;

function pop_vr( URL, width, height )
{
	vrCount++;
	windowWidth = width + 0;
	windowHeight = height + 25;
	if ( ie ) 
		windowWidth = windowWidth + 10;
	vrp =  window.open( '/products/pop_vr.jsp?URL=' + URL + '&width=' + width + 
		'&height=' + height, 'vrPop'+vrCount , 'width=' + windowWidth + 
		',height=' + windowHeight + 
		',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0,top=50,left=50');
	vrp.focus();
}
	
function donothing()
{}
	 
if ( ns4 ) {
	var origWidth = innerWidth;
	var origHeight = innerHeight;
}

function reDo() { 
	if ( ns4 )
		if ( innerWidth != origWidth || innerHeight != origHeight )
  	  		location.reload();
}

function OpenPopup( W, H, Name, URL )
{
	var X = 0;
	var Y = 0;
	
	if ( screen.width ) {
		X = parseInt( ( parseInt( screen.width ) - W ) / 2 );
		Y = parseInt( ( parseInt( screen.height ) - H ) / 2 );
	}
	window.open( URL, Name, "menubar=no,status=no,resizable=no,titlebar=no,scrollbars=no,screenX=" + X + 
		",left=" + X + ",screenY=" + Y + ",top=" + Y + ",width=" + W + ",height=" + H );
}

function OpenPopupScroll( W, H, Name, URL )
{
	window.open( URL, Name, "location=yes,toolbar=yes,menubar=yes,status=yes," +
		"resizable=yes,titlebar=yes,scrollbars=yes,screenX=50,left=50,screenY=50,top=50,width=" + 
		W + ",height=" + H);
}

function windowOpen( w, h, name, URL ) 
{
	newWin = window.open( URL, name, "resizable=yes,scrollbars=yes,width=" + w + ",height=" + h );
	newWin.focus();
}

function glossarywindowOpen(w,h,name,URL) {
	newWin = window.open(URL,name,"resizable=no,scrollbars=yes,width=" + w + ",height=" + h);
	newWin.focus();
}

function checkSearchSubmit() 
{
	obj = ( ( ie ) || ( ns6 ) ) ? document.searchform : document.searchPanel.document.searchform;
	obj[0].value = "nc";
	obj[1].value = "nc";
	obj[2].value = "nc";
	obj[3].value = "nc";
	if ( (  obj.cbox1.checked ) || 
		( ( !obj.cbox1.checked ) && 
		  ( !obj.cbox2.checked ) &&
		  ( !obj.cbox3.checked ) &&
		  ( !obj.cbox4.checked ) ) ) {
		obj[0].value = "jca";
		obj[1].value = "prod";
		obj[2].value = "revw";
		obj[3].value = "faq";
	} else {
		if ( obj.cbox2.checked )
			obj[1].value = "prod";
		if ( obj.cbox3.checked )
			obj[2].value = "revw";
		if ( obj.cbox4.checked )
			obj[3].value = "faq";
	}
}
var spam = 0;
var slideActiv = 1
var slideWidth = 550;
var arrowWidth = 32;
var min_x = 0;
var max_x = 0;
var right_margin = arrowWidth;



function init_prods() {
	
	min_x = client_width() - slideWidth - arrowWidth - right_margin;
	max_x = min_x + slideWidth;
	
	document.getElementById( "sliderControlLeft" ).style.left = min_x - arrowWidth;
	document.getElementById( "product_frame" ).style.left = min_x;
	document.getElementById( "product_list_1" ).style.left = -slideWidth + "px";
	document.getElementById( "product_list_2" ).style.left = "0px";
	document.getElementById( "product_list_3" ).style.left = slideWidth + "px";
	document.getElementById( "sliderControlRight" ).style.left = max_x;
	
	document.getElementById( "sliderControlLeft" ).style.visibility = "visible";
	document.getElementById( "product_frame" ).style.visibility = "visible";
	document.getElementById( "product_list_1" ).style.visibility = "visible";
	document.getElementById( "product_list_2" ).style.visibility = "visible";
	document.getElementById( "product_list_3" ).style.visibility = "visible";
	document.getElementById( "sliderControlRight" ).style.visibility = "visible";
}



function slideLeft( speed ) {

	var timeVal = (isMac && ie) ? 90 : 10;
	var speed_mult = 1;
	var	x1, x2, x3;
	
	if ( !document.all )
		speed_mult = 3;
	
	if ( slideActiv ) {
		var lp = parseInt( document.getElementById( "product_list_1" ).style.left );
		x1 = -slideWidth;
		if ( lp > -(slideWidth + slideWidth) ) 
			x1 = (lp - speed * speed_mult);
		if ( lp < -(slideWidth + slideWidth - 1) )
			x1 = -slideWidth;
		x2 = x1 + slideWidth;
		x3 = x2 + slideWidth;
		document.getElementById( "product_list_1" ).style.left = x1 + "px";
		document.getElementById( "product_list_2" ).style.left = x2 + "px";
		document.getElementById( "product_list_3" ).style.left = x3 + "px";
	}
	
	spam = setTimeout( 'slideLeft(' + speed +')', timeVal );
}



function slideRight( speed ) {

	var timeVal = (isMac && ie) ? 90 : 10;
	var speed_mult = 1;
	var	x1, x2, x3;
	
	if ( !document.all )
		speed_mult = 3;
		
	if ( slideActiv ) {
		var lp = parseInt( document.getElementById( "product_list_1" ).style.left );
		x1 = -slideWidth;
		if ( lp < 0 ) 
			x1 = (lp + speed * speed_mult);
		if ( lp > -1 )
			x1 = -slideWidth;
		x2 = x1 + slideWidth;
		x3 = x2 + slideWidth;
		document.getElementById( "product_list_1" ).style.left = x1 + "px";
		document.getElementById( "product_list_2" ).style.left = x2 + "px";
		document.getElementById( "product_list_3" ).style.left = x3 + "px";
	}
	
	spam = setTimeout( 'slideRight(' + speed +')', timeVal );
}



function stopMe() {

	slideActiv = 0;
	clearTimeout( spam );
}



function startSlide( dir, speedVal ) {

	slideActiv = 1;
	
	if ( dir == "rite" )
		slideRight( speedVal );
	if ( dir == "left" )
		slideLeft( speedVal );
}



function set_clip() {
		
	min_x = client_width() - slideWidth - arrowWidth - right_margin;
	max_x = min_x + slideWidth;

	document.getElementById( 'product_frame' ).style.clip = "rect(0px " + slideWidth + "px 50px " + 0 + "px)";
	document.getElementById( 'product_frame' ).style.width = slideWidth + "px";
	document.getElementById( 'product_frame' ).style.visibility = "visible";
	document.getElementById( 'product_frame' ).style.left = min_x + "px";
	document.getElementById( 'sliderControlLeft' ).style.left = (min_x - arrowWidth - 1) + "px";
	document.getElementById( 'sliderControlRight' ).style.left = max_x + "px";
}
function browser_type() {

	agent = navigator.userAgent.toLowerCase();
	this.major = parseInt( navigator.appVersion );
	this.minor = parseFloat( navigator.appVersion );

	this.ns = (
		(agent.indexOf( 'mozilla' ) != -1) &&
		(agent.indexOf( 'spoofer' ) == -1) &&
		(agent.indexOf( 'compatible' ) == -1) &&
		(agent.indexOf( 'opera' ) == -1) &&
		(agent.indexOf( 'webtv' ) == -1) &&
		(agent.indexOf( 'hotjava' ) == -1)
	);

	this.opera = (
		(agent.indexOf( 'mozilla' ) == -1) &&
		(agent.indexOf( 'spoofer' ) == -1) &&
		(agent.indexOf( 'compatible' ) == -1) &&
		(agent.indexOf( 'opera' ) != -1) &&
		(agent.indexOf( 'webtv' ) == -1) &&
		(agent.indexOf( 'hotjava' ) == -1)
	);

	this.ns4 = (this.ns && (this.major == 4));
	this.ns6 = (this.ns && (this.major >= 5));

	this.ie = (
		(agent.indexOf( "msie" ) != -1) &&
		(agent.indexOf( "opera" ) == -1)
	);

	this.ie4 = (
		this.ie &&
		(this.major ==  4) &&
		(agent.indexOf( "msie 4" ) != -1)
	);

	this.ie5 = (
		this.ie &&
		(this.major == 4) &&
		(agent.indexOf( "msie 5." ) != -1) &&
		(agent.indexOf( "msie 5.5" ) == -1) &&
		(agent.indexOf( "mac" ) == -1)
	);

	if ( agent.indexOf( "mac" ) != -1 )
		this.mac = 1;
	else
		this.mac = 0;
		
	this.iem5 = (
		this.ie &&
		(this.major == 4) &&
		(agent.indexOf( "msie 5." ) != -1) &&
		(agent.indexOf( "mac" ) != -1)
	);

	this.ie55 = (
		this.ie &&
		(this.major == 4) &&
		(agent.indexOf( "msie 5.5" ) != -1)
	);

	this.ie6 = (
		this.ie &&
		(this.major == 4) &&
		(agent.indexOf( "msie 6." ) != -1)
	);

	this.nsdom = (this.ns4 || this.ns6);
	this.ie5dom = (this.ie5 || this.iem5 || this.ie55);
	this.iedom = (this.ie4 || this.ie5dom || this.ie6);
	this.w3dom = (this.ns6 || this.iem5 || this.ie55 || this.ie6);
}

function client_width() {

	var	w;
	
	if ( typeof( window.innerWidth ) == 'number' )
		w = window.innerWidth;
	else {
		if ( document.documentElement && document.documentElement.clientWidth ) 
			w = document.documentElement.clientWidth;
		else
			if ( document.body && document.body.clientWidth )
				w = document.body.clientWidth;
	}
	
	return w;
}

function client_height() {

	var	h;
	
	if ( typeof( window.innerHeight ) == 'number' )
		h = window.innerHeight;
	else {
		if ( document.documentElement && document.documentElement.clientHeight ) 
			h = document.documentElement.clientHeight;
		else
			if ( document.body && document.body.clientHeight )
				h = document.body.clientHeight;
	}
	
	return h;
}

function element_position( id ) {

	if ( !(document.getElementById || document.all) )
		return null;
	
	var elem = document.getElementById( id );
	
	this.x = 0;
	this.y = 0;

	while ( elem.offsetParent ) {
		this.x += elem.offsetLeft;
		this.y += elem.offsetTop;
		elem = elem.offsetParent;
	}
}


function event_handler( e, h, b, o ) {
	
	var	obj = document;
	
	if ( o && (o != '') ) 
		obj = document.getElementById( o );
	
	if ( document.addEventListener ) {
    	obj.addEventListener( e, h, b );
		this.detach = function() {
			obj.removeEventListener( e, h, b );
		}
	}
	else if ( document.attachEvent ) {
    	obj.attachEvent( 'on' + e, aeh_ie_handler );
		this.detach = function() {
			obj.detachEvent( 'on' + e, aeh_ie_handler );
		}
	}
	
	function aeh_ie_handler() {
		h( window.event );
	}
}


function event_stop_propagation( event ) {

	if ( event.stopPropagation )	
		event.stopPropagation();
	else
		event.cancelBubble = true;
}

function event_stop_default( event ) {
	
	if ( event.preventDefault )
		event.preventDefault();
	else
		event.returnValue = false;
}

function scrollbar( gid, wid, cid, tid, bid, gri, upi, dni, axi ) {
	
	this.grip_id = gid;
	this.window_id = wid;
	this.content_id = cid;
	this.top_id = tid;
	this.bot_id = bid;
	this.axis = axi;
	this.dy = 0;
	this.elem = 0;
	this.grimg_id = gri;
	this.upimg_id = upi;
	this.dnimg_id = dni;
	this.scroll_active = false;
	this.scroll_spam = 0;
	this.scroll_delay = 10;
	this.dragging = false;

	this.recalc_layout();
}

scrollbar.prototype.begin_drag = function( elem, event ) {

	var sb_object = this;
	
	var	mm_event_handler = new event_handler( 'mousemove', sb_move_handler, true );
	var	mu_event_handler = new event_handler( 'mouseup', sb_up_handler, true );
	
	this.elem = document.getElementById( this.grip_id );
	this.dy = event.clientY;
	this.dragging = true;
	
	event_stop_propagation( event );
	event_stop_default( event );
	
	function sb_move_handler( event ) {
		
		var c, y;
	
		if ( sb_object.axis == 'vertical' ) {
			y = event.clientY - sb_object.dy;
			sb_object.dy = event.clientY;
			c = parseInt( sb_object.elem.style.top );
		}
		else {
			y = event.clientX - sb_object.dy;
			sb_object.dy = event.clientX;
			c = parseInt( sb_object.elem.style.left );
		}
		
		c += y;
			
		if ( c > sb_object.max_pos ) 
			c = sb_object.max_pos;
		if ( c < sb_object.min_pos ) 
			c = sb_object.min_pos;
	
		if ( sb_object.axis == 'vertical' )
			sb_object.elem.style.top = c + "px";
		else
			sb_object.elem.style.left = c + "px";
		
		sb_object.set_pos( c );
	
		event_stop_propagation( event );
		event_stop_default( event );
	}

	function sb_unregister_handlers() {
		sb_object.dragging = false;
		mm_event_handler.detach();
		mu_event_handler.detach();
	}

	function sb_up_handler( event ) {
		sb_unregister_handlers();
		event_stop_propagation( event );
		event_stop_default( event );
	}
}

scrollbar.prototype.recalc_layout = function() {
	
	var	obj_win = document.getElementById( this.window_id );
	var	obj_con = document.getElementById( this.content_id );
	var	obj_grp = document.getElementById( this.grip_id );
	var	pos;
	
	pos = new element_position( this.top_id );
	if ( this.axis == 'vertical' )
		this.min_pos = pos.y;
	else
		this.min_pos = pos.x;

	pos = new element_position( this.bot_id );
	if ( this.axis == 'vertical' )
		this.max_pos = pos.y - parseInt( obj_grp.style.height ) + 1;
	else
		this.max_pos = pos.x - parseInt( obj_grp.style.width ) + 1;
		
	if ( this.axis == 'vertical' )
		this.content_span = parseInt( obj_con.offsetHeight );
	else
		this.content_span = parseInt( obj_con.offsetWidth );
		
	if ( this.axis == 'vertical' )
		this.window_span = parseInt( obj_win.offsetHeight );
	else
		this.window_span = parseInt( obj_win.offsetWidth );
		
	this.grip_span = this.max_pos - this.min_pos + 1; 
	
	if ( this.content_span > this.window_span ) {
		obj_grp.style.top = this.min_pos + "px";
		obj_grp.style.visibility = 'visible';
	}
	
	obj_win.style.clip = "rect( 0px " + parseInt( obj_win.offsetWidth ) + "px " + parseInt( obj_win.offsetHeight ) + "px 0px )";
	obj_win.style.visibility = 'visible';
}

scrollbar.prototype.scroll_dec = function( sb, speed ) {

	var	obj = document.getElementById( this.grip_id );
	var	y;
	
	if ( this.scroll_active ) {
	
		if ( this.axis == 'vertical' ) 
			y = parseInt( obj.style.top );
		else 
			y = parseInt( obj.style.left );
			
		if ( y < this.max_pos )
			y++;
			
		if ( y >= this.max_pos )
			y = this.max_pos;
			
		if ( this.axis == 'vertical' )
			obj.style.top = y + 'px';
		else
			obj.style.left = y + 'px';
			
		this.set_pos( y );
	}
	
	this.scroll_spam = setTimeout( sb + '.scroll_dec(\'' + sb + '\',' + speed + ')', this.scroll_delay );
}

scrollbar.prototype.scroll_inc = function( sb, speed ) {

	var	obj = document.getElementById( this.grip_id );
	var	y;
	
	if ( this.scroll_active ) {
	
		if ( this.axis == 'vertical' ) 
			y = parseInt( obj.style.top );
		else 
			y = parseInt( obj.style.left );
			
		if ( y > this.min_pos )
			y--;
			
		if ( y < this.min_pos )
			y = this.min_pos;
			
		if ( this.axis == 'vertical' )
			obj.style.top = y + 'px';
		else
			obj.style.left = y + 'px'; 
			
		this.set_pos( y );
	}
	
	this.scroll_spam = setTimeout( sb + '.scroll_inc(\'' + sb + '\',' + speed + ')', this.scroll_delay );
}

scrollbar.prototype.set_pos = function( grip_pos ) {

	var p = -Math.floor( Math.abs( ((grip_pos - this.min_pos) * (this.content_span - this.window_span)) / this.grip_span ) * 1.01 );
	
	var o = document.getElementById( this.content_id );
	
	if ( this.axis == 'vertical' )
		o.style.top = p + "px";
	else
		o.style.left = p + "px";
}

scrollbar.prototype.start_scroll = function( sb, dir, speedVal ) {

	if ( this.dragging )
		return;
		
	this.scroll_active = 1;
	
	if ( dir == "up" || dir == "left" )
		this.scroll_dec( sb, speedVal );
	if ( dir == "dn" || dir == "right" )
		this.scroll_inc( sb, speedVal );
}

scrollbar.prototype.stop_scroll = function() {

	this.scroll_active = 0;
	clearTimeout( this.scroll_spam );
}

function PurpleMenu( text, divclass, x, y ) {

	this.menu_text = text;
	this.subiconon = null;
	this.subiconoff = null;
	this.menuid = "main";
	this.menuname = "main";
	this.selected = new Array();
	this.alignwith = null;
	
	this.prev_menu = null;
	this.prev_highlight = -1;

	this.normal_background_color = "#cccccc";
	this.highlight_background_color = "#cc0000";
	this.normal_text_color = "#000000";
	this.highlight_text_color = "#ffffff";
	
	this.separator = false;
	this.separator_color = "#000000";
	this.separator_height = 1;

	this.x = x;
	this.y = y;

	this.w = 0;
	this.h = 0;
	this.div_class = divclass;
	this.font_height = 12;
	this.font_width = 7;
	this.visible = false;
	this.parent = null;
	this.open_submenu = null;
	this.orientation = "vertical";

	this.items = new Array();
	this.num_items = 0;		
	this.max_item_length = 0;

	this.menu_window = null;
}



PurpleMenu.prototype.AddItem = function( subitem, target ) {

	var	w;
	
	this.items[this.num_items] = new Object();

	if ( typeof( subitem ) == "string" ) {
		w = subitem.length * this.font_width;
		if ( this.orientation == "vertical" ) {
			if ( w > this.max_item_length )
				this.max_item_length = w;
		}
		else
			this.max_item_length += subitem.length;
		this.items[this.num_items].item_text = subitem;
		this.items[this.num_items].item_url = target;
		this.items[this.num_items].submenu = null;
	}

	else {
		w = subitem.toString().length * this.font_width + 8;
 		if ( this.orientation == "vertical" ) {
			if ( w > this.max_item_length )
				this.max_item_length = w;
		}
		else
			this.max_item_length += subitem.length + 2;
		this.items[this.num_items].item_text = subitem.toString();
		this.items[this.num_items].item_url = target;
		this.items[this.num_items].submenu = subitem;
		subitem.parent = this;
		subitem.menuid = this.menuid + "_" + target;
		subitem.menuname = target;
	}

	this.num_items++;

	return this.num_items;
}



PurpleMenu.prototype.AlignWithElement = function( name, ofs ) {

	this.alignwith = name;
	this.alignoffs = ofs;
}



PurpleMenu.prototype.CloseSiblings = function() {

	var parent = this.parent;

	if ( parent == null )
		return;

	parent.CloseSiblings();

	for ( var i = 0;  i < parent.num_items;  i++ )
		if ( (parent.items[i].submenu != null) && (parent.items[i].submenu != this) )
			parent.items[i].submenu.HideMenu();
}



PurpleMenu.prototype.EnableSeparator = function( color, height ) {

	this.separator = true;
	this.separator_color = color;
	this.separator_height = height;

	for ( var i = 0;  i < this.num_items;  i++ )
		if ( this.items[i].submenu != null )
			this.items[i].submenu.EnableSeparator( color, height );
}



PurpleMenu.prototype.HideMenu = function() {

	if ( this.menu_window == null )
		return;

	if ( !this.visible )
		return;

	for ( var i = 0;  i < this.num_items;  i++ ) {
		this.selected[i] = false;
		if ( this.items[i].submenu != null ) {
			this.NormalBackground( i );
			this.items[i].submenu.HideMenu();
		}
	}

	this.menu_window.style.visibility = "hidden";

	this.visible = false;
}



PurpleMenu.prototype.HighlightBackground = function( ord ) {

	var	element = document.getElementById( this.menuid + ord + '_div' );

	if ( this.prev_highlight != -1 )
		this.NormalBackground( this.prev_highlight );
		
	element.style.backgroundColor = this.highlight_background_color;
	element.style.color = this.highlight_text_color;
	this.prev_highlight = ord;

	if ( element == document.getElementById( this.menuid + ord + '_subicon' ) ) 
		element.src = this.subiconon.src;

	if ( this.prev_menu != null )
		this.prev_menu.HideMenu();
	
	if ( this.items[ord].submenu != null ) {
		this.items[ord].submenu.ShowMenu();
		this.prev_menu = this.items[ord].submenu;
	}
}



PurpleMenu.prototype.NormalBackground = function( ord ) {

	if ( this.selected[ord] ) return;

	var	element = document.getElementById( this.menuid + ord + '_div' );

	element.style.backgroundColor = this.normal_background_color;
	element.style.color = this.normal_text_color;
	
	this.prev_highlight = -1;

	if ( element == document.getElementById( this.menuid + ord + '_subicon' ) )
		element.src = this.subiconoff.src;
}



PurpleMenu.prototype.SelectItem = function( ord ) {

	this.CloseSiblings();
	this.selected[ord] = true;
	this.HighlightBackground( ord );
}



PurpleMenu.prototype.SetHighlightColor = function( bg, fg ) {

	this.highlight_background_color = bg;
	this.highlight_text_color = fg;
	
	for ( var i = 0;  i < this.num_items;  i++ )
		if ( this.items[i].submenu != null )
			this.items[i].submenu.SetHighlightColor( bg, fg );
}



PurpleMenu.prototype.SetNormalColor = function( bg, fg ) {

	this.normal_background_color = bg;
	this.normal_text_color = fg;
	
	for ( var i = 0;  i < this.num_items;  i++ )
		if ( this.items[i].submenu != null )
			this.items[i].submenu.SetNormalColor( bg, fg );
}



PurpleMenu.prototype.SetOrientation = function( orientation ) {

	this.orientation = orientation;
}



PurpleMenu.prototype.SetSubmenuIcons = function( menu_on, menu_off ) {

	this.subiconon = new Image();
	this.subiconoff = new Image();

	this.subiconon.src = menu_on;
	this.subiconoff.src = menu_off;
	
	for ( var i = 0;  i < this.num_items;  i++ )
		if ( this.items[i].submenu != null )
			this.items[i].submenu.SetSubmenuIcons( menu_on, menu_off );
}



PurpleMenu.prototype.ShowMenu = function() {

	var	a_tag = "";
	var	content = "";
	var	ie = 0;
	var	agent;
	var	w;
	var	y;

	if ( this.visible ) {
		this.HideMenu();
		return;
	}

	agent = navigator.userAgent.toLowerCase();

	if ( (agent.indexOf( "msie" ) != -1) && (agent.indexOf( "opera" ) == -1) )
		ie = 1;

	this.CloseSiblings();

	if ( this.menu_window == null ) {

		this.menu_window = document.createElement( "div" );
		this.menu_window.className = this.div_class;
		
		this.w = this.max_item_length;
		this.h = (((this.font_height + this.separator_height + ie) * this.num_items) + 1);

		if ( this.alignwith == null ) {
			if ( this.x == -1 ) {
				if ( this.parent != null )
					this.x = this.parent.x + this.parent.w + 1;
				if ( this.x > (client_width() / 2) )
					this.x = this.parent.x - this.w - 1;
			}
			if ( this.y == -1 )
				if ( this.parent != null )
					for ( var i = 0;  i < this.parent.num_items;  i++ )
						if ( this.parent.items[i].submenu == this ) {
							this.y = this.parent.y + (this.parent.font_height * i);
							if ( this.parent.separator )
								this.y += ((this.parent.separator_height + ie) * i);
							break;
						}
		}
		else {
			var elem = document.getElementById( this.alignwith );
			this.x = 0;
			this.y = 0;
			while ( elem.offsetParent ) {
				this.x += elem.offsetLeft;
				this.y += elem.offsetTop;
				elem = elem.offsetParent;
			}
			elem = document.getElementById( this.alignwith );
			this.y += elem.offsetHeight;
			this.y += this.separator_height * 5;
			this.x += this.alignoffs;
		}

		this.menu_window.style.left = this.x + "px";
		this.menu_window.style.top = this.y + "px";
		this.menu_window.style.width = this.w + "px";
		this.menu_window.style.height = this.h + "px";
		this.menu_window.style.overflow = "hidden";
		this.menu_window.style.backgroundColor = this.normal_background_color;
		this.menu_window.style.color = this.normal_text_color;

		for ( var i = 0;  i < this.num_items;  i++ ) {
			if ( this.items[i].submenu == null ) {
				a_tag = '<a ' +
					'href="' +
						this.items[i].item_url +
					'" ' +
					'style="color:' + this.normal_text_color + ';text-decoration:none;"' +
				'>';
			}
			else {
				a_tag = '<a ' +
					'href="' +
						'javascript:' + this.items[i].item_url + '.ShowMenu();' +
					'" ' +
					'style="color:' + this.normal_text_color + ';text-decoration:none;"' +
				'>';
			}
			content = content + a_tag + '<div id="' + this.menuid + i + '_div" onmouseover="' + this.menuname + '.HighlightBackground(' + i + ');">';
			content = content + this.items[i].item_text;
			if ( (this.subiconoff != null) && (this.items[i].submenu != null) )
				content = content + '<div id="' + this.menuid + i + '_div_subicon" style="position:absolute;"><img style="border:none;" id="' + this.menuid + i + '_subicon" name="' + this.menuid + i + '_subicon" src="' + this.subiconoff.src + '"></div>';
			content = content + '</div></a>';
			if ( this.separator && i < (this.num_items - 1) )
				content = content + '<div id="' + this.menuid + i + '"_div_separator" style="font:1px verdana;font-weight:normal;background-color:' + this.separator_color + ';height:' + this.separator_height + 'px;border:none;"></div>';
		}

		this.menu_window.innerHTML = content;

		document.body.appendChild( this.menu_window );
	}

	this.menu_window.style.visibility = "visible";
	this.visible = true;
	
	for ( i = y = 0;  i < this.num_items;  i++ ) {
		if ( this.items[i].submenu != null ) {
			elem = document.getElementById( this.menuid + i + "_div_subicon" );
			elem.style.left = this.w - 15 + "px";
			elem.style.width = "15px";
			elem.style.top = y + "px";
		}
		y += this.font_height;
		if ( this.separator )
			y += this.separator_height + ie;
	}
}



PurpleMenu.prototype.toString = function() {

	return this.menu_text;
}



PurpleMenu.prototype.valueOf = function() {

	return this.menu_text;
}

// Main Menu
var menu_main = new PurpleMenu( "Main", "purple_menu_main", -1, -1 );

// Main Submenus
var menu_audio = new PurpleMenu( "Audio", "purple_menu", -1, -1 );
var menu_video = new PurpleMenu( "Video", "purple_menu", -1, -1 );
var menu_telev = new PurpleMenu( "Televisions", "purple_menu", -1, -1 );
var menu_mobil = new PurpleMenu( "Mobile", "purple_menu", -1, -1 );
var menu_acces = new PurpleMenu( "Accessories", "purple_menu", -1, -1 );

// Main/Audio Submenus
var	menu_audio_hts = new PurpleMenu( "Home Theater", "purple_menu", -1, -1 );
var	menu_audio_porta = new PurpleMenu( "Portable Audio", "purple_menu", -1, -1 );

// Main/Video Submenus
var	menu_video_camcorders = new PurpleMenu( "Camcorders", "purple_menu", -1, -1 );
var	menu_video_vcrs = new PurpleMenu( "VCRs", "purple_menu", -1, -1 );

// Main/Televisions Submenus
var	menu_telev_tvcombos = new PurpleMenu( "TV Combos", "purple_menu", -1, -1 );
var	menu_telev_specialty = new PurpleMenu( "Specialty Televisions", "purple_menu", -1, -1 );
var	menu_telev_digital = new PurpleMenu( "Digital Television", "purple_menu", -1, -1 );

// Main/Mobile Submenus
var	menu_mobil_cdreceivers = new PurpleMenu( "CD Receivers", "purple_menu", -1, -1 );
var	menu_mobil_avsystems = new PurpleMenu( "Audio Video Systems", "purple_menu", -1, -1 );
var	menu_mobil_mobilespeakers = new PurpleMenu( "Mobile Speakers", "purple_menu", -1, -1 );
var	menu_mobil_marine = new PurpleMenu( "Marine", "purple_menu", -1, -1 );

// Main/Accessories Submenus
var	menu_acces_recordingmedia = new PurpleMenu( "Recording Media", "purple_menu", -1, -1 );

// Populate Audio Menu
menu_audio.AlignWithElement( "td_audio", 0 );
menu_audio.AddItem( "AV Receivers", "/product.jsp?productId=PRD1000000" );
menu_audio.AddItem( "Cassette Decks", "/product.jsp?productId=PRD1400000" );
menu_audio.AddItem( "CD Players", "/product.jsp?productId=PRD1600000" );
menu_audio.AddItem( "Executive Stereos", "/product.jsp?productId=PRD2200000" );
menu_audio.AddItem( "Headphones", "/product.jsp?productId=PRD0200000" );
menu_audio.AddItem( menu_audio_hts, "menu_audio_hts" );
menu_audio.AddItem( "Mega CD Changers", "/product.jsp?productId=PRD2600000" );
menu_audio.AddItem( "Microphones", "/product.jsp?productId=PRD0400000" );
menu_audio.AddItem( "Mini Systems", "/product.jsp?productId=PRD3000000" );
menu_audio.AddItem( "Personal CD Players", "/product.jsp?productId=PRD3400000" );
menu_audio.AddItem( menu_audio_porta, "menu_audio_porta" );
menu_audio.AddItem( "Ultra Micro Systems", "/product.jsp?productId=PRD4400000" );

// Populate Audio/Home Theater Systems Menu
menu_audio_hts.AddItem( "Home Theater Systems", "/product.jsp?productId=PRD2401000" );
menu_audio_hts.AddItem( "Rack Systems", "/product.jsp?productId=PRD2402000" );
		
// Populate Audio/Portable Audio Menu
menu_audio_porta.AddItem( "Fashion Series", "/product.jsp?productId=PRD3602000" );

// Populate Video Menu
menu_video.AlignWithElement( "td_video", -12 );
menu_video.AddItem( menu_video_camcorders, "menu_video_camcorders" );
menu_video.AddItem( "High Def Cam", "/product.jsp?modelId=MODL027075" );
menu_video.AddItem( "Digital Still Cameras", "/product.jsp?productId=PRD1700000" );
menu_video.AddItem( "Digital Video Printers", "/product.jsp?productId=PRD1800000" );
menu_video.AddItem( "DVD Players", "/product.jsp?productId=PRD2000000" );
menu_video.AddItem( "Satellite Systems", "/product.jsp?productId=PRD4000000" );
menu_video.AddItem( menu_video_vcrs, "menu_video_vcrs" );
menu_video.AddItem( "Video Switchers", "/product.jsp?productId=PRD0600000" );

// Populate Video/Camcorders Menu
menu_video_camcorders.AddItem( "Compact VHS Camcorders", "/product.jsp?productId=PRD1201000" );
menu_video_camcorders.AddItem( "Compact VHS Camcorders with LCD screen", "/product.jsp?productId=PRD1202000" );
menu_video_camcorders.AddItem( "Digital Cybercams", "/product.jsp?productId=PRD1203000" );
menu_video_camcorders.AddItem( "Digital Video Accessory", "/product.jsp?productId=PRD1205000" );

// Populate Video/VCRs Menu
menu_video_vcrs.AddItem( "VHS VCR", "/product.jsp?productId=PRD4601000" );
menu_video_vcrs.AddItem( "Super VHS VCR", "/product.jsp?productId=PRD4602000" );
menu_video_vcrs.AddItem( "Digital VHS VCR", "/product.jsp?productId=PRD4603000" );

// Populate Televisions Menu
menu_telev.AlignWithElement( "td_telev", -12 );
menu_telev.AddItem( "13-20 inch TV", "/product.jsp?productId=PRD4201000" );
menu_telev.AddItem( "24-27 inch TV", "/product.jsp?productId=PRD4203000" );
menu_telev.AddItem( "32-36 inch TV", "/product.jsp?productId=PRD4204000" );
menu_telev.AddItem( menu_telev_tvcombos, "menu_telev_tvcombos" );
menu_telev.AddItem( menu_telev_digital, "menu_telev_digital" );
menu_telev.AddItem( menu_telev_specialty, "menu_telev_specialty" );
menu_telev.AddItem( "Satellite Systems", "/product.jsp?productId=PRD4000000" );
menu_telev.AddItem( "Television Stands", "/product.jsp?productId=PRD4205000" );

// Populate Televisions / TV Combos Menu
menu_telev_tvcombos.AddItem( "TV / VCR Combo", "/product.jsp?productId=PRD4206100" );
menu_telev_tvcombos.AddItem( "TV / DVD Combo", "/product.jsp?productId=PRD4206200" );

// Populate Televisions / Specialty Menu
//menu_telev_specialty.AddItem( "I'Art", "/product.jsp?productId=PRD4209100" );
menu_telev_specialty.AddItem( "D - Series", "/product.jsp?productId=PRD4209200" );
//menu_telev_specialty.AddItem( "I'Art Pro", "/product.jsp?productId=PRD4209400" );

//Populate Digital Television
menu_telev_digital.AddItem( "Digital Direct View", "/product.jsp?productId=PRD4208100" );
menu_telev_digital.AddItem( "Digital Projection Television", "/product.jsp?productId=PRD4208200" );
menu_telev_digital.AddItem( "LCD and Plasma", "/product.jsp?productId=PRD4208300" );

// Populate Mobile Menu
menu_mobil.AlignWithElement( "td_mobil", -12 );
menu_mobil.AddItem( menu_mobil_cdreceivers, "menu_mobil_cdreceivers" );
menu_mobil.AddItem( "Mobile CD Changers", "/product.jsp?productId=PRD3203000" );
menu_mobil.AddItem( "Cassette Receivers", "/product.jsp?productId=PRD3204000" );
menu_mobil.AddItem( "CD Cassette Receivers", "/product.jsp?productId=PRD3206000" );
menu_mobil.AddItem( menu_mobil_avsystems, "menu_mobil_avsystems" );
menu_mobil.AddItem( "Amplifiers and Equalizers", "/product.jsp?productId=PRD3207000" );
menu_mobil.AddItem( menu_mobil_mobilespeakers, "menu_mobil_mobilespeakers" );
menu_mobil.AddItem( menu_mobil_marine, "menu_mobil_marine" );

// Populate Mobile / CD Receivers Menu
menu_mobil_cdreceivers.AddItem( "Arsenal Series", "/product.jsp?productId=PRD3201100" );
menu_mobil_cdreceivers.AddItem( "Get Personal", "/product.jsp?productId=PRD3201200" );
menu_mobil_cdreceivers.AddItem( "Regular Series", "/product.jsp?productId=PRD3201300" );

// Populate Mobile / Audio Video Systems Menu
menu_mobil_avsystems.AddItem( "AV Theater Package", "/product.jsp?productId=PRD3205400" );
menu_mobil_avsystems.AddItem( "Car AV Systems", "/product.jsp?productId=PRD3205100" );
menu_mobil_avsystems.AddItem( "LCD Monitors", "/product.jsp?productId=PRD3205200" );
menu_mobil_avsystems.AddItem( "Mobile Video Cassette", "/product.jsp?productId=PRD3205300" );
menu_mobil_avsystems.AddItem( "AV System Options", "/product.jsp?productId=PRD3205500" );

// Populate Mobile / Mobile Speakers Menu
menu_mobil_mobilespeakers.AddItem( "Coaxial Speakers", "/product.jsp?productId=PRD3208100" );
menu_mobil_mobilespeakers.AddItem( "Subwoofers", "/product.jsp?productId=PRD3208200" );
menu_mobil_mobilespeakers.AddItem( "Mid-Bass Speakers", "/product.jsp?productId=PRD3208300" );
menu_mobil_mobilespeakers.AddItem( "2-Way Separate", "/product.jsp?productId=PRD3208400" );
menu_mobil_mobilespeakers.AddItem( "Marine", "/product.jsp?productId=PRD3208500" );

// Populate Mobile / Marine Menu
menu_mobil_marine.AddItem( "Speakers", "/product.jsp?productId=PRD3209100" );

// Populate Accessories Menu
menu_acces.AlignWithElement( "td_acces", -12 );
menu_acces.AddItem( "Cables", "/product.jsp?productId=PRD0800000" );
menu_acces.AddItem( menu_acces_recordingmedia, "menu_acces_recordingmedia" );
menu_acces.AddItem( "Digital Video Acc.", "/product.jsp?productId=PRD1205000" );
menu_acces.AddItem( "Headphones", "/product.jsp?productId=PRD0200000" );
menu_acces.AddItem( "Microphones", "/product.jsp?productId=PRD0400000" );
menu_acces.AddItem( "Television Stands", "/product.jsp?productId=PRD4205000" );
menu_acces.AddItem( "Cell Phone", "/product.jsp?productId=PRD5400000" );
menu_acces.AddItem( "Video Switchers", "/product.jsp?productId=PRD0600000" );

// Accessories / Recording Media
menu_acces_recordingmedia.AddItem( "VHS / VHS-C", "/product.jsp?productId=PRD3801000" );
menu_acces_recordingmedia.AddItem( "S-VHS/S-VHS-C", "/product.jsp?productId=PRD3803000" );
menu_acces_recordingmedia.AddItem( "Digital DVHS Tapes", "/product.jsp?productId=PRD3807000" );
menu_acces_recordingmedia.AddItem( "Digital Mini DV Tapes", "/product.jsp?productId=PRD3808000" );
menu_acces_recordingmedia.AddItem( "8MM Video Tapes", "/product.jsp?productId=PRD3806000" );
menu_acces_recordingmedia.AddItem( "Audio Tapes", "/product.jsp?productId=PRD3804000" );
menu_acces_recordingmedia.AddItem( "Minidisc", "/product.jsp?productId=PRD3805000" );
menu_acces_recordingmedia.AddItem( "CD-R", "/product.jsp?productId=PRD3802000" );
menu_acces_recordingmedia.AddItem( "DVD", "/product.jsp?productId=PRD3809000" );

// Populate Main Menu
menu_main.AddItem( menu_audio, "menu_audio" );
menu_main.AddItem( menu_video, "menu_video" );
menu_main.AddItem( menu_telev, "menu_telev" );
menu_main.AddItem( menu_mobil, "menu_mobil" );
menu_main.AddItem( menu_acces, "menu_acces" );

// Main Menu is horizontally oriented (don't need to set others, vertical is default)
menu_main.SetOrientation( "horizontal" );

menu_main.EnableSeparator( "#000000", 1 );
menu_main.SetSubmenuIcons( "main_archivos/menu_dot_on.gif", "main_archivos/menu_dot_off.gif" );

// Set highlight and normal colors for main menu and all submenus
menu_main.SetNormalColor( "#cccccc", "#000000" );
menu_main.SetHighlightColor( "#cc0000", "#ffffff" );


var sb_obj;
var	news_width;
var	event_width = 140;
var	num_events = 3;
var news_height = 200;
var scroll_bar_width = 10;
var	arrow_height = 16;
		
function recalc_news_dims() {	
	var o_news_window_div = document.getElementById( 'news_window_div' );
	news_width = client_width() - (num_events * event_width) - (scroll_bar_width * (num_events + 8));
	if ( news_width < 10 )
		news_width = 10;
			
	o_news_window_div.style.width = news_width + "px";
	o_news_window_div.style.height = news_height + "px";
}
