
	function initTabs(){
		var test = document.getElementById('mediablock') ? true : false;
		if(test){			
			 bttnDivArr = document.getElementById('mediaswitch').getElementsByTagName('div');
			 mediaDivArr = document.getElementById('mediaobject').getElementsByTagName('div');		 
			
			//if( (bttnDivArr.length > 0) && (bttnDivArr.length == mediaDivArr.length ) ){
			if (bttnDivArr.length > 0) {
				showTab(bttnDivArr[0]);
			}			
		}
	}

		
	function showTab(whichtab){
		// change all buttons
		for(i=0; i < bttnDivArr.length; i++){
			divId = bttnDivArr[i];
			divId.className = "navbttn";
		}
		// set required button to active
		whichtab.className = "navbttn active";
		
		// get corresponding mediadiv
		var mediaDiv = whichtab.getAttribute("toshow");
		// hide all mediadivs
		for(j=0; j < mediaDivArr.length; j++){
			mediaDivId = mediaDivArr[j];
				mediaDivId.style.display = 'none';
		}
		// show required
		document.getElementById(mediaDiv).style.display = 'block';
	}
	
	addOnLoadFunction("initTabs");
