var cards_array= new Array();
//cards array

cards_array[1]= new cards_object(
								 'Carta Personale American Express',
								 '1,2,6,7',
								 '<span class="titleOfferta">10.000 punti</span>',
								 '<ul class="titleOfferta2"><li>Quota  associativa ridotta: <strong>30 euro</strong> il primo anno!<li>Bonus di <strong>10.000 punti</strong> Membership Rewards' + String.fromCharCode(174) + '.<li>Iscrizione al Club Membership Rewards automatica e gratuita il primo anno.</ul>'
								 );

cards_array[2]= new cards_object(
								 'Carta Oro American Express',
								 '1,2,6,7',
								 '<span class="titleOfferta">15.000 punti</span>',
								 '<ul class="titleOfferta2"><li>Quota  associativa ridotta: <strong>50 euro</strong> il primo anno!<li>Bonus di <strong>15.000 punti</strong> Membership Rewards' + String.fromCharCode(174) + '.<li>Iscrizione al Club Membership Rewards automatica e gratuita per il primo anno.</ul>'
								 );
cards_array[3]= new cards_object(
								 'Carta Platino American Express',
								 '1,2,3,6,7,8',
								 '<span class="titleOfferta">25.000 punti</span>',
								 '<ul class="titleOfferta2"><li>Bonus di <strong>25.000 punti</strong> Membership Rewards' + String.fromCharCode(174) + '!<li>Iscrizione al Club Membership Rewards automatica e gratuita per sempre.</ul>'
								 );

cards_array[4]= new cards_object(
								 'Alitalia Card American Express',
								 '4,5',
								 '<span class="titleOfferta">6.000 Miglia</span>',
								 '<ul class="titleOfferta2"><li>Gratuita il primo anno!<li>Bonus di <strong>6.000 Miglia</strong> Alitalia.</ul>'
								 );
cards_array[5]= new cards_object(
								 'Alitalia Card Premium American Express',
								 '4,5',
								 '<span class="titleOfferta">10.000 Miglia</span>',
								 '<ul class="titleOfferta2"><li>Gratuita il primo anno!<li>Bonus di <strong>10.000 Miglia</strong> Alitalia.</ul>'
								 );
cards_array[6]= new cards_object(
								 'Carta Business American Express',
								 '1,2,6,7',
								 '<span class="titleOfferta">15.000 punti</span>',
								 '<ul class="titleOfferta2"><li>Bonus di <strong>15.000 punti</strong> Membership Rewards' + String.fromCharCode(174) + '!<li>Iscrizione al Club Membership Rewards automatica e gratuita il primo anno.</ul>'
								 );
cards_array[7]= new cards_object(
								 'Carta Oro Business American Express',
								 '1,2,6,7',
								 '<span class="titleOfferta">18.000 punti</span>',
								 '<ul class="titleOfferta2"><li>Bonus di <strong>18.000 punti</strong> Membership Rewards' + String.fromCharCode(174) + '!<li>Iscrizione al Club Membership Rewards automatica e gratuita il primo anno.</ul>'
								 );
cards_array[8]= new cards_object(
								 'Carta Platino Business American Express',
								 '1,2,3,6,7,8',
								 '<span class="titleOfferta">25.000 punti</span>',
								 '<ul class="titleOfferta2"><li>Bonus di <strong>25.000 punti</strong> Membership Rewards' + String.fromCharCode(174) + '!<li>Iscrizione al Club Membership Rewards automatica e gratuita per sempre.</ul>'
								 );
cards_array[9]= new cards_object(
								 'Centurion',
								 '1,2,3,6,7,8',
								 '',
								 ''
								 );




	function cards_object(display_name, sel_rel,txt_sx,txt_dx){
		this.display_name = display_name;
		this.sel_rel = sel_rel;
		this.txt_sx = txt_sx;
		this.txt_dx = txt_dx;
	}
	
	function svuota_select(sel){
		num_option=document.getElementById(sel).options.length;
		for(a=num_option;a>=0;a--){
			document.getElementById(sel).options[a]=null;
		}
	}
	
	function add_option(sel, opt_text, opt_value){
		var x = document.getElementById(sel);
		var new_opt = document.createElement('option');
		new_opt.text=opt_text;
		new_opt.value=opt_value;
		try {
			x.add(new_opt,null); 
		}
		catch(ex)	{
			x.add(new_opt); 
		}
	}
	
	function fill_select(sel, options_string){
		var x = document.getElementById(sel);
		var opts_array = options_string.split(',');
		add_option(sel,'Carta','--');
		for (i in opts_array){
			option_value=opts_array[i];
			option_name=cards_array[option_value].display_name + String.fromCharCode(174);
			add_option(sel,option_name,option_value);
		}
	}
	
	function update_image(imgId, sel_value){
		document.getElementById(imgId).src = 'http://amex.ogilvy.it/eMGM/images/card_' + sel_value + '.jpg';	
	}
	
	function show_div(divId){
		if (document.getElementById(divId).style.display == 'none') {
			document.getElementById(divId).style.display = 'inline';
		}
	}
	
	function hide_div(divId){
		if (document.getElementById(divId).style.display == 'inline') {
			document.getElementById(divId).style.display = 'none';
		}
	}
	
		
	function update_divs(){
		var sel = 'sel_card_2';
		var sel1 = 'sel_card_1';
		var imgId = 'card_dx';
		
		var x = document.getElementById(sel);
		var a = document.getElementById(sel1);
		
		//update_image('card_dx',0);
		//update_image('card_sx',sel_value);
//		alert(a.selectedIndex);
	if(a.selectedIndex!=0){
		
		if(x.selectedIndex==0){
			
		hide_div('offertaDiv');
		hide_div('sendMail');
		update_image('card_dx',0);
		update_image('card_sx',a.value);
		return;
		}
		sel_value = x.value;
		
		show_div('offertaDiv');
		show_div('sendMail');
		
		update_image(imgId,sel_value);
		document.getElementById('text_sx').innerHTML=cards_array[sel_value].txt_sx;		
		document.getElementById('text_dx').innerHTML=cards_array[sel_value].txt_dx;
		if ((sel_value==4) || (sel_value==5)){
			document.getElementById('logo_member').src = 'http://amex.ogilvy.it/eMGM/images/MilleMiglia.gif';
		} else {
			document.getElementById('logo_member').src = 'http://amex.ogilvy.it/eMGM/images/img_member.gif';
		}
		
		if(x.selectedIndex!=0){
		
		
		if(x.options[x.selectedIndex].value==1){
     
     		document.getElementById('pdiv1').innerHTML="<input type='hidden' name='n' 	value='263' /> <input type='hidden' name='prod_nm' 	value='Carta Personale American Express?' /> <input type='hidden' name='ctry_prod' value='uk_premiumplus' />  <input type='hidden' name='source_cd' value='M52024XB08' />	  <input type='hidden' name='spid' 		value='A11' />				      <input type='hidden' name='gift_cd' value='IT09' />						  <input type='hidden' name='off_desc' 	value='Vi chiedo di rilasciare a mio nome la Carta Personale American Express nonch? la Carta Supplementare eventualmente richiesta. Accetto che la quota annuale, attualmente di Euro 30 per il primo anno (Euro 65 dal secondo anno), mi verr? addebitata sul primo estratto conto. Prendo atto inoltre che la quota annuale per la Carta Supplementare eventualmente richiesta, attualmente di Euro 36, non mi verr? addebitata per il primo anno.Inoltre sar? iscritto automaticamente e gratuitamente per il primo anno, al Club Membership Rewards? (la quota associativa, attualmente di ? 25, mi verr? addebitata a partire dal secondo anno).' />";	
		}else if(x.options[x.selectedIndex].value==2){
     	
     		document.getElementById('pdiv1').innerHTML="<input type='hidden' name='n' 	value='262' /><input type='hidden' name='prod_nm' 	value='Carta Oro American Express?' />			  			  <input type='hidden' name='ctry_prod' value='uk_premiumplus' />						  <input type='hidden' name='source_cd' value='M52034XB08' />						  <input type='hidden' name='spid' 		value='C11' />					      <input type='hidden' name='gift_cd' value='IT10' />						  <input type='hidden' name='off_desc' 	value='Vi chiedo di rilasciare a mio nome la Carta Oro American Express nonch? la Carta Supplementare eventualmente richiesta. Accetto che la quota annuale, attualmente di Euro 50 per il primo anno (Euro 140 dal secondo anno), mi verr? addebitata sul primo estratto conto. Prendo atto inoltre che la quota annuale per la Carta Supplementare eventualmente richiesta, attualmente di Euro 83, non mi verr? addebitata per il primo anno.Inoltre sar? iscritto automaticamente e gratuitamente per il primo anno, al Club Membership Rewards? (la quota associativa, attualmente di ? 25, mi verr? addebitata a partire dal secondo anno)..' />";	
		}else if(x.options[x.selectedIndex].value==3){
     	
     		document.getElementById('pdiv1').innerHTML="<input type='hidden' name='n' 	value='264' /> <input type='hidden' name='prod_nm' 	value='Carta Platino American Express?' />			  			  <input type='hidden' name='ctry_prod' value='uk_premiumplus' />						  <input type='hidden' name='source_cd' value='M52045XB08' />						  <input type='hidden' name='spid' 		value='NP3' />					      <input type='hidden' name='gift_cd' value='IT11' />						  <input type='hidden' name='off_desc' 	value='Vi chiedo di rilasciare a mio nome Carta Platino American Express. Prendo atto e accetto che la quota annuale, attualmente di euro 550, mi verr? addebitata sul primo estratto conto. Prendo atto che questa quota comprende anche una Carta Platino Addizionale per separare le mie spese di lavoro da quelle personali, una Carta Platino Supplementare e fino a 4 Carte Oro Supplementari.Inoltre diventer? automaticamente e gratuitamente socio del Club Membership Rewards?' />";	
		}else if(x.options[x.selectedIndex].value==4){
     	
     		document.getElementById('pdiv1').innerHTML="<input type='hidden' name='n' 	value='261' /><input type='hidden' name='prod_nm' 	value='Alitalia Card American Express?' />			  			  <input type='hidden' name='ctry_prod' value='uk_premiumplus' />						  <input type='hidden' name='source_cd' value='M52051XB08' />						  <input type='hidden' name='spid' 		value='6AL' />					      <input type='hidden' name='gift_cd' value='IT12' />						  <input type='hidden' name='off_desc' 	value='Vi chiedo di rilasciare a mio nome Alitalia Card American Express nonch? la Carta Supplementare eventualmente richiesta e prendo atto che la quota annuale, attualmente di Euro 95 per la Carta Base e di Euro 36 per la Carta Supplementare, non mi verr? addebitata per il primo anno.' />";	
		}else if(x.options[x.selectedIndex].value==5){
     	
     		document.getElementById('pdiv1').innerHTML=" <input type='hidden' name='n' 	value='260' /><input type='hidden' name='prod_nm' 	value='Alitalia Card Premium American Express?' />			  			  <input type='hidden' name='ctry_prod' value='uk_premiumplus' />						  <input type='hidden' name='source_cd' value='M52061XB08' />						  <input type='hidden' name='spid' 		value='5AL' />					      <input type='hidden' name='gift_cd' value='IT13' />						  <input type='hidden' name='off_desc' 	value='Vi chiedo di rilasciare a mio nome Alitalia Card Premium American Express nonch? la Carta Supplementare eventualmente richiesta e prendo atto che la quota annuale, attualmente di Euro 190 per la Carta Base e di Euro 83 per la Carta Supplementare, non mi verr? addebitata per il primo anno.' />";	
		}else if(x.options[x.selectedIndex].value==6){
     	
     		document.getElementById('pdiv1').innerHTML="  <input type='hidden' name='n' 	value='266' /><input type='hidden' name='prod_nm' 	value='Carta Business American Express?' />			  			  <input type='hidden' name='ctry_prod' value='uk_premiumplus' />						  <input type='hidden' name='source_cd' value='M52070XB08' />						  <input type='hidden' name='spid' 		value='H11' />					      <input type='hidden' name='gift_cd' value='IT06' />						  <input type='hidden' name='off_desc' 	value='Vi chiedo di rilasciare a mio nome Carta Business American Express nonch? la Carta Supplementare eventualmente richiesta. Prendo atto che la quota annuale, attualmente di 62 euro per la Carta Base e di euro 36 per la Carta Supplementare eventualmente richiesta, mi verr? addebitata sul primo estratto conto. Inoltre sar? iscritto automaticamente e gratuitamente per il primo anno al Club Membership Rewards? (la quota associativa, attualmente di ? 25, mi verr? addebitata a partire dal secondo anno).' />";	
		}else if(x.options[x.selectedIndex].value==7){
     	
     		document.getElementById('pdiv1').innerHTML=" <input type='hidden' name='n' 	value='265' /><input type='hidden' name='prod_nm' 	value='Carta Oro Business American Express?' />			  			  <input type='hidden' name='ctry_prod' value='uk_premiumplus' />						  <input type='hidden' name='source_cd' value='M52080XB08' />						  <input type='hidden' name='spid' 		value='K11' />					      <input type='hidden' name='gift_cd' value='IT07' />						  <input type='hidden' name='off_desc' 	value='Vi chiedo di rilasciare a mio nome Carta Oro Business American Express nonch? la Carta Supplementare eventualmente richiesta. Prendo atto che la quota annuale, attualmente di 140 euro per la Carta Base e di euro 83 per la Carta Supplementare Oro e di euro 36 per la Carta Supplementare Verde eventualmente richieste, mi verr? addebitata sul primo estratto conto.Inoltre sar? iscritto automaticamente e gratuitamente per il primo anno al Club Membership Rewards? (la quota associativa, attualmente di ? 25, mi verr? addebitata a partire dal secondo anno).' />";	
		}else if(x.options[x.selectedIndex].value==8){
     	
     		document.getElementById('pdiv1').innerHTML="<input type='hidden' name='n' 	value='267' /><input type='hidden' name='prod_nm' 	value='Carta Platino Business American Express?' />			  			  <input type='hidden' name='ctry_prod' value='uk_premiumplus' />						  <input type='hidden' name='source_cd' value='M52090XB08' />						  <input type='hidden' name='spid' 		value='XP1' />					      <input type='hidden' name='gift_cd' value='IT08' />						  <input type='hidden' name='off_desc' 	value='Vi chiedo di rilasciare a mio nome Carta Platino Business American Express nonch? le eventuali Carte Supplementari richieste. Accetto che la quota annuale, attualmente di euro 550, mi venga addebitata sul primo estratto conto e prendo atto che tale quota comprende, ove da me richiesto, una Carta Platino Business Supplementare e fino a 4 Carte Oro Business Supplementari per i miei collaboratori. Inoltre diventer? automaticamente e gratuitamente socio del Club Membership Rewards?.' />";	
		}
		
		} 
		
		}
		
		
		
	}

	function update_select(){

		var sel_2 = 'sel_card_2';
		var sel_1 = 'sel_card_1';
		var sel_value = document.getElementById(sel_1).value;
		
		hide_div('offertaDiv');
		hide_div('sendMail');
		update_image('card_dx',0);
		update_image('card_sx',sel_value);
		if (sel_value>0){
			svuota_select(sel_2);
			fill_select(sel_2,cards_array[sel_value].sel_rel);
		}
	}
	
	function open_popup(url,w,h){
		a = window.open(url,'newwin','scrollbars=yes, toolbar=no,directories=no, menu bar=no, resizable=yes, status=yes, width=' + w + ', height=' + h);
	}
	
	
	
	function focusButton(type) {
	var node = document.getElementById('validerBTN');
	if(type == 'light'){
		node.style.backgroundImage = 'url(images/arrow_1.gif)';
		node.style.color = '#5b8aaf';
		node.style.backgroundColor = '#ffffff';
		node.style.border = '1px solid #5b8aaf';
	}
	if(type == 'dark'){
		node.style.backgroundImage = 'url(images/flechebleufc.gif)';
		node.style.color = '#0E4279';
		node.style.backgroundColor = '#ffffff';
		node.style.border = '1px solid #0E4279';
	}
}
function blurButton(type) {
	var node = document.getElementById('validerBTN');
	if(type == 'light'){
		node.style.backgroundImage = 'url(images/arrow_0.gif)';
		node.style.color = '#ffffff';
		node.style.backgroundColor = '#5b8aaf';
		node.style.border = '1px solid #ffffff';
	}
	if(type == 'dark'){
		node.style.backgroundImage = 'url(images/flecheblc.gif)';
		node.style.color = '#ffffff';
		node.style.backgroundColor = '#0E4279';
		node.style.border = '1px solid #ffffff';
	}
}