var pop = {
 	overlay: function(){document.body.appendChild(Builder.node('div', { id: 'box_overlay', style: 'display:none' }))},
	
	image: function(file){
		this.destroy();
		this.overlay();
		
		var element = Builder.node('div', { id: 'box_wrapper', style: 'display:none;'}, [
					Builder.node('div', { id: 'box_content' }),
					Builder.node('div', { id: 'box_shadow' }),
					Builder.node('div', { id: 'box_close' })
				  ]);
			
		document.body.appendChild(element);	  
		
		
		$('box_overlay').observe('click',pop.destroy );
		$('box_close').observe('click', pop.destroy );
		$('box_overlay').appear({ duration: 0.3, from: 0.0, to: 0.9, queue: 'end' });
		$('box_wrapper').appear({ duration: 0.3, from: 0.0, to: 1.0, queue: 'end' });
		new Ajax.Updater('box_content', file, { evalScripts: true});
	},
	
	contact: function(file){
		this.destroy();
		this.overlay();
		
		if (file == '/pop_map.asp'){
			var element = Builder.node('div', { id: 'box_wrapper2', style: 'display:none;'}, [
					Builder.node('div', { id: 'box_content2' }),
					Builder.node('div', { id: 'box_close' })
				  ]);
		}else{
			var element = Builder.node('div', { id: 'box_wrapper2', style: 'display:none;'}, [
					Builder.node('div', { id: 'box_content2' }),
					Builder.node('div', { id: 'box_shadow2' }),
					Builder.node('div', { id: 'box_close' })
				  ]);
		}
			
		document.body.appendChild(element);	  
		
		
		$('box_overlay').observe('click',pop.destroy );
		$('box_close').observe('click', pop.destroy );
		$('box_overlay').appear({ duration: 0.3, from: 0.0, to: 0.9, queue: 'end' });
		$('box_wrapper2').appear({ duration: 0.3, from: 0.0, to: 1.0, queue: 'end' });
		new Ajax.Updater('box_content2', file, { evalScripts: true});
	},
	
	refresh: function(file){
		new Ajax.Updater('box_content', file, { evalScripts: true});
	},
	
	set_focus: function(){
		if ($('focus')) { 
			window.setTimeout(function() {$('focus').focus();}, 500); 
		};
	},

	
	destroy: function(){
 		if ($('box_overlay')){ 
			$('box_overlay').remove(); 
			if ($('box_wrapper')) $('box_wrapper').remove(); 
			if ($('box_wrapper2')) $('box_wrapper2').remove(); 
		};
		
		
	}	
};

var tip = {
 	show: function(text,obj){
		this.destroy();
		
		var element = Builder.node('div', { id: 'tip'}, [
				  	Builder.node('div', { id: 'tip_top' }),
					Builder.node('div', { id: 'tip_center' },text),
					Builder.node('div', { id: 'tip_bottom' })
				  ]);
			
		$(obj).insert(element);
		
		this.click_handler.delay(0.2);
		
		return false;
	},
	click_handler: function(){
 		document.observe("click",tip.destroy);
	},	
	destroy: function(){
 		if ($('tip')){ 
			$('tip').remove();
			document.stopObserving('click', tip.destroy); 
		};
	}	
};


