
var initialized = "1";

if (initialized == "1") {
	var initObj = "item1";
}

var tabobjlinks;
var initialtab = [initialized, initObj];
var previoustab = "";

/*
function AfficherSousMenu (menuID, objet) {

	if (previoustab != "") {
		document.getElementById(previoustab).style.display = "none";
	}
		
	if (menuID != "") { 
		document.getElementById(menuID).style.display = "block";
		previoustab = menuID;
				
		for (i = 0; i < tabobjlinks.length; i++) {
			tabobjlinks[i].className = "";
		}
		
		objet.className = "current";		
	} 	
}
*/

function do_onload () {
	var tabobj = document.getElementById("MenuPrincipal");
	tabobjlinks = tabobj.getElementsByTagName("a");	
	//AfficherSousMenu (initialtab[1], tabobjlinks[initialtab[0]-1]);
}

function resetTab () {
	setTimeout("AfficherSousMenu (initialtab[1], tabobjlinks[initialtab[0]-1]);", 25000);
}

if (window.addEventListener) {
	window.addEventListener("load", do_onload, false);
} else if (window.attachEvent) {
	window.attachEvent("onload", do_onload);
} else if (document.getElementById) {
	window.onload = do_onload;
}

/*************************************************************************
  This code is from Dynamic Web Coding at www.dyn-web.com
  Copyright 2001-4 by Sharon Paine 
  See Terms of Use at www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

function initScrollLayer() {
  // arguments: id of layer containing scrolling layers (clipped layer), id of layer to scroll, 
  // if horizontal scrolling, id of element containing scrolling content (table?)
  var wndo = new dw_scrollObj('wn', 'lyr1');
  
  // bSizeDragBar set true by default (explained at www.dyn-web.com/dhtml/scroll/ )
  // wndo.bSizeDragBar = false;
  
  // arguments: dragBar id, track id, axis ("v" or "h"), x offset, y offset
  // (x/y offsets of dragBar in track)
  wndo.setUpScrollbar("dragBar", "track", "v", 1, 1);
  
  // pass id('s) of scroll area(s) if inside table(s)
  // i.e., if you have 3 (with id's wn1, wn2, wn3): dw_scrollObj.GeckoTableBugFix('wn1', 'wn2', 'wn3');
  dw_scrollObj.GeckoTableBugFix('wn'); 
}

function changeStation() {
	var stationObj = document.getElementById ("stations");
	document.location.href = "player.php?Station=" + stationObj.options[stationObj.selectedIndex].value + "";
}

function searchPalmares(){

	document.getElementById("search_artistname").value="";
	document.getElementById("search_a").value="";
	document.getElementById("search_t").value="";
	
	var action_page = "http://www.palmares.ca/catalog/"; 
	
	var search_form =  document.getElementById("search_form");
	var search_for = document.getElementById("search_for").value;
	var search_by = document.getElementById("search_by").value;
	
	if (search_by == "artiste"){
		document.getElementById("search_artistname").value = search_for;
		action_page = action_page + "browse.aspx";
	}
	else if (search_by == "piste"){
		document.getElementById("search_a").value = search_for;
		document.getElementById("search_t").value = "2";
		action_page = action_page + "searchtracks.aspx";
	}
	else if (search_by == "album"){
		document.getElementById("search_a").value = search_for;
		document.getElementById("search_t").value = "1";
		action_page = action_page + "searchalbums.aspx";
	}
	
	search_form.action = action_page;
	search_form.submit();
}


function resetAllTabs(){
	for (x=1;x<=4;x++){
		document.getElementById("mnu_" + x + "_div").style.backgroundPosition = "0 0px";
	}
}

function clickTab(tab_number){

	current_tab = tab_number;
	resetAllTabs();
	
	document.getElementById("mnu_" + tab_number + "_div").style.backgroundPosition = "0 -29px";	
}

function overTab(tab_number){

	if (current_tab != tab_number){
		document.getElementById("mnu_" + tab_number + "_div").style.backgroundPosition = "0 -29px";
	}
}

function outTab(tab_number){

	if (current_tab != tab_number){
		document.getElementById("mnu_" + tab_number + "_div").style.backgroundPosition = "0 0px";
	}
}

/***********************************************
* Bookmark site script-  Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

/* Modified to support Opera */
function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}

var current_tab = '1';
