/*
 * Baynote Observer for connect.mypath.com
 * Last updated: aug 11, 2009. Copied from Production with the short title
 */
function bn_isNotEmpty(name) {
	return (name != null) && (name != "");
}

function bn_getShortTitle()
{
	var regexMatch = ":";		 
	var docTitle = document.title;
	var index = docTitle.search(regexMatch);
	var baynoteTitle = docTitle;
	if(index > 0)
	{
		baynoteTitle = docTitle.substring(index+2,docTitle.length);
	}
    return baynoteTitle;
}
/*
* ------ Added by Arshad on aug 11,2009. For getting attributes from meta information -start
*/

function bn_getMetaValue(metaName) {
	var metas = document.getElementsByTagName("meta");
	for (var i=0; i<metas.length; i++) {
		if (metas[i].name==metaName) {
			return metas[i].content;
		}
	}
	return;
}
function bn_setDocAttr(attrName, metaName) {
	var metaValue = bn_getMetaValue(metaName);
	if(bn_isNotEmpty(metaValue)) {
		baynote_tag.docAttrs[attrName] = metaValue;
	}
}
function bn_getDocAttrs() {
/*	bn_setDocAttr("Environment","Environment");  */
	bn_setDocAttr("author_name","author_name");
bn_setDocAttr("mindset","mindset");
bn_setDocAttr("publish_date","publish_date");
bn_setDocAttr("content_type","content_type");
bn_setDocAttr("ThumbUrl","ThumbUrl");
/* bn_setuserID(); */

}

 function bn_setuserID(){
          alert("inside set user ID");
          var UserId = Get_Cookie("mypath.user.userId")
     if(bn_isNotEmpty(UserId)) {
		 baynote_tag.docAttrs["userID"] = UserId;
                   	}
    alert("UserID: " + Get_Cookie("mypath.user.userId")) ; 
 }


/*
*------ Added by Arshad on aug 11,2009. For getting attributes from meta information -end
*/



function bn_showObserver() {
	bn_customerId = "manpower";
	bn_code = "mypath";
	var bn_locHref = window.location.href;
	if (bn_locHref.indexOf("https://") == 0) {
		baynote_tag.server = "https://" + bn_customerId + "-" + bn_code + ".baynote.net";
	} else {
		baynote_tag.server = "http://" + bn_customerId + "-" + bn_code + ".baynote.net";
	}
	baynote_tag.customerId = bn_customerId;
	baynote_tag.code = bn_code;
	baynote_tag.type = "baynoteObserver";
	if (bn_locHref.indexOf("mypath.com") > 0) {
		baynote_globals.cookieDomain = "mypath.com";
	}
	baynote_tag.title 				= bn_getShortTitle();
                bn_getDocAttrs(); /* added by Arshad on Aug 11,2009. For getting attributes from Meta Information*/
	baynote_tag.show();
}
if (typeof(baynote_tag)!="undefined") {
	bn_showObserver();
}