// RETRIEVE VARIABLE VALUE FROM URL

function getVar(name)
{
get_string = document.location.search;        
return_value = '';

do { //This loop is made to catch all instances of any get variable.
  name_index = get_string.indexOf(name + '=');
  
  if(name_index != -1)
    {
    get_string = get_string.substr(name_index + name.length + 1, get_string.length - name_index);
    
    end_of_value = get_string.indexOf('&');
    if(end_of_value != -1)                
      value = get_string.substr(0, end_of_value);                
    else                
      value = get_string;                
      
    if(return_value == '' || value == '')
       return_value += value;
    else
       return_value += ', ' + value;
    }
  } while(name_index != -1)
  
//Restores all the blank spaces.
space = return_value.indexOf('+');
while(space != -1)
    {
    return_value = return_value.substr(0, space) + ' ' +
    return_value.substr(space + 1, return_value.length);
                  
    space = return_value.indexOf('+');
    }

return(return_value);        
}

// ON WINDOW LOUD FUNCTION

window.onload = function() {
id = getVar('page_id');

if(id >=51 && id <= 53) id='24';
if(id == 49 || id == 50) id='25';
if(id == 54 || id == 55) id='26';
if(id >= 56 && id <= 61) id='27';

if(id != 22 && id != 11){document.getElementById("s" + id).childNodes[0].className = 'op_on';}

if(id>=6 && id<=10) id='1';
if((id >= 11 && id <= 15) || (id >= 18 && id <= 21)) id='2';
if(id >= 22 && id <= 27) id='3';
if(id >= 29 && id <= 30) id='4';
if(id == 33 || id == 35 || id == 36) id='5';
if(id >= 105 && id <= 121) id='6';

document.getElementById("hau" + id).className = 'show';
document.getElementById( "m" + id).childNodes[0].className = 'on';
}

// HIDE AND UNHIDE FUNCTION

function hau(id){

if(document.getElementById("hau" + id).className == 'hide'){

document.getElementById("hau" + id).className = 'show';
document.getElementById( "m" + id).childNodes[0].className = 'on';

}else{

document.getElementById("hau" + id).className = 'hide';
document.getElementById( "m" + id).childNodes[0].className = 'off';
}
}
