//added js functions from the old Sigma-Aldrich site

function OpenWin(URL, windowattributes) {
	//help=window.open(URL,"Help",'window attributes');
	help=window.open(URL,"Help",windowattributes);
	help.focus();
}

function changeParentURL(url){
	window.opener.location = url;
}

function OpenWindow(URL, windowattributes) {
	    help=window.open(URL,"Help",windowattributes);
	    help.focus();
	}

//SCRIPT FOR A JUMP-TO BOX
      function MM_jumpMenu(targ,selObj,restore){ //v3.0
      eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
      if (restore) selObj.selectedIndex=0;
 }     

//**added for CoreMetrics**//

function getMemberId() {
	var hasWCUserActivityCookie  = document.cookie.indexOf("WC_USERACTIVITY_");
	if (hasWCUserActivityCookie != -1 ){ 
		var startcount2 = hasWCUserActivityCookie + 16;// Start cookie value 
		var endcount2 = document.cookie.indexOf("=", startcount2); // End cookie value 
		if (endcount2 == -1) endcount = document.cookie.length; 
			var MemberID = document.cookie.substring(startcount2, endcount2); //Extract value 
	} 
	else 
	{ 
		MemberID = "Unknown"; 
	}

	if(MemberID == "-1002"){MemberID = "Unknown";}
	return MemberID;
}


function getClientId() {
	var ClientID = "Unknown";
	var userCookie = document.cookie;
 	var hasAnonymousClientIdCookie = userCookie.indexOf("AnonymousClientId="); 
	if (hasAnonymousClientIdCookie != -1 )
		{userCookie = userCookie.substring(hasAnonymousClientIdCookie + 21, userCookie.length);} 
 	var hasClientIdCookie = userCookie.indexOf("ClientId=");
	if (hasClientIdCookie != -1 ){
		var startcount = hasClientIdCookie + 9;
		var endcount = userCookie.indexOf(";", startcount);
			if (endcount == -1) endcount = userCookie.length; 
			{ClientID = userCookie.substring(startcount, endcount);}
	}
	return ClientID;
}

//**added for Bookmark**//

var addthis_pub = "sigmaaldrich";

function writeSocialBookmark() {

	var url = window.location.href;
	var addthisURL = url;
	var page = window.location.pathname.substring(window.location.pathname.lastIndexOf('/') + 1);
	if (url.indexOf("cm_mmc=") == -1) {
		if (url.indexOf("?") >= 0)
			{addthisURL += "&cm_mmc=social-_-AddThis-_-bookmarks-_-" + page;}
		else
			{addthisURL += "?cm_mmc=social-_-AddThis-_-bookmarks-_-" + page;}
	}

	document.write('<a href="http://www.addthis.com/bookmark.php?v=20" onmouseover="return addthis_open(this, \'\', \''+addthisURL+'\', \''+document.title+'\')" onmouseout="addthis_close()" onclick="return addthis_sendto()"><img id="/etc/medialib/sigma-aldrich/headers/endeca-search-and/lg-bookmark-en.Par.0001.Image.-1.-1.1.gif" height="16" alt="Share" width="105" border="0" src="/etc/medialib/sigma-aldrich/headers/endeca-search-and/lg-bookmark-en.Par.0001.Image.-1.-1.1.gif" /></a>');
	document.write('<script type=\"text/javascript\" src=\"http://s7.addthis.com/js/200/addthis_widget.js\"></script>');

}



