﻿LoadScript("http://w.sharethis.com/button/sharethis.js#publisher=d7aef654-bb5e-4583-b4b6-abef5af51300&amp;type=website&amp;tracking=google&amp;post_services=email%2Cdigg%2Cdelicious%2Ctwitter%2Cstumbleupon%2Creddit%2Clinkedin%2Cfacebook%2Cmyspace%2Csms%2Ctechnorati%2Cgoogle_bmarks%2Cwindows_live%2Cbebo%2Cybuzz%2Cblogger%2Cyahoo_bmarks%2Cmixx%2Cfriendfeed%2Cpropeller%2Cwordpress%2Cnewsvine%2Cxanga%2Cslashdot%2Clivejournal%2Ctwine%2Cblinklist%2Ctwackle%2Cdiigo%2Cfark%2Cmister_wong%2Cfaves%2Ccurrent%2Cmeneame%2Ckirtsy%2Coknotizie%2Ccare2%2Cyigg%2Caim%2Cdealsplus%2Ctypepad%2Cn4g%2Csphinn%2Csimpy%2Cblogmarks%2Cfresqui%2Cbus_exchange%2Cfunp&amp;headerbg=%230071bc&amp;buttonText=Share&amp;headerTitle=Share%20from%20Photonics.com");

// Default text to display in an element while it is loading
var DEFAULT_LOADING_TEXT="<table width=\"100%\" height=\"100%\"><tr><td align=\"center\" valign=\"middle\"><img src=\"/images/loading.gif\" width=\"169\" height=\"39\" border=\"0\" alt=\"Loading\" /></td></tr></table>";
// The current element waiting to be populated with a response
var PopulatingElement=null;
// The code to execute immediately following a successful population
var CodeAfterPopulation=null;
// The minimum number of chars typed before the suggestion box appears - Directory Box
var MIN_CHARS_FOR_FIELD_SUGGESTION=2;
// Default product search field text - Directory Box
var PRODUCT_SEARCH_FIELD_DEFAULT="Enter product or service";
// Default company search field text - Directory Box
var COMPANY_SEARCH_FIELD_DEFAULT="Enter company name";

// Init the object used for conenctions
function GetXmlHttpObject(){
	var xmlHttp=null;
	try {
		xmlHttp=new XMLHttpRequest();
	} catch(e) {
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}

// Pass true or false to either show or hide the search results area
function ShowElement(ElementID, State){
	var Element=document.getElementById(ElementID);
	if (Element){
		Element.style.visibility=(State?"visible":"hidden");
	}
}

function PerformToggle(id)
// Function to toggle the display of an element. used specifically for toggling blog comments on and off, but is not limited to that.
{
	var elem = document.getElementById(id);
	if (elem)
	{
		if (elem.style.display != 'block')
		{
			elem.style.display = 'block';
		}
		else
		{
			elem.style.display = 'none';
		}
	}
}

function PerformTogglePostText(id)
// Function turns off a div, turns on another div, and turns of the div that controlled this function. used to display the full blog entry when they have been collapsed. it removes the shortened text, displays the full text, and removes the expand post button.
{
	var ShortenedText = document.getElementById('BlogPostShortenedTextID' + id);
	if (ShortenedText)
	{
		ShortenedText.style.display = 'none';
		ShortenedText.style.visibility = 'hidden';
	};
	
	var ExpandedText = document.getElementById('BlogPostExpandedTextID' + id);
	if (ExpandedText)
	{
		ExpandedText.style.display = 'block';
		ExpandedText.style.visibility = 'visible';
	};
	
	var ExpandButton = document.getElementById('BlogPostExpandButtonID' + id);
	if (ExpandButton)
	{
		ExpandButton.style.display = 'none';
		ExpandButton.style.visibility = 'hidden';
	};
}

// Populate the element with the given 'DivID' with the response from calling 'LoadURL'
// You can optionally pass a third parameter with the text to display during load (defaults to DEFAULT_LOADING_TEXT)
function PopulateElement(DivID, LoadURL, LoadingText, CodeToFollow){
	// See if LoadingText was passed.  If not, go with the default
	if (PopulatingElement!=null){
		document.getElementById(DivID).innerHTML=LoadingText;
		// If trying to populate an element while it is awaiting a response, abort the previous call
		// Otherwise, wait until the current operation is complete by retrying this function every 10ms
		if (PopulatingElement==document.getElementById(DivID)){
			xmlHttp.abort();
		} else {
			setTimeout("PopulateElement('"+DivID+"', '"+LoadURL+"', "+(LoadingText==null?"null":"'"+LoadingText+"'")+", "+(CodeToFollow==null?"null":"'"+CodeToFollow+"'")+")", 10);
			return false;
		}
	}
	PopulatingElement=document.getElementById(DivID);
	if (LoadingText!=null){
		PopulatingElement.innerHTML=LoadingText;
	}
	CodeAfterPopulation=CodeToFollow;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
		return false;
	}
	xmlHttp.onreadystatechange=PopulateElementResponse;
	xmlHttp.open("GET", LoadURL, true);
	xmlHttp.send(null);
	return false;
}

// Populate the element with the response upon completion
function PopulateElementResponse(){
	if (xmlHttp.readyState==4){
		PopulatingElement.innerHTML=xmlHttp.responseText;
		if (CodeAfterPopulation!=null){
			eval(CodeAfterPopulation);
		}
		PopulatingElement=null;
		CodeAfterPopulation=null;
	}
}

//Load external script from inside a script
function LoadScript(url)
{
  document.write('<script src="', url, '" type="text/javascript"></script>');
}


// Add the passed function to the page load event handler
function AddFunctionToOnload(NewFunction){
	var FormerLoadEvents=window.onload;
	if (typeof FormerLoadEvents=="function") {
		window.onload = function() {
			FormerLoadEvents();
			NewFunction();
		}
	} else {
		window.onload=NewFunction;
	}
}

// Return the absolute left of the given element
function ElementAbsoluteX(Element){
	var X=0;
	while (Element){
		X+=Element.offsetLeft;
		Element=Element.offsetParent;
	}
	return X;
}

// Return the absolute top of the given element
function ElementAbsoluteY(Element){
	var Y=0;
	while (Element){
		Y+=Element.offsetTop;
		Element=Element.offsetParent;
	}
	return Y;
}


//v1.7
// Flash Player Version Detection
// Detect Client Browser type
// Copyright 2005-2008 Adobe Systems Incorporated.  All rights reserved.
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
function ControlVersion()
{
	var version;
	var axo;
	var e;
	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}
	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";
			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";
			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}
	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}
	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}
	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}
// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");			
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}
// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];
			// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
	return src.replace(/\?/, ext+'?'); 
  else
	return src + ext;
}
function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '';
  if (isIE && isWin && !isOpera)
  {
	str += '<object ';
	for (var i in objAttrs)
	{
	  str += i + '="' + objAttrs[i] + '" ';
	}
	str += '>';
	for (var i in params)
	{
	  str += '<param name="' + i + '" value="' + params[i] + '" /> ';
	}
	str += '</object>';
  }
  else
  {
	str += '<embed ';
	for (var i in embedAttrs)
	{
	  str += i + '="' + embedAttrs[i] + '" ';
	}
	str += '> </embed>';
  }
  document.write(str);
}
function AC_FL_RunContent(){
  var ret = 
	AC_GetArgs
	(  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
	 , "application/x-shockwave-flash"
	);
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}
function AC_SW_RunContent(){
  var ret = 
	AC_GetArgs
	(  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
	 , null
	);
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}
function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
	var currArg = args[i].toLowerCase();    
	switch (currArg){	
	  case "classid":
		break;
	  case "pluginspage":
		ret.embedAttrs[args[i]] = args[i+1];
		break;
	  case "src":
	  case "movie":	
		args[i+1] = AC_AddExtension(args[i+1], ext);
		ret.embedAttrs["src"] = args[i+1];
		ret.params[srcParamName] = args[i+1];
		break;
	  case "onafterupdate":
	  case "onbeforeupdate":
	  case "onblur":
	  case "oncellchange":
	  case "onclick":
	  case "ondblclick":
	  case "ondrag":
	  case "ondragend":
	  case "ondragenter":
	  case "ondragleave":
	  case "ondragover":
	  case "ondrop":
	  case "onfinish":
	  case "onfocus":
	  case "onhelp":
	  case "onmousedown":
	  case "onmouseup":
	  case "onmouseover":
	  case "onmousemove":
	  case "onmouseout":
	  case "onkeypress":
	  case "onkeydown":
	  case "onkeyup":
	  case "onload":
	  case "onlosecapture":
	  case "onpropertychange":
	  case "onreadystatechange":
	  case "onrowsdelete":
	  case "onrowenter":
	  case "onrowexit":
	  case "onrowsinserted":
	  case "onstart":
	  case "onscroll":
	  case "onbeforeeditfocus":
	  case "onactivate":
	  case "onbeforedeactivate":
	  case "ondeactivate":
	  case "type":
	  case "codebase":
	  case "id":
		ret.objAttrs[args[i]] = args[i+1];
		break;
	  case "width":
	  case "height":
	  case "align":
	  case "vspace": 
	  case "hspace":
	  case "class":
	  case "title":
	  case "accesskey":
	  case "name":
	  case "tabindex":
		ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
		break;
	  default:
		ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
	}
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}



//----------------begin items for Directory Search Box---------------

// Get and display the search suggestions
// Pass either 'Products' or 'Companies' as text to SearchType to differentiate the suggestions
function GetSearchSuggestions(SearchType, SearchTerm){
	// See if the search term is of acceptable length
	if (SearchTerm.length>=MIN_CHARS_FOR_FIELD_SUGGESTION){
		if (SearchType=="Products"){
			PopulateElement("ProductSuggestionsLabel", "/Content/AjaxBoxes/DirectoryBoxSearchSuggestions.aspx?Filter="+escape(SearchTerm)+"&SearchType="+escape(SearchType), "&nbsp;")
			ShowElement("ProductSuggestionsArea", true);
		 } else if (SearchType=="Companies"){
			PopulateElement("CompanySuggestionsLabel", "/Content/AjaxBoxes/DirectoryBoxSearchSuggestions.aspx?Filter="+escape(SearchTerm)+"&SearchType="+escape(SearchType), "&nbsp;")
			ShowElement("CompanySuggestionsArea", true);
		}
	// The search term is not of acceptable length, hide the suggestion boxes
	} else {
		if (SearchType=="Products"){
			ShowElement("ProductSuggestionsArea", false);
			document.getElementById("ProductSuggestionsLabel").innerHTML="";
		 } else if (SearchType=="Companies"){
			ShowElement("CompanySuggestionsArea", false);
			document.getElementById("CompanySuggestionsLabel").innerHTML="";
		}
	}
	return false;
}


// Handle the key down event for the search fields by trapping the 'enter' key and forwarding to the right search
function SearchFieldKeyDown(SearchType, Event){
	if (Event.keyCode==13){
		SubmitSearchTerm(SearchType);
		return false;
	}
	return true;
}


// Perform any tasks that should happen when entering the search field
// Pass either 'Products' or 'Companies' as text to SearchType to differentiate the fields
function EnteringSearchField(SearchType, SearchField){
	if (SearchType=="Products"){
		if (SearchField.value==PRODUCT_SEARCH_FIELD_DEFAULT){
			SearchField.value="";
		}
	} else if (SearchType=="Companies"){
		if (SearchField.value==COMPANY_SEARCH_FIELD_DEFAULT){
			SearchField.value="";
		}
	}
	// SearchField.className="SearchFieldActiveStyle";
	SearchField.select();
	GetSearchSuggestions(SearchType, SearchField.value);
}


// Perform any tasks that should happen when leaving the search field
// Pass either 'Products' or 'Companies' as text to SearchType to differentiate the fields
function LeavingSearchField(SearchType){
	if (SearchType=="Products"){
		ShowElement("ProductSuggestionsArea", false);
	} else if (SearchType=="Companies"){
		ShowElement("CompanySuggestionsArea", false);
	}
}


// Submit one of the search fields
function SubmitSearchTerm(SearchType){
	var QueryToPass="";
	if (SearchType=="Products"){
		QueryToPass="?ProductSearchTerm="+escape(document.getElementById('ProductSearchField').value);
	} else if (SearchType=="Companies"){
		QueryToPass="?CompanySearchTerm="+escape(document.getElementById('CompanySearchField').value);
	}
	window.location="/SearchResults.aspx"+QueryToPass;
	return false;
}


// Perform any tasks that should happen when entering the search suggestion area
function EnteringSearchSuggestionArea(SearchArea){
	ShowElement(SearchArea.id, true);
}


// Perform any tasks that should happen when leaving the search suggestion area
function LeavingSearchSuggestionArea(SearchField){
	document.getElementById(SearchField).focus();
}


// Launch the category page for the given CatID
function GoToCategoryPage(CatID){
	window.location="/Category.aspx?CatID="+escape(CatID);
	return false;
}


// Launch the company page for the given CompanyID
function GoToCompanyPage(CompanyID){
	window.location="/Company.aspx?CompanyID="+escape(CompanyID);
	return false;
}

//----------------end items for Directory Search Box---------------

function Cancel_Validator(theForm)
{
	if (theForm.subcrid.value == "")
	{
		alert("Please enter a value for the \"Subscription ID\" field.");
		theForm.subcrid.focus();
		return (false);
	}
	if (theForm.FirstNAME.value == "")
	{
		alert("Please enter a value for the \"First Name\" field.");
		theForm.FirstNAME.focus();
		return (false);
	}
	if (theForm.LastNAME.value == "")
	{
		alert("Please enter a value for the \"Last Name\" field.");
		theForm.LastNAME.focus();
		return (false);
	}
	return (true);
}

function doSearch() {
	if (document.getElementById("searchText").value == 'Enter search term') {
		alert("You Must Enter A Search Term.");
		return false;
	} else {
		window.location="/photonicsFind.aspx?searchString=" + document.getElementById("searchText").value + "&searchIndex=" + document.getElementById("searcher").value ;
	}
}

function pp(pVisibility) {
		document.getElementById("privacyPolicy").style.visibility = pVisibility;
}

function openWindow9d(url) {
	popupWin = window.open(url, '9digit', 'menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,dependent,width=400,height=200,left=200,top=200')
}

function showHome() {
	document.getElementById("homeDelivery").style.display = 'block';
}

function jobFunctionCheck() {
	if (document.getElementById("jobFunction").options[document.getElementById("jobFunction").selectedIndex].value == "F") {
		document.getElementById("jobOtherEngineer").style.display = "block";
		document.getElementById("jobOtherMan").style.display = "none";
		document.getElementById("jobOtherOther").style.display = "none";
	} else if (document.getElementById("jobFunction").options[document.getElementById("jobFunction").selectedIndex].value == "L") {
		document.getElementById("jobOtherEngineer").style.display = "none";
		document.getElementById("jobOtherMan").style.display = "block";
		document.getElementById("jobOtherOther").style.display = "none";
	} else if (document.getElementById("jobFunction").options[document.getElementById("jobFunction").selectedIndex].value == "P") {
		document.getElementById("jobOtherEngineer").style.display = "none";
		document.getElementById("jobOtherMan").style.display = "none";
		document.getElementById("jobOtherOther").style.display = "block";
	}
}

function jobProductCheck() {
	if (document.getElementById("PrimaryProduct").options[document.getElementById("PrimaryProduct").selectedIndex].value == "6") {
		document.getElementById("otherProduct").style.display = "block";
	}
}

function jobTechCheck() {
	if (document.getElementById("tech").options[34].selected == true) {
		document.getElementById("otherTech").style.display = "block";
	}
}

function DisplayArticleDiscussionTab()
{
	document.getElementById('ArticleDiscussionTab').style.display='block';
	document.getElementById('MemberLoginTab').style.display='none';
}

function DisplayMemberLoginTab()
{
	document.getElementById('ArticleDiscussionTab').style.display='none';
	document.getElementById('MemberLoginTab').style.display='block';
}



// *** User Control Bar Functions
var UserControlBarInfo_LoadingText="<img src=\"/images/loading.gif\" width=\"169\" height=\"39\" border=\"0\" alt=\"\" />";
var UserControlBarInfo_OpenBox=null;
var UserControlBarInfo_FormerBodyClick=null;
function ToggleUserControlBarInfoBox(ElementID){
	var State=document.getElementById(ElementID).style.visibility!="visible";
	ShowUserControlBarInfoBox(ElementID, State);
}

function ShowUserControlBarInfoBox(ElementID, State, DoNotPopulate){
	ShowElement("UserControlBarInfo_MoreInfo", false);
	ShowElement("UserControlBarInfo_AccountDetails", false);
	ShowElement("UserControlBarInfo_ArticleLibrary", false);
	ShowElement("UserControlBarInfo_ProductInterests", false);
	ShowElement("UserControlBarInfo_CompanyInterests", false);
	ShowElement("UserControlBarInfo_EventInterests", false);
	ShowElement("UserControlBarInfo_Register", false);
	ShowElement("UserControlBarInfo_Login", false);
	if (State && !DoNotPopulate){
		if (ElementID=="UserControlBarInfo_ArticleLibrary") {
			PopulateElement("UserControlBarInfo_ArticleLibrary_Body", "/ajax/GetUserArticleLibrary.aspx", UserControlBarInfo_LoadingText);
		} else if (ElementID=="UserControlBarInfo_ProductInterests") {
			PopulateElement("UserControlBarInfo_ProductInterests_Body", "/ajax/GetMemberProductInterests.aspx", UserControlBarInfo_LoadingText);            
		} else if (ElementID=="UserControlBarInfo_CompanyInterests") {
			PopulateElement("UserControlBarInfo_CompanyInterests_Body", "/ajax/GetMemberCompanyInterests.aspx", UserControlBarInfo_LoadingText);            
		} else if (ElementID=="UserControlBarInfo_EventInterests") {
			PopulateElement("UserControlBarInfo_EventInterests_Body", "/ajax/GetMemberEventInterests.aspx", UserControlBarInfo_LoadingText);            
		}
	}
	if (State){
		UserControlBarInfo_OpenBox=ElementID;
	} else {
		UserControlBarInfo_OpenBox=null;
	}
	ShowElement(ElementID, State);
	if (State){
		if (ElementID=="UserControlBarInfo_Login"){
			var Element=document.getElementById("rtbExistingEmailAddress_ALT");
			if (Element){
				Element.focus();
			}
		}
		if (ElementID=="UserControlBarInfo_Register"){
			var Element=document.getElementById("rtbFirstName_ALT");
			if (Element){
				Element.focus();
			}
		}
	} else {
		if (ElementID=="UserControlBarInfo_Login"){
			var Element=document.getElementById("UserControlBarInfo_Login_Notice");
			if (Element){
				Element.style.display="none";
			}
			MiniLoginForm_ReturnURL_ALT="";
		}
		if (ElementID=="UserControlBarInfo_Register"){
			var Element=document.getElementById("UserControlBarInfo_Registration_Notice");
			if (Element){
				Element.style.display="none";
			}
			MiniRegistrationForm_ReturnURL_ALT="";
		}
	}
}

function FeatureRequiresLogin(ForwardURL, State){
	var Element=document.getElementById("UserControlBarInfo_Login_Notice");
	if (Element){
		Element.style.display="block";
	}
	MiniLoginForm_ReturnURL_ALT=escape(ForwardURL);
	if (document.getElementById("UserControlBarInfo_Login")){
		ShowUserControlBarInfoBox("UserControlBarInfo_Login", true);
		return false;
	}
	return true;
}

function FeatureRequiresRegistration(ForwardURL, State){
	var Element=document.getElementById("UserControlBarInfo_Registration_Notice");
	if (Element){
		Element.style.display="block";
	}
	MiniRegistrationForm_ReturnURL_ALT=escape(ForwardURL);
	ShowUserControlBarInfoBox("UserControlBarInfo_Register", true);
}


function OverUserControlBarInfoBox(){
	if (UserControlBarInfo_OpenBox){
		document.onclick=UserControlBarInfo_FormerBodyClick;
	}
}

function LeftUserControlBarInfoBox(){
	if (UserControlBarInfo_OpenBox){
		UserControlBarInfo_FormerBodyClick=document.onclick;
		document.onclick=HideCurrentInfoBox;
	}
}

function HideCurrentInfoBox(){
	if (UserControlBarInfo_OpenBox){
		ToggleUserControlBarInfoBox(UserControlBarInfo_OpenBox);
		document.onclick=UserControlBarInfo_FormerBodyClick;
	}
}

function AddArticleToLibrary(ArticleID){
	if (!document.getElementById("UserControlBarInfo_ArticleLibrary_Body")){
		return true;
	}
	PopulateElement("UserControlBarInfo_ArticleLibrary_Body", "/ajax/GetUserArticleLibrary.aspx?Action=SAVE&AID="+ArticleID, UserControlBarInfo_LoadingText);
	setTimeout("ShowUserControlBarInfoBox(\"UserControlBarInfo_ArticleLibrary\", true, true)", 10);
	return false;
}

function RemoveArticleFromLibrary(ArticleID){
	if (confirm("Remove this article from your list?")){
		PopulateElement("UserControlBarInfo_ArticleLibrary_Body", "/ajax/GetUserArticleLibrary.aspx?Action=REMOVE&AID="+ArticleID, UserControlBarInfo_LoadingText);
	}
	setTimeout("ShowUserControlBarInfoBox(\"UserControlBarInfo_ArticleLibrary\", true, true)", 10);
}

function AddProductInterest(ArticleID){
	if (!document.getElementById("UserControlBarInfo_ProductInterests_Body")){
		return true;
	}
	PopulateElement("UserControlBarInfo_ProductInterests_Body", "/ajax/GetMemberProductInterests.aspx?Action=SAVE&AID="+ArticleID, UserControlBarInfo_LoadingText);
	setTimeout("ShowUserControlBarInfoBox(\"UserControlBarInfo_ProductInterests\", true, true)", 10);
	return false;
}

function RemoveProductInterest(ArticleID){
	if (confirm("Remove this product from your list?")){
		PopulateElement("UserControlBarInfo_ProductInterests_Body", "/ajax/GetMemberProductInterests.aspx?Action=REMOVE&AID="+ArticleID, UserControlBarInfo_LoadingText);
	}
	setTimeout("ShowUserControlBarInfoBox(\"UserControlBarInfo_ProductInterests\", true, true)", 10);
}

function RequestInfo_ProductInterests(){
	var AIDs="";
	var Element=document.getElementById("UserControlBarInfo_ProductInterests_Body");
	var Children=Element.getElementsByTagName("input");
	for (LoopVar=0; LoopVar<Children.length; LoopVar++){
		if (Children[LoopVar].name=="ArticleSelector"){
			if (Children[LoopVar].checked){
				AIDs+=(AIDs.length?",":"")+Children[LoopVar].value;
			}
		}
	}
	window.location="/EmailSender.aspx?IsMultiArticleSend=1&ArticleIDs="+AIDs;
}

function AddCompanyInterest(CompanyID){
	if (!document.getElementById("UserControlBarInfo_CompanyInterests_Body")){
		return true;
	}
	PopulateElement("UserControlBarInfo_CompanyInterests_Body", "/ajax/GetMemberCompanyInterests.aspx?Action=SAVE&CID="+CompanyID, UserControlBarInfo_LoadingText);
	setTimeout("ShowUserControlBarInfoBox(\"UserControlBarInfo_CompanyInterests\", true, true)", 10);
	return false;
}

function RemoveCompanyInterest(CompanyID){
	if (confirm("Remove this company from your list?")){
		PopulateElement("UserControlBarInfo_CompanyInterests_Body", "/ajax/GetMemberCompanyInterests.aspx?Action=REMOVE&CID="+CompanyID, UserControlBarInfo_LoadingText);
	}
	setTimeout("ShowUserControlBarInfoBox(\"UserControlBarInfo_CompanyInterests\", true, true)", 10);
}

function RequestInfo_CompanyInterests(){
	var CIDs="";
	var Element=document.getElementById("UserControlBarInfo_CompanyInterests_Body");
	var Children=Element.getElementsByTagName("input");
	for (LoopVar=0; LoopVar<Children.length; LoopVar++){
		if (Children[LoopVar].name=="CompanySelector"){
			if (Children[LoopVar].checked){
				CIDs+=(CIDs.length?",":"")+Children[LoopVar].value;
			}
		}
	}
	window.location="/EmailSender.aspx?IsMultiCompanySend=1&CompanyIDs="+CIDs;
}

function AddEventInterest(EventID){
	if (!document.getElementById("UserControlBarInfo_EventInterests_Body")){
		return true;
	}
	PopulateElement("UserControlBarInfo_EventInterests_Body", "/ajax/GetMemberEventInterests.aspx?Action=SAVE&EID="+EventID, UserControlBarInfo_LoadingText);
	setTimeout("ShowUserControlBarInfoBox(\"UserControlBarInfo_EventInterests\", true, true)", 10);
	return false;
}

function RemoveEventInterest(EventID){
	if (confirm("Remove this event from your calendar?")){
		PopulateElement("UserControlBarInfo_EventInterests_Body", "/ajax/GetMemberEventInterests.aspx?Action=REMOVE&EID="+EventID, UserControlBarInfo_LoadingText);
	}
	setTimeout("ShowUserControlBarInfoBox(\"UserControlBarInfo_EventInterests\", true, true)", 10);
}

function ChangeEventCalendarFilters(ViewMode, NewYear, NewMonth, NewDay){
	PopulateElement("UserControlBarInfo_EventInterests_Body", "/ajax/GetMemberEventInterests.aspx?ViewMode="+(ViewMode?ViewMode:"Calendar")+(NewYear?"&Year="+NewYear:"")+(NewMonth?"&Month="+NewMonth:"")+(NewDay?"&Day="+NewDay:""), null, "HideUserControlBarTooltip();");
	setTimeout("ShowUserControlBarInfoBox('UserControlBarInfo_EventInterests', true, true)", 10);
}



var MoreInfoIcon_Step=0;
var MoreInfoIcon_Values=new Array(-18, 0, -18, 0, -18, 0);
var MoreInfoIcon_Value=0;
function AnimateMoreInfoIcon(){
	var ElementID="UserControlBarInfo_MoreInfo_Icon";
	var Element=document.getElementById(ElementID);
	if (!Element){
		return;
	}
	if (!Element.complete){
		var Timer=setTimeout("AnimateMoreInfoIcon()", 100);
		return;
	}
	if (MoreInfoIcon_Values.length-1>=MoreInfoIcon_Step){
		BounceMoreInfoIcon("UserControlBarInfo_MoreInfo_Icon", MoreInfoIcon_Value, MoreInfoIcon_Values[MoreInfoIcon_Step], (MoreInfoIcon_Value>MoreInfoIcon_Values[MoreInfoIcon_Step]?-3:2), 40);
	}
}

function BounceMoreInfoIcon(ElementID, Start, End, Increment, Delay){
	var Element=document.getElementById(ElementID);
	if (!Element || !Increment){
		return;
	}
	MoreInfoIcon_Value=Start;
	Element.style.marginTop=MoreInfoIcon_Value+"px";
	if ((Increment<0 && Start>End) || (Increment>0 && Start<End)){
		var Timer=setTimeout("BounceMoreInfoIcon('"+ElementID+"', "+(Start+Increment)+", "+End+", "+Increment+", "+Delay+")", Delay);
	} else {
		MoreInfoIcon_Step++;
		AnimateMoreInfoIcon();
	}
}



function ShowUserControlBarTooltip(Caller, Message){
	var TooltipBox=document.getElementById("UserControlBarTooltip");
	TooltipBox.innerHTML=Message;
	TooltipBox.style.left=ElementAbsoluteX(Caller)+"px";
	TooltipBox.style.top=ElementAbsoluteY(Caller)-TooltipBox.offsetHeight-10+"px";
	TooltipBox.style.visibility="visible";
}

function HideUserControlBarTooltip(){
	var TooltipBox=document.getElementById("UserControlBarTooltip");
	TooltipBox.style.visibility="hidden";
}



function ShowOutlineTab(Title, AnchorID, IconPath){
	var Target=document.getElementById(AnchorID);
	if (Target){
		var Page=(document.body?document.body:document.documentElement);
		var NewTab=document.createElement("div");
		var TargetY=ElementAbsoluteY(Target);
		NewTab.className="OutlineTabBox";
		var Content="";
		Content+="<a href=\"#"+Target.name+"\" onClick=\"SmoothScrollTo("+TargetY+"); return false;\" style=\"float: right;\">";
		if (IconPath){
			Content+="<img src=\"/images/PageElements/Outline/" + IconPath + "\" width=\"16\" height=\"16\" border=\"0\" align=\"absmiddle\" alt=\"" + Target.name + "\" />";
		}
		Content+="&nbsp;"+Title;
		Content+="</a>";
		Content+="<img src=\"/images/PageElements/Outline/outline_tab_left.gif\" width=\"7\" height=\"22\" border=\"0\" style=\"float: left;\" alt=\"\" />";
		NewTab.innerHTML=Content;
		NewTab.style.top=((TargetY/Page.offsetHeight)*100)+"%";
		document.body.appendChild(NewTab);
	}
}


function CurrentScrollY(){
  var ScrollY=0;
  if(typeof(window.pageYOffset)=="number"){
	ScrollY=window.pageYOffset;
  } else if(document.body && document.body.scrollTop) {
	ScrollY=document.body.scrollTop;
  } else if(document.documentElement && document.documentElement.scrollTop) {
	ScrollY=document.documentElement.scrollTop;
  }
  return ScrollY;
}


var ScrollTimer=null;
function SmoothScrollTo(YPos, RemainingSteps){
	if (RemainingSteps==null){
		if (ScrollTimer){
			clearTimeout(ScrollTimer);
		}
		RemainingSteps=15;
	}
	window.scrollTo(0, (CurrentScrollY()+YPos)/2);
	if (RemainingSteps>0){
		ScrollTimer=setTimeout("SmoothScrollTo("+YPos+", "+(RemainingSteps-1)+");", 20);
	} else {
		window.scrollTo(0, YPos);
	}
}

