	//Check for undefined variables
	if ((typeof(iFrameEmbed) == "undefined") && (iFrameEmbed == null))
		var iFrameEmbed = false;
	if ((typeof(omitEmailPhoto) == "undefined") && (omitEmailPhoto == null))
		var omitEmailPhoto = false;
	if ((typeof(popupEmailPhoto) == "undefined") && (popupEmailPhoto == null))
		var popupEmailPhoto = false;
	if ((typeof(popupBuyThisPhoto) == "undefined") && (popupBuyThisPhoto == null))
		var popupBuyThisPhoto = false;
		
	var target = document;
	if(iFrameEmbed)
		target = parent.document;

	var blankImage = "/images/blank.gif";
	
 	//Set Cookie
	function SetCookie (name,value,expires,path,domain,secure) {
  		document.cookie = name + "=" + value +
    		((expires) ? "; expires=" + expires.toGMTString() : "") +
    		((path) ? "; path=" + path : "") +
    		((domain) ? "; domain=" + domain : "") +
    		((secure) ? "; secure" : "");
	}
	
	//Set up cookies for sending the photo
	function submitEmailPhoto(indexPos) {
	
		SetCookie ("imageSRC", imageLoc[indexPos], null, "/");
		SetCookie ("imageCaption", imageCap[indexPos], null, "/");
		SetCookie ("imageCredit", imageCre[indexPos], null, "/");
		SetCookie ("articleURL", target.location, null, "/");
		SetCookie ("articleTitle", window.target.title, null, "/");
		
		if(location.hostname == "linuxpub1w") {
			//SetCookie ("teamPath", location.pathname.substring(1, location.pathname.indexOf('/', 1)), null, "/");
			SetCookie("site", 'WNBA', null, "/");
		}
		
		attrs = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,screenX=25,screenY=25,top=25,left=25,copyhistory=no,,width=690,height=560';
		newPopup=window.open('/components/EmailAPhotoForm.html','EmailaPhoto',attrs);
		newPopup.focus();

	}
	function popupBuyPhoto(buyURL){
		newPopup=window.open(buyURL,'BuyThisPhoto', 'toolbar=1,menubar=1,scrollbars=1,scrolling=yes,resizable=yes');	
		newPopup.focus();
	}

function drawPhoto() {
	//Add cache to blank images if necessary
	if(imageLocation.indexOf("cache.nba.com") > 0)
		blankImage = "http://cache.nba.com/images/blank.gif";	
	
	var ns = (navigator.appName.indexOf('Netscape') != -1) ? true : false;
	var ns6 = (ns && document.getElementById) ? true : false
	
	var tdWidth = "99%";
	var tableWidth = "100%";
	
	if(imageWidth > 0) {
		tableWidth = imageWidth;
		tdWidth = imageWidth - 2;
	}
	else if(ns)
		tdWidth = "90";
	document.write('<div class=ePhotoWrapper>');
	if ((typeof(buyPhotoURL) != "undefined") && (buyPhotoURL != null) && (buyPhotoURL.length > 0)){
		document.write("<a id=\"buyPhotoLink\" href=\"javascript:submitEmailPhoto('" + currentEPhoto + "');\"><img src=\"/media/mystics/08/email_photo.gif\"></a><a id=\"emailPhotoLink\" ");
		if (popupBuyThisPhoto==true) {
			document.write("href=\"javascript:popupBuyPhoto('"+buyPhotoURL+"');");
		} else {
			document.write("href=\"" + buyPhotoURL );
		}		
		document.write("\"><img src=\"/media/mystics/08/buy_photo.gif\"></a>");
		}else{
		document.write("<a  id=\"emailPhotoLink\" href=\"javascript:submitEmailPhoto('" + currentEPhoto + "');\"><img src=\"/media/mystics/08/email_photo.gif\"></a>");
	}
	document.write('</div>');
	if(imageCaption.length < 1)
		imageCaption = "&nbsp;";
	if(imageCredit.length < 1)
		imageCredit = "&nbsp;";

	if(imageLocation.indexOf("cache.nba.com") > -1)
		imageLoc[currentEPhoto] = imageLocation.substring(imageLocation.indexOf("cache.nba.com") + 13, imageLocation.length);
	else if(imageLocation.indexOf("www.nba.com") > -1)
		imageLoc[currentEPhoto] = imageLocation.substring(imageLocation.indexOf("www.nba.com") + 11, imageLocation.length);
	else if(imageLocation.indexOf("media.nba.com") > -1)
		imageLoc[currentEPhoto] = imageLocation.substring(imageLocation.indexOf("media.nba.com") + 13, imageLocation.length);
	else
		imageLoc[currentEPhoto] = imageLocation;
	
	
	imageCap[currentEPhoto] = imageCaption;
	imageCre[currentEPhoto] = imageCredit;
	
	currentEPhoto++;

}

if(omitEmailPhoto)
	document.write("<img src=\"" + imageLocation + "\">");
else
	drawPhoto()