//////////////////////////////////////////////////////////////////
/// JD Soft.
/// jd@infdj.com
///
/// Servicio de programación de Pág.Web ---> Consulte precios <---
//////////////////////////////////////////////////////////////////


     var paridadEURO = 166.386;

     var CPU 		= new Array;	CPU[0] = 	new Array( "null", 0 );
     var MONITOR	= new Array;	MONITOR[0] = 	new Array( "null", 0 );
     var SONIDO 	= new Array;	SONIDO[0] = 	new Array( "null", 0 );
     var VIDEO 		= new Array;	VIDEO[0] = 	new Array( "null", 0 );
     var RAM 		= new Array;	RAM[0] = 	new Array( "null", 0 );
     var HD 		= new Array;	HD[0] =		new Array( "null", 0 );
     var MODEM 		= new Array;	MODEM[0] = 	new Array( "null", 0 );
     var WORM 		= new Array;	WORM[0] = 	new Array( "null", 0 );
     var CAJA 		= new Array;	CAJA[0] = 	new Array( "null", 0 );
     var IMPRESORA	= new Array;	IMPRESORA[0] = 	new Array( "null", 0 );
     var SCANNER 	= new Array;	SCANNER[0] = 	new Array( "null", 0 );
     var SCSI 		= new Array;	SCSI[0] = 	new Array( "null", 0 );
     var SAI 		= new Array;	SAI[0] = 	new Array( "null", 0 );
     var SOFTWARE	= new Array;	SOFTWARE[0] = 	new Array( "null", 0 );
     var VCONF 		= new Array;	VCONF[0] = 	new Array( "null", 0 );

     var lstr_VALIDEZ = "4ª Semana de Noviembre del 2001";

     var DEFAULTS	= new Array;	

     var defaultPB1 = "PB ELITE GROUP 133";	
     var defaultPB2 = "PB ELITE GROUP K7";
	
     var defaultRAM = "128 Mb RAM Pc133";
     var defaultHD = "HD 20Gb Seagate";
     var defaultVIDEO = "RivaTNT Vanta 8Mb";
     var defaultCAJA = "MediaTorre ATX";
     var defaultDEF = "Disquetera 3'5<br>Disipador CPU<br>Teclado 102t. Win9x<br>Raton + Alfombrilla";

     var lstr_CB1 = defaultPB1 +"<br>"+ defaultRAM +"<br>"+ defaultHD +"<br>"+ defaultVIDEO +"<br>"+ defaultCAJA +"<br>"+ defaultDEF;
     var lstr_CB2 = defaultPB2 +"<br>"+ defaultRAM +"<br>"+ defaultHD +"<br>"+ defaultVIDEO +"<br>"+ defaultCAJA +"<br>"+ defaultDEF;

     var pv_CB1 = "18500";  // Reajuste de componentes A
     var pv_CB2 = "18500";  // Reajuste de componentes B

     CPU[1] = new Array( 	"PIII 866 Mhz", 		"68000" );
     CPU[2] = new Array( 	"PIII 933 Mhz", 		"72000" );
     CPU[3] = new Array( 	"PIII 1000 Mhz", 		"75000" );
     CPU[4] = new Array( 	"PIV 1,5 Ghz", 			"88000" );
     CPU[5] = new Array( 	"Duron 850 Mhz", 		"52000" );
     CPU[6] = new Array( 	"Thun 1000 Mhz", 		"58000" );
     CPU[7] = new Array( 	"Thun 1200 Mhz", 		"60000" );
     CPU[8] = new Array( 	"XP   1600 Mhz", 		"67500" );

	for( i=1; i<5; i++ )
		CPU[i][1] = ( eval( CPU[i][1] ) + eval( pv_CB1 ) ).toString();
	for( i=5; i<9; i++ )
		CPU[i][1] = ( eval( CPU[i][1] ) + eval( pv_CB1 ) ).toString();


     MONITOR[1] = new Array( 	"15' 0'28Dig. 3 Años LG",	"20546" );	
     MONITOR[2] = new Array(  	"17' 0'28Dig. 3 Años Prodisma",	"26500" );	
     MONITOR[3] = new Array(  	"15' 0'28Dig. 3 Años Nec V520",	"24542" );	
     MONITOR[4] = new Array(  	"17' 0'28Dig. 3 Años Nec V721",	"32504" );	

     SONIDO[1] = new Array( 	"DVDx16 + SB128 PCI", 		"19900" );
     SONIDO[2] = new Array( 	"SB128 PCI", 			"12000" );	
     SONIDO[3] = new Array( 	"SB1024 PCI Live!", 		"15350" );	
     SONIDO[4] = new Array( 	"Compatible (en placa)",	 "8000" );	

     VIDEO[1] = new Array( 	"WinFast 16Mb + Gafas 3D",	"2000" );	
     VIDEO[2] = new Array( 	"GForce 2 MX 200 32Mb",		"9000" );	
     VIDEO[3] = new Array( 	"GForce 2 MX DUAL 64Mb",    	"13000" );	
     VIDEO[4] = new Array( 	"GForce 2 MX Max 64Mb", 	"14000" );	

     RAM[1] = new Array( 	"DIMM 256Mb PC133", 		"5000" );	
     RAM[2] = new Array( 	"DIMM 512Mb PC133", 		"15000" );	
     RAM[3] = new Array( 	"DIMM 256Mb DDR", 		"10000" );	
     RAM[4] = new Array( 	"DIMM 512Mb DDR", 		"21000" );	

     HD[1] = new Array( 	"20 Gb Seagate 7.200 3",	"1500" );	
     HD[2] = new Array( 	"40 Gb Seagate (3años)",	"2800" );	
     HD[3] = new Array( 	"40 Gb Seagate 7.200 3",	"7000" );	
     HD[4] = new Array( 	"40 Gb Fujistu (3años)",	"5228" );	

     MODEM[1] = new Array( 	"INT 56Kbps Creative", 		"4935" );	
     MODEM[2] = new Array( 	"INT 56Kps OEM",		"3700" );	
     MODEM[3] = new Array( 	"USB 56Kbps Accord",		"8500" );	
     MODEM[4] = new Array( 	"T.Red PCI 100Mbps", 		"4500" );	

     WORM[1] = new Array( 	"LG 16x10x40",			"19500" );	
     WORM[2] = new Array( 	"AOPEN 24x10x40", 		"23700" );	
     WORM[3] = new Array( 	"Acer 16x10x40", 		"18500" );	
     WORM[4] = new Array( 	"HP 12RI 12x4x32",	 	"29000" );	

     CAJA[1] = new Array( 	"MediaTorre ATX 400",		"6300" );	
     CAJA[2] = new Array( 	"GranTorre ATX",		"4300" );	
     CAJA[3] = new Array( 	"TRANSPARENTE", 		"13400" );	
     CAJA[4] = new Array( 	"--", 				"0" );	

     IMPRESORA[1] = new Array( 	"Stylus C.580", 		"13417" );	
     IMPRESORA[2] = new Array( 	"Stylus C.680", 		"20209" );	
     IMPRESORA[3] = new Array( 	"Stylus C.880", 		"27716" );	
     IMPRESORA[4] = new Array( 	"HP Deskjet 640c", 		"12785" );	
     IMPRESORA[5] = new Array( 	"HP Deskjet 840c", 		"17909" );	
     IMPRESORA[6] = new Array( 	"HP Deskjet 930c", 		"25793" );	
     IMPRESORA[7] = new Array( 	"Lexmark Z12", 			"12010" );	
     IMPRESORA[8] = new Array( 	"Lexmark Z32", 			"15895" );	
     IMPRESORA[9] = new Array( 	"Lexmark Z52", 			"5430" );	
     IMPRESORA[10] = new Array(	 "Laser HL-P2500", 		"70160" );	
     IMPRESORA[11] = new Array(	 "Laser HL-1030", 		"43060" );	
     IMPRESORA[12] = new Array(	 "Laser HL1240",		"49084" );	

     SCANNER[1] = new Array( 	"SCAN Mustek 600x1200", 	"10082" );	
     SCANNER[2] = new Array( 	"SCAN Mustek 1200x2400 USB", 	"21000" );	
     SCANNER[3] = new Array( 	"Scanjet HP 3.300", 		"13645" );	

     SCSI[1] = new Array( 	"Adaptec 2940 UW2", 		"41896" );	
     SCSI[2] = new Array( 	"IWill SCSI (10Mb/s)", 		"5776" );	
     SCSI[3] = new Array( 	"IWill 2935 UW 40Mb/s", 	"13880" );	

     SAI[1] = new Array( 	"SAI NGS BER 325w", 		"13500" );	
     SAI[2] = new Array( 	"SAI NGS BER 425w", 		"18000" );	
     SAI[3] = new Array( 	"SAI NGS BER 625w", 		"25000" );	

     SOFTWARE[1] = new Array( 	"Windows 98 OEM", 		"23000" );	
     SOFTWARE[2] = new Array( 	"MS-Office 2000", 		"0" );	
     SOFTWARE[3] = new Array( 	"McAfee ViruScan 5", 		"7000" );	

     VCONF[1] = new Array( 	"Miro PcTv con Teletexto",	"10475" );	
     VCONF[2] = new Array( 	"NGS TV+FM (incluye Mando Distancia)", 	"13000" );	
     VCONF[3] = new Array( 	"Descompresora RealMagic Hollywood",		"11950" );	

			function writeFormatNumber(n) { document.write( FormatNumber( n ) ); }

			function FormatNumber(n) 
			{
				var t = "";
				var i, j = 0;
				for (i = n.length - 1; i >= 0; i--) {
					t = n.charAt(i) + t;
					if (i && ((++j % 3) == 0))
						t = "." + t;
				}
				return t;
			}	


//Imagenes ON/OFF
var iON = new Image();	iON.scr = "images/on.gif";
var iOFF = new Image();	iOFF.scr = "images/off.gif";

var precioTotal = 0.0;

function actualizaTotal( Nombre, linea, Grupo )
{
  precioTotal = eval(precioTotal) - eval(Grupo[Grupo[0][1]][1]);		
  document.images[Grupo[0][0]].src=iOFF.scr;
  if ( Grupo[0][0]==Nombre ) { Grupo[0][0]="null"; Grupo[0][1]=0; return; }
  document.images[Nombre].src=iON.scr;
  Grupo[0][0] = Nombre;
  Grupo[0][1] = linea;
  precioTotal = eval(Grupo[linea][1]) + eval(precioTotal);		
}

function fclick( Grupo, Nombre, linea )
{
 switch ( Grupo )
 { 
   case "cpu":		actualizaTotal( Nombre, linea, CPU );		break;
   case "monitor":	actualizaTotal( Nombre, linea, MONITOR );	break;
   case "sonido":	actualizaTotal( Nombre, linea, SONIDO );	break; 
   case "video":	actualizaTotal( Nombre, linea, VIDEO );		break;
   case "ram":		actualizaTotal( Nombre, linea, RAM );		break;
   case "hd":		actualizaTotal( Nombre, linea, HD );		break;
   case "modem":	actualizaTotal( Nombre, linea, MODEM );		break;
   case "worm":		actualizaTotal( Nombre, linea, WORM );		break;
   case "caja":		actualizaTotal( Nombre, linea, CAJA );		break;
   case "impresora":	actualizaTotal( Nombre, linea, IMPRESORA );	break;
   case "scan":		actualizaTotal( Nombre, linea, SCANNER );	break;
   case "scsi":		actualizaTotal( Nombre, linea, SCSI );		break;
   case "sai":		actualizaTotal( Nombre, linea, SAI );		break;
   case "videoconf":	actualizaTotal( Nombre, linea, VCONF );		break;
   case "software":	actualizaTotal( Nombre, linea, SOFTWARE );	break;
}
 ActualizaTOTAL();
}

function ActualizaTOTAL()
{
 var MSG = "TOTAL:   " + FormatNumber( precioTotal.toString()  ) + " +IVA  (" + FormatNumber( Math.round(eval(precioTotal)*1.16).toString()  ) +" Ptas)";
 window.status = MSG;
 document.FINAL.T1.value = MSG;
}

 var msg;

var MegaCadena = new String;
function generaPresupuesto()
{
 var baseImponible = 0;
 msg = window.open("presupuesto.htm","displayWindow","toolbar=yes,scrollbars=yes");

 MegaCadena = '<table border="0" width="100%"><tr><td width="70%">&nbsp;</td><td align="right" width="15%" >.&nbsp;</td><td align="right" width="15%" >.&nbsp;</td></tr>';   

 if ( CPU[0][1] > 0 )
 {
  anexa( '<strong>'+CPU[ CPU[0][1] ][0]+'<strong>', CPU[ CPU[0][1] ][1] );
  if ( CPU[0][1] < 5 )	
	  banexa( defaultPB1, 0 );  
  else
	  banexa( defaultPB2, 0 );
 }

//     var lstr_CB1 = defaultPB1 + defaultMEM + defaultHD + defaultSVGA + defaultCAJA + //defaultDEF;
 
 if ( RAM[0][1] > 0 )		 banexa( '<strong>'+RAM[ RAM[0][1] ][0]+'</strong>', RAM[ RAM[0][1] ][1] );
 else banexa( defaultRAM, 0 );  

 if ( HD[0][1] > 0 ) 		 banexa( '<strong>'+HD[ HD[0][1] ][0]+'</strong>', HD[ HD[0][1] ][1] );
 else banexa( defaultHD, 0 );  

 if ( VIDEO[0][1] > 0 ) 	 banexa( '<strong>'+VIDEO[ VIDEO[0][1] ][0]+'</strong>', VIDEO[ VIDEO[0][1] ][1] );
 else banexa( defaultVIDEO, 0 );  

 if ( CAJA[0][1] > 0 ) 	 	 banexa( '<strong>'+CAJA[ CAJA[0][1] ][0]+'</strong>', CAJA[ CAJA[0][1] ][1] );
 else banexa( defaultCAJA, 0 );  

 anexa( '<blockquote>'+defaultDEF+'</blockquote>', 0 );  

 ianexa( MONITOR );

 if ( SONIDO[0][1] > 0 )
 {
  anexa( '<br><strong>Kit Multimedia</strong>', 0 );
  banexa( 'CD-ROMx52 Creat.', 0 );
  banexa( 'Altavoces 120w // microfono+Auricular', 0 ); 
  banexa( SONIDO[ SONIDO[0][1] ][0], SONIDO[ SONIDO[0][1] ][1] );
//  ianexa( SONIDO );
 }
 ianexa( MODEM );
 ianexa( WORM );
 ianexa( IMPRESORA );
 ianexa( SCANNER );
 ianexa( SCSI );
 ianexa( SAI );
 ianexa( SOFTWARE );
 ianexa( VCONF );

 MegaCadena += '</table>';

 setTimeout("ShowData()", 2000);
}

function ShowData()
{
 IE4 = document.all ? 1 : 0;
 NC4 = document.layer ? 1 : 0;

 if ( IE4 ) msg.document.all.prod.innerHTML = MegaCadena;
 if ( NC4 ) msg.document.layers.prodn.innerHTML = MegaCadena;

 precioTotal2 = precioTotal / paridadEURO;

 var precioPTS = FormatNumber( precioTotal.toString() )+'<br>'+FormatNumber( Math.round(eval(precioTotal*0.16)).toString() )+'<br><strong>'+FormatNumber( Math.round(eval(precioTotal*1.16)).toString() )+'</strong>';   
 var precioEUROS = acota( precioTotal2 )+'<br>'+acota( eval(precioTotal2*0.16) )+'<br>'+acota( eval(precioTotal2*1.16) );   
 var textTOTAL = '<table border="0" width="100%"><tr><td width="20%">Base Imponible:<br>I.V.A. 16%<br>Total Presupuesto:</td><td align="right" width="15%">'+precioPTS+'</td><td align="right" width="15%">'+precioEUROS+'</td></tr></table>';

 if ( IE4 ) msg.document.all.total.innerHTML = textTOTAL;
 if ( NC4 ) msg.document.layers.totaln.innerHTML = textTOTAL;
}

function banexa( cadena, valor )
{
 anexa ( '<font color="#FFFFFF">_____</font>'+cadena, valor );
}

function ianexa( GRUPO )
{
 if ( GRUPO[0][1] > 0 )
	 anexa( GRUPO[ GRUPO[0][1] ][0], GRUPO[ GRUPO[0][1] ][1] );
}

function anexa( cadena, valor )
{
 valor2 = Math.round( eval(valor) / paridadEURO);
 if ( valor == 0 )
   anexar = '<tr><td>'+cadena+'</td><td>&nbsp;</td><td>&nbsp;</td></tr>'
 else
   anexar = '<tr><td>'+cadena+'</td><td align="right">'+FormatNumber(valor.toString())+'</td><td align="right">'+acota(valor2)+'</td></tr>';
 MegaCadena += anexar;
}

function acota( N )
{
 return Math.round(eval(N)*100) / 100;
}