function showMedia(divid,source,type,width,height,caption,imgSource,thumbdivid,autostart,isFirst,theLink){
	if(type=='application/x-shockwave-flash'){ // swf
	    if (source.indexOf("://") >= 0){ // Om YouTube
			height = parseInt(height)+33; // YouTube-kontroller
		} else { // Om inte YouTube är det en lokal flv
			//source = 'http://www.brittonbritton.se'+source
		}
		var mySWFObject = new SWFObject(source, 'cf', width, height, '8', '#FFFFFF');
		mySWFObject.write(divid);
	} else if(type=='video/quicktime') { // qt
		height = parseInt(height)+15;
		var myQTObject = new QTObject(source, 'bushfinger'+divid, width, height);
		myQTObject.addParam('autostart', autostart);
		myQTObject.addParam('controller', 'true');
		myQTObject.write(divid);
	} else if(type=='application/octet-stream') { // flv
		boxheight = parseInt(height)+20;
		displayheight = parseInt(height)-20;
		var myFLVObject = new SWFObject("/inc/flvplayer.swf", "flvplayer", width, height, "8", "#ffffff");
		myFLVObject.addParam('allowfullscreen', 'true');
  		myFLVObject.addVariable('file', source);
  		myFLVObject.addVariable('height', height);
  		myFLVObject.addVariable('width', width);
  		myFLVObject.addVariable('image', imgSource);
  		myFLVObject.addVariable('autostart', autostart);
  		myFLVObject.addVariable('displayheight', displayheight);
  		myFLVObject.addVariable('showicons', true);
  		myFLVObject.addVariable('backcolor', 0x000000);
  		myFLVObject.addVariable('frontcolor', 0xCCCCCC);
  		myFLVObject.addVariable('lightcolor', 0x557722);
		myFLVObject.addVariable("overstretch",true);
   		myFLVObject.write(divid);
	} else {
		document.getElementById(divid).innerHTML = '<img src="'+source+'" width="'+width+'" height="'+height+'" alt="" />\n';
	}

	var thumbdiv = document.getElementById(thumbdivid);
	if(thumbdiv && !isFirst){
		var a=thumbdiv.getElementsByTagName('a');
		for (var i=0;i<a.length;i++){
			if ( a[i].className ){
			var classList = a[i].className.split(' ');
				for ( var j = 0; j < classList.length; j++ ){
					// ta bort klassen active från alla artikelns thumbnails
					if ( classList[j] == 'active' ){
						classList.splice(j, 1);
						j--;
					}
				}
				a[i].className = classList.join(' ');
			}
		}
	}
		
	// lägg till klassen active på den länk man klickat på
	theLink.className+=theLink.className?' active':'active';
	var pCaption = document.createElement('p');
	pCaption.innerHTML = unescape(caption);
	document.getElementById(divid).appendChild(pCaption);
	
	theLink.blur();

	return false;
}

function setLargeImageSize(){
	var orgSrc;
	var ww = Window.getWidth();
	var wh = Window.getHeight();
	var bigImg=document.getElementById('startImage');
	if(bigImg){
		if (!bigImg.orgSrc) {
			bigImg.orgSrc = bigImg.src;
		}
		var newHeight;
		//if ((wh<850)&&(wh>550)){
			newHeight = wh-120;
			bigImg.src = bigImg.orgSrc + "&h=" + newHeight;
			bigImg.height = newHeight;
		/*} else {
			bigImg.src = bigImg.orgSrc;
		}*/
	}
}
window.addEvent('domready', setLargeImageSize);
window.addEvent('resize', setLargeImageSize);