// ******************************************
// * In Case JAVASCRIPT is needed           *
// ******************************************


// ******************************************
// * Functions to handel shopping functions *
// ******************************************

function fermePanier (currency)

	{
	myLocation = window.opener.location.href;
	if (myLocation.indexOf("checkout.php") != -1)
		{
		window.opener.location = "checkout.php?currency=" +currency;
		}
	window.close();
	

	}
function checkout (currency)

	{
	window.opener.location = "checkout.php?currency=" +currency;
	window.close();
	}

function switchCurrency (newCurrency) 

	{
	document.location.href = "manageCaddie.php?currency=" +newCurrency;
	}

function switchCurOut (newCurrency) 

	{
	document.location.href = "checkout.php?currency=" +newCurrency;
	}

function showCondGen() 

	{
	leftPosit = self.screen.width - 780;
	topPosit = self.screen.height - 630;
	
	var mon_url = "condgen.html";
	window.open (mon_url,"_blank", "WIDTH=752, HEIGHT=570, TOP=" +topPosit +", LEFT=" +leftPosit +", SCROLLBARS=NO");	
	}

function enableButton()
	{

	if (document.shopping.condGen.checked == true)
		{
		document.shopping.mySendButton.disabled = false;
		}
	else
		{
		document.shopping.mySendButton.disabled = true;
		}
	}



function addArticle (article)

	{
	var mon_url = "manageCaddie.php?mode=orderart&article=" +article +"&option=1";
 	window.open(mon_url, "monCaddie", "WIDTH=752, HEIGHT=570, TOP=30 LEFT=50 SCROLLBARS=NO");
	}

function addArtOpt(article, option)

	{
	var mon_url = "manageCaddie.php?mode=orderart&article=" +article +"&option=" +option;
 	window.open(mon_url, "monCaddie", "WIDTH=752, HEIGHT=570, TOP=30 LEFT=50 SCROLLBARS=NO");
	}

function addtocart()

	{

	if (isNum(document.orderArt.ordQty.value) && document.orderArt.ordQty.value > "0")
		{

		document.orderArt.submit();
		}
	else
		{
		alert("La quantité doit être plus grande que 0 et numérique !");
		}
	}



function isNum(str) {


	for (var i = 0; i < str.length; i++)
		{
		var ch = str.substring(i, i+1)

		if ((ch < "0" || "9" < ch) && ch != '.')
			{
			return false
			}
		}
	if ((str.length == 0))
		{ 
		return false
		}
	else
		{
		return true
		}
	}

function showCaddie ()

	{
 	var mon_url = "manageCaddie.php?mode=show";
	window.open(mon_url, "monCaddie", "WIDTH=752, HEIGHT=570, TOP=30 LEFT=50 SCROLLBARS=NO");
	}


// *************************************************
// * This function opens contact into a new window 
// * and positions it near bottom right corner
// *************************************************

function showORP () 

	{
	leftPosit = self.screen.width - 780;
	topPosit = self.screen.height - 630;
	var mon_url = "../../publications/lemorp.php";
	window.open (mon_url,"_blank", "WIDTH=752, HEIGHT=570, TOP=" +topPosit +", LEFT=" +leftPosit +", SCROLLBARS=NO, TOOLBAR=YES");	
	}


function showContact (levelUp) 

	{
	leftPosit = self.screen.width - 780;
	topPosit = self.screen.height - 630;
	leftURL = "";
	for (i=1; i <= levelUp; i++)
		{
		leftURL = leftURL + "../";
		}
	var mon_url = leftURL + "contacts.html";
	window.open (mon_url,"_blank", "WIDTH=752, HEIGHT=570, TOP=" +topPosit +", LEFT=" +leftPosit +", SCROLLBARS=NO");	
	}

function showPlanSite (levelUp) 

	{
	leftPosit = self.screen.width - 780;
	topPosit = self.screen.height - 630;
	leftURL = "";
	for (i=1; i <= levelUp; i++)
		{
		leftURL = leftURL + "../";
		}
	var mon_url = leftURL + "plansite.html";
	window.open (mon_url,"_blank", "WIDTH=752, HEIGHT=570, TOP=" +topPosit +", LEFT=" +leftPosit +", SCROLLBARS=NO");	
	}



function showArticleDetail (artNo) 

	{
	leftPosit = self.screen.width - 780;
	topPosit = 10;

	var mon_url = "detailart.php?artNo=" +artNo;

	window.open (mon_url,"_blank", "WIDTH=752, HEIGHT=700, TOP=" +topPosit +", LEFT=" +leftPosit +", SCROLLBARS=YES");	
	}


function showAnimation () 

	{
	leftPosit = self.screen.width - 780;
	topPosit = self.screen.height - 630;
	var mon_url = "http://www.asleman.org/divers/animation.html";
	window.open (mon_url,"_blank", "WIDTH=752, HEIGHT=570, TOP=" +topPosit +", LEFT=" +leftPosit +", SCROLLBARS=NO");	
	}



// ********************************************************
// * Function to Switch Cotisation values from CHF to EUR *
// ********************************************************

function ResetCoti()
	{
	if (document.membre.ModPmt[0].checked != true)
		{
		document.membre.ChoixCoti[1].text="EUR  35.- Individuel"
		document.membre.ChoixCoti[2].text="EUR  60.- Collectif / Famille"
		document.membre.ChoixCoti[3].text="EUR  15.- Junior"
		document.membre.ChoixCoti[4].text="EUR  80.- ou plus - Soutien"
                                           document.membre.ChoixCoti[5].text="EUR  200.- ou plus - Ami du Lac"
                                           document.membre.ChoixCoti[6].text="EUR  500.- ou plus - Compagnon du Lac"
		document.membre.ChoixCoti[7].text="EUR 3'000.- ou plus - Mécène"

		document.membre.ChoixCoti[1].value="EUR-35"
		document.membre.ChoixCoti[2].value="EUR-60"
		document.membre.ChoixCoti[3].value="EUR-15"
		document.membre.ChoixCoti[4].value="EUR-80"
		document.membre.ChoixCoti[5].value="EUR-200"
		document.membre.ChoixCoti[6].value="EUR-500"
		document.membre.ChoixCoti[7].value="EUR-3000"


		document.membre.ChoixCoti[0].selected=true
		}

	else

		{
		document.membre.ChoixCoti[1].text="CHF   70.- Individuel"
		document.membre.ChoixCoti[2].text="CHF   120.- Collectif / Famille"
		document.membre.ChoixCoti[3].text="CHF   25.- Junior"
		document.membre.ChoixCoti[4].text="CHF  200.- ou plus - Soutien"
		document.membre.ChoixCoti[5].text="CHF  500.- ou plus - Ami du Lac"
		document.membre.ChoixCoti[6].text="CHF  1'000.- ou plus - Compagnon du Lac"
		document.membre.ChoixCoti[7].text="CHF 5'000.- ou plus - Mécène"

		document.membre.ChoixCoti[1].value="CHF-70"
		document.membre.ChoixCoti[2].value="CHF-120"
		document.membre.ChoixCoti[3].value="CHF-25"
		document.membre.ChoixCoti[4].value="CHF-200"
		document.membre.ChoixCoti[5].value="CHF-500"
		document.membre.ChoixCoti[6].value="CHF-1000"
		document.membre.ChoixCoti[7].value="CHF-5000"


		document.membre.ChoixCoti[0].selected=true
		}
	}
	
function downloadCharte () 

	{
	leftPosit = self.screen.width - 780;
	topPosit = self.screen.height - 630;
	var mon_url = "charte.pdf";
	window.open (mon_url,"_blank", "WIDTH=752, HEIGHT=570, TOP=" +topPosit +", LEFT=" +leftPosit +", SCROLLBARS=NO, TOOLBAR=YES");	
	}

