// [TJK_SlideMENU] v1.6 Copyright 2006, Thierry Koblentz - TJKDesign.com. all rights reserved. */
// Report bugs or errors to thierry@tjkdesign.com
if (document.getElementById && document.getElementsByTagName){			
document.write("<link href=\"http://www.camilacolaneri.com.br/wp-content/themes/default/css/TJK_SlideMENU_lua.css\" type=\"text/css\" rel=\"stylesheet\" />")
document.write("<!--[if lt IE 7]><style type=\"text/css\" media=\"screen\">#TJK_SlideMenu a.TJK_Skipper {zoom:1}#TJK_SlideMenu .TJK_SlideMenu_ShowDD {display:block}</style><![endif]--><!--[if IE 5]><style type=\"text/css\" media=\"screen\">#TJK_SlideMenu * {height:0}</style><![endif]-->")
}
var TJK_zMENU;
var TJK_zDD;
var TJK_zDT;
var TJK_zSKIPid="skip_1";
function TJK_SlideMENU(menu){
// we check first if the browser can handle our script, if it does not then we stop right there
if (!document.getElementById || !document.getElementsByTagName) return; 
// the parameter we pass through the function is assigned to the variable 
TJK_zMENU=menu;
// an array that contains all our DTs
TJK_zDD =document.getElementById(TJK_zMENU).getElementsByTagName('dd');
// an array that contains all our DDs
TJK_zDT =document.getElementById(TJK_zMENU).getElementsByTagName('dt'); 
// we go through the whole array to do what we have to do
for(var i=0;i<TJK_zDT.length;i++){
// we create a new DT
	var newDT = document.createElement('dt');
// we grab the text the original one contains
	var stringOfText = TJK_zDT[i].firstChild.data;
// we create a A element
	var newAnchor = document.createElement('a');
// we wrap the text in the DT into the new anchor	
	//newAnchor.appendChild(document.createTextNode(stringOfText));
// we plug the anchor into the new DT
	var identidade = document.createElement('id');
	var nome = 'signo'+i;
	newDT.setAttribute('id',nome);
	
	
	newDT.appendChild(newAnchor);	
// we set a href attribute
	newAnchor.href = "#";
// we set an ID to use it as a named anchor	(to be used with the skip links)
//	newAnchor.id=TJK_zSKIPid;	
//	newAnchor.name=TJK_zSKIPid;
// we set a title	
    newAnchor.title="Mostrar/Esconder as luas";
// we use redundant mechanisms to call the function that will do the job
	newAnchor.onclick = function(event){return TJK_doSlideMENU(this,event)};
	newAnchor.onkeypress = function(event){return TJK_doSlideMENU(this,event)};
// we replace the old one with the one we have just created
    TJK_zDT[i].parentNode.replaceChild(newDT,TJK_zDT[i]);
// we plug a skip link in all DTs but the last one. this skip link contains some static text + a BR element + the text found in the next DT 
	if(i<TJK_zDT.length-1){
// we start by creating an A element
	var newSkipLink = document.createElement("a");
// now we set some static text
	var startString = "Skip to:";
// we include a BR element to create a line break after the above static text
	var newBR = document.createElement("br");
// we fetch the text within the next DT
	var endString = TJK_zDT[i+1].firstChild.data;
// we start to put everything together, first the static text
	newSkipLink.appendChild(document.createTextNode(startString));
// now the BR element			
	newSkipLink.appendChild(newBR);
// and now the text inside the next DT			
	newSkipLink.appendChild(document.createTextNode(endString));			
// we apply a class name to the "skip link" (used to hide/reveal with active/focus)
    newSkipLink.className = "TJK_Skipper";
// we set a href attribute so it is possible to "jump" to the next "skip link"		
	newSkipLink.href= "#";
	newSkipLink.id=TJK_zSKIPid;	
// we cannot use the "href" above to navigate to the named anchors because that would feed the history object. We could use replace(), but using focus() is a better approach.
		if(i==TJK_zDT.length-2){newSkipLink.onclick=function(){this.parentNode.parentNode.getElementsByTagName("dd")[TJK_zDT.length-1].getElementsByTagName("a")[0].focus();};}else{newSkipLink.onclick=function(){TJK_SKIPtoLINK(this.id+"1");};}
// 	we call TJK_removeSkipLink() onblur and onfocus to "help" MS IE do the job
	newSkipLink.onblur=function(){TJK_removeSkipLink(this)};
	newSkipLink.onfocus=function(){TJK_removeSkipLink(this)};
	TJK_zDT[i].appendChild(newSkipLink);
	}
// we set the class for all the DTs and the DDS in there
	TJK_zDT[i].className='TJK_SlideMenu_DTopen';
	TJK_zDD[i].className='TJK_SlideMenu_HideDD';
// we call "TJK_revealOnFocus()" on all nested links
		var zAnchors = TJK_zDD[i].getElementsByTagName('a');
		for(var j=0;j<zAnchors.length;j++){
			TJK_zDD[i].getElementsByTagName("a")[j].onfocus= TJK_revealOnFocus;
		}
		
	TJK_zSKIPid=TJK_zSKIPid+"1";		
	}
// we create one more anchor to help keyboard users jump back at the very top of the menu
	var newSkipBackLink = document.createElement("a");
	newSkipBackLink.appendChild(document.createTextNode("Skip To:"));
// now the BR element			
	newSkipBackLink.appendChild(newBR);
// and now the text inside the next DT			
	newSkipBackLink.appendChild(document.createTextNode("Top of the Menu"));			
// we apply a class name to the "skip link" (used to hide/reveal with active/focus)
    newSkipBackLink.className = "TJK_Skipper";
// we set a href attribute so it is possible to "jump" to the very first anchor in the Menu
	newSkipBackLink.href="#";
	newSkipBackLink.onclick=function(){document.getElementById("skip_1").focus();};
// we call TJK_removeSkipLink() onblur and onfocus to "help" MS IE do the job
	newSkipBackLink.onblur=function(){TJK_removeSkipLink(this)};
	newSkipBackLink.onfocus=function(){TJK_removeSkipLink(this)};
// we plug this new anchor in the DL	
	TJK_zDD[TJK_zDD.length-1].appendChild(newSkipBackLink);			
}
function TJK_SKIPtoLINK(z_thisSKIP){document.getElementById(z_thisSKIP).focus();return false;}
function TJK_doSlideMENU(zItem,objEvent){
// to take care of "onkeypress": see http://juicystudio.com/article/ecmascriptmenu.php
    var iKeyCode;
    // Check if from a keyboard - non IE, but irrelevant as tab doesn't trigger the keypress event in IE
    if (objEvent && objEvent.type == 'keypress'){
        if (objEvent.keyCode) iKeyCode = objEvent.keyCode;
        else if (objEvent.which) iKeyCode = objEvent.which;
        // If it is not the enter key or space key, pass control back to the browser
        if (iKeyCode != 13 && iKeyCode != 32) return true;
    }
// we do the stuff - swapping classes for the DTs and the DDs
zItem.parentNode.className=(zItem.parentNode.className=='TJK_SlideMenu_DTopen')?'TJK_SlideMenu_DTclose':'TJK_SlideMenu_DTopen'; 
// we swap the class of the DDs differently depending on the browser
if(zItem.parentNode.nextSibling.nodeType==1){
// for MSIE
zItem.parentNode.nextSibling.className=(zItem.parentNode.nextSibling.className=='TJK_SlideMenu_HideDD')?'TJK_SlideMenu_ShowDD':'TJK_SlideMenu_HideDD';	
}else{
zItem.parentNode.nextSibling.nextSibling.className=(zItem.parentNode.nextSibling.nextSibling.className=='TJK_SlideMenu_HideDD')?'TJK_SlideMenu_ShowDD':'TJK_SlideMenu_HideDD';	
}
// to make sure the browser does not load the href value
return false;
}
function TJK_revealOnFocus(){
// we swap DD class to reveal them when the user hits a nested (hidden) link
	this.parentNode.parentNode.parentNode.className='TJK_SlideMenu_ShowDD';
// we swap the related DT class (the previous sibling)

if(this.parentNode.parentNode.parentNode.previousSibling.nodeType==1){
// for MSIE	
	this.parentNode.parentNode.parentNode.previousSibling.className='TJK_SlideMenu_DTclose';	
}else{
	this.parentNode.parentNode.parentNode.previousSibling.previousSibling.className='TJK_SlideMenu_DTclose';	
}
}
function TJK_removeSkipLink(zObject){
// this is to avoid an IE bug with the skip links when tabbing backward/forward
	zObject.className='TJK_Skipper';
}