function afficheReglement(site){
	popup = window.open('/'+site+'/reglement.html','reglement','height=600,width=600,directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no');
	//reglement=window.open("/"+site+"/reglement.html",'reglement','height=600,width=600');

	popup.focus();
}

function goToIndex(site){
	document.location.href = '/'+site+'/index.php';
}

function afficheMentions(site,popup){
	switch (popup){
		case 'journee':
			url = 'remerciement_journee.html';
			l = 278;
			h = 201;
			break;
		case 'sejour':
			url = 'remerciement_sejour.html'
			l = 278;
			h = 344;
			break;
		default:
			url = 'mentions.html';
			l = 278;
			h = 209;
			
	}
	mentions=window.open('/'+site+'/'+url,'mentions','height='+h+',width='+l+',directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no');
	mentions.focus();
}

function redirectFormulaire(site, type_abo){
	switch (site){
		case 'souriscity':
			url='http://www.canalplus.fr/index_jeux.php?cid=33116';
			break;
		case 'starwars':
			url='http://www.canalplus.fr/index_jeux.php?cid=33118';
			break;
		case 'cinema':
			url='http://www.canalplus.fr/index_jeux.php?cid=37341';
			break;
		case 'comedie':
			url='http://www.canalplus.fr/index_jeux.php?cid=39029';
			break;
		case 'nouveaucanalsat':
			url='http://www.canalsat.fr/index_jeux.php?cid=39030';
			break;
		case 'series':
			url='http://www.canalplus.fr/index_jeux.php?cid=42312';
			break;
		case 'ligue1':
			url='http://www.programmes.canalplus.fr/index_jeux.php?pid=1&cid=53364';
			break;
		case 'notoriete':
			if(type_abo == 'CANALSAT'){
				url='http://www.canalsat.fr/index_jeux.php?pid=1&cid=63267';
			}else{
				url='http://www.programmes.canalplus.fr/index_jeux.php?pid=1&cid=63084';
			}
			break;	
		case 'cars':
			url = 'http://www.canalsat.fr/index_jeux.php?cid=70611&acc=1';
			break;
		case 'bigcity':
			//url = 'http://www.programmes.canalplus.fr/index_jeux.php?cid=72153&acc=1';
			url = 'https://secure-espaceclient-canalplus.canal-bis.com/index.php?pid=196&cid=22798&url_retour=&tpl=10&init=1&mod=&clkid=&cpmid=&kwid=&sc_cmpid=&mess_page=7';
			break;
		case 'skins':
			url = 'http://www.programmes.canalplus.fr/index_jeux.php?cid=72150&acc=1';
			break;
		case 'aedisney':
			url = 'http://www.canalsat.fr/index_jeux.php?cid=70707&acc=1';
			break;
		case 'damages':
			//url = 'test.php';
			url = 'https://secure-espaceclient-canalplus.canal-plus.com/index.php?tpl=10&cid=95196&cv=&postgame=1&init=1&mess_page=10';
			
			break;
		case 'discoverychannel':
			//url = 'test.php';
			url = 'http://espaceclient.canalsatellite.canal-plus.com/index_jeux.php?pid=195&cid=100800&acc=1';
			break;
		case 'discoveryrealtime':
			//url = 'test.php';
			url = 'http://espaceclient.canalsatellite.canal-plus.com/index_jeux.php?pid=195&cid=100803&acc=1';
			break;
		case 'coulisses_cplus':
			//url = 'test.php';
			url = 'http://espaceclient.canalplus.canal-plus.com/index_jeux.php?pid=1208&cid=111202&acc=1';
			break;
		case 'durban_cplus':
			//url = 'test.php';
			url ='http://espaceclient.canalplus.canal-plus.com/index_jeux.php?pid=1208&cid=113091&acc=1';
			break;
		case 'cannes08':
			url = 'http://espaceclient.canalplus.canal-plus.com/index_jeux.php?pid=196&cid=119850&acc=1';
			break;
		case 'scifi_spielberg':
			url = 'http://espaceclient.canalsat.canal-plus.com/index_jeux.php?pid=196&cid=119851&acc=1';
			break;
		case 'beijing2008':
			url = 'http://espaceclient.canalplus.canal-plus.com/index_jeux.php?cid=128416&acc=1';
			break;
		case 'mtv08':
			url = 'http://espaceclient.canalsatellite.canal-plus.com/index_jeux.php?cid=128418&acc=1';
			break;
		case 'coluche08':
			url = 'http://espaceclient.canalplus.canal-plus.com/index_jeux.php?&cid=154786&acc=1';
			break;
		case 'ligue1_08':
			url = 'http://espaceclient.canalplus.canal-plus.com/index_jeux.php?pid=1208&cid=170625&acc=1';
			break;
		case 'happy_planet_2008':
			switch (type_abo){
				// => Madagascar
				case 'liberty_tv': 
					url = 'http://espaceclient.canalsat.canal-plus.com/index_jeux.php?pid=1208&cid=178663&acc=1';
					break; 
				// => Sri Lanka
				case 'discovery_channel': 
					url = 'http://espaceclient.canalsat.canal-plus.com/index_jeux.php?pid=1208&cid=178669&acc=1 ';
					break; 
			}
			break;
		case 'ligue1_2009': 
			url = 'test.php';			// pour la préprod et le dev
			url = 'http://espaceclient.canalplus.canal-plus.com/index_jeux.php?&cid=271915&acc=1'; // pour la prod
			break;
	} 
	/*
	if (window.opener != undefined){
		window.opener.location = url;
	}else{
		//formulaire=window.open(url,'formulaire','height=800,width=1024,directories=yes,location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes');
		//formulaire.focus();
		document.location.href = url;
	}
	*/
	
	document.location.href = url;
}

function redirectSite(site, type_abo) {
	var sameWindow = false;
	//alert("redirectSite");
 	switch (site){
		case 'souriscity':
			url='http://www.canalplus.fr/';
			break;
		case 'starwars':
			url='http://www.canalplus.fr/';
			break;
		case 'cinema':
			url='http://www.canalplus.fr/';
			break;
		case 'comedie':
			url='https://secure-espaceclient-canalplus.canal-plus.com/index.php?pid=1326&cid=36109&tpl=10&init=1&mess_page=9';
			break;
		case 'nouveaucanalsat':
			url='http://www.canalsat.fr/';
			break;
		case 'series':
			url='http://espaceclient.canalplus.canal-plus.com/pid1578.htm';
			break;
		case 'ligue1':
			url='http://espaceclient.canalplus.canal-plus.com/pid1578.htm';
			break;
		case 'notoriete':
			if(type_abo == 'CANALSAT'){
				url='http://espaceclient.canalsat.canal-plus.com/pid1579.htm';
			}else if(type_abo == 'CANALPLUS'){
				url='http://espaceclient.canalplus.canal-plus.com/pid1578.htm';
			}else{
				url='http://espaceclient.couple.canal-plus.com/pid1580.htm';
			}
			break;
		case 'cars':
			switch (type_abo) {
				case 'COUPLE':
					url = 'http://espaceclient.couple.canal-plus.com/pid1580.htm&rubId=2';
					break;
				case 'CANALSAT':
					url = 'http://espaceclient.canalsatellite.canal-plus.com/pid1579.htm&rubId=2 ';
					break;			
				default:
					url = 'http://espaceclient.canalsatellite.canal-plus.com/pid1579.htm';
			}
			break;
		case 'bigcity':
			url = 'http://espaceclient.canalplus.canal-plus.com/pid1578.htm';
			break;
		case 'skins':
			//url = 'http://espaceclient.canalplus.canal-plus.com/pid1578.htm';
			url = 'http://www.canalplus.fr/cid68644-skins.html';
			break;
		case 'aedisney':
			url = '';
			break;
		case 'damages':
			url = 'http://www.canalplus.fr/damages';
			break;
		case 'coulisses_cplus':
			url = 'http://espaceclient.canalplus.canal-plus.com/pid1578.htm';
			break;
		case 'durban_cplus':
			url = 'http://espaceclient.canalplus.canal-plus.com/pid1578.htm';
			break;
		case 'cannes08':
			urlGagnant = 'https://secure-espaceclient-couple.canal-plus.com/index.php?pid=1215&cid=7865&url_retour=&tpl=10&init=1&mod=&clkid=&cpmid=&kwid=&sc_cmpid=&mess_page=7 ';
			urlPerdant = 'http://espaceclient.canalplus.canal-plus.com/pid1578.htm';
			if (isWinner) url = urlGagnant;
			else url = urlPerdant;
			break;
		case 'scifi_spielberg':
			url = 'http://espaceclient.canalsatellite.canal-plus.com/pid1579.htm';
			break;
		case 'beijing2008':
			url = 'http://espaceclient.canalplus.canal-plus.com/pid1578.htm';
			break;
		case 'mtv08':
			url = 'http://espaceclient.canalsatellite.canal-plus.com/pid1579.htm';
			break;
		case 'coluche08':
			url = 'http://espaceclient.canalplus.canal-plus.com/pid1578.htm';
			break;
		case 'ligue1_08':
			url = 'http://www.subsidesports.com/canal-plus';
			sameWindow = true;
			break;			
	} 
	if (sameWindow) {
		document.location.href = url;
	}
	else {
		if (window.opener != undefined){
			window.opener.location = url;
		}else{
			siteCanal=window.open(url,'site','height=800,width=1024,directories=yes,location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes');
			siteCanal.focus();
		} 
	}
}

function nextstep(site){
	//alert("nextstep");
 	switch (site){
		case 'cannes08':
			document.nextstep.submit();
			//http://www.cannessurmonmobile.com
			break;
		case 'mtv08':
			document.nextstep.action = 'http://www.canalsat.fr/index.php?pid=2381'; 
			document.nextstep.target = '_blank';
			document.nextstep.submit();
			break;
	}
}

function getMtvSong(type){
	switch (type) {
		case 1:
		case '1':
			url = 'http://sib1.od2.com/common/product/Product.aspx?shop=20&associd=2&catno=OD2DI6216913-05&attemptedaction=promo&attemptedarg1=OD2DI6216913-05';
			break;
		case 2:
		case '2':
			url = 'http://sib1.od2.com/common/product/Product.aspx?shop=20&associd=2&catno=OD2DI6282145-07&attemptedaction=promo&attemptedarg1=OD2DI6282145-07';
			break;
		case 3:
		case '3':
			url = 'http://sib1.od2.com/common/product/Product.aspx?shop=20&associd=2&catno=OD2DI6326401-01&attemptedaction=promo&attemptedarg1=OD2DI6326401-01';
			break;			
	}
	if (url){
		document.nextstep.action = url; 
		document.nextstep.target = '_blank';
		document.nextstep.submit();	
	}
}

function redirectMatch(id){
	document.location.href = '/ligue1_08/remerciements.php?match_id='+id;
}