// Function to show calculation tooltip popup
function showCalculation(offerId)
{
	newwindow = window.open('content/support/displayCalculation.php?offerId='+offerId,'Prijsberekening','height=350,width=400');
	if (window.focus) {newwindow.focus()}
	return false;
}

// Function to change the display state for an object
function changeDisplay(objectId)
{
	// Get references
	objectToChange = document.getElementById(objectId);
	
	if (objectToChange.className == "shownObject")
	{
		objectToChange.className = "hiddenObject";
	}
	else
	{
		objectToChange.className = "shownObject";
	}
}

// Function to change the display state for a dropdown item
function changeDropDownDisplay(objectId, pictureId, secondary)
{
	// Get references
	objectToChange = document.getElementById(objectId);
  pictureToChange = document.getElementById(pictureId);
  
	if (objectToChange.className == "shownDropDown")
	{
		objectToChange.className = "hiddenDropDown";
    pictureToChange.src = "images/main/plus.gif";
	}
	else
	{
		objectToChange.className = "shownDropDown";
    pictureToChange.src = "images/main/min.gif";
	}
  //Special if there are more than 1 selected menu item.
  if (secondary == true)
  {
    objectToChange.className = "shownDropDown";
    pictureToChange.src = "images/main/min.gif";
  }
}

// Function to change the display state for an object
function changeObjectDisplay(objectId)
{
	// Get references
	objectToChange = document.getElementById(objectId);

	if (objectToChange.style.display == "block")
	{
		objectToChange.style.display = "none";
	}
	else
	{
		objectToChange.style.display = "block";
	}
}

// Function to change the background image of a menu-tab
function changeMenuTab(tabId)
{
	var tabEl = document.getElementById(tabId);
	if (tabEl.className == 'topMenuSelected')
	{
		tabEl.className = 'topMenuUnselected';
	}
	else
	{
		tabEl.className = 'topMenuSelected';
	}
}

// Function to show offer variations
function showOfferVariations(offerId, imageName)
{
	// Get reference for variation table
	variationTable = document.getElementById('variationTable'+offerId);
	
	if (variationTable.style.display == 'none')
	{
		var imageToChange = imageName;
		
		// Show the variations
		variationTable.style.display = '';
		
		// Change SRC of image
		document[imageToChange].src = 'images/phone/offer-variations-down.gif';
	}
	else
	{
		// Hide the variations
		variationTable.style.display = 'none';
		
		var imageToChange = imageName;
		
		// Change SRC of image
		document[imageToChange].src = 'images/phone/offer-variations.gif';
	}	
}