/**
	@author tGDA
	Used to switch between available styles 
*/

StyleSwitcher={};
StyleSwitcher.avaiableStylesheets=[];
StyleSwitcher.hiddenStyleImg=null;
StyleSwitcher.extraImages2preload=['meeting_name.gif', 'top_bg.gif', 'logo.gif'];
StyleSwitcher.init=function() {
	var maybeStylesheets=document.getElementsByTagName('link');
	for(var i=0; i<maybeStylesheets.length; i++) {
		var currElem=maybeStylesheets[i], name;
		if(currElem.getAttribute('rel').indexOf('stylesheet')!=-1 &&(name=currElem.getAttribute('title'))) {
			this.avaiableStylesheets[name]=currElem;
			//alert(this.avaiableStylesheets[name]);
			
			for(var k=0; k<this.extraImages2preload.length; k++){
				(new Image()).src='./Templates/ITC/'+name+'/'+StyleSwitcher.extraImages2preload[k];
			}
		}
	}
	this.hiddenStyleImg=document.createElement('IMG');
	this.hiddenStyleImg.id='style-hidden-img-switch';
	document.body.appendChild(this.hiddenStyleImg);
}

StyleSwitcher.setActiveStylesheet=function(newStylesheet) {
	var found=false;
	for(var i in this.avaiableStylesheets) {
		//alert(i);
		var styleElem=this.avaiableStylesheets[i];
		//alert(styleElem);
		styleElem.disabled=true;
			
		if(i==newStylesheet) {
			found=true;
			styleElem.rel='stylesheet';
			styleElem.disabled=false;
			this.hiddenStyleImg.src='utils.php?do=changestyle&newstyle='+i;
		} else {
			//styleElem.rel='alternate stylesheet';
		}
	}
	
	if(!found) {
		alert('no such style');
	}
}

var vstreamingContainers=null;

function loadVstreamingContainer() {
	if(!vstreamingContainers) {
		vstreamingContainers={
			div:document.getElementById('vstreaming-container'),
			cell:document.getElementById('vstreaming-container-cell')
		};
	}
}

function video_big() {
	loadVstreamingContainer();
	vstreamingContainers.div.className='vstreaming-container-undocked';
	vstreamingContainers.cell.className='vstreaming-container-cell-undocked';
}
function video_small() {
	vstreamingContainers.div.className='vstreaming-container-docked';
	vstreamingContainers.cell.className='vstreaming-container-cell-docked';
}