/**
 * @author Abdellah
 */
function abLightSwf(swiff, target, container, dims, bg, queryString, extension, otherVars) {
	extension = extension || 'swf';
	swiff = swiff || 'diapo';
	swiff = swiff + '.' + extension;
	container = container || 'diapo';
	dims = dims || [352, 238];
	var areaWidth = dims[0];
	var areaHeight = dims[1];
	var areaBg = bg || '#ffffff';
	queryString = queryString || '';
	if(queryString != '') queryString = '&' + queryString;
	if($type($('thumbnails')) == 'element'){
		$('thumbnails').addClass('hidden');
	}
	if($type($(container)) == "element") $(container).removeClass('hidden');

	var abVars = { awkomSrc: target + '.xml?l=' + $time() +  queryString};
	if(otherVars && $type(otherVars) == 'object') {
		abVars = $merge(abVars, otherVars);
	}
	
	obj2 = new Swiff(swiff, {
		id: 'awkomDiap',
	    width: areaWidth, height: areaHeight, container: container,
	    params: { wmode: 'opaque', bgcolor: areaBg, allowFullScreen: true },
	    vars: abVars
	});
	$$('.diapoControls').each(function(el){
		el.addEvent('click', function(e){
			e.stop();
			Swiff.remote($('awkomDiap'), el.rev);
		})
	});
	//$('diapoController').removeClass('hidden');
}
function abSwf2Light(target) {
	thumbs = $$('.thumbnail');
	box.setContainerId('imagesLight');
	box.options.openFromLink = false;
	box.open(thumbs[target]);
}
function abGoLightBox(link, title, dimensions, customBg) {
	title = title || 'Galerie Photos - Photo Gallery';
	dimensions = dimensions || [1000,700];
	customBg = customBg || 'abLightBox';
	window.addEvent('domready', function() {
		//detruire l'ancien lien - si existant-
		if($type($('goLight')) == 'element') {
			$('goLight').destroy();
		}
		//detruire l'ancien lightBox - si existant-
		if($type($('OverlayContainer')) == 'element') {
			$$($('OverlayContainer'), '.LightBoxContainer').destroy();
		}
		//création du lien
		var abLink = new Element('a', {
			'id': 'goLight',
			'class': 'goLight',
			'href': link,
			'rel': 'width:' + dimensions[0] + ',height:' + dimensions[1],
			'title': title
		}).inject(document.body);
		var box = new LightBox("goLight", {useOverlay: true, colour: "#262626", contentColor: "#262626", openFromLink: false, showControls: title == "NOTITLE" ? false : true});
		box.setContainerId(customBg);
		box.open($('goLight'));
	})
}
