document.domain="construction.com";

	if (typeof Server_Name != 'undefined' && Server_Name.toLowerCase().indexOf('qa.') == 0)
	{
			// QA
			var siteLifeHost = "sitelifestage.construction.com";
			var daapiServerUrl="http://sitelifestage.construction.com/ver1.0/Direct/Process";
			var constructionServerUrl="http://qa.construction.com";

			document.write('<scr'+'ipt language="javascript" src="http://ssoqa.construction.com/SingleSignOn/AuthInfo.aspx?cl=pluck"></scr'+'ipt>');
			document.write('<scr'+'ipt type="text/javascript" language="javascript" src="http://sitelifestage.construction.com/ver1.0/SiteLifeProxy"></scr'+'ipt>');
			document.write('<scr'+'ipt type="text/javascript" src="http://sitelifestage.construction.com/ver1.0/Direct/DirectProxy"></scr'+'ipt>');
	}
	else
	{
			// Prod
			var siteLifeHost = "sitelife.construction.com";
			var daapiServerUrl="http://sitelife.construction.com/ver1.0/Direct/Process";
			var constructionServerUrl="http://construction.com";

			document.write('<scr'+'ipt language="javascript" src="http://sso.construction.com/SingleSignOn/AuthInfo.aspx?cl=pluck"></scr'+'ipt>');
			document.write('<scr'+'ipt type="text/javascript" language="javascript" src="http://sitelife.construction.com/ver1.0/SiteLifeProxy"></scr'+'ipt>');
			document.write('<scr'+'ipt type="text/javascript" src="http://sitelife.construction.com/ver1.0/Direct/DirectProxy"></scr'+'ipt>');
	}


// DAAPI code fo 'view my profile' link in header
	
function jprocessUser(user) {
		window.location = constructionServerUrl + "/community/personas.aspx?newspaperUserId=" + user.UserKey.Key;
	}

	function jClientCallBack(responseBatch) {
		for (var i = 0; i < responseBatch.Messages.length; i++) {
			var serverMessage = responseBatch.Messages[i];
		}

		for (var i = 0; i < responseBatch.Responses.length; i++) {
			var response = responseBatch.Responses[i];
			articleProcessResponse(response);
		}
	}
	function articleProcessResponse(response) {
		if (response.User != null) {
			jprocessUser(response.User);
		}
		// skip the others
	}
	function FixIt() {
		var jRequestBatch = new RequestBatch();
		// Tell SiteLife who we are.
		jRequestBatch.AddToRequest(new UserKey());
		jRequestBatch.BeginRequest(daapiServerUrl, jClientCallBack);
	}
// END: DAAPI code fo 'view my profile' link in header


function getArticleID(){ //grabs the document title and uses it as the article ID to tie pluck content to
              var input = document.title;
              var output = "";
			   for(var ii=0; ii < input.length; ii++) {
				  var char = input.charAt(ii);
				  if((char >= 'A' && char <= 'Z') || (char >= 'a' && char <= 'z') || (char >= '0' && char <= '9')) {
					  output += char;
				  }
			   }
			   return output;
			}
	function cleanUpURL(){ //grabs the URL as the reference to all pluck content attached to it
           var thisURL = window.location.href.split("#");
           return thisURL[0];
      	}