var CUR_PL_IMG = null;		
		var CUR_INFO_WINDOW = null;
		var CUR_URL = null;
		var CUR_PRIME_INDEX = 0;
		var PL_SLIDER = new Array();
		var HOLD_NUM_PRIME_LOCATIONS = (NUM_PRIME_LOCATIONS+6);
		var CUR_REG_IMG = 'regpreimg_init';
		
		//alert(PL_NAMES.length);
		
		window.addEvent('domready', function(){
			
			var up = true;
			
			for(var i2 = 0; i2 < PL_NAMES.length; i2++)
			{
				PL_SLIDER[i2] = new Fx.Slide(PL_NAMES[i2], {transition: Fx.Transitions.Expo.easeOut, duration:  500}).addEvent('onComplete', function() {
					if(up)
					{
						//toggleContent(PL_NAMES[CUR_PRIME_INDEX]);
						PL_SLIDER[CUR_PRIME_INDEX].toggle();
						//NUM_PRIME_LOCATIONS -= 6;
						mnumber = (NUM_PRIME_LOCATIONS - (CUR_PRIME_INDEX*6));
						if(mnumber > 0)
						{
							if(CUR_PRIME_INDEX == 0)
								document.getElementById('primeLocationsLess').style.display = 'none';
							else
								document.getElementById('primeLocationsLess').style.display = 'block';
								
							text = 'see ' + mnumber + ' more ads';
							document.getElementById('primeLocationsMore').style.display = 'block';
						}
						else
						{
							text = 'no more ads';
							document.getElementById('primeLocationsMore').style.display = 'none';
							//toggleContent('primeLocationsMore');
						} // end else
						
						lnumber = CUR_PRIME_INDEX*6;
							if(lnumber > HOLD_NUM_PRIME_LOCATIONS)
								lnumber = HOLD_NUM_PRIME_LOCATIONS;
							ltext = 'see last ' + lnumber + ' ads';
						
						
						document.getElementById('primeLocationsMore').innerHTML = text;
						document.getElementById('primeLocationsLess').innerHTML = ltext;
						up = false;
					}
					else
						up = true;
				}); // end function
					
				if(i2)
				{
					PL_SLIDER[i2].hide();
					toggleContent(PL_NAMES[i2]);
				} // end if
				
				
				//CUR_PRIME_INDEX += 1;
				//CUR_PRIME_INDEX = CUR_PRIME_INDEX++;
				
			} // end for
						
		});
	
	
		/****************************************************/
		/* fades in the div id passed in
		/****************************************************/
	
		function fade_in(id)
		{
			if(document.getElementById(id).style.display == "none")
			{
				toggleContent(CUR_PL_IMG);
				toggleContent(id);
				CUR_PL_IMG = id;
			}
		
			//alert(id);
		
			var alpha = new Fx.Style(id, 'opacity', {transition: Fx.Transitions.Cubic.easeIn,duration:250});
				alpha.start(.25,1);
				
		} // end fade_in
		
		function fade_in_reg(id)
		{
			//alert(document.getElementById(id).style.display);
			if(CUR_REG_IMG != id)
			{
				if(document.getElementById(id).style.display == "none")
				{
					if(CUR_REG_IMG)
						toggleContent(CUR_REG_IMG);
					toggleContent(id);
					CUR_REG_IMG = id;
					//alert(id);
				}
			
				//alert(id);
				
				//toggleContent(id);
				//CUR_REG_IMG = id;
			
				var alpha = new Fx.Style(id, 'opacity', {transition: Fx.Transitions.Cubic.easeIn,duration:250});
					alpha.start(.25,1);
			} // end if
				
		} // end fade_in
		
		
		/****************************************************/
		/* shows the gmap marker
		/****************************************************/
		
		function do_primelocation(id,text,url)
		{
			if(CUR_INFO_WINDOW != id)
			{
				marker[id].openInfoWindowHtml(text);
				CUR_INFO_WINDOW = id;
				fade_in('adpreimg' + id);
				
				if(CUR_URL)
				{
					document.getElementById('adprelink').style.display = 'block';
					//document.getElementById('adprelink').onmouseover = function() { 
						document.getElementById('adprelink').innerHTML = '<a href="/redirect.php?t=' + url + '&f=index_primelocations">more information<\/a>';
					//}
				}
				else
					document.getElementById('adprelink').style.display = 'none';
			} // end if
			
		} // end no_redraw
		
		/****************************************************/
		/* shows the gmap marker
		/****************************************************/
		
		function do_reglocation(id)
		{
			if(CUR_REG_IMG != id)
			{
				//alert(CUR_REG_IMG);
				//marker[id].openInfoWindowHtml(text);
				CUR_REG_IMG = id;
				fade_in_reg('adregimg' + id);
				
			} // end if
			
		} // end no_redraw	
		
		/****************************************************/
		/* toggles prime
		/****************************************************/
		
		function togglePrime(which_way)
		{
		
			var old = CUR_PRIME_INDEX;
			
			if(which_way == 'more')
			{
				CUR_PRIME_INDEX += 1;
				PL_SLIDER[old].toggle();
			}
			else if(which_way == 'previous')
			{
				CUR_PRIME_INDEX -= 1;
				PL_SLIDER[old].toggle();
			} // end if
			
		} // end togglePrime
		
		
		function toggleMoreInformation(showhide,write)
		{
			toggleContent(showhide);
						
			if(document.getElementById(write).innerHTML == "what is this?")
				document.getElementById(write).innerHTML = "ok, I'm done";
			else
				document.getElementById(write).innerHTML = "what is this?";
		
		} // end toggleMoreInformation