/*
	AHR/RMA/DOA fault description listing
	
	to create a option dropbox use the following call:  
	<select name="field_name"><script language="Javascript"> document.write(fault_list("doa","en"));</script></select>
	
	Bernhard Speyer
	14/02/2003
	
*/

var display_lang = new Array();
	display_lang["en"]= 1;
	display_lang["de"]= 2;
	display_lang["fr"]= 3;
	display_lang["it"]= 4;
	display_lang["es"]= 5;
	display_lang["nl"]= 6;	
	display_lang["se"]= 7;			
	
var fault_options_rma = new Array();
//fault_options_rma[0] = "value&&English&&German&&French&&Italian&&Spanish&&Dutch";
fault_options_rma[0] = "						&&Please specify...											&&Bitte angeben...															&&S'il vous pla&icirc;t pr&eacute;ciser												&&Specificare cortesemente										&&Por favor Especifique																	&&Gaarne specificeren                                  &&Vänligen specificera";
fault_options_rma[1] = "lost password			&&lost password												&&Verlorenes Passwort														&&Mot de passe oublié																&&Password smarrita												&&La contrase ña se ha perdido															&&Wachtwoord vergeten                                        &&Glömt ditt lösenord";
fault_options_rma[2] = "missing accessories		&&missing or incorrect accessories							&&Fehlendes oder falsches Zubehör											&&Accessoire perdu ou incorrect														&&Accessori mancanti o inesatti									&&Faltan accesorios o no son los adecuados												&&Verloren of verkeerde onderdelen         &&Tillbehör saknas eller är felaktig";
fault_options_rma[3] = "missing psu/cable		&&missing or incorrect power cable or power adapter			&&Fehlendes oder falsches Netzkabel oder Netzstecker						&&Câble d'alimentation ou Adapteur perdu ou incorrect								&&Alimentatore o cavo di alimentazione mancante o inesatto		&&Fuente de alimentacion o cable de alimentacion erroneo o no incluido					&&Verloren of verkeerde kabel of adapter           &&Strömsladd eller strömadapter saknas eller är felaktig ";
fault_options_rma[4] = "module not recognised	&&module is not recognised in the unit						&&Modul wird von der Einheit nicht erkannt									&&Module non reconnu dans l'unité													&&Modulo non riconosciuto dall`unità							&&El modulo no es reconocido por la unidad												&&Module wordt niet herkend in de unit               &&Enheten känner inte modulen  ";
fault_options_rma[5] = "network performance		&&network performance is not as expected					&&Netzwerkleistung nicht den Erwartungen entsprechend						&&Performance réseaux non conforme à celle attendue									&&La performance della rete non riflette le aspettative			&&El rendimiento de la red no es el esperado											&&Netwerkprestatie is niet zoals verwacht (traag netwerk)              &&Nätverksprestanda motsvarar inte förväntningar";
fault_options_rma[6] = "channel/port fail		&&one or more ports will not function or unable to connect	&&Einer oder mehrere Ports funktionieren nicht oder können nicht verbunden 	&&1 ou plusieurs ports ne fonctionnent pas ou sont incapables de se connecter		&&Una o piu` porte non funzionano o non si connettono			&&Uno o mas puertos no funcionan o no se conectan										&&Een of meer onderdelen werken niet of het is niet mogelijk deze aan te sluiten      &&En eller flera portar fungerar inte eller kan inte etablera kontakten ";
fault_options_rma[7] = "damaged packaging		&&physical damage to the packaging							&&Schaden an der Verpackung													&&Embalage endommagé																&&Imballaggio danneggiato										&&Envoltorio o caja dañada fisicamente													&&Verpakking is beschadigd               &&Förpackningen är skadad";
fault_options_rma[8] = "physical damage			&&physical damage to unit									&&Schaden am Gerät															&&Unité physique endommagée															&&Unità danneggiata												&&La unidad esta dañada fisicamente														&&Unit is beschadigd           &&Enheten är skadad";
fault_options_rma[9] = "can't access UI			&&unable to access unit's management user interface			&&Auf das Benutzer-Management-Interface kann nicht zugegriffen werden		&&Impossible d'accéder à l'interface de management de l'unité						&&Incapace di accedere all`interfaccia di gestione dell`unità	&&No se puede acceder al interfase de administracion de la unidad						&&Niet mogelijk toegang te krijgen tot de gebruikersinterface           &&Kommer inte åt enhetens management interface";
fault_options_rma[10] = "noisy unit				&&unit has become noisy										&&Gerät ist sehr laut														&&L'unité est devenue bruyante														&&Unità divenuta rumorosa										&&La unidad se ha vuelto ruidosa														&&Unit maakt lawaai            &&Enheten har börjat låta     ";
fault_options_rma[11] = "unit locks up			&&unit locks-up, freezes or hangs							&&Gerät reagiert nicht oder hängt											&&L'unité se bloque, stope ou ne répond plus										&&Unità si blocca mentre in funzione o non risponde				&&La unidad se bloquea o cuelga															&&Unit loopt vast, blijft hangen            &&Enheten hänger eller låser sig";
fault_options_rma[12] = "unit resets itself		&&unit resets itself for no reason							&&Gerät setzt sich grundlos selbst zurück									&&L'unité  redémarre sans aucune raison												&&Unità si riavvia senza motivo									&&La unidad se reinicia sin razon aparente												&&Unit reset automatisch zonder reden				 &&Enheten startar om sig själv utan någon orsak";
fault_options_rma[13] = "fails pwrup/self tst	&&unit will not power up or failed power on self test (post)&&Gerät fährt nicht hoch oder passiert nicht erfolgreich den Selbsttest		&&L'unité ne démarre pas ou échoue le 'Power On Self Test' (POST)					&&L'unità non si avvia o ha fallito il Power On Self Test		&&La unidad no se enciende o falla el autotest de arranque								&&Unit start niet op         &&Enheten startar inte eller självtestet går inte genom";
fault_options_rma[14] = "upgrade failed			&&upgrade process failed & unable to recover unit			&&Upgrade-Prozess fehlgeschlagen & Gerät kann nicht zurückgesetzt werden	&&Procédure de mise à jour n'as pas fonctionné & impossible de récupérer l'unité	&&Processo di Upgrade fallito e unità incapace di fare recovery	&&La actualizacion del codigo de la unidad fallo y la unidad es ahora irrecuperable		&&Upgrade proces mislukt & unit werkt niet meer				 &&Uppdateringsprocessen misslyckades och enheten är oandvändbar	";
fault_options_rma[15] = "OTHER&&				other, please describe										&&Sonstiges, bitte spezifizieren 											&&Autre,  décrivez nous le problème, s'il vous plait								&&Altro: per favore descrivere									&&Otra razon, por favor, describala														&&Overig, graag hieronder beschrijven             &&Annat, vänligen beskriv";


var fault_options_doa = new Array();
// fault_options[x] = "value && english && german && french && spanish && italian &&Dutch";
fault_options_doa[0] = "						&&Please specify...											&&Bitte angeben...															&&S'il vous pla&icirc;t pr&eacute;ciser												&&Specificare cortesemente										&&Por favor Especifique																	&&Gaarne specificeren                           &&Vänligen specificera";
fault_options_doa[1] = "lost password			&&lost password												&&Verlorenes Passwort														&&Mot de passe oublié																&&Password smarrita												&&La contrase ña se ha perdido															&&Wachtwoord vergeten                                 &&Glömt ditt lösenord";
fault_options_doa[2] = "missing accessories		&&missing or incorrect accessories							&&Fehlendes oder falsches Zubehör											&&Accessoire perdu ou incorrect														&&Accessori mancanti o inesatti									&&Faltan accesorios o no son los adecuados												&&Verloren of verkeerde onderdelen            &&Tillbehör saknas eller är felaktig";
fault_options_doa[3] = "missing psu/cable		&&missing or incorrect power cable or power adapter			&&Fehlendes oder falsches Netzkabel oder Netzstecker						&&Câble d'alimentation ou Adapteur perdu ou incorrect								&&Alimentatore o cavo di alimentazione mancante o inesatto		&&Fuente de alimentacion o cable de alimentacion erroneo o no incluido					&&Verloren of verkeerde kabel of adapter            &&Strömsladd eller strömadapter saknas eller är felaktig ";
fault_options_doa[4] = "module not recognised	&&module is not recognised in the unit						&&Modul wird von der Einheit nicht erkannt									&&Module non reconnu dans l'unité													&&Modulo non riconosciuto dall`unità							&&El modulo no es reconocido por la unidad												&&Module wordt niet herkend in de unit             &&Enheten känner inte modulen  ";
fault_options_doa[5] = "network performance		&&network performance is not as expected					&&Netzwerkleistung nicht den Erwartungen entsprechend						&&Performance réseaux non conforme à celle attendue									&&La performance della rete non riflette le aspettative			&&El rendimiento de la red no es el esperado											&&Netwerkprestatie is niet zoals verwacht (traag netwerk)             &&Nätverksprestanda motsvarar inte förväntningar";
fault_options_doa[6] = "channel/port fail		&&one or more ports will not function or unable to connect	&&Einer oder mehrere Ports funktionieren nicht oder können nicht verbunden 	&&1 ou plusieurs ports ne fonctionnent pas ou sont incapables de se connecter		&&Una o piu` porte non funzionano o non si connettono			&&Uno o mas puertos no funcionan o no se conectan										&&Een of meer onderdelen werken niet of het is niet mogelijk deze aan te sluiten  &&En eller flera portar fungerar inte eller kan inte etablera kontakten ";
fault_options_doa[7] = "damaged packaging		&&physical damage to the packaging							&&Schaden an der Verpackung													&&Embalage endommagé																&&Imballaggio danneggiato										&&Envoltorio o caja dañada fisicamente													&&Verpakking is beschadigd              &&Förpackningen är skadad";
fault_options_doa[8] = "physical damage			&&physical damage to unit									&&Schaden am Gerät															&&Unité physique endommagée															&&Unità danneggiata												&&La unidad esta dañada fisicamente														&&Unit is beschadigd             &&Enheten är skadad";
fault_options_doa[9] = "can't access UI			&&unable to access unit's management user interface			&&Auf das Benutzer-Management-Interface kann nicht zugegriffen werden		&&Impossible d'accéder à l'interface de management de l'unité						&&Incapace di accedere all`interfaccia di gestione dell`unità	&&No se puede acceder al interfase de administracion de la unidad						&&Niet mogelijk toegang te krijgen tot de gebruikersinterface            &&Kommer inte åt enhetens management interface";
fault_options_doa[10] = "noisy unit				&&unit has become noisy										&&Gerät ist sehr laut														&&L'unité est devenue bruyante														&&Unità divenuta rumorosa										&&La unidad se ha vuelto ruidosa														&&Unit maakt lawaai             &&Enheten har börjat låta     ";
fault_options_doa[11] = "unit locks up			&&unit locks-up, freezes or hangs							&&Gerät reagiert nicht oder hängt											&&L'unité se bloque, stope ou ne répond plus										&&Unità si blocca mentre in funzione o non risponde				&&La unidad se bloquea o cuelga															&&Unit loopt vast, blijft hangen           &&Enheten hänger eller låser sig ";
fault_options_doa[12] = "unit resets itself		&&unit resets itself for no reason							&&Gerät setzt sich grundlos selbst zurück									&&L'unité  redémarre sans aucune raison												&&Unità si riavvia senza motivo									&&La unidad se reinicia sin razon aparente												&&Unit reset automatisch zonder reden				 &&Enheten startar om sig själv utan någon orsak";
fault_options_doa[13] = "fails pwrup/self tst	&&unit will not power up or failed power on self test (post)&&Gerät fährt nicht hoch oder passiert nicht erfolgreich den Selbsttest		&&L'unité ne démarre pas ou échoue le 'Power On Self Test' (POST)					&&L'unità non si avvia o ha fallito il Power On Self Test		&&La unidad no se enciende o falla el autotest de arranque								&&Unit start niet op         &&Enheten startar inte eller självtestet går inte genom";
fault_options_doa[14] = "upgrade failed			&&upgrade process failed & unable to recover unit			&&Upgrade-Prozess fehlgeschlagen & Gerät kann nicht zurückgesetzt werden	&&Procédure de mise à jour n'as pas fonctionné & impossible de récupérer l'unité	&&Processo di Upgrade fallito e unità incapace di fare recovery	&&La actualizacion del codigo de la unidad fallo y la unidad es ahora irrecuperable		&&Upgrade proces mislukt & unit werkt niet meer			 &&Uppdateringsprocessen misslyckades och enheten är oandvändbar	";
fault_options_doa[15] = "OTHER					&&other, please describe									&&Andere, bitte beschreiben Sie 											&&Autre,  décrivez nous le problème, s'il vous plait								&&Altro: per favore descrivere									&&Otra razon, por favor, describala														&&Overig, graag hieronder beschrijven          &&Annat, vänligen beskriv";

var list_type = new Array();
list_type["rma"] = fault_options_rma;
list_type["doa"] = fault_options_doa;
list_type["ahr"] = fault_options_rma;


function fault_list(list_id,lang_id) 
// list_id = doa/ahr or rma
// lang_id = en,de,fr,es,it
{
	var curr_option = new Array();
	var current_list = list_type[list_id];
	var ret = "";
	for (var i=0 ; i < current_list.length; i++)
	{
		var curr_option = current_list[i].split("&&");
		var value = curr_option[0];
		ret += ('<option value="' + curr_option[0] +'">' + curr_option[display_lang[lang_id]] +'</option> \n'); 
	}
	return ret;
}

function disable_other(optionbox,textbox)
{
	if(optionbox.selectedIndex == 15)
	{
		textbox.disabled = false;
	}
	else
	{
		textbox.value = '';
		textbox.disabled = true;
	}
}



//Validate PurchaseDate
//Takes "number of months" to check against and the "date to check"
//Returns false if purchase date is older recent than "number of months" in past, 
function checkMonthsAgo(myMonths,date_to_check)
{
//###### Get current Date
var dateGetter = new Date()
var year = dateGetter.getUTCFullYear()
var month = dateGetter.getUTCMonth() 
var day = dateGetter.getUTCDate()

//##### Get Last allowed date
month = (dateGetter.getUTCMonth() - myMonths )
if (month < 0){
	//calc correct month
	month = 11 + month 
	//calc correct year
	year --;
}
//#### Compare both dates
var last_allowed_date = new Date(year,month,day) 
//Debug Lines
//alert('last_allowed_date = ' +last_allowed_date)
//alert('date_to_check = ' +date_to_check)
	if (date_to_check < last_allowed_date){	//Older than number of months in to the past
		return false}
	else{return true							//Within the past "number of months" months
	}
}

//checks Purchase Date for DOA Forms
function checkDate(item){
var myMonths = 4;

//Get selected date from the form
myitemDay =  (eval('document.form1.'+item+'_day.selectedIndex'))
myitemMonth = (eval('document.form1.'+item+'_month.selectedIndex')) 
myitemYear = (eval('document.form1.'+item+'_year.value'))

//Create purchase date from the values in the form
var purchase_date = new Date(myitemYear,myitemMonth-1,myitemDay) 	//minus 1 because months range from 0 - 11

	//Check the purchase date is within the allowed range
	if (myitemDay && myitemMonth && myitemYear){
		//alert(myitemMonth)
		if (checkMonthsAgo(myMonths,purchase_date) == false){
			alert(field['purchase_date_error'])			//Get the message from the local translation doc
			eval('document.form1.'+item+'_day').selectedIndex  = 0;
			eval('document.form1.'+item+'_month').selectedIndex  = 0;
		}	
	}
}

//added 24 Sept 2003 incorporating 3C Numbers for Advanced Hardware Replacement Request Form 
// Create new main array. 
var my3Cnum_list = new Array();
//Format of Array is -		3Cnum, ProdDesc, 
my3Cnum_list[0] = ['',' '];
my3Cnum_list[1] = ['3CR17501-91','3Com® SuperStack® 3 Switch 48-port Layer-3 Switch'];
my3Cnum_list[2] = ['3CR17500-91','3Com® SuperStack® 3 Switch 24-port Layer-3 Switch'];
my3Cnum_list[3] = ['3C17300','3Com® SuperStack® 3 Switch 4226T 24-Port Plus 2 10/100/1000'];
my3Cnum_list[4] = ['3C17302', '3Com® SuperStack® 3 Switch 4250T 48-Port Plus 2 10/100/1000'];
my3Cnum_list[5] = ['3C17304','3Com® SuperStack® 3 Switch 4228G 24-Port Plus 2 10/100/1000 and 2 GBIC slots'];
my3Cnum_list[6] = ['3C17400','3Com® SuperStack® 3 Switch 3824 (24-port, managed, Gigabit)'];
my3Cnum_list[7] = ['3C17401','3Com® SuperStack® 3 Switch 3812'];
my3Cnum_list[8] = ['3C16478','3Com® Baseline Switch 2816 (16-port, unmanaged, Gigabit)'];
my3Cnum_list[9] = ['3C16479','3Com® Baseline Switch 2824 (24-port unmanaged, Gigabit)'];
my3Cnum_list[10] = ['3C16470','3Com® Baseline 10/100 Switch 16-Port'];
my3Cnum_list[11] = ['3C16471','3Com® Baseline 10/100 Switch 24-Port'];
my3Cnum_list[12] = ['3C16475','3Com® Baseline 10/100 Switch 24-Port Plus 2 10/100/1000'];
my3Cnum_list[13] = ['3C16476','3Com® Baseline 10/100 Switch 48-Port Plus 2 10/100/1000'];
my3Cnum_list[14] = ['3C16477','3Com® Baseline 10/100/1000 Switch 8-Port'];
my3Cnum_list[15] = ['3C16410','3Com® SuperStack® 3 Baseline Dual Speed Hub 16-Port'];
my3Cnum_list[16] = ['3C16411','3Com® SuperStack® 3 Baseline Dual Speed Hub 24-Port'];


//XRNV4 upgrade list
var my3Cnum_list2 = new Array();
//Format of Array is -		3Cnum, ProdDesc, 
my3Cnum_list2[0] = ['Please select...'];
my3Cnum_list2[1] = ['3C17700 - SuperStack 3 Switch 4900'];
my3Cnum_list2[2] = ['3C17701 - SuperStack 3 Switch 4924'];
my3Cnum_list2[3] = ['3C17702 - SuperStack 3 Switch 4900 SX'];
my3Cnum_list2[4] = ['3C17706 - SuperStack 3 Switch 4950'];
my3Cnum_list2[5] = ['3C17707 - 3Com Switch 4070'];
my3Cnum_list2[6] = ['3C17708 - 3Com Switch 4050'];
my3Cnum_list2[7] = ['3C17709 - 3Com Switch 4060'];

//XRNV4 upgrade list
var my3Cnum_list3 = new Array();
//Format of Array is -		3Cnum, ProdDesc, 
my3Cnum_list3[0] = ['Please select...'];
my3Cnum_list3[1] = ['3C17700 - SuperStack 3 Switch 4900'];
my3Cnum_list3[2] = ['3C17701 - SuperStack 3 Switch 4924'];
my3Cnum_list3[3] = ['3C17702 - SuperStack 3 Switch 4900 SX'];
my3Cnum_list3[4] = ['3C17706 - SuperStack 3 Switch 4950'];
my3Cnum_list3[5] = ['3C17707 - 3Com Switch 4070'];
my3Cnum_list3[6] = ['3C17708 - 3Com Switch 4050'];
my3Cnum_list3[7] = ['3C17709 - 3Com Switch 4060'];

//Writes the options for the country list
function my3Cnum_options()
{	
	for (j=0; j < my3Cnum_list.length; j++)
	{
		document.write('<option value="'+ my3Cnum_list[j][0] +'">' + my3Cnum_list[j][0] +'</option>')
	}		
}

function my3Cnum_tablerow()
{	
	for (j=0; j < my3Cnum_list.length; j++)
	{	
		document.write('<tr>');
		document.write('<td>' + my3Cnum_list[j][0] +'</td><td>' + my3Cnum_list[j][1] +'</td>');
		document.write('</tr>');
	}		
}


function my3Cnum_xrnv4()
{	
	for (j=0; j < my3Cnum_list2.length; j++)
	{
		document.write('<option value="'+ my3Cnum_list2[j][0] +'">' + my3Cnum_list2[j][0] +'</option>')
	}		
}

function my3Cnum_xrnv4_pt()
{	
	for (j=0; j < my3Cnum_list3.length; j++)
	{
		document.write('<option value="'+ my3Cnum_list3[j][0] +'">' + my3Cnum_list3[j][0] +'</option>')
	}		
}


