// Detect browsers
var userAgent	= navigator.userAgent.toLowerCase();
var opera	= (userAgent.indexOf('opera') != -1);
var saf		= ((userAgent.indexOf('applewebkit') != -1) || (navigator.vendor == 'Apple Conputer Inc.'));
var webtv	= (userAgent.indexOf('webtv') != -1);
var ie		= ((userAgent.indexOf('msie') != -1) && (!opera) && (!saf) && (!webtv));
var ie4		= ((ie) && (userAgent.indexOf('msie 4.') != -1));
var moz		= ((navigator.product == 'Gecko') && (!saf));
var kon		= (userAgent.indexOf('konqueror') != -1);
var ns		= ((userAgent.indexOf('compatible') != -1) && (userAgent.indexOf('mozilla') != -1) && (!opera) && (!webtv) && (!saf));
var ns4		= ((ns) && (parseInt(navigator.appVersion) == 4));
var mac		= (userAgent.indexOf('mac') != -1);
var win		= ((userAgent.indexOf('win') != -1) || (userAgent.indexOf("32bit") != -1));

// Hidden links in taskbar of browsers
texteAff = "Zelda-Series  ";
place = 0;
tempoLong = 100;

function EJSAnimEtat2()
{
	texteTemp1 = texteAff.substring(0, place);
	texteTemp2 = texteAff.substring(place,place+1);
	texteTemp2 = texteTemp2.toUpperCase();
	texteTemp3 = texteAff.substring(place+1,texteAff.length);
	window.status = texteTemp1 + texteTemp2 + texteTemp3;

	if (place > texteAff.length)
	{
		place = 0;
		tempoLong = 1000;
	}

	if (place == 0)
	{
		tempoLong = 100;
	}
	place++;
	tempoAnimEtat2 = setTimeout("EJSAnimEtat2()", tempoLong)
}

function EJSAnimEtat2Break()
{
	window.status = "";
	clearTimeout(tempoAnimEtat2);
}

/*function disableselect(e)
{
	return false
}

function reEnable()
{
	return true
}

//if IE4+
document.onselectstart = new Function ("return false")

//if NS6
if (window.sidebar)
{
	document.onmousedown = disableselect
	document.onclick = reEnable
}*/

function CreateBookmarkLink()
{
	title = "Zelda-Series";
	url = "http://www.zelda-series.net";

	if (moz)
	{
		// Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url, "");
	}
	else if (ie)
	{
		// IE Favorite
		return window.external.AddFavorite(url, title);
	}
	else if (opera && window.print)
	{
		// Opera Hotlist
		return true;
	}
}

function fetch_object(idname)
{
	if (document.getElementById)
	{
		return document.getElementById(idname);
	}
	else if (document.all)
	{
		return document.all[idname];
	}
	else if (document.layers)
	{
		return document.layers[idname];
	}
	else
	{
		return null;
	}
}

function js_fic_jump(i, sid, lien)
{
	var sel = fetch_object("ficsel" + i);
	var act = sel.options[sel.selectedIndex].value;
	if (act != '')
	{
		switch (act)
		{
			case 'view': page = "../../index.php?lang=fr&rub=fanfictions&action="; if (sid != '') sid = lien; break;
			case 'edit': page = "fictions.php?do=edit&ficid="; break;
			case 'delete': page = "fictions.php?do=delete&ficid="; break;
			default: return;
		}
		document.form.reset();
		jumptopage = page + sid;
		window.location = jumptopage;
	}
	else
	{
		alert('Invalid Action Specified');
	}
}

function js_ficchap_jump(i, sid, lien)
{
	var sel = fetch_object("ficchapsel" + i);
	var act = sel.options[sel.selectedIndex].value;
	if (act != '')
	{
		switch (act)
		{
			case 'edit': page = "fictions.php?do=editchap&ficchapid="; break;
			case 'delete': page = "fictions.php?do=deletechap&ficchapid="; break;
			default: return;
		}
		document.form.reset();
		jumptopage = page + sid;
		window.location = jumptopage;
	}
	else
	{
		alert('Invalid Action Specified');
	}
}