aewindowurl = window.location;
aewindowurl = unescape(aewindowurl);

scripttemplate = "\<script src='scripturl'  type='text/javascript'\>\<\/script\>";	
scripturl = "/ds/setstyles.js";
document.write (scripttemplate.replace("scripturl",scripturl));

if (aewindowurl.indexOf('nofeatured')>-1) 
	{document.getElementById('xg').style.display = "block";}

//In IE there was something weird with using mouse to get focus on the box so I put in this code to default to some value



if (document.getElementById('aebreaking') && navigator.appVersion.indexOf("MSIE")!=-1 ) // firefox can work so it is in adbox.js	... msie does not  so that is in aejs.js
	{
			scripttemplate = "\<script src='scripturl'  type='text/javascript'\>\<\/script\>";	
			scripturl = "/ds/specrss.js";
			//document.write (scripttemplate.replace("scripturl",scripturl));	
	}	


if (document.getElementById('greencity1'))
	{
		scripturl = "/ds/Scripts/greencity.js";
		document.write (scripttemplate.replace("scripturl",scripturl));
	}
	
newProfile = aewindowurl.indexOf("newProfile") > 0;
profilepage = aewindowurl.indexOf("profile/edit") > 0;


if (newProfile || profilepage)
{
	//alert('Welcome!');
	
	xg_bodystart = document.getElementById('xg_body').innerHTML;
	mailinglist = "<iframe src='http://www.stun1.com/stun/manageforms/preview.php?weburl=1&formID=5129&weblink=1' width='450' height='250' marginwidth='0' marginheight='0' scrolling='no' frameborder='0'></iframe>" ;
	mailinglist = ""
	conversionframe = (newProfile) ? "<iframe src='http://alternativeenergy.com/ds/conversiontracking.php' width='300' height='50' scrolling='no' frameborder='0' ></iframe>" : "";
	document.getElementById('xg_body').innerHTML = xg_bodystart + mailinglist + conversionframe;
	
} // if (newProfile)


//put in ad next to cozmo
if (false)
{
	googlelinkscozmoObj = document.getElementById('googlelinkscozmo');
	googlelinksscriptObj = document.getElementById('googlelinksscript');
	if (googlelinkscozmoObj && googlelinksscriptObj )
	{
		googlelinkscozmoObj.innerHTML = "<a href='/edy' title='Watch our unique Alternative Energy Comedy Videos updated 3 times a week'><img height='155' width='155' border='0' src='/ds/images/BN_altnrgComedy.jpg'/></a>"	
	}
}
//check to see if put in ad
barmarginbottom = document.getElementById("xn_bar").style.marginBottom;
barmarginbottom = barmarginbottom.replace("px","");


scripturl = "http://leads.demandbase.com/44610.js";
document.write (scripttemplate.replace("scripturl",scripturl));


if (barmarginbottom>20)  	
	{

	if (navigator.appVersion.indexOf("MSIE")!=-1 ) // IS INTERNET EXPLORER
		{
			document.write("<div id='putadshere' style='overflow: hidden; position: absolute; left: 0px; width: 100%; height: 64px;  top: 30px; text-align: center; white-space: nowrap;'>putadshere</div>");
			putadshereObj=document.getElementById("putadshere");

						
		
//"<iframe src='http://media.fastclick.net/w/get.media?sid=45930&m=1&tp=1&d=f&v=1.0c&t=n&pageid=1' width=468 height=60 hspace=0\
//vspace=0 frameborder=0 marginheight=0 marginwidth=0 scrolling=no>\
//<a href='http://media.fastclick.net/w/click.here?sid=45930&m=1&pageid=1' target='_blank'><img width=468\
//height=60 src='http://media.fastclick.net/w/get.media?sid=45930&m=1&tp=1&d=s&v=1.0c&pageid=1' border=0></a>\
//</iframe>",
			
			adsarray = [ 
			"<a href='http://www.kqzyfj.com/click-2636437-10514935' target='_blank'>\
			<img src='http://www.tqlkg.com/image-2636437-10514935' width='468' height='60' alt='Locate the Car You Want at the Price You Want' border='0'/></a>",
			"<a href='http://www.anrdoezrs.net/click-2636437-10537642' target='_blank'>\
			<img src='http://www.ftjcfx.com/image-2636437-10537642' width='468' height='60' alt='Stop Junk Mail / Save Trees' border='0'/></a>",
			"<a href='http://www.kqzyfj.com/click-2636437-5598139' target='_top'>\
			<img src='http://www.awltovhc.com/image-2636437-5598139' width='468' height='60' alt='Eemax Electric Tankless Water Heaters' border='0'/></a>",
			"<a href='http://www.shareasale.com/r.cfm?b=118044&u=230520&m=16774&urllink=&afftrack=' target='_blank' >\
			<img src='http://www.shareasale.com/image/banner1180.gif' border=0></a>", 
			"<a href='http://www.kqzyfj.com/click-2636437-10570164' target='_blank'>\
			<img src='http://www.tqlkg.com/image-2636437-10570164' width='468' height='60' alt='Energy-related Education Products!' border='0'/></a>" ,
			"<a href='http://www.kqzyfj.com/click-2636437-10511847' target='_blank'>\
			<img src='http://www.ftjcfx.com/image-2636437-10511847' width='468' height='60' alt='Charge Your Mobile and iPod!' border='0'/></a>"
			]
			stringstart = "012345"

			firstone = Math.round(Math.random()*(stringstart.length-1))
			firstoneb = stringstart.substring(firstone,firstone+1)
		
			
			stringstart = stringstart.replace(firstone,"");
			secondone = Math.round(Math.random()*(stringstart.length-1))
			secondoneb = stringstart.substring(secondone,secondone+1)		
		
			putadshereObj.innerHTML = adsarray[firstoneb] + adsarray[secondoneb];
		}

	else if (false) // try valueclick here put true if want to use valueclick
		{

			document.write("<div style='overflow: hidden; position: absolute; left: 0px; width: 100%; height: 90px;  top: 28px;' align='center' id='putadshere' ></div>");
			putadshereObj=document.getElementById("putadshere");
						
			scripttemplate = "<div id='googtopadsrc'>\<div align='center' style='display:inline-table; width: 768px;'>\<script src='scripturl'  type='text/javascript'\>\<\/script\></div></div>";	
			scripturl = "http://media.fastclick.net/w/get.media?sid=45930&m=1&tp=5&d=j&t=n";
			document.write (scripttemplate.replace("scripturl",scripturl));
			
			scripttemplate = "\<script src='scripturl'  type='text/javascript'\>\<\/script\>";	
			scripturl = "/ds/aejsStep2.js";
			document.write (scripttemplate.replace("scripturl",scripturl));		
		}

	else 
		{
			document.write("<div style='position: absolute; left: 0px; width: 100%; height: 90px;  top: 28px;' align='center' id='putadshere' ></div>");
			putadshereObj=document.getElementById("putadshere");
			google_ad_client = "pub-2594380237188342";
			//* top for most pages 728x90, created 3/24/08 */
			google_ad_slot = "9271970750";
			google_ad_width = 728;
			google_ad_height = 90;
						
			scripttemplate = "<div id='googtopadsrc'>\<script src='scripturl'  type='text/javascript'\>\<\/script\></div>";	
			scripturl = "http://pagead2.googlesyndication.com/pagead/show_ads.js";
			//var cb = Math.random()
			//scripturl = "http://optimized-by.rubiconproject.com/a/1837/1849/2310-2.js?cb=" + cb
			document.write (scripttemplate.replace("scripturl",scripturl));
			
			scripttemplate = "\<script src='scripturl'  type='text/javascript'\>\<\/script\>";	
			scripturl = "/ds/aejsStep2.js";
			document.write (scripttemplate.replace("scripturl",scripturl));		
		}
	
	}
//if(document.getElementById("vanpooling"))
	//document.getElementById("vanpooling").innerHTML="<a title='Save energy ... get involved with van pooling!' href='http://www.pooling-resources.com/' target='_blank' ><img src='/ds/advertisers/vanpooling.gif' border=0 ></a>";

if (aewindowurl.indexOf("notes/Article")>1)
	{
	  var PLUCKIT_APIKEY = '33ad4fdf-9ff3-427d-b5f2-5aa0a256ec22';  
	  var PLUCKIT_WIDGET_OPTIONS = {
		'showRelatedTags' : 'true',
		'numberOfTags' : '5',
		'topicPageUrl' : '',
		'showRecommendations' : 'true',
		'adWidth' : 'narrow'
	  }
		scripttemplate = "<div id='pluckarticlesource'>\<script src='scripturl'  type='text/javascript'\>\<\/script\></div>";
		scripturl = "http://pluckit.demandmedia.com/Widgets/v1/PluckItArticleWidget/generated.js?apiKey=33ad4fdf-9ff3-427d-b5f2-5aa0a256ec22";
		document.write (scripttemplate.replace("scripturl",scripturl));
	}
	
if (aewindowurl.indexOf("notes/pluck")>1 )
	{
		scripttemplate = "\<script src='scripturl'  type='text/javascript'\>\<\/script\>";
		scripturl = "/ds/Scripts/plucksetup.js";
		document.write (scripttemplate.replace("scripturl",scripturl));		
	}
	
if (document.getElementById('newsbox'))
	{
		scripttemplate = "\<script src='scripturl'  type='text/javascript'\>\<\/script\>";
		scripturl = "/ds/Scripts/replacefeaturedposts.js";
		document.write (scripttemplate.replace("scripturl",scripturl));
	}




function codeonfocus(passval)
	{
		testval = document.getElementById('signup_captcha').value
		if (testval == "" && passval == "blur")
			document.getElementById('signup_captcha').value = "CODE";
		if (testval == "CODE")
			document.getElementById('signup_captcha').value = "";
	}