
function SetTabFocus(selectedTab) {
	var tabIdPrefix = "tab_";
	var menuIdPrefix = "menu_";
	var tabs = [	"hjem", 
					"bio", 
					"disko", 
					"sanger", 
					"medlemmer", 
					"bilder", 
					"presse", 
					"kontakt", 
					"annet"];
	for (var i = 0; i < tabs.length; i++) {
		var tabElement = document.getElementById(tabIdPrefix + tabs[i]);
		var menuElement = document.getElementById(menuIdPrefix + tabs[i]);
		if (tabs[i] == selectedTab) {
			if (tabElement != null)
				tabElement.style.display = "block";
			if (menuElement != null) {
				menuElement.className = "baseTab tabActive"; 
				menuElement.onmouseout = function() { this.className="baseTab tabActive"; };
			}
		}
		else {
			if (tabElement != null)
				tabElement.style.display = "none";
			if (menuElement != null) {
				menuElement.className = "baseTab tabInactive";
				menuElement.onmouseout = function() { this.className="baseTab tabInactive"; };
			}
		}
	}
}
function ToggleExpandCollapse(id) {
	var element = document.getElementById(id);
	if (element.style.display == "block")
		element.style.display = "none";
	else
		element.style.display = "block";
}


function ExpandDivById(idOfDiv, idOfExpandButton, duration) {
	var shouldExpand = true;
	if (document.getElementById(idOfDiv).style['marginLeft'] == '-610px') {
		shouldExpand = false;
	}
	if (shouldExpand) {
		$('#' + idOfDiv).animate(
			{
				width: '+=610',
				height: '+=610',
				marginLeft: '-610'
			}, 
			duration,
			"",
			function() {
				ToggleExpandButton(idOfExpandButton, shouldExpand);
				ExpandEmbedPlayers(shouldExpand);
			}
			);
	}
	else {
		$('#' + idOfDiv).animate(
			{
				width: '-=610',
				height: '-=610',
				marginLeft: '0'
			}, duration,
			"",
			function() { // anonymous function
				ToggleExpandButton(idOfExpandButton, shouldExpand);
				ExpandEmbedPlayers(shouldExpand);
			}
			);
	}
	
	
}

function ToggleExpandButton(idOfButton, shouldExpand) {
	if (shouldExpand) {
		document.getElementById(idOfButton).className="arrowBase arrowRight";
	}
	else {
		document.getElementById(idOfButton).className="arrowBase arrowLeft";
	}
}

function ExpandEmbedPlayers(shouldExpand) {
	var myspaceObjectId = "shell";
	var myspaceIeObjectId = "msIeObject";
	var youtubeObjectId = "ytObject";
	var youtubeEmbedId = "ytEmbed";
	
	var myspaceObject = document.getElementById(myspaceObjectId);
	var myspaceIeObject = document.getElementById(myspaceIeObjectId);
	var youtubeObject = document.getElementById(youtubeObjectId);
	var youtubeEmbed = document.getElementById(youtubeEmbedId);
	
	var smallWidth = 180;
	var smallHeight = 130;
	
	var largeMsWidth = 450;
	var largeMsHeight = 315;
	
	var largeYtWidth = 480;
	var largeYtHeight = 385;

	if (shouldExpand) {
		if (myspaceObject != null) {
			myspaceObject.width = largeMsWidth;
			myspaceObject.height = largeMsHeight;
		}
		if (myspaceIeObject != null) {
			myspaceIeObject.width = largeMsWidth;
			myspaceIeObject.height = largeMsHeight;
		}
		if (youtubeObject != null) {
			youtubeObject.width = largeYtWidth;
			youtubeObject.height = largeYtHeight;
		}
		if (youtubeEmbed != null) {
			youtubeEmbed.width = largeYtWidth;
			youtubeEmbed.height = largeYtHeight;
		}
			
	}
	else {
		if (myspaceObject != null) {
			myspaceObject.width = smallWidth;
			myspaceObject.height = smallHeight;
		}
		if (myspaceIeObject != null) {
			myspaceIeObject.width = smallWidth;
			myspaceIeObject.height = smallHeight;
		}
		if (youtubeObject != null) {
			youtubeObject.width = smallWidth;
			youtubeObject.height = smallHeight;
		}
		if (youtubeEmbed != null) {
			youtubeEmbed.width = smallWidth;
			youtubeEmbed.height = smallHeight;
		}
		
	}
	/*	
	if (shouldExpand) {
		myspaceIeObject.attributes["width"] = largeMsWidth;
		youtubeObject.attributes["width"] = largeYtWidth;
		youtubeEmbed.attributes["width"] = largeYtWidth;
		
		myspaceObject.attributes["height"] = largeMsHeight;
		myspaceIeObject.attributes["height"] = largeMsHeight;
		youtubeObject.attributes["height"] = largeYtHeight;
		youtubeEmbed.attributes["height"] = largeYtHeight;	
	}
	else {
		myspaceObject.attributes["width"] = smallWidth;
		myspaceIeObject.attributes["width"] = smallWidth;
		youtubeObject.attributes["width"] = smallWidth;
		youtubeEmbed.attributes["width"] = smallWidth;
		
		myspaceObject.attributes["height"] = smallHeight;
		myspaceIeObject.attributes["height"] = smallHeight;
		youtubeObject.attributes["height"] = smallHeight;
		youtubeEmbed.attributes["height"] = smallHeight;
	}
	*/
}