function breakFrame(){
	if(parent.frames.length > 0){
		window.top.location.href = location.href;
	}
}
breakFrame();

function addbookmark(){
	var bookmarkurl="http://www.tousvosanimaux.com/";
	var bookmarktittle="Tous vos animaux";
	if(document.all){
		window.external.addfavorite(bookmarkurl,bookmarktittle)
	}
}

function getFishByFamilly(){
	var form = document.fishFamilly;
	var gpe = form.gpe.options[form.gpe.selectedIndex].value;
	window.location.href = '/encyclopedie/liste/cat/poisson-dom/gpe/' + gpe;
}

function zoom(id, isConcours){
	var url = '/concours/zoom/id/'+id;
	if(!isConcours){
		url += '/xt/alb';
	}
	var zoom = window.open(url, "zoom", "toolbar=no,width=760,height=600,top=20,left=20,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no");
}

function zoom_coloriage(id){
	var zoom = window.open('/color/zoom/id/'+id, "zoom", "toolbar=no,width=760,height=600,top=20,left=20,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no");
}

function player_video(id){
	var player = window.open('/video/player/id/'+id, "player", "toolbar=no,width=760,height=550,top=20,left=20,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no");
}

function getCatAlbum(){
	var form = document.theform;
	var cat = form.categorie.options[form.categorie.selectedIndex].value;
	window.location.href = '/album/liste/cat/'+cat;
}
function getCatVideo(){
	var form = document.theform;
	var cat = form.categorie.options[form.categorie.selectedIndex].value;
	window.location.href = '/video/liste/cat/'+cat;
}

function printPage(){
	window.print();
}


var isMozilla = false;
if(window.innerWidth){
	isMozilla = true;
}
function alertWin(buttonOFF, buttonON, positionCallback) {

	this.buttonOFF = buttonOFF;
	this.buttonON = buttonON;
	this.positionCallback = positionCallback;
	this.pubPath = '';
	this.alertTetiereH = 14;
	this.ombrage = 4;

	//
	//	affiche un popup d'alerte personnalisé
	//
	this.show = function(w, h, titleTetiere, text, picto, isPub){
		//	la hauteur min. est 110
		var h = (h<110)?110:h;
		var rect = this.positionCallback();
		var adjustTetiereH = (isMozilla)?(this.alertTetiereH+13):(this.alertTetiereH);

		var wnd 	= document.getElementById('div0');
		var tetiere = document.getElementById('tetpopup');
		var cadre 	= document.getElementById('div2');
		var prof 	= document.getElementById('prf');
		var bt 		= document.getElementById('alert_bt');
		var texte	= document.getElementById('alert_text');
		var pub 	= document.getElementById('alert_pub');

		tetiere.innerHTML = titleTetiere;
		texte.innerHTML = text;
		
		// si la pub n'est pas demander a etre afficher on masque le div et on vire iframe
		pub.innerHTML = '&nbsp;';
		pub.style.display = 'none';
		
		if(isPub && this.pubPath != ''){
			pub.innerHTML = '<iframe scrolling="no" id="publicite" name="publicite" src="' + this.pubPath + '" style="width:' + this.pubW + 'px;height:' + this.pubH + 'px;border:0px"></iframe><br>Publicité';
			pub.style.display = 'block';
		}

		if(picto != 'null')
		{
			document.getElementById('alert_pict').src = picto;
			document.getElementById('div_picto_alert').style.display = 'inline';
		}
		else
		{
			document.getElementById('div_picto_alert').style.display = 'none';
		}

		bt.src = this.buttonOFF;

		var pos_left = ( rect.left+((rect.width-rect.left)/2) - (w/2) );
		var pos_top = ( rect.top+((rect.height-rect.top)/2) - (h/2) );

		wnd.style.width = w+'px';
		cadre.style.height = h+'px';
		wnd.style.left = pos_left+'px';
		wnd.style.top = pos_top+'px';

		prof.style.width = w+'px';
		prof.style.height = (h+adjustTetiereH)+'px';
		prof.style.left = (pos_left+this.ombrage)+'px';
		prof.style.top = (pos_top+this.ombrage)+'px';

		wnd.style.display = 'block';
		prof.style.display = 'block';
	};
	
	//
	//	info concernant la pub a afficher
	//
	this.setParamPub = function (pathPub, w, h)
	{
		this.pubPath 	= pathPub;
		this.pubW 		= w;
		this.pubH 		= h;
	};

	//
	//	indique la fct a appellé pour savoir où positionner le popup
	//
	this.setPositionCallback = function (callbackName){
		this.positionCallback = callbackName;
	}

	//
	//	Modifie uniquement le texte afficher dans l'alerte
	//
	this.refreshText = function (text)
	{
		var texte = document.getElementById('alert_text');
		texte.innerHTML = text;
	};

	//
	//	masque le popup d'alerte personnalise
	//
	this.hide = function ()
	{
		var wnd = document.getElementById('div0');
		var prof = document.getElementById('prf');
		wnd.style.display = 'none';
		prof.style.display = 'none';
	};

	//
	//	effet de rollover sur bouton du popup d'alerte
	//
	this.btOn = function()
	{
		var bt = document.getElementById('alert_bt');
		bt.src = this.buttonON;
	};
	this.btOff = function()
	{
		var bt = document.getElementById('alert_bt');
		bt.src = this.buttonOFF;
	};

	//
	//	affiche ou masque le bouton pour fermer le popup
	//
	this.hideButton = function ()
	{
		document.getElementById('alert_button').style.display = 'none';
	};
	this.showButton = function ()
	{
		document.getElementById('alert_button').style.display = 'block';
	};

}

function getOffsetPosition(divId, attr){
	var theVal = 0;
	var refObj = document.getElementById(divId);
	var sType = 'refObj.offset' + attr;
	while (refObj && refObj.tagName != 'BODY') {
		theVal += eval(sType);
		refObj = refObj.offsetParent;
	}
	return theVal;
}

function getCenterPage(){
	var rect = {};
	rect.top = 0;
	rect.left = 0;
	rect.width = largeur_fenetre();
	rect.height = hauteur_fenetre();
	
	return rect;
}

function largeur_fenetre()
{
 if (window.innerWidth) return window.innerWidth;
 else if (document.body && document.body.offsetWidth) return document.body.offsetWidth;
 else return 0;
}

function hauteur_fenetre()
{
	if (window.innerHeight) return window.innerHeight  ;
	else if (document.body && document.body.offsetHeight) return document.body.offsetHeight;
	else return 0;
}

function resetEmail(){
	document.formNews.email.value='';
}