function Init (pageID,parentID,siteID,homeURL,mode,level1ID,level2ID) {
	
	/*MENU*/
	//Iterates over all menuitems (e.g #menu ul li.menuitem)
		var menuheight = $('menu').getStyle('height');
			var menu_offset_left = $('menu').getCoordinates().left;
			
			$$(".menuitem").each(function(element,index){
										  
				//SELECTED?
				if(element.getProperty('id')=='li'+level1ID)
				{
					element.toggleClass('selected');
				}
				
				var children = element.getChildren();
				element.addEvent('mouseenter',function() {
					if(children.length>1)
					{
						var SubMenu = children[1];
						var SubMeuItems = SubMenu.getChildren();
						var SubMenuLength = 0;
						
						SubMeuItems.each(function(subelement,subindex){
							if(subelement.getCoordinates().width > SubMenuLength)
								SubMenuLength = subelement.getCoordinates().width;
						});
												
						if(element.getCoordinates().width>SubMenuLength)
						{
							SubMeuItems.each(function(subelement,subindex){
								//SELECT?
//								alert(subelement.getProperty('id')+'==li'+level2ID)
								if(subelement.getProperty('id')=='li'+level2ID){
									subelement.toggleClass('selected');
								}
								subelement.setStyle('width',element.getCoordinates().width);
								$ES('li',SubMenu).setStyle('width',element.getCoordinates().width);
							});
						} else {							
							SubMenu.setStyle('width',SubMenuLength);	
							$ES('li',SubMenu).setStyle('width','100%');
						}
						
						this.toggleClass('hover-dropdown');
						if(window.ie)
						{
							var margin_left = this.getCoordinates().left;						
							SubMenu.setStyle('margin','0 0 0 0');
							SubMenu.setStyle('left',margin_left+'px');
						}
					}
					else
						this.toggleClass('hover');
				
				});				
				element.addEvent('mouseleave', function() {
														
					var SubMenu = children;
					if(SubMenu.length>1)
					{
						this.toggleClass('hover-dropdown');			
						
						if(window.ie)
							children[1].setStyle("left","-999em");
					}
					else
						this.toggleClass('hover');				
				});
			});
		
		/* PATH */
		try {
		$('path_'+pageID).addClass('selected');
		} catch (exception) {
			//No path
		}
		
		/* FONT SIZE */ 
		$$("font").each(function(tag,i){		
			if(tag.size.toInt()>0 && tag.size.toInt()<8)
			{
				tag.toggleClass('size'+tag.size);	
				tag.removeProperty('size');				
			}
			else
			{
				tag.toggleClass('size3');	
				tag.removeProperty('size');				
			}
		});

		/* NET-BLAST LOGIN */
			$('login').adopt(new Element('img', {
			    'styles': {
					'cursor':'pointer'
				},
				'events': {
					'mouseenter': function(){
						this.src = this.src.replace(/.gif/, "-over.gif");        		
					},
					'mouseleave': function(){
						this.src = this.src.replace(/-over.gif/, ".gif");	
					},
					'click': function(){
						window.open('../../login?idWebside='+pageID+'','teleport','width=50,height=50, resizable');
					}
				},
				'src': '../../images/nbLayoutMaster/_Rainbow/net-blast.gif',
				'title': 'Net-blast'
			}));

		/* SITEMAP */
		$('sitemap').addEvent('click',function() {
			document.location.href='index.html?id='+pageID+'&template=9Sitemap::Rainbow';
		});
		

		/* PRINT */
		$('print').addEvent('click',function(printformat) {
			window.open("index.html?id="+pageID+"&template=Print::2008","_blank","toolbar=no, location=no, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=yes, copyhistory=no, width=570, height=580"); return false; },this);

		/* BANNER */
		$('banner').addEvent('click',function() {
//			location.href=homeURL;
			location.href='alias.html?id='+siteID;
		});
}

function InsertImage(imageID,imageDescription) {
	if(imageID!='')
		document.write('<img src="../../images/'+imageID+'" alt="'+imageDescription+'" />');
	else
		document.write('');
}

function InsertColumnBannerTitle(id,title)
{
	if($chk(title))
		document.write('<h2>'+title+'</h2>');
}

function InsertColumnBannerElement(id,title,image)
{
	if($chk(title) && $chk(image))
		document.write('<a href="alias.html?id='+id+'"><img src="../../images/'+image+'" alt="'+title+'" /><h3>'+title+'</h3></a>');

	else if($chk(title) && !$chk(image))
    	document.write('<a href="alias.html?id='+id+'"><h3>'+title+'</h3></a>');

	else if(!$chk(title) && $chk(image))
    	document.write('<a href="alias.html?id='+id+'"><img src="../../images/'+image+'" alt="'+title+'" /></a>');
}


function InsertNewsElement(id,title,date,source,presentation)
{
    var byline = "";
    if($chk(date) && $chk(source))
        byline = '<p class="byline">'+date+' - '+source+'</p>';
    else if($chk(date) && !$chk(source))
        byline = '<p class="byline">'+date+'</p>';
    else if(!$chk(date) && $chk(source))
        byline = '<p class="byline">'+source+'</p>';

    var text = "";
    if($chk(presentation))
        text = '<p class="presentation">'+presentation+'</p>';
    
    if($chk(id) && $chk(title))  
       document.write('<a href="alias.html?id='+id+'"><h3>'+title+'</h3></a>'+byline+text); 
}
