

/*** Gestion de la Carte D'indentité de chaque Chapeau ***/

function ConstructSimpleObj(obj,nest){ 
    nest=(!nest) ? '':'document.'+nest+'.' 
    this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0; 
    this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0; 
    this.changeTxt=changeTxt; 
    this.changeHTML=changeHTML; 
    this.changeImg=changeImg; 
    this.show=show; 
    this.hide=hide; 
    this.obj = obj + "Object" 
    eval(this.obj + "=this") 
    return this 
} 

function hide(){
	this.css.visibility = 'hidden';
}

function show(){
	this.css.visibility = 'visible';
}

function changeTxt(p_txt){
	this.el.innerText = p_txt
}

function changeHTML(p_txt){
	 this.el.innerHTML = p_txt
}

function changeImg(p_src){
	this.el.src = p_src;
}


function InitialiseFloatImg()
{ 
	nb_menu = 2
	imgFloat  =new Array(nb_menu);
	for (var i=0; i<nb_menu; i++) {
		menu = (i==0) ? 'h': 'e';
	    imgFloat[i]=new Object();
	    imgFloat[i].menu=menu;
	    imgFloat[i].img_index=1;
    	imgFloat[i].block=new ConstructSimpleObj('float_img_block_'+menu);
	    imgFloat[i].titre=new ConstructSimpleObj('titre_'+menu,'float_img_block_'+menu);
	    imgFloat[i].ref=new ConstructSimpleObj('ref_'+menu,'float_img_block_'+menu);
	    imgFloat[i].desc=new ConstructSimpleObj('desc_'+menu,'float_img_block_'+menu);
	    imgFloat[i].id=new ConstructSimpleObj('float_img_id_'+menu,'float_img_block_'+menu);
	    imgFloat[i].matiere=new ConstructSimpleObj('matiere_'+menu,'float_img_block_'+menu);
//			    imgFloat[i].img_ref=new ConstructSimpleObj('img_ref_'+menu,'float_img_block_'+menu);
	}
	 initImgTab();
} 

img_switch = 1;

function showFloatImg(p_img,p_menu)
{
	img_switch = 1;
	i = (p_menu == 'h') ? 0 : 1 ;
	img_tab = (p_menu == 'h') ? img_tab_h : img_tab_e ;
	imgFloat[i].img_index = p_img;
	imgFloat[i].titre.changeHTML(img_tab[p_img-1].titre);
	imgFloat[i].ref.changeHTML(img_tab[p_img-1].ref);
	imgFloat[i].desc.changeHTML(img_tab[p_img-1].desc);
	imgFloat[i].id.changeImg(img_tab[p_img-1].src1);
	imgFloat[i].matiere.changeHTML(img_tab[p_img-1].matiere);

/*	t_html=" ";
	if (img_tab[(imgFloat[i].img_index)-1].img_nb == 2)
		 t_html = '<a href="javascript:showNextImg("' + p_menu + '");" onfocus="if(this.blur)this.blur()"><IMG id="float_img_id_h" src="' + img_tab[(imgFloat[i].img_index)-1].src1 + '" border=0 alt="Cliquez pour changer de photo"  align="middle" ></a>'	 
	else  
		 t_html = '<IMG id="float_img_id_h" src="' + img_tab[(imgFloat[i].img_index)-1].src1 + '" border=0 align="middle" >'	 
		 
//	writedebug(t_html)	 
	imgFloat[i].ref.changeHTML(t_html);	
*/	imgFloat[i].block.show();	
}


function showNextImg(p_menu)
{
	i = (p_menu == 'h') ? 0 : 1 ;
	img_tab = (p_menu == 'h') ? img_tab_h : img_tab_e ;
	img_switch = img_switch + 1;
	if (img_switch > img_tab[(imgFloat[i].img_index)-1].img_nb) img_switch = 1;
	if (img_tab[(imgFloat[i].img_index)-1].img_nb > 1 ){
		t_img_src2 = "chapeaux/cs_mid_" + p_menu + "_" + (imgFloat[i].img_index) + "_" + img_switch + ".jpg"
		imgFloat[i].id.changeImg(t_img_src2);
	}
}

/*** Fin : Gestion de la Carte D'indentité de chaque Chapeau ***/



/*********  Tableau des Chapeaux des deux collection  **********/

function Chapeau(p_coll, p_src1, p_titre, p_ref, p_desc, p_matiere, p_img_nb) 
{   
	this.coll	= p_coll;  
	this.src1	= p_src1;  
	this.titre	= p_titre;  
	this.ref	= p_ref;
	this.desc	= p_desc;
	this.matiere	= p_matiere;
	this.img_nb	= p_img_nb;

// Load all images
	img_tab = (p_coll =='h') ? img_tab_h : img_tab_e; 
	var i = img_tab.length + 1;
	for (j=p_img_nb; j >0; j--) {
		this.src = "chapeaux/cs_mid_" + p_coll + "_" + i + "_" + j + ".jpg";
//		alert(this.src);
	}

}


function initImgTab()
{ 
	img_tab_h = new Array(); 
	img_tab_e = new Array();
	img_tab   = img_tab_h; 
	
	/* Collection Hiver */

	// série Xanbei
	addNewImg( new Chapeau('h', "chapeaux/cs_mid_h_1_1.jpg", "Xianbei", "Ref : HXAN.01", "", "Broché vert et rouille, revers taffetas changeant", 2));
	addNewImg( new Chapeau('h', "chapeaux/cs_mid_h_2_1.jpg", "Xianbei", "Ref : HXAN.02", "", "Soie lyonnaise bleue, revers cachemire", 2));
	addNewImg( new Chapeau('h', "chapeaux/cs_mid_h_3_1.jpg", "Xianbei", "Ref : HXAN.03", "", "Soie lyonnaise quatre couleurs, revers taffetas changeant, dentelles anciennes bleu", 2));
	// série Cubissimo
	addNewImg( new Chapeau('h', "chapeaux/cs_mid_h_4_1.jpg", "Cubissimo", "Ref : HCUB.01", "", "Soierie lyonnaise chinée", 2));

	// 
	addNewImg( new Chapeau('h', "chapeaux/cs_mid_h_5_1.jpg", "Carrémenrond", "Ref : HCRR.01", "", "Velours, revers taffetas changeant", 2));
	addNewImg( new Chapeau('h', "chapeaux/cs_mid_h_6_1.jpg", "Carrémenrond", "Ref : HCRR.02", "", "Tissu 'Vintage' Pieds de poule, revers taffetas changeant", 2));

	// série Poiluxe
	addNewImg( new Chapeau('h', "chapeaux/cs_mid_h_7_1.jpg", "Poiluxe", "Ref : HPOI.01", "", "Fourrure synthétique imitation peau", 2));
	addNewImg( new Chapeau('h', "chapeaux/cs_mid_h_8_1.jpg", "Poiluxe", "Ref : HPOI.02", "", "Fourrure synthétique imitation peau", 2));

	// série Poildissimo
	addNewImg( new Chapeau('h', "chapeaux/cs_mid_h_9_1.jpg", "Poildissimo", "Ref : HPOD.01", "", "Fourrure synthétique imitation peau", 2));
	
	// série Carréluxe
	addNewImg( new Chapeau('h', "chapeaux/cs_mid_h_10_1.jpg", "Carréluxe", "Ref : HCAL.01", "", "Lainage angora, revers Velours: soie viscose", 2));
	addNewImg( new Chapeau('h', "chapeaux/cs_mid_h_11_1.jpg", "Carréluxe", "Ref : HCAL.02", "", "Imitation daim, revers Façonné", 2));

	// série Manda +
	addNewImg( new Chapeau('h', "chapeaux/cs_mid_h_12_1.jpg", "Manda +", "Ref : HMA+.01", "", "Imitation daim, Façonné, Caches oreilles amovibles", 2));
	addNewImg( new Chapeau('h', "chapeaux/cs_mid_h_13_1.jpg", "Manda +", "Ref : HMA+.02", "", "Matelassé, Taffetas, Paillettes, Caches oreilles amovibles", 2));
	addNewImg( new Chapeau('h', "chapeaux/cs_mid_h_14_1.jpg", "Manda +", "Ref : HMA+.03", "", "Lainage angora, Taffetas, Paillettes, Caches oreilles amovibles", 2));

	// série Casquette Pieds de Coq
	addNewImg( new Chapeau('h', "chapeaux/cs_mid_h_15_1.jpg", "Casquette", "Ref : HCAS.01", "", "Lainage Noir & Blanc, Motif Pieds de Coq", 2));

	/* Fin Collection Hiver */
	
	
	
	/* Collection Eté */

	// série Mandarin	
	addNewImg( new Chapeau('e', "chapeaux/cs_mid_e_1_1.jpg", "Mandarin", "Ref : EMAN.01", "", "Non Tissé imprimé coquelicot", 1));
	addNewImg( new Chapeau('e', "chapeaux/cs_mid_e_2_1.jpg", "Mandarin", "Ref : EMAN.02", "", "Tulle avec incrustations de velours, gris changeant", 1));
	addNewImg( new Chapeau('e', "chapeaux/cs_mid_e_3_1.jpg", "Mandarin", "Ref : EMAN.03", "", "Soierie lyonnaise", 1));
	addNewImg( new Chapeau('e', "chapeaux/cs_mid_e_4_1.jpg", "Mandarin", "Ref : EMAN.04", "", "Soierie lyonnaise", 1));
	addNewImg( new Chapeau('e', "chapeaux/cs_mid_e_5_1.jpg", "Mandarin", "Ref : EMAN.05", "", "Non Tissé", 1));
//	série Cubissimo 
	addNewImg( new Chapeau('e', "chapeaux/cs_mid_e_6_1.jpg", "Cubissimo", "Ref : ECUB.01", "", "Non Tissé", 2));

//	série Rubantine 
	addNewImg( new Chapeau('e', "chapeaux/cs_mid_e_7_1.jpg", "Rubantine", "Ref : ERUB.01", "", "Lin, Ruban métallique, Plumes, Strass", 2));

	// nouveau  Mandarin	
	addNewImg( new Chapeau('e', "chapeaux/cs_mid_e_8_1.jpg", "Mandarin", "Ref : EMAN.06", "", "Crêpe, Satin", 2));
	/* Fin Collection Eté */

//	série Tournicoton 
	addNewImg( new Chapeau('e', "chapeaux/cs_mid_e_9_1.jpg", "Tournicoton", "Ref : ETOU.01", "", "Satin, non tissé, Plumes", 2));
	
}


function addNewImg(p_chapeau)
{
	img_tab = (p_chapeau.coll =='h') ? img_tab_h : img_tab_e; 
	img_tab[img_tab.length] = p_chapeau
}


