function PopUp( PopupDivID,TransParantLayer ) {
	this.Setup( PopupDivID,TransParantLayer );
}

PopUp.prototype.Setup = function( PopupDivID,TransParantLayer ) {
	this.PopupDivID = PopupDivID;
	this.PopupOpen = false;
	this.DarkLayer = document.getElementById( TransParantLayer );
	this.setBackground();
}

PopUp.prototype.togglePopup = function() {
	if ( this.PopupOpen ) {
		//If the popup is open, close it
		this.closePopup();
		return;
	}

	if ( !this.PopupOpen ) {
		//If the ppup was not open, open it
		this.openPopup();
		return;
	}
}

PopUp.prototype.openPopup = function() {
	//Setting popupDiv visable and when ready change the normal image
	$( '#' + this.PopupDivID ).fadeIn( 'slow' );
	this.PopupOpen = true;
}

PopUp.prototype.closePopup = function() {
	//Setting popupDiv visable
	$( '#' + this.PopupDivID ).fadeOut( 'slow' );
  this.PopupOpen = false;
}

PopUp.prototype.setBackground = function() {
	if( this.DarkLayer ) {
	  var Body = document.getElementsByTagName( 'body' ).item( 0 );
	  var Html = document.getElementsByTagName( 'html' ).item( 0 );
 	 	var Height = Math.max( Body.offsetHeight, Html.offsetHeight );
 	 	var Width = Math.max( Body.offsetWidth, Html.offsetWidth );
		
  	this.DarkLayer.style.height = Height + 'px';
  	this.DarkLayer.style.width = Width + 'px';
	}
}
