/* imagegallery swap */

var tmpContent = '';
var sW = 135;
var sH = 135;
var lUrl = 'http://www.floetotto.net/';

function swapContent(num,w,h,elem){
	if(document.getElementById){
//		tmpContent = document.getElementById('img'+num).innerHTML;
//		document.getElementById('img'+num).innerHTML = document.getElementById('imgfull').innerHTML;
		if(tmpContent == ''){
			tmpContent = document.getElementById('imgfull').innerHTML;
			tmpContent = tmpContent.replace(w, sW);
			tmpContent = tmpContent.replace(w, sW);
			tmpContent = tmpContent.replace(h, sH);
			tmpContent = tmpContent.replace(h, sH);
		}
		if(imgArr[num].indexOf('.flv') > 0){
			document.getElementById('imgfull').innerHTML = '<span class="rgmediaimages-player" id="imgfullspan">Flash ist Pflicht!</span>';
			var so = new SWFObject(lUrl+"typo3conf/ext/rgmediaimages/res/mediaplayer.swf","mpl000",w,h,"8");
			so.addParam("allowscriptaccess","always");
			so.addParam("allowfullscreen","true");
			so.addParam("wmode", "transparent");
			so.addVariable("file",lUrl+"uploads/pics/"+imgArr[num]);
			so.addVariable('width',w);
			so.addVariable('height',h);
			so.addVariable('backcolor','0xwhite');
			so.addVariable('showdigits','0');
			so.addVariable('showicons','false');
			so.addVariable('showvolume','false');
			so.addVariable('volume','0');
			so.addVariable('shownavigation','false');
			so.addVariable('autostart','1');
			so.addVariable('repeat','1');
			so.write("imgfullspan");
		} else {
			if(!document.getElementById('fimg') || document.all){
				document.getElementById('imgfull').innerHTML = '<iframe style="border:0;" src="'+elem.childNodes[0].getAttribute('href')+'" name="fimg" id="fimg" width="'+w+'" height="'+h+'" marginwidth="0" marginheight="0"></iframe>';
				if(document.all){
					window.setTimeout("if(fimg.document.getElementsByTagName('body')[0]){fimg.document.getElementsByTagName('body')[0].style.width = '"+w+"px';fimg.document.getElementsByTagName('body')[0].style.height = '"+h+"px';fimg.document.getElementsByTagName('body')[0].style.overflow = 'hidden';}",200);
					window.setTimeout("if(fimg.document.getElementsByTagName('body')[0]){fimg.document.getElementsByTagName('body')[0].style.width = '"+w+"px';fimg.document.getElementsByTagName('body')[0].style.height = '"+h+"px';fimg.document.getElementsByTagName('body')[0].style.overflow = 'hidden';}",1000);
				}
			}
		}
		var lStr = document.getElementById('img'+num).innerHTML;
		var lNum = imgArr[num];
		document.getElementById('img'+num).innerHTML = tmpContent;
		imgArr[num] = imgArr[0];
		imgArr[0] = lNum;
		tmpContent = lStr;
		if(captionArr.length > 0){
			var lCaption = '';
			if(num < captionArr.length){
				if(captionArr[num] && captionArr[num] != 'undefined'){
					lCaption = captionArr[num];
				}
			}
			document.getElementById('img-caption').innerHTML = '<p>'+lCaption+'</p>';
			captionArr[num] = captionArr[0];
			captionArr[0] = lCaption;
		}
	}


}