//##############################################################################
//------------------------------------------------------------------------------
function Photo()
{  
    Entity.apply(this);

    this.text = '';
    this.didSearch = false;
}

Photo.prototype = new Entity();

//------------------------------------------------------------------------------
Photo.prototype.startSearches = function(priority)
{
    if(this.didSearch)
        return;
        
    if(this.childScale < 2.0e-14)
        this.plantSeed('too deep; turn back now!', 'tag');
    else
    {
        var url = 'http://api.flickr.com/services/rest/?method=flickr.tags.getListPhoto&api_key=53a4dfca73a01693b18701af6485147d&photo_id=' + this.id;
        
        getXML(proxyPath + '?url=' + escape(url), parseFlickrTags, this, priority);
                
        this.didSearch = true;
    }
}

//##############################################################################
//------------------------------------------------------------------------------
function parseFlickrTags(http_request, requester)
{
    var file = http_request.responseXML;
    if(!file)
        return;

    var velocityRange = 20 * requester.childScale;
   	var tags = file.getElementsByTagName('tag');
	var foundCount = 0;
	var count = tags.length;
	var a;
	for(a = 0; a < count; a++)
    {
        if(foundCount > 20)
            return;
            
        var tag = tags[a];
        var raw = getXMLAttribute(tag, 'raw');
        
        if(isAcceptableTag(raw))
        {
			requester.plantSeed(cleanTag(raw), 'tag');
			foundCount++;
        }
   	}
}

