// JavaScript Document
function OuvrirPopup(page,height,width) 
{
	if((typeof(height) != undefined && typeof(width) !=undefined) && (height.length != 0 && width.length != 0)){
		LScreen = screen.width
		HCentre = (LScreen/2) - (width/2)
		HScreen = screen.height
		VCentre = (HScreen/2) - (height/2)
		nw=width;
		nh=height;
	}else{
		nw=screen.height;
		nh=nw*0.75;
		LScreen = screen.width
		HCentre = (LScreen/2) - (nw/2)
		HScreen = screen.height
		VCentre = (HScreen/2) - (nh/2)
	}
	window.open(page,'popup',config='height='+nh+', width='+nw+',left='+HCentre+', top='+VCentre+', toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no');
}
function playSound(son)
{
	thisMovie("movieson").tunnelStart(son);
}

function cancelSound()
{
	thisMovie("movieson").tunnelCancel();
}

function buildSoundCookie(volume)
{
	var options = { path: '/', expires: 30};
	var cookiename = "volume";
	$.cookie(cookiename, volume, options);
}

function thisMovie(movieName)
{
	if (navigator.appName.indexOf("Microsoft") != -1)
	{
		return window[movieName];
	}
	else
	{
		return document[movieName];
	}
}

function mycarousel_itemVisibleInCallback(carousel, item, i, state, evt)
{
	// The index() method calculates the index from a
	// given index who is out of the actual item range.
	var idx = carousel.index(i, mycarousel_itemList.length);
	carousel.add(i, mycarousel_getItemHTML(mycarousel_itemList[idx - 1]));
}

function mycarousel_itemVisibleOutCallback(carousel, item, i, state, evt)
{
	carousel.remove(i);
}

/**
 * Item html creation helper.
 */
function mycarousel_getItemHTML(item)
{
	//return '<img src="' + item.url + '" width="75" height="75" alt="' + item.title + '" />';
	return '<img src="' + item.url + '" alt="' + item.title + '" />';
};

function popupHeros()
{
	$.nyroModalManual(
	{
		url: 'tes-heros.html',
		bgColor: '#ffffff'
	});
}

function popuphref(lien)
{
	$.nyroModalManual(
	{
		url: lien,
		bgColor: '#ffffff'
	});
}


function favoris()
{
	if (navigator.appName != 'Microsoft Internet Explorer')
	{
		window.sidebar.addPanel("PIWI.TV", "http://www.piwi.tv/", "PIWI.TV");
	}
	else
	{
		window.external.AddFavorite("http://www.piwi.tv", "PIWI.TV");
	}
}

