popContent = {
	fetchPop 					: function(popID, callingElement){
												var urlAddress = 'http://' + window.location.hostname + '/';
												
												var req = new Request({
															method: 'get',
															url:  urlAddress + '/pop-content/?action=fetch-pop&pop=' + popID,
															onSuccess: function(response) { 
																switch(response){
																	case '#private' :
																		alert('You must be logged in to access this feature.');
																	break;
																	
																	case '#notexist' :
																		alert('This feature has been removed.');
																	break
																	
																	default :
																		jQuery('#pop-inner').html(response);
																		popContent.fetchPopStyle(popID, callingElement);
																		label2value();
																	break;
																}
															},
															link: 'chain'
												}).send();
		
												return true;
	},
	
	fetchPopStyle		: function(popID, callingElement){
												var urlAddress = 'http://' + window.location.hostname + '/';

												var req = new Request({
															method: 'get',
															url: urlAddress + 'pop-content/?action=fetch-style&pop=' + popID,
															onSuccess: function(response) { 
																if(response != ''){
																	popDiv = document.getElementById('pop-content');
																	popDiv.setAttribute('style', response + ' display: block;');																	
																	popDiv.style.top = callingElement.style.top;
																	popDiv.style.left = callingElement.style.left;
																	var ns4 = (navigator.appName.indexOf("Netscape")>=0 
																						&& parseFloat(navigator.appVersion) >= 4 
																						&& parseFloat(navigator.appVersion) < 5)? true : false;
																	var ns6 = (parseFloat(navigator.appVersion) >= 5 
																						&& navigator.appName.indexOf("Netscape")>=0 )? true: false;
																	var ns = (document.layers)? true:false;
																	var ie = (document.all)? true:false;
																	function getElLeft(el) {
																		if (ns4) {return el.pageX;} 
																		else {
																				xPos = el.offsetLeft;
																				tempEl = el.offsetParent;
																				while (tempEl != null) {
																						xPos += tempEl.offsetLeft;
																							tempEl = tempEl.offsetParent;
																				}
																				return xPos;
																		}
																	}
																	function getElTop(el) {
																		if (ns4) {return el.pageY;} 
																		else {
																				yPos = el.offsetTop;
																				tempEl = el.offsetParent;
																				while (tempEl != null) {
																						yPos += tempEl.offsetTop;
																							tempEl = tempEl.offsetParent;
																				}
																				return yPos;
																		}
																	}
																	popDiv.style.left = (getElLeft(callingElement) - 160) + 'px';
																	popDiv.style.top =  getElTop(callingElement) + 'px'
																}
															},
															link: 'chain'
												}).send();
		
												return true;	
	},
	
	hidePop					: function(){
		jQuery('#pop-content').css('display','none');
	}
}
