// UTF-8 Dreamweaver detect (éàç)
/*
Doit etre execute une fois le document charge.
*/

function lightview_glow(set_custom){
	var set, div_lv, newContainer, nb_elem
	// Reglages par defauts
	set = {
		borderWidth:24,
		img_folder:'/images/lightview_glow/'
	};
	// Remplace les reglages par defauts
	if (set_custom){
		for (set_elem in set_custom){
			set[set_elem] = set_custom[set_elem];
		}
	}
	
	div_lv = document.getElementById('lightview');
	// --- New Container
	newContainer = document.createElement('div');
	newContainer.style.position = 'relative';
	nb_elem = div_lv.childNodes[0].childNodes.length
	for (k=0;k<nb_elem;k++){
		newContainer.appendChild(div_lv.childNodes[0].firstChild);
	}
	div_lv.childNodes[0].appendChild(newContainer);
	
	// --- Borders div
	bordersDiv_list = ['top','bottom','left','right','cornerTL','cornerTR','cornerBL','cornerBR'];
	bordersDiv = new Object();
	for (k=0;k<bordersDiv_list.length;k++){
		bordersDiv[bordersDiv_list[k]] = new Object();
		bordersDiv[bordersDiv_list[k]] = document.createElement('div');
		bordersDiv[bordersDiv_list[k]].className = 'div_'+bordersDiv_list[k];
		bordersDiv[bordersDiv_list[k]].style.backgroundImage = 'url('+set.img_folder+bordersDiv_list[k]+'.png)';
		if (bordersDiv_list[k].substr(0,6) == 'corner'){
			bordersDiv[bordersDiv_list[k]].style.height = set.borderWidth+'px';
			bordersDiv[bordersDiv_list[k]].style.width = set.borderWidth+'px';
		}
		div_lv.childNodes[0].appendChild(bordersDiv[bordersDiv_list[k]]);
	}
	// Top
	bordersDiv.top.style.top = '-'+set.borderWidth+'px';
	bordersDiv.top.style.height = set.borderWidth+'px';
	// Bottom
	bordersDiv.bottom.style.bottom = '-'+set.borderWidth+'px';
	bordersDiv.bottom.style.height = set.borderWidth+'px';
	// Left
	bordersDiv.left.style.left = '-'+set.borderWidth+'px';
	bordersDiv.left.style.width = set.borderWidth+'px';
	// Right
	bordersDiv.right.style.right = '-'+set.borderWidth+'px';
	bordersDiv.right.style.width = set.borderWidth+'px';
	// Corner top-left
	bordersDiv.cornerTL.style.top = '-'+set.borderWidth+'px';
	bordersDiv.cornerTL.style.left = '-'+set.borderWidth+'px';
	// Corner top-right
	bordersDiv.cornerTR.style.top = '-'+set.borderWidth+'px';
	bordersDiv.cornerTR.style.right = '-'+set.borderWidth+'px';
	// Corner bottom-left
	bordersDiv.cornerBL.style.bottom = '-'+set.borderWidth+'px';
	bordersDiv.cornerBL.style.left = '-'+set.borderWidth+'px';
	// Corner bottom-right
	bordersDiv.cornerBR.style.bottom = '-'+set.borderWidth+'px';
	bordersDiv.cornerBR.style.right = '-'+set.borderWidth+'px';
}
