// JavaScript Document

function setStyle(saisonCSS) {
	document.getElementById('activeCSS').href='css/carcajou_' + saisonCSS + '.css';
	if (saisonCSS == "undefined") {
		//alert("fonction setStyle undefined" + saisonCSS);
		document.getElementById('activeCSS').href='css/carcajou_hiver.css';
	}
	//alert("fonction setStyle " + saisonCSS);
	
	//document.getElementById('activeCSS').href='css/carcajou_'+saisonCSS+'.css';
	//trace("setsaion "+saisonCSS);
}

function MM_displayStatusMsg(msgStr) { //v1.0
  	status=msgStr;
  	document.MM_returnValue = true;
}

function Launch(page, width, height, menu, scrollbars) {
	if (menu== "undefined") menu = "no";
	if (scrollbars== "undefined") scrollbars = "no";
	
	OpenWin = this.open(page, "_blank", "toolbar=no, menubar="+ menu +" ,location=no, scrollbars="+ scrollbars +", resizable=yes, width=" + width + ", height=" + height + ", top=" + (screen.height/2 - height/2) + ", left=" + (screen.width/2 - width/2) + "\""); 
}
function toggleLayer(whichLayer) {
	if (document.getElementById) {
// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.display = style2.display? "":"block";
	}
	else if (document.all) {
// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = style2.display? "":"block";
	}
	else if (document.layers) {
// this is the way nn4 works
	var style2 = document.layers[whichLayer].style;
	style2.display = style2.display? "":"block";
	}
}
function jstoflash(label,URL,textSousSect){
	var movie = window.document.movie
	movie.SetVariable("_root:textSousSect", textSousSect);
	movie.SetVariable("_root:jstoflash_b", URL);
	movie.TCallLabel("_level0.js_control_mc", label);
}

function getValue(varname){
  // First, we load the URL into a variable
  var url = window.location.href;

  // Next, split the url by the ?
  var qparts = url.split("?");

  // Check that there is a querystring, return "" if not
  if (qparts.length == 0)
  {
    return "";
  }

  // Then find the querystring, everything after the ?
  var query = qparts[1];

  // Split the query string into variables (separates by &s)
  var vars = query.split("&");

  // Initialize the value with "" as default
  var value = "";

  // Iterate through vars, checking each one for varname
  for (i=0;i<vars.length;i++)
  {
    // Split the variable by =, which splits name and value
    var parts = vars[i].split("=");
    
    // Check if the correct variable
    if (parts[0] == varname)
    {
      // Load value into variable
      value = parts[1];

      // End the loop
      break;
    }
  }
  
  // Convert escape code
  value = unescape(value);

  // Convert "+"s to " "s
  value.replace(/\+/g," ");

  // Return the value
  return value;
}
//function setsaison(saison) {
//	var movie = window.document.movie
//	var saison = getValue("id");
//	movie.SetVariable("_root:saison", saison);
//}
