// CSS Browser Selector   v0.2.5
// Documentation:         http://rafael.adm.br/css_browser_selector
// License:               http://creativecommons.org/licenses/by/2.5/
// Author:                Rafael Lima (http://rafael.adm.br)
// Contributors:          http://rafael.adm.br/css_browser_selector#contributors

/******************************************************************
Available OS Codes [os]:

    * win - Microsoft Windows
    * linux - Linux (x11 and linux)
    * mac - Mac OS

Available Browser Codes [browser]:

    * ie - Internet Explorer (All versions)
    * ie6 - Internet Explorer 6.x
    * ie5 - Internet Explorer 5.x
    * gecko - Mozilla, Firefox, Camino
    * opera - Opera (All versions)
    * opera8 - Opera 8.x
    * opera9 - Opera 9.x
    * konqueror - Konqueror
    * webkit or safari - Safari, NetNewsWire, OmniWeb, Shiira
    
Use: .ie .menu{color:White;}
*******************************************************************/

var css_browser_selector = function() {
	var 
		ua=navigator.userAgent.toLowerCase(),
		is=function(t){ return ua.indexOf(t) != -1; },
		h=document.getElementsByTagName('html')[0],
		b=(!(/opera|webtv/i.test(ua))&&/msie (\d)/.test(ua))?('ie ie'+RegExp.$1):is('gecko/')? 'gecko':is('opera/9')?'opera opera9':/opera (\d)/.test(ua)?'opera opera'+RegExp.$1:is('konqueror')?'konqueror':is('applewebkit/')?'webkit safari':is('mozilla/')?'gecko':'',
		os=(is('x11')||is('linux'))?' linux':is('mac')?' mac':is('win')?' win':'';
	var c=b+os+' js';
	h.className += h.className?' '+c:c;
} ();




function GoToPage(url) {
    var aPosition = window.location.href.indexOf('?');
    var querystring = '';

    if (aPosition != -1)
        querystring = window.location.href.substr(aPosition, 4);

    window.location = url + querystring;
}


function setCssClass(objId,cssClass)
{
    var obj = document.getElementById(objId);
    
    if(obj != undefined)
        obj.className = cssClass;
}



/************* HOME PAGE FUNCTIONS ************************/


var click = false;
function accordionImageChange(id, imageName) {
    if (!click)
        document.getElementById(id).src = imageName;
    else
        click = false;
}

function accordionSetDefaults(id, imageName) {
    document.getElementById('AccordionImage1').src = 'Images/homeMedia/bikeBrandsBertrandOver.jpg';
    document.getElementById('AccordionImage2').src = 'Images/homeMedia/bikeBrandsGiantOver.jpg';
    document.getElementById('AccordionImage3').src = 'Images/homeMedia/bikeBrandsMerlinOver.jpg';
    document.getElementById('AccordionImage4').src = 'Images/homeMedia/bikeBrandsTrekOver.jpg';

    accordionImageChange(id, imageName);
    click = true;
}





/************* HISTORY PAGE FUNCTIONS ************************/

var salonDesGenerations = -1;

function showHistory(id) {

    var showHide = '';
    showHide = document.getElementById(id).style.visibility;

    if (showHide == 'hidden' || showHide == '')
        showHide = 'visible';
    else
        showHide = 'hidden';

    initHistory();

    document.getElementById(id).style.visibility = showHide;
    document.getElementById(id).style.display = (showHide == 'visible') ? 'block' : 'none';

}

function initHistory() {
    // Kathy Tremblay
    document.getElementById('ctl00_contentplaceholder_HistoryItemKathyTremblay').style.visibility = 'hidden';
    document.getElementById('ctl00_contentplaceholder_HistoryItemKathyTremblay').style.display = 'none';

    document.getElementById('ctl00_contentplaceholder_HistoryItemCoeurDeSportif').style.visibility = 'hidden';
    document.getElementById('ctl00_contentplaceholder_HistoryItemCoeurDeSportif').style.display = 'none';

}





function setSelectedImage(productPanelId,productPanelCssClass,imgId,cssClass,topWhiteDivId,topWhiteDivCssClass)
{
    // Reset the text and arrow color
    setCssClass('ctl00_contentplaceholder_veloTourProductPanelVp','veloTourProduct');
    setCssClass('ctl00_contentplaceholder_veloTourProductPanelVpExp','veloTourProduct');
    setCssClass('ctl00_contentplaceholder_veloTourProductPanelVpTi','veloTourProduct');
    setCssClass('ctl00_contentplaceholder_veloTourProductPanelVpTiExp','veloTourProduct');
    
    // Reset the top white panel
    setCssClass('ctl00_contentplaceholder_veloTourProductImagePlaceholderVp','veloTourProductImagePlaceholder vp firstImage');
    setCssClass('ctl00_contentplaceholder_veloTourProductImagePlaceholderVpExp','veloTourProductImagePlaceholder vpExp');
    setCssClass('ctl00_contentplaceholder_veloTourProductImagePlaceholderVpTi','veloTourProductImagePlaceholder vpTi');
    setCssClass('ctl00_contentplaceholder_veloTourProductImagePlaceholderVpTiExp','veloTourProductImagePlaceholder vpTiExp');
    
    // Set the description panel visible
    setCssClass('ctl00_contentplaceholder_DescVp','bertrandProductDescriptionContent display');
    setCssClass('bertrandProductDescriptionTableBottom','display');
    
    // Set the text and arrow color, the selected image css class and the top white panel
    setCssClass(productPanelId,productPanelCssClass);    
    setCssClass(imgId,cssClass);
    setCssClass(topWhiteDivId,topWhiteDivCssClass);
}