var latest_wx = 81;
var latest_wx_en = 63;

// google +1 button stuff
window.___gcfg = {lang: 'fr'};

  (function() {
    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
    po.src = 'https://apis.google.com/js/plusone.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
  })();
// end of google +1 button stuff


// table display
function hide(identifiant) {
	if (document.getElementById(identifiant).className == "hidden") {
	   document.getElementById(identifiant).className = "visible";
	} else {
	   document.getElementById(identifiant).className = "hidden";
	}
}

// display BD
function display_BD_w_d(week,day) {

if (day!=0) { link="http://www.olivox.com/bd/w" + week + "/index"+ day +".html";}
else { link="http://www.olivox.com/bd/w" + week + "/index.html";}

img_number=(week-1)*5+day+1;

pic_path = "http://www.olivox.com/daily_bd/" + img_number + ".jpg";

document.write("<table align='center' border='0' cellpadding='0' cellspacing='0'><tbody><tr><td style='width: 90px; text-align: right; background-color: #FFFFFF;'>");

document.write("<a href=" + link + ">");
document.write("<img src=" + pic_path + "></a>");

document.write("<a href=http://feeds.feedburner.com/olivox/OrdS><img src='http://www.olivox.com/rss2.png'/>&nbsp;</a> ");
document.write("<a href=http://www.facebook.com/share.php?u="+link+"><img src='http://www.olivox.com/facebook.png'/>&nbsp;</a> ");
document.write("<g:plusone size='small' annotation='none' href="+link+"> </g:plusone>&nbsp;");
document.write("<a href=http://twitter.com/home?status="+link+"><img src='http://www.olivox.com/twitter.png'>&nbsp;</a> ");
document.write("<a href=mailto:?subject=BD%20olivox&amp;body="+link+"><img src='http://www.olivox.com/mail_link.png'>&nbsp;&nbsp;</a> ");
//document.write("<iframe src='//www.facebook.com/plugins/like.php?href='"+ link +"'&amp;layout=button_count&amp&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font&amp;scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:100px; height:21px;' allowTransparency='true'></iframe>");

document.write("</td></tr></tbody></table>");

}


// display BD
function display_BD(pic_path,link) {
if (pic_path=="rnd" || link=="rnd")
	{
	var rndweek = Math.round(Math.random()*(latest_wx-30))+30;
	var rndday = Math.round(Math.random()*4);

	if (rndweek==0 || rndweek==58 || rndweek==59 || rndweek==67 || rndweek==68 || rndweek==73) {rndweek=65}

	rndpic = (rndweek-1)*5+rndday+1;
	pic_path = "daily_bd/" + rndpic + ".jpg";

	if (rndday==0){ link="http://www.olivox.com/bd/w" + rndweek + "/index.html";}
	if (rndday!=0){ link="http://www.olivox.com/bd/w" + rndweek + "/index" + rndday + ".html";}
	}

if (link==".") {link=window.location.pathname}

document.write("<table align='center' border='0' cellpadding='0' cellspacing='0'><tbody><tr><td style='width: 90px; text-align: right; background-color: #FFFFFF;'>");


//if (pic_path!="."){
	document.write("<a href=" + link + ">");
	document.write("<img src=" + pic_path + "></a>");
//	}

document.write("<a href=http://feeds.feedburner.com/olivox/OrdS><img src='http://www.olivox.com/rss2.png'/>&nbsp;</a> ");
document.write("<a href=http://www.facebook.com/share.php?u="+link+"><img src='http://www.olivox.com/facebook.png'/>&nbsp;</a> ");
document.write("<g:plusone size='small' annotation='none' href="+link+"> </g:plusone>&nbsp;");
document.write("<a href=http://twitter.com/home?status="+link+"><img src='http://www.olivox.com/twitter.png'>&nbsp;</a> ");
document.write("<a href=mailto:?subject=BD%20olivox&amp;body="+link+"><img src='http://www.olivox.com/mail_link.png'>&nbsp;&nbsp;</a> ");
//document.write("<iframe src='//www.facebook.com/plugins/like.php?href='"+ link +"'&amp;layout=button_count&amp&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font&amp;scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:100px; height:21px;' allowTransparency='true'></iframe>");

document.write("</td></tr></tbody></table>");

}

// display BD
function display_BD_en() {
	var rnd = Math.round(Math.random()*30+1);
	link="http://www.olivox.com/bd/comics.html";

document.write("<table align='center' border='0' cellpadding='0' cellspacing='0'><tbody><tr><td style='width: 90px; text-align: right; background-color: #FFFFFF;'>");
document.write("<a href="+link+"><img src=daily_bd_en/" + rnd + ".jpg></a>");

document.write("<a href=http://feeds.feedburner.com/olivox/OrdS><img src='http://www.olivox.com/rss2.png'/>&nbsp;</a> ");
document.write("<a href=http://www.facebook.com/share.php?u="+link+"><img src='http://www.olivox.com/facebook.png'/>&nbsp;</a> ");
document.write("<g:plusone size='small' annotation='none' href="+link+"> </g:plusone>&nbsp;");
document.write("<a href=http://twitter.com/home?status="+link+"><img src='http://www.olivox.com/twitter.png'>&nbsp;</a> ");
document.write("<a href=mailto:?subject=BD%20olivox&amp;body="+link+"><img src='http://www.olivox.com/mail_link.png'>&nbsp;&nbsp;</a> ");

document.write("</td></tr></tbody></table>");

}

function display_BD_menu() {
var Nmax = latest_wx+1;
var Nwidth = 3;
var Ncol = 1;
document.write("<table style='width: 100%; height: 100%; margin-left: auto; margin-right: auto;' border='0' cellpadding='2' cellspacing='5'><tbody><tr>");

		document.write("<tr><td class='category' colspan='3' rowspan='1'><a style='display : block' href='bd/2012/index.html'>2012</a></td>");
		document.write("<td class='category' colspan='3' rowspan='1'><a style='display : block' href='bd/2011/index.html'>2011</a></td>");
		document.write("<td class='category' colspan='3' rowspan='1'><a style='display : block' href='bd/2009/index.html'>2009</a></td>");
		document.write("<td class='category' colspan='3' rowspan='1'><a style='display : block' href='bd/2008/index.html'>2008</a></td>");
		document.write("<td class='category' colspan='3' rowspan='1'><a style='display : block' href='bd/2007/index.html'>2007</a></td></tr>");

for (i=1; i<=Nmax-1; i++)
	{
		document.write("<td class='category'><a style='display : block' href='bd/w"+ (Nmax-i) +"/index.html'>"+ (Nmax-i)*5 +"</a></td>");
		for (j=1; j<=4; j++)
		{
		if (i == Ncol*Nwidth && j==4)
			{
			document.write("<td class='category'><input type=\"submit\" onclick=\"javascript:hide(\'more_menu\');\" value=\"+\" /></td>");
			document.write("</tr></tbody></table>");
			document.write("<div id=\"more_menu\" class=\"hidden\" >");
			document.write("<table style='width: 100%; height: 100%; margin-left: auto; margin-right: auto;' border='0' cellpadding='2' cellspacing='5'><tbody><tr>");
			}
			else
			{
			document.write("<td class='category'><a style='display : block' href='bd/w"+ (Nmax-i) +"/index"+ j +".html'>"+ ((Nmax-i)*5-j) +"</a></td>");
			}
		}
		if (i/Nwidth == Math.round(i/Nwidth))
			{
			document.write("</tr><tr>");
			}
	}
document.write("</tr></tbody></table></div>");
}


function display_BD_loop(wfirst,wlast) {
	if (wlast=="."){wlast=latest_wx}

for (i=wlast; i>=wfirst; i--)
	{
	if (i==58 || i==59 || i==67 || i==68 || i==73) {}
	else
		{
		for (j=0; j<=4; j++)
			{
			if (i==30 && (j==0 || j==3 || j==4)) {} //remove w30/index3 4 .html
			else
			{
				if (j==0){ link="http://www.olivox.com/bd/w" + i + "/index.html";}
				else { link="http://www.olivox.com/bd/w" + i + "/index" + j + ".html";}

				document.write("<br><table align='center' border='0' cellpadding='0' cellspacing='0'><tbody><tr><td style='width: 90px; text-align: right; background-color: #FFFFFF;'>");
				document.write("<a href=" + link + ">");
				document.write("<img src=http://www.olivox.com/daily_bd/" + (i*5-5+j+1) + ".jpg></a>");
				document.write("<a href=http://feeds.feedburner.com/olivox/OrdS><img src='http://www.olivox.com/rss2.png'/>&nbsp;</a> ");
				document.write("<a href=http://www.facebook.com/share.php?u="+link+"><img src='http://www.olivox.com/facebook.png'/>&nbsp;</a> ");
				document.write("<g:plusone size='small' annotation='none' href="+link+"> </g:plusone>&nbsp;");
				document.write("<a href=http://twitter.com/home?status="+link+"><img src='http://www.olivox.com/twitter.png'>&nbsp;</a> ");
				document.write("<a href=mailto:?subject=BD%20olivox&amp;body="+link+"><img src='http://www.olivox.com/mail_link.png'>&nbsp;&nbsp;</a> ");
				//document.write("<iframe src='//www.facebook.com/plugins/like.php?href='"+ link +"'&amp;layout=button_count&amp&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font&amp;scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:100px; height:21px;' allowTransparency='true'></iframe>");
				document.write("</td></tr></tbody></table><br>");
				}
			}
	}
	}
}

function display_BD_loop_en(wfirst,wlast) {
	if (wlast=="."){wlast=latest_wx_en}

for (i=wlast; i>=wfirst; i--)
	{
				link="http://www.olivox.com/bd/w_en/"+i+".html";

				document.write("<br><table align='center' border='0' cellpadding='0' cellspacing='0'><tbody><tr><td style='width: 90px; text-align: right; background-color: #FFFFFF;'>");
				document.write("<a href=w_en/" +i+ ".html>");
				document.write("<img src=slides_en/"+i+".jpg></a>");
				document.write("<a href=http://feeds.feedburner.com/olivox/OrdS><img src='http://www.olivox.com/rss2.png'/>&nbsp;</a> ");
				document.write("<a href=http://www.facebook.com/share.php?u="+link+"><img src='http://www.olivox.com/facebook.png'/>&nbsp;</a> ");
				document.write("<g:plusone size='small' annotation='none' href="+link+"> </g:plusone>&nbsp;");
				document.write("<a href=http://twitter.com/home?status="+link+"><img src='http://www.olivox.com/twitter.png'>&nbsp;</a> ");
				document.write("<a href=mailto:?subject=BD%20olivox&amp;body="+link+"><img src='http://www.olivox.com/mail_link.png'>&nbsp;&nbsp;</a> ");
				document.write("</td></tr></tbody></table><br>");
	}
}

function archive_BD_menu(year) {
document.write("<table align='center'><tbody><tr>");

if (year!=2012){document.write("<td><a href=http://www.olivox.com/bd/2012/index.html>2012</a></td><td> - </td>");}
else {document.write("<td>2012 - </td>");}
if (year!=2011){document.write("<td><a href=http://www.olivox.com/bd/2011/index.html>2011</a></td><td> - </td>");}
else {document.write("<td>2011 - </td>");}
if (year!=2009){document.write("<td><a href=http://www.olivox.com/bd/2009/index.html>2009</a></td><td> - </td>");}
else {document.write("<td>2009 - </td>");}
if (year!=2008){document.write("<td><a href=http://www.olivox.com/bd/2008/index.html>2008</a></td><td> - </td>");}
else {document.write("<td>2008 - </td>");}
if (year!=2007){document.write("<td><a href=http://www.olivox.com/bd/2007/index.html>2007</a></td><td> - </td>");}
else {document.write("<td>2007 - </td>");}
if (year!=2006){document.write("<td><a href=http://www.olivox.com/bd/2006/index.html>avant</a></td><td></td>");}
else {document.write("<td>avant</td>");}

document.write("</tr></tbody></table>");
}

function archive_BD_menu_en(year) {
document.write("<table align='center'><tbody><tr>");

if (year!=2012){document.write("<td><a href=http://www.olivox.com/bd/comics.html>2012</a></td><td> - </td>");}
else {document.write("<td>2012 - </td>");}
if (year!=2011){document.write("<td><a href=http://www.olivox.com/bd/comics_2011.html>2011</a></td>");}
else {document.write("<td>2011</td>");}

document.write("</tr></tbody></table>");
}


function menu_bar_bd_en() {
url = window.location.pathname;
filename = url.substring(url.lastIndexOf('/')+1);
rnd_en = Math.round(Math.random()*latest_wx_en);

if (filename == "0.html") {previous = "http://www.olivox.com/index_en.html";next = "1.html";}
if (filename == latest_wx_en+".html") {previous = (latest_wx_en-1)+".html";next = "http://www.olivox.com/index_en.html";}

for (j=1; j<=(latest_wx_en-1); j++)
	{
	if (filename == j+".html") {
		previous = (j-1)+".html";next = (j+1)+".html";
		}
	}

document.write("<table style='width: 100%; cellpadding='5' cellspacing='5'><tbody><tr>");
document.write("<td class='category'><a href=" + previous + "> <     previous </a></td>");
document.write("<td class='category'><a href=" + rnd_en + ".html>random</a></td>");
document.write("<td class='category'><a href=" + next + " > next       > </a></td>");
document.write("</tr></tbody></table>");

}
