var numButtons=8;

function setOpera(){
	if (window.opera){
		var divTags=new Array();
		divTags=document.getElementsByTagName('div');
		for (i=0;i<divTags.length;i++){
			if (divTags[i].className.indexOf('hadow')!=-1){
				divTags[i].style.visibility='hidden';
			}
		}
	}
}

function showFlyout(index){
	for (i=1;i<=numButtons;i++){
		if (typeof closer!='undefined') {
			clearTimeout(closer);
		}
		if (i!=index && document.getElementById('subMenu'+i)) document.getElementById('subMenu'+i).style.display='none';
	}
	document.getElementById('subMenu'+index).style.display='block';
}

function closeAll(){
	for (i=1;i<=numButtons;i++){
		if (document.getElementById('subMenu'+i)) document.getElementById('subMenu'+i).style.display='none';
	}
}

	function makeCorners(node){
	
		  if (node.hasChildNodes) {
				var iteration;
				for (iteration=0;iteration<node.childNodes.length;iteration++) {
					makeCorners(node.childNodes[iteration]);
				}
		  }
		  
		  // format for ATTRIBUTE: corners="round,[radius (0 if none)],[shadowOffset (0 if none)],[color (opt)]"
		  
		  if (node.getAttribute&&(sty=node.getAttribute('corners'))){
		   
			var arrSty=sty.split(',');
			sty=arrSty[0];
			cornerRadius=parseInt(arrSty[1]);
			shadowOffset=parseInt(arrSty[2]);
			
			var n=node;
			
			if (arrSty[3]) {
				borderColor=arrSty[3];
			} else {
				borderColor=n.style.backgroundColor;
			}
						
			if (parseInt(n.offsetWidth)!=0){  
			
				elWidth=n.offsetWidth;
				elHeight=n.offsetHeight;
				
			} else {  //ROUTINE TO DETERMINE SIZE OF display:none ELEMENTS
			
				var elTemp=document.createElement('div');
				elTemp.style.position='absolute';
				elTemp.style.visibility='hidden';
				document.body.insertBefore(elTemp,document.body.firstChild);
				nodeTemp=n.cloneNode(true);
				elTemp.appendChild(nodeTemp);
				elWidth=nodeTemp.offsetWidth;
				elHeight=nodeTemp.offsetHeight;
				elTemp.parentNode.removeChild(elTemp);
			
			}
			
			if (sty=='round'){
			
				var newDiv=document.createElement('div');
				newDiv.style.width=elWidth+(!document.all?0:0)+'px';
				newDiv.style.styleFloat=n.style.styleFloat;
				newDiv.style.cssFloat=n.style.cssFloat;
				newDiv.style.marginLeft=n.style.marginLeft;
				newDiv.style.marginRight=n.style.marginRight;
				newDiv.style.marginTop=n.style.marginTop;
				newDiv.style.marginBottom=n.style.marginBottom;
				newDiv.style.position=n.style.position==''?'relative':n.style.position;
				newDiv.style.top=n.style.top;
				newDiv.style.left=n.style.left;
				
				for (i=cornerRadius;i>=0;i--){
					var newLine=document.createElement('div');
					newLine.style.height='1px';
					newLine.style.overflow='hidden';
					newLine.style.position='relative';
					newLine.style.zIndex='10';
					var mrgn=cornerRadius-Math.cos(Math.asin(i/cornerRadius))*cornerRadius;
					newLine.style.margin='0px ' + mrgn + 'px';
					newLine.style.backgroundColor=borderColor;
					newDiv.appendChild(newLine);	
				}
				
				var orig=n.cloneNode(true);
				orig.style.position='relative';
				orig.style.top='0px';
				orig.style.left='0px';
				orig.style.width='100%'
				orig.style.marginLeft='0px';
				orig.style.marginRight='0px';
				orig.style.marginTop='0px';
				orig.style.marginBottom='0px';
				orig.style.cssFloat='';
				orig.style.styleFloat='';
				newDiv.appendChild(orig);
				
				for (i=1;i<=cornerRadius;i++){
					var newLine=document.createElement('div');
					newLine.style.height='1px';
					newLine.style.overflow='hidden';
					newLine.style.position='relative';
					var mrgn=cornerRadius-Math.cos(Math.asin(i/cornerRadius))*cornerRadius;
					newLine.style.margin='0px ' + mrgn + 'px';
					newLine.style.backgroundColor=borderColor;
					newDiv.appendChild(newLine);	
				}

				n.parentNode.replaceChild(newDiv,n);
				
				if (shadowOffset!=0){
				
					if (document.all && !window.opera){
						var shad=newDiv.cloneNode(true);
						shad.style.position='absolute';
						shad.style.marginLeft='0px';
						shad.style.marginRight='0px';
						shad.style.marginTop='0px';
						shad.style.marginBottom='0px';
						shad.style.top=-shadowOffset/2+'px';
						shad.style.left=-shadowOffset/2+'px';
						shad.style.filter='progid:DXImageTransform.Microsoft.Blur(PixelRadius="'+shadowOffset+'", MakeShadow="true", ShadowOpacity="0.50")';
						newDiv.insertBefore(shad,newDiv.firstChild);
					} else {
						var shad=newDiv.cloneNode(true);
						shad.style.marginLeft='0px';
						shad.style.marginRight='0px';
						shad.style.marginTop='0px';
						shad.style.marginBottom='0px';
						var allDivs=shad.getElementsByTagName('div');
						for (i=0;i<allDivs.length;i++){
							allDivs[i].style.backgroundColor='black';
						}
						shad.style.position='absolute';
						shadowOffset+=5;
						for (x=1;x<=shadowOffset;x++){
							var shad2=shad.cloneNode(true);
							shad2.style.top=x+'px';
							shad2.style.left=x+'px';
							shad2.style.opacity=1/(3*x);
							newDiv.insertBefore(shad2,newDiv.firstChild);
						}
					}
				}
				
			}

		  }
		  
	}

document.onload=setOpera;

