	var DanPopUp = {
		init: function(){
				var ArrayPageSize 	= this.GetPageSize();
				var ArrayPageScroll = this.GetPageScroll();
				
				if (!document.getElementById(this.DanPopUpID)) {
					var NewNode = document.createElement("div");
					NewNode.setAttribute("id", this.DanPopUpID);
					NewNode.className = 'DanPopUpOuterDiv';
					document.body.appendChild(NewNode);
				}		
				this.objDiv = document.getElementById(this.DanPopUpID);
				this.objDiv.className = 'DanPopUpOuterDiv';
				this.objDiv.style.left 		= "0px";
				this.objDiv.style.top 		= "0px";
				this.objDiv.style.height 	= ArrayPageSize[1]+'px';
				this.objDiv.style.zIndex 	= 10000;
				this.objDiv.onclick			= 'return false';
				if(this.showWrapper) this.objDiv.style.display	= "block";
				else this.objDiv.style.display	= "none";
			
				if (!document.getElementById(this.DanPopUpInnerDivID)) {
					var NewNode = document.createElement("div");
					NewNode.setAttribute("id", this.DanPopUpInnerDivID);
					NewNode.className = "DanPopUpInnerDIV";
					document.body.appendChild(NewNode);
				}		
				this.objInnerDiv = document.getElementById(this.DanPopUpInnerDivID);
				this.objInnerDiv.className	= 'DanPopUpInnerDIV';
				this.objInnerDiv.onlick		= 'return false';
				this.objInnerDiv.style.left = '0px';
				this.objInnerDiv.style.width = '100%';
			
				this.objInnerDiv.style.top = (ArrayPageScroll[1] + 200) + 'px';
				this.objInnerDiv.style.display = "block";
				this.objInnerDiv.style.zIndex = 10000;
				
				this.opacity = 100;
			},
		Alert: function(content,title,background,delaytime){
				if(background == false){
					this.showWrapper = background;
				}
				this.init();
				if(title)title = title;
				else title = this.DanPopUpTitle;
				this.hideSelectBoxes();
				
				
				html = this.getPopUpContent(title,content,1);
				this.objInnerDiv.innerHTML = html;	
				if(delaytime){
					setTimeout('DanPopUp.FadeOut();',delaytime);
				}
			},
		MsgBox: function(content,title,background,delaytime){
				if(background == false){
					this.showWrapper = background;
				}
				this.init();
				if(title)title = title;
				else title = this.DanPopUpTitle;
				this.hideSelectBoxes();
				
				 
				html = this.getPopUpContent(title,content,2);
				this.objInnerDiv.innerHTML = html;	
				if(delaytime){
					setTimeout('DanPopUp.FadeOut();',delaytime);
				}
			},
		RateBox: function(type,id){
				this.init(); 
				title = "Project "+type+" rating";
				content = '		<div style="width:370px;font-weight:bold">Enter your rating with 1 is the lowest and 5 is the highest.</div>';
				content += '	<div style="padding-top:5px">';
				content += '		<table class="pagination">';
				content += '			<tr>';
				content += '				<td class="pglinks"><a href="'+BASE_URL+'home/place_rating/'+type+'/'+id+'/1" style="font-size:20px;font-weight:bold">1</a></td>';
				content += '				<td class="pglinks"><a href="'+BASE_URL+'home/place_rating/'+type+'/'+id+'/2" style="font-size:20px;font-weight:bold">2</a></td>';
				content += '				<td class="pglinks"><a href="'+BASE_URL+'home/place_rating/'+type+'/'+id+'/3" style="font-size:20px;font-weight:bold">3</a></td>';
				content += '				<td class="pglinks"><a href="'+BASE_URL+'home/place_rating/'+type+'/'+id+'/4" style="font-size:20px;font-weight:bold">4</a></td>';
				content += '				<td class="pglinks"><a href="'+BASE_URL+'home/place_rating/'+type+'/'+id+'/4" style="font-size:20px;font-weight:bold">5</a></td>';
				content += '			</tr>';
				content += '		</table>';
				content += '	</div>';
				content += '	<div style="text-align:right;"><input type="button" class="DanPopUpButton" onClick="DanPopUp.Close();" value="   CANCEL  " width="57" height="30" alt=""></div>';
				html = this.getPopUpContent(title,content,2);
				this.objInnerDiv.innerHTML = html;	
			},
		Close: function (){
				this.opacity = 0;
				this.displaySelectBoxes();
				this.objDiv.style.display = "none";
				this.objInnerDiv.style.display = "none";
			},
		FadeOut: function(){
				if(this.opacity > 0){
					this.opacity--;
					this.set_Opacity(this.opacity);
					setTimeout("DanPopUp.FadeOut()",5);
				}else{
					this.Close();
				}
			},
		set_Opacity: function(opacity){
			if (this.objDiv.style.MozOpacity!=null) {
				/* Mozilla's pre-CSS3 proprietary rule */
				this.objDiv.style.MozOpacity = (opacity/100)-.001;
				this.objInnerDiv.style.MozOpacity = (opacity/100)-.001;
				/* the .001 fixes a glitch in the opacity calculation which normally results in a flash when reaching 1 */
			} else if (this.objDiv.style.opacity!=null) {
				/* CSS3 compatible */
				this.objDiv.style.opacity = (opacity/100)-.001;
				this.objInnerDiv.style.opacity = (opacity/100)-.001;
			} else if (this.objDiv.style.filter!=null) {
				/* IE's proprietary filter */
				this.objDiv.style.filter = "alpha(opacity="+opacity+")";
				this.objInnerDiv.style.filter = "alpha(opacity="+opacity+")";
				/* worth noting: IE's opacity needs values in a range of 0-100, not 0.0 - 1.0 */ 
			}
		},
		getPopUpContent: function (title,content,mode){
				var htmlContent;
				htmlContent='		<table id="message_box" border="0" width="300" cellpadding="0" align="center" cellspacing="0" class="DanPopUpBody" >';
				htmlContent += '		<tr>';
				htmlContent += '			<td  width="100%" class="DanPopUpTitle" style="font-size:12px"><b>'+title+'</b></td>';
				htmlContent += '		</tr>';
				htmlContent += '		<tr>';
				htmlContent += '			<td align="center"  class="DanPopUpContent" style="font-size:12px">'+content+'</td>';
				htmlContent += '		</tr>';
				htmlContent += '		<tr>';
				if(mode == 1){
					htmlContent += '			<td align="center" height="30" class="DanPopUpButtonHolder"><input type="button" class="DanPopUpButton" onClick="DanPopUp.Close();" value="   OK   " width="57" height="30" alt=""></td>';
				}else{
					htmlContent += '			<td align="center" height="1" class="DanPopUpButtonHolder"></td>';
				}
				htmlContent += '		</tr>';
				htmlContent += '	</table>';	
				return htmlContent;
			},
		GetPageSize: function(){
				var xScroll, yScroll;
				var windowWidth, windowHeight;
				if (window.innerHeight && window.scrollMaxY) {	
					xScroll = document.body.scrollWidth;
					yScroll = window.innerHeight + window.scrollMaxY;
				} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
					xScroll = document.body.scrollWidth;
					yScroll = document.body.scrollHeight;
				} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
					xScroll = document.body.offsetWidth;
					yScroll = document.body.offsetHeight;
				}
				if (self.innerHeight) {	// all except Explorer
					windowWidth = self.innerWidth;
					windowHeight = self.innerHeight;
				} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
					windowWidth = document.documentElement.clientWidth;
					windowHeight = document.documentElement.clientHeight;
				} else if (document.body) { // other Explorers
					windowWidth = document.body.clientWidth;
					windowHeight = document.body.clientHeight;
				}	
				// for small pages with total height less then height of the viewport
				if(yScroll < windowHeight){
					pageHeight = windowHeight;
				} else { 
					pageHeight = yScroll;
				}
				// for small pages with total width less then width of the viewport
				if(xScroll < windowWidth){	
					pageWidth = windowWidth;
				} else {
					pageWidth = xScroll;
				}
				ArrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
				return ArrayPageSize;
			},
		GetPageScroll: function (){
				var yScroll;
				if (self.pageYOffset) {
					yScroll = self.pageYOffset;
				} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
					yScroll = document.documentElement.scrollTop;
				} else if (document.body) {// all other Explorers
					yScroll = document.body.scrollTop;
				}
				arrayPageScroll = new Array('',yScroll) 
				return arrayPageScroll;
			},
		hideSelectBoxes: function() {
				for(var i = 0; i < document.forms.length; i++) {
					for(var e = 0; e < document.forms[i].length; e++){
						if(document.forms[i].elements[e].tagName == "SELECT") {
							document.forms[i].elements[e].style.visibility="hidden";
						}
					}
				}
			},
		displaySelectBoxes: function() {
				for(var i = 0; i < document.forms.length; i++) {
					for(var e = 0; e < document.forms[i].length; e++){
						if(document.forms[i].elements[e].tagName == "SELECT") {
						document.forms[i].elements[e].style.visibility="visible";
						}
					}
				}
			},
		showWrapper: true,
		opacity:100,
		contentHeight: 100,
		objDiv: new Object(),
		objInnerDiv: new Object(),
		DanPopUpTitle: 'yourlinguafranca.com',
		DanPopUpID: 'DanPopUp',
		DanPopUpInnerDivID: 'DanPopUpInner'
		
	}

	
	function addEvent(elm, evType, fn, useCapture){
		if (elm.addEventListener){
			elm.addEventListener(evType, fn, useCapture);
			return true;
		}else if (elm.attachEvent){
			var r = elm.attachEvent("on"+evType, fn);
			return r;
		}
	}
