/** * display selected region in red over the french map * and display the region name in the div below the map * * @param regionName * @return */ function onMouseOverRegion( regionName, selected ) { $("regionName").show(); if( regionName != selected ) { $("region_"+regionName+"_red").show(); } $("regionName").innerHTML = a_regions[regionName]["libelle"]; } /** * mask the red color over the french map * and mask the div with region name below the map * * @param regionName * @return */ function onMouseOutRegion( regionName, selected ) { $("regionName").hide(); if( regionName != selected ) { $("region_"+regionName+"_red").hide(); } $("regionName").innerHTML = ""; } /** * Switch element visibility * @param a_elements - Array contains id of elements to roll * @param rolling_interval - Integer * */ function switch_element (a_elements, rolling_interval) { var current = 0; var element_length = a_elements.length - 1; var intervalId; /* init: show first element of a_elements */ var init = function(){ for(i = 0; i < element_length; i++){ if(i == current){ $(a_elements[i]).show(); } else{ $(a_elements[i]).hide(); } } if(rolling_interval){ start_automatic_roll(); } }; /* perform rolling element */ var roll = function(){ $(a_elements[current]).hide(); if(current < element_length) { current++; } else{ current = 0; } $(a_elements[current]).show(); start_automatic_roll(); }; /* start & restart automatic roll */ var start_automatic_roll = function(){ clearInterval(intervalId); intervalId = setInterval(roll, rolling_interval); }; init(); } /** * refresh list of affiliate in function of selected company_group * * @param id_company_group * @return list of affiliate */ function refreshAffiliateList( value, selected_value ) { //get affiliate selectBox and purge it select = $("affiliate_selectBox"); select.options.length = 0; //after purge, insert new affiliate list for selected company_group var new_option = new Option( '', '', false ); select.options[select.length] = new_option; if( typeof( affiliateIndexedByCompanyGroup[value] ) != "undefined" && affiliateIndexedByCompanyGroup[value].length > 0 ) { newAffiliateList = affiliateIndexedByCompanyGroup[value]; for( j=0; j < newAffiliateList.length; j++) { selected = false; if( newAffiliateList[j]['id_affiliate'] == selected_value ) { selected = true; } var new_option = new Option( newAffiliateList[j]['name'], newAffiliateList[j]['id_affiliate'], selected ); select.options[select.length] = new_option; } } }