function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

function showHideStory(storyContainer){
	string1 = "full story";
	string2 = "hide story";
	showHideLinks = getElementsByClass("showHideLink",storyContainer);
	if(showHideLinks.length > 0){
		showHideLink = showHideLinks[0];
		storyLinkText = showHideLink.innerHTML;
		(storyLinkText == string1) ? storyLinkText = string2 : storyLinkText = string1;
		showHideLink.innerHTML = storyLinkText;
	}
	for(x=0;x<storyContainer.childNodes.length;x++){
		currentElement = storyContainer.childNodes[x];
		if(currentElement.className == "hiddenstory"){
			currentElement.className = "visiblestory";
		}else if(currentElement.className == "visiblestory"){
			currentElement.className = "hiddenstory";
		}
	}
}

function openPopup( url, name, widgets, openerUrl )
{
	var host = location.hostname;
	if (window == top) { window.top.name = "opener"; }
	var popupWin = window.open( url, name, widgets );
	if(popupWin) {hasOpenPopup = 1;}
	if ( popupWin && popupWin.opener ) {
		if ( openerUrl )
		{
			popupWin.opener.location = openerUrl;
		}
	}
	if ( popupWin) {
		popupWin.focus();
	}
}

function sendToAFriend(page){
	openPopup("/script/communication/send_to_friend.asp?page="+page,"sendtofriend","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=400,height=350");
}