var PLI = {
		BasePath: '',
		Menu: {
			Tooltip: {
				Id: '_div_tooltip_',
				Toggle: function(b,obj) {
					if (!b && (docObj(this.Id))) { document.body.removeChild(docObj(this.Id)); document.body.removeChild(docObj(this.Id+'i')); }
					else
					{
						var html = '',offset = 0;
						switch (obj.id)
						{
							case 'mc1': offset+=0;  html = 'Peregrine Academics, LLC is a subsidiary of the Peregrine Leadership Institute, LLC headquartered in Gillette Wyoming'; break;
							case 'mc2': offset+=35;  html = 'We are continually expanding our services to best meet the evolving requirements for higher learning institutions so that '; break;
							case 'mc3': offset+=70;  html = 'Our Mission is to provide on-line testing and learning related to business programs for'; break;
							case 'mc4': offset+=105;  html = 'accountability and accreditation for business schools and programs associated with the Association of Collegiate Business '; break;
							case 'mc5': offset+=140; html = 'Our Vision is to be the academic partner of choice for all higher learning business school, in the US and throughout the '; break;
						}
						var div = newDocObj(this.Id,'div',html,{ className:'menu_tooltip' });
						var img = newDocObj(this.Id+'i','img',false,{ className: 'menu_tooltip_img' }); img.src = PLI.BasePath+'/media/images/ttt1.gif';
						document.body.appendChild(div); document.body.appendChild(img);
						var left = findPos(docObj('mc1')).left + offset; var top = findPos(obj).top - (parseInt(div.offsetHeight) + 7);
						div.style.top = top+'px'; div.style.left = left+'px';
						img.style.top = (findPos(obj).top-8)+'px'; img.style.left = (findPos(obj).left+30)+'px';
					}
				}
			}			
		},
		
		Email: function(to,copy) {
			var e = to+'@'+'pereg'+'rineacademi'+'cs.com';
			if (!copy) copy = e;
			document.write('<'+'a title="'+e+'" h'+'ref="mailto:'+e+'">'+copy+'</a>');			
		},

		Form: {
			Textbox: {				
				PreText: {
					_initial_value: '',
					Toggle: function(obj,b) {
						if (b && $(obj).css('color') == 'silver') { this._initial_value = obj.value; obj.value = ''; $(obj).css('color','#000000'); }
						else if (obj.value == '') 				  { obj.value = this._initial_value; $(obj).css('color','silver'); }
					}					
				}
			}
			
		},
		Combobox: {
			IsShown: false, IdShown: 'null', Timer:false,
			Show: function(id,filter) {
				//if (filter) { this.Filter($('#'+filter.obj),id); return; }
				var targ = $('#'+id).removeClass('cboxPanel_off').addClass('cboxPanel');
				this.IsShown = true; this.IdShown = id;
			},
			Hide: function() {
				if ($('#'+this.IdShown))
				{
					$('#'+this.IdShown).removeClass('cboxPanel').addClass('cboxPanel_off');
					this.IsShown = false; this.IdShown = 'null';
				}
			},
			Select: function(obj,val) {
				var input = obj.parentNode.parentNode.getElementsByTagName('input')[0];					
				if (val) { var targId = input.id.split('-'); $('#'+targId[1]).attr('value',val); }
				input.value = obj.innerHTML;
				this.Hide();
			},
			InitFilter: function(o,id) {
				if (! this.IsShown)
					this.Timer = setTimeout("PLI.Combobox.Show('"+id+"',{'obj':'"+o.id+"'});",500);
			},
			Filter: function(o,id) {                
				if (PLI.Combobox.Timer) clearTimeout(PLI.Combobox.Timer);
				
				// if filtering then reset the pre-selected value
				var targId = o.id.split('-'); $('#'+targId[1]).attr('value',0);
				
				if (! this.IsShown)
					this.Show(id);
				
				var re = new RegExp('^'+o.value,'i'); var hidden = 0;
				var spn = $('#'+id+' > span').each(function() {
							if (re.test($(this).text())) { $(this).css('display','block'); }
							else { $(this).css('display','none'); hidden++; }									
						   });
					if (spn.length == hidden)
						this.Hide();
			}
		},		

		ExamWindow: function(url) {
			 var width  = 900; var height = 700;
			 var left   = (screen.width - width)/2; var top = (screen.height - height)/2;
			 var params = 'width='+width+', height='+height+',top='+top+',left='+left+',directories=no,location=yes,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no';
			 exam_win = window.open(url,'pla_exam', params);
			 if (exam_win && window.focus)
			 	exam_win.focus();
		},
		Commerce: {
			ToggleShipTo: function(val) {
					$('#divShippingAddressContainer').css('display',(val == 1 ? 'none' : 'block'));
					$('#divBillingTitle').html( (val == 1 ? '&nbsp; BILLING/SHIPPING ADDRESS (if applicable)' : 'BILLING ADDRESS') );
			}
		},
		
		Print: function(b) {
			if (b)
			{
				var ifrm = document.getElementById('print_frame');
				if (ifrm) { ifrm.contentWindow.document.getElementById('content').innerHTML = $('#td').html(); setTimeout("PLI.Print();",150); }
			}
			else { window.frames[0].focus(); window.frames[0].print(); }
		},
		
		Events: {
			_targ: function(e) { if (!e) var e = window.event; var targ = (window.event) ? e.srcElement : e.target; return targ; },
			ClickListener: function(e) {
				if (PLI.Combobox.IsShown)
				{
					targ = PLI.Events._targ(e);			
					while (targ.nodeName.toUpperCase() != 'BODY')
					{
						if (targ.id && targ.id.match(/^(ddl|cbox)/)) { return; } else { targ = targ.parentNode; }
						PLI.Combobox.Hide();
					}
				}
			}
		}
	}
	
document.onclick = PLI.Events.ClickListener;
if (document.captureEvents)
{
	document.captureEvents(Event.ONCLICK);
	document.captureEvents(Event.ONKEYUP);
	document.captureEvents(Event.ONKEYPRESS);
}
