<!--
/* ---------------------------------------------
 * Created:		22.02.2007
 * Revision:		11.03.2007
 * Author:		Philippe Jos
 * Copyrights:		Philippe Jos
 * Email:		jos.philippe@wanadoo.fr
 * ---------------------------------------------
 */


Tool = {
	
	AppendImageTitle: function( dest, title, cls ){
		dest.appendChild( createImageExt( "image/title/" + title.getAttribute("image"), title.getAttribute("width"), title.getAttribute("height"), null, cls, title.getAttribute("alt") ) );
	},

	
	AppendTextTitle: function( dest, title, cls ){
		appendNewTextBlock( dest, null, cls, title.getAttribute("caption") );
	},


	
	AppendButtonHautPage: function( dest ){
		dest.appendChild( Button.Create( "hautpage", 103, 18, "#eContainer", "btn right" ) );
	},


	
	AppendButtonSommaire: function( dest, uri, cls ){
		dest.appendChild( Button.Create( "sommaire", 131, 18, uri, cls ) );
	},


	AppendBrandLogo: function( xmlParser ){
		xmlParser.ViewHeader.appendChild( createImageExt( "image/logo/" + xmlParser.Query.brand + ".gif", Number(xmlParser.Query.logow),  Number(xmlParser.Query.logoh), null, "right", "Logo " + firstCharToUpperCase(xmlParser.Query.brand) ) );
	},

	AppendBrandTitle: function( xmlParser ){
		xmlParser.Header.appendChild( createImageExt( "image/caption/prod" + xmlParser.Query.brand + ".gif", Number(xmlParser.Query.titlew), Number(xmlParser.Query.titleh), "eTitle", null, "Produits " + firstCharToUpperCase(xmlParser.Query.brand) ) );
	},

	AppendRangeTitle: function( xmlParser ){
		xmlParser.ViewHeader.appendChild( createImageExt( "image/title/" + xmlParser.Query.rimage, Number(xmlParser.Query.rwidth), Number(xmlParser.Query.rheight), null, "title", xmlParser.Query.range ) );
	},

	AppendCategoryTitle: function( xmlParser, index ){
		image = createImageExt( "image/title/"+ xmlParser.Query.cimage, Number(xmlParser.Query.cwidth), Number(xmlParser.Query.cheight), null, "title", xmlParser.Query.category );
	
		if(index == 0 ){									
			Tool.SetViewHeaderHeight(xmlParser, true );						
			xmlParser.ViewHeader.appendChild( image );					
		}else xmlParser.View.appendChild( image );						
	},

	

	AppendMaxCSeparator: function( xmlParser ){
		xmlParser.View.appendChild( xmlParser.MaxCSeparator.cloneNode(false) );
	},

	AppendMinCSeparator: function( xmlParser ){
		xmlParser.View.appendChild( xmlParser.MinCSeparator.cloneNode(false) );
	},

	AppendCSeparator: function( xmlParser ){
		xmlParser.View.appendChild( xmlParser.CSeparator.cloneNode(true) );
	},

	AppendVSeparator: function( xmlParser ){
		xmlParser.View.appendChild( xmlParser.VSeparator.cloneNode(false) );
	},

	SetViewHeaderHeight: function( xmlParser, isFirst ){
		var height;

		if(!isFirst) height = Math.max(  xmlParser.Query.logoh, xmlParser.RangeH + xmlParser.MarginBottom );
		else height = xmlParser.RangeH + xmlParser.CategoryH + (2*xmlParser.MarginBottom );

		xmlParser.ViewHeader.style.height = height + "px";
	}
};
