// En genial funktion som hittar alla objekt av en viss class. Kanon om man ska sätta alla genomskinliga eller liknande
document.getElementsByClassName = function(cl) 
{
	var retnode = [];
	var minClass = new RegExp('\\b'+cl+'\\b');
	var elemObjekt = this.getElementsByTagName('*');
	
	for (var i = 0; i < elemObjekt.length; i++) 
	{
		var classes = elemObjekt[i].className;
		if (minClass.test(classes))
		{	
			retnode.push(elemObjekt[i]);
		}
	}
	return retnode;
}
	
// Sätter genomskinlighet efter smak på vad som än kommer in, typ
function setAlphaClass(inObjekt,alphaIn)
{
	if(IE)
	{
		inObjekt.style.filter="alpha(opacity=" + alphaIn + ")";
	}
			
	if(NotIE)
	{
		inObjekt.style.opacity = alphaIn/100;
	}
}

// Gör alla classer man skickar in genomskinliga
function makeGenomskinlig(inClass,alphaIn,rollOver) 
{  
	var targetObjekts = document.getElementsByClassName(inClass); 
	
	for (i = 0; i < targetObjekts.length; i++) 
	{
		//alert("1: " +targetObjekts[i]+ " 2: "+document.getElementById('pip_wrapper'));
		
		setAlphaClass(targetObjekts[i],alphaIn);
		
		if(rollOver)
		{
			targetObjekts[i].onmouseover = function() {setAlphaClass(this,100);} 
			targetObjekts[i].onmouseout = function() {setAlphaClass(this,alphaIn);} 
		}
	}
}

// Funktioner här nedan för att stoppa alla andra flashfiler som spelas när man börjar att spela en ny
var isSpelar = "";
function setIsPlaying(theId) 
{
	if(isSpelar != "") 
	{
		stopPlaying(isSpelar);
	}
	isSpelar = theId;
}
function stopPlaying(theId) 
{
	document.getElementById(isSpelar).korStoppaLjudPreviews();
}


// Om jag skulle vilja göra runda hörn på allt
/*
function makeRoundCorners() 
{  
	  var images = document.getElementsByClassName('rundahorn');  
	  for (i = 0; i < images.length; i++) {
		var imageWidth = images[i].width;
		var imageHeight = images[i].height;    var html = "<div style=\"background: url('images/ramG.gif') repeat-x top left; position: absolute; width: " + imageWidth + "px; height: " + imageHeight + "px;\"></div>";
		html = html + "<div style=\"background: url('images/ramG.gif') repeat-x bottom left; position: absolute; width: " + imageWidth + "px; height: " + imageHeight + "px;\"></div>";
		html = html + "<div style=\"background: url('images/ramG.gif') repeat-y left; position: absolute; width: " + imageWidth + "px; height: " + imageHeight + "px;\"></div>";  
		html = html + "<div style=\"background: url('images/ramG.gif') repeat-y right; position: absolute; width: " + imageWidth + "px; height: " + imageHeight + "px;\"></div>";
		
		html = html + "<div style=\"background: url('images/tl.gif') no-repeat top left; position: absolute; width: " + imageWidth + "px; height: " + imageHeight + "px;\"></div>";
		html = html + "<div style=\"background: url('images/tr.gif') no-repeat top right; position: absolute; width: " + imageWidth + "px; height: " + imageHeight + "px;\"></div>";
		html = html + "<div style=\"background: url('images/bl.gif') no-repeat bottom left; position: absolute; width: " + imageWidth + "px; height: " + imageHeight + "px;\"></div>";
		html = html + "<div style=\"background: url('images/br.gif') no-repeat bottom right; position: absolute; width: " + imageWidth + "px; height: " + imageHeight + "px;\"></div>"; 
		
		html = html + "<img src='" + images[i].src + "' width='" + imageWidth + "' height='" + imageHeight + "'>";
		images[i].parentNode.innerHTML = html;
	  }
}
*/

