// urci sekci podle URL

var rgx = new RegExp("^(http://)?([^\.]+\.{1})?[^\.]+\.cz/([^/]*)(/)?cestovani/([^/]*)(/)?([^/]*)(/)?.*$");
//var rgx = new RegExp("^(http://)?([^\.]+\.{1})?[^\.]+\.cz/cestovani/([^/]*)(/)?([^/]*)(/)?.*$");
var section, section_root, currentItem;

section_root = 'homepage';

if(regURL=location.href.match(rgx)) {
	if(regURL[3]=="asc" || regURL[3]=="toISO-8859-2.cs" || regURL[3]=="win" || regURL[3]=="mac" || regURL[3]=="lat" || regURL[3]=="kam" || regURL[3]=="toISO-8859-1.cs" || regURL[3]=="koi" || regURL[3]=="utf8") {
		if(regURL[8]=="/") { 
		section = regURL[5]+"_"+regURL[7];
		section_root = regURL[5];
		}
		else if(regURL[6]=="/") { 
		section = regURL[5];
		}
		else{
		section = 'homepage';    
		}
	} else {
		if(regURL[8]=="/") { 
		section = regURL[5]+"_"+regURL[7];
		section_root = regURL[5];
		}
		else if(regURL[6]=="/") { 
		section = regURL[5];
		}
		else{
		section = 'homepage';    
		}
	}
}
else {
  section = 'homepage';
}

// if(regURL=location.href.match(rgx)) {
    // if(regURL[6]=="/") { 
	// section = regURL[3]+"_"+regURL[5];
	// section_root = regURL[3];
    // }
    // else if(regURL[4]=="/") { 
	// section = regURL[3];
    // }
    // else{
	// section = 'homepage';
    // }
// }
// else {
  // section = 'homepage';
// }


// vysviceni sekce v menu

currentItem = "sect_"+section;

if(!(elem = document.getElementById(currentItem))){
    section = section_root;
    currentItem = "sect_"+section_root;
    if(!(elem = document.getElementById(currentItem))){
	elem = document.getElementById("sect_homepage");
    }
}

elem.style.backgroundImage = 'URL(http://i2.cn.cz/cestovani_menu_bg_a.jpg)';
elem.style.backgroundColor = '#FFFFFF';
elem.childNodes[0].style.color = '#FFFFFF';

// rozbal menu pokud je rozbalovaci

//switch(section){
//  case "motorsport_f1":
//  case "motorsport_dakar":  
//  currentSubmenu = "sub_motorsport";
//  break;
//  default:
//  currentSubmenu = "sub_"+section;
//  break;
//}

//if(document.getElementById(currentSubmenu)){
//SwitchMenu(currentSubmenu);
//}
