//for email this to a friend

function openEmailThisPopUp(url, name) {
	popupWin = window.open(url, name, 'scrollbars,resizable,width=430,height=590');
	popupWin.focus();
}

//openEmailThis - this function displays the contents of an html element at the location specified
//id - the id of the element whose innerHTML should be displayed
//ref - the id of the element that the overlib popup should be aligned to
//x, y - the x and y offset of that alignment (can be pos. or neg.)
//refCorner - the corner of the referenced object that should be used for alignments. options are:
//            UR - Upper Right
//            LR - Lower Right
//            UL - Upper Left
//            LL - Lower Left
//popCorner - the corner of the popup used for alignment. Use same values as above.
//see: http://www.macridesweb.com/oltest/REF.html
// for demonstration of alignment
//body - the html to be displayed
//FULLHTML means that we won't be using any of the default overlib html
//STICKY - means that it won't scroll with the browser window; it will remain fixed
//REF - the reference id passed in as "ref"
//REFX, REFY - the offset (passed in as x & y)
//REFC, REFP - the corners of the reference object and the popup for alignment
//NOJUSTX, NOJUSTY - means that overlib will not attempt to ensure that the popup is on the screen
//                   but will instead place it at the reference coordinates given regardless of where
//                   the browser is scrolled to.
// more on overlib: http://www.macridesweb.com/oltest/commandRef.html
function openEmailThis(url,searchString,id,ref,x,y,refCorner,popCorner){

	// for fpp - override emailPath
	var emailPath = document.URL;
        	if (emailPath.indexOf('/1200-') > -1 || emailPath.indexOf('/3405-') > -1) {
		var tokenBeginsAt = url.indexOf('&emailPath=') + 11;
		var tokenEndsAt = url.indexOf('?tag=emailThis')
		var tokenLength = tokenEndsAt - tokenBeginsAt;
		var urlbegin = url.substr(0,tokenBeginsAt);
		var urlend = url.substr(tokenBeginsAt + tokenLength,url.length);
        	url = urlbegin + emailPath + urlend;			
	}

	// set to true to override overlib implementation
	var usepopup = false;
	if (usepopup == true) {
		url = url + "&style=pop";
		openEmailThisPopUp(url, "emailThis"); 
	} else {
		//set the user's popup preferences to false so that other mouse-over overlib
		//elements don't make this one disappear.
		showPopUps = false;
		//get the html for the item to be displayed (passed in as "id")
		var body = document.getElementById(id).innerHTML;
		//plug in the iframe source and call the overlib
		var offset = body.toLowerCase().indexOf(searchString) + searchString.length + 1;
		var begin = body.substr(0,offset);
		var end = body.substr(offset,body.length);
        	body = begin + url + end;
		overlib(body, FULLHTML, STICKY, REF, ref, REFX, x, REFY, y, REFC, refCorner, REFP, popCorner, NOJUSTX, NOJUSTY);
	}
};

function closeEmailThis() {
    cClick();
}