var services = new Array();
services['doc'] = '?service=http://wiki.domogik.org/tiki-login.php?cas=y';
services['wiki'] = '?service=http://wiki.domogik.org/tiki-login.php?cas=y';
services['download'] = '?service=http://wiki.domogik.org/tiki-login.php?cas=y';
services['tracker'] = '?service=http://tracker.domogik.org/login';
services['forum'] = '?service=http://forum.domogik.org:80//ucp.php?mode=login';
services['cas'] = '';
services['home'] = '';
services['testlink'] = '';

function banner(section, lang) {
	jQuery.noConflict();
	jQuery('head').append("<link href='http://www.domogik.org/banner/dmgnavbar.css' type='text/css' rel='stylesheet' />");
	if (lang == 'fr') banner_fr(section);
	else banner_en(section);
}

function banner_en(section) {
	var html = "<a id='logo' title='Return to the main page' href='http://www.domogik.org'>Domogik - Free home automation</a>\
		    <ul id='dmgcas'>\
	        <li><a href='https://cas.domogik.org/cas/login" + services[section] + "'>Sign in</a></li>\
        <li><a href='http://wiki.domogik.org/tiki-register.php'>Register</a></li>\
    </ul>\
    <ul id='dmgsections'>";
	if (section == 'home')
		html = html + "<li>Home</li>";
	else
    	html = html + "<li><a title='Domogik news, project and more' href='http://www.domogik.org'>Home</a></li>";
	if (section == 'doc')
		html = html + "<li>Documentation</li>";
	else
		html = html + "<li><a title='User Documentation' href='http://wiki.domogik.org/End_user_documentation'>Documentation</a></li>";
	if (section == 'wiki')
    	html = html + "<li>Wiki</li>";
	else
    	html = html + "<li><a title='Community documentation' href='http://wiki.domogik.org'>Wiki</a></li>";
	if (section == 'tracker')
    	html = html + "<li>Tracker</li>";
	else
    	html = html + "<li><a title='Report and track bugs' href='http://tracker.domogik.org/projects'>Tracker</a></li>";
	if (section == 'forum')
    	html = html + "<li>Forums</li>";
	else
    	html = html + "<li><a title='Community forums' href='http://forum.domogik.org'>Forums</a></li>";
	if (section == 'download')
    	html = html + "<li>Download</li>";
	else
    	html = html + "<li><a title='Get Domogik' href='http://wiki.domogik.org/Download'>Download</a></li>";
    html = html + "</ul>";
	jQuery('#dmgnavbar').addClass('dmgen');
	jQuery('#dmgnavbar').html(html);
}

function banner_fr(section) {
	var html = "<a id='logo' title='Retourner à la page principale' href='http://www.domogik.org'>Domogik - Solution de Domotique Libre</a>\
    <ul id='dmgcas'>\
    	<li><a href='https://cas.domogik.org/cas/login" + services[section] + "'>Connexion</a></li>\
        <li><a href='http://wiki.domogik.org/tiki-register.php'>S'enregistrer</a></li>\
    </ul>\
    <ul id='dmgsections'>";
	if (section == 'home')
		html = html + "<li>Accueil</li>";
	else
		html = html + "<li><a title='Domogik news, le projet et plus' href='http://www.domogik.org'>Accueil</a></li>";
	if (section == 'doc')
    	html = html + "<li>Documentation</li>";
	else
    	html = html + "<li><a title='Documentation utilisateur' href='http://wiki.domogik.org/End_user_documentation'>Documentation</a></li>";
	if (section == 'wiki')
    	html = html + "<li>Wiki</li>";
	else
    	html = html + "<li><a title='Documentation Wiki' href='http://wiki.domogik.org'>Wiki</a></li>";
	if (section == 'tracker')
    	html = html + "<li>Tracker</li>";
	else
    	html = html + "<li><a title='Suivi des bugs' href='http://tracker.domogik.org/projects'>Tracker</a></li>";
	if (section == 'forum')
    	html = html + "<li>Forums</li>";
	else
    	html = html + "<li><a title='Forums' href='http://forum.domogik.org'>Forums</a></li>";
	if (section == 'download')
    	html = html + "<li>Télécharger</li>";
	else
    	html = html + "<li><a title='Télécharger Domogik' href='http://wiki.domogik.org/Download'>Télécharger</a></li>";
    html = html + "</ul>";
	jQuery('#dmgnavbar').addClass('dmgfr');
	jQuery('#dmgnavbar').html(html);
}
