ident.yql={parserName:"yql",parseUf:5,parseRss:10,parseAtom:10,findProfiles:function(){ident.yql.findContent("twitter.com","Profile","hCard",true);for(var a=0;a<ident.domains.length;a++){if(ident.domains[a].accounts!=null){ident.yql.findContent(ident.domains[a].domain,"Profile","hCard",true);ident.yql.findContent(ident.domains[a].domain,"Resume","hResume",true);ident.yql.findContent(ident.domains[a].domain,"Services","XFN",true)}}},findContent:function(d,h,c){var a="";var b="";for(var f=0;f<ident.domains.length;f++){if(ident.domains[f].domain==d){if(ident.domains[f].accounts!=null){var e=ident.domains[f];for(var j=0;j<e.accounts.length;j++){var g=e.accounts[j];var a=ident.getAPIEndPoint(h,c,e.urlmappings,g,1);if(a!=""){b=e.name;break}}}}}if(b!=""&&a!=""){ident.yql.loadContent(a,d,b,h,c)}},loadContent:function(b,e,a,c,d){if(ident.hasAPIBeenCalled(b,d,"")==false){ident.yql.getJson(b,e,a,c,d)}},getJson:function(b,f,a,d,e){if(b.indexOf("#")>0){var g=b.split("#");b=g[0]}var h=new ident.historyItem(b,"");h.apiName="yql";h.name=a;h.domain=f;h.schema=e;h.contentType=d;var c="microformats";if(e=="Rss"){c="rss"}if(e=="Atom"){c="atom"}query="select * from "+c+" where url='"+b+"'";apiurl="http://query.yahooapis.com/v1/public/yql?q="+encodeURIComponent(query)+"&format=json";h.apiurl=apiurl;if(f=="twitter.com"&&ident.getEnchancedTwitterProfile&&e=="hCard"){ident.getEnchancedTwitterProfile(b)}else{ident.history[ident.history.length]=h;jQuery.getJSON(apiurl+"&callback=?",function(i){ident.yql.processJson(i,f,a,d,h,c)})}},processJson:function(json,domain,name,type,historyItem,mediatype){ident._apiReturnCount++;if(ident.isObject(json)){yql=json}else{yql=eval("("+json+")")}historyItem.rawJSON=yql;if(mediatype=="rss"||mediatype=="atom"){if(yql.query){if(yql.query.results){if(yql.query.results.entry){if(yql.query.results.entry.length==null){singleEntry=yql.query.results.entry;yql.query.results.entry=new Array();yql.query.results.entry[0]=singleEntry}if(yql.query.results.entry.length){for(var x=0;x<=yql.query.results.entry.length-1;x++){hentry=ident.yql.parseAtomItem(yql.query.results.entry[x]);hentry.domain=domain;hentry.name=name;hentry.type=type;hentry.sourceUrl=historyItem.url;ident.postProcesshEntry(hentry);ident.entries[ident.entries.length]=hentry}ident.contentAddedEvent()}}if(yql.query.results.item){if(yql.query.results.item.length==null){singleItem=yql.query.results.item;yql.query.results.item=new Array();yql.query.results.item[0]=singleItem}if(yql.query.results.item.length){for(var x=0;x<=yql.query.results.item.length-1;x++){hentry=ident.yql.parseRssItem(yql.query.results.item[x]);hentry.domain=domain;hentry.name=name;hentry.type=type;hentry.sourceUrl=historyItem.url;ident.postProcesshEntry(hentry);ident.entries[ident.entries.length]=hentry}ident.contentAddedEvent()}}}}}if(mediatype=="microformats"){var UnStructuredhCards=null;var UnStructuredhResumes=null;var UnStructuredhEntry=null;var UnStructuredXFN=null;var ufCollection=new Array();var sourceUrl="";if(yql!=null){if(yql.query!=null){if(yql.query.results!=null){if(yql.query.results.result!=null){if(yql.query.results.result.url!=null){sourceUrl=yql.query.results.result.url}if(yql.query.results.result.feed!=null){if(yql.query.results.result.feed.adjunct!=null){if(yql.query.results.result.feed.adjunct.length!=null){for(var x=0;x<=yql.query.results.result.feed.adjunct.length-1;x++){var adjunct=yql.query.results.result.feed.adjunct[x];if(adjunct.id=="com.yahoo.page.uf.hcard"){UnStructuredhCards=adjunct}if(adjunct.id=="com.yahoo.page.uf.hresume"){UnStructuredhResumes=adjunct}if(adjunct.id=="com.yahoo.page.uf.hentry"){UnStructuredhEntry=adjunct}if(adjunct.id=="com.yahoo.page.uf.xfn"){UnStructuredXFN=adjunct}}}else{var adjunct=yql.query.results.result.feed.adjunct;if(adjunct.id=="com.yahoo.page.uf.hcard"){UnStructuredhCards=adjunct}if(adjunct.id=="com.yahoo.page.uf.hresume"){UnStructuredhResumes=adjunct}if(adjunct.id=="com.yahoo.page.uf.hentry"){UnStructuredhEntry=adjunct}if(adjunct.id=="com.yahoo.page.uf.xfn"){UnStructuredXFN=adjunct}}}}else{historyItem.error=true;historyItem.errorMessage="Not Found"}}}}}if(UnStructuredhCards!=null){hCards=ident.yql.parsehCards(UnStructuredhCards,domain,name,sourceUrl);ufCollection[ufCollection.length]={vcard:hCards};var hCard=null;if(hCards.length==1){hCard=hCards[0]}if(hCards.length>1){hCard=ident.findRepresentativehCard(hCards,domain)}if(hCard!=null){if(hCard.url){for(var i=0;i<hCard.url.length;i++){ident.appendDeclaredProfileUrl(hCard.url[i])}}if(hCard.fn){ident.appendFormattedName(hCard.fn.replace("  "," "))}ident.profiles[ident.profiles.length++]=hCard;ident.createCombinedhCard();jQuery(document).trigger("identify:profileAdded");jQuery(document).trigger("identify:statusUpdate",["data-change"])}}if(UnStructuredXFN!=null){ident.yql.parseXFN(UnStructuredXFN,domain,name,sourceUrl)}if(UnStructuredhResumes!=null){var hResume=ident.yql.parsehResumes(UnStructuredhResumes,domain,name,sourceUrl);ufCollection[ufCollection.length]={hresume:hResume};if(hResume.summary!=""){for(var i=0;i<ident.profiles.length;i++){if(hResume.domain==ident.profiles[i].domain){var note=new ident.valueTypeProperty();note.domain=domain;note.sourceUrl=sourceUrl;note.value=hResume.summary;ident.profiles[i].note[0]=note}}}jQuery(document).trigger("identify:statusUpdate",["data-change"]);ident.resumes[ident.resumes.length++]=hResume}historyItem.uf=ufCollection}},parseAtomItem:function(b){hentry=new ident.hEntry();hentry.id=b.id;hentry.author.fn=b.author.name;hentry.author.url[0]=b.author.uri;hentry.published=b.published;hentry.updated=b.updated;hentry["entry-title"]=b.title;hentry["entry-content"][0]=b.content.content;if(b.link){if(b.link.length){for(var a=0;a<b.link.length;a++){enclosure=new ident.enclosure();enclosure.link=b.link[a].href;enclosure.type=b.link[a].type;enclosure.rel=b.link[a].rel;hentry.enclosure[hentry.enclosure.length]=enclosure}}}return hentry},parseRssItem:function(a){hentry=new ident.hEntry();if(a.id){hentry.id=a.id}if(a.author){if(a.author.fn){hentry.author.fn=a.author.name}if(a.author.url){hentry.author.url[0]=a.author.uri}}if(a.pubDate){hentry.published=a.pubDate}if(a.title){hentry["entry-title"]=a.title}if(a.description){hentry["entry-content"][0]=a.description}if(a.summary){hentry.summary=a.summary}if(a.dtstart){hentry.dtstart=a.dtstart}if(a.dtend){hentry.dtend=a.dtend}if(a.location){hentry.location=a.location}if(a["x-calconnect-venue"]){if(a["x-calconnect-venue"].adr){venueAdr=a["x-calconnect-venue"].adr;hentry.venue=new Object();if(venueAdr["x-calconnect-venue-name"]){hentry.location=venueAdr["x-calconnect-venue-name"]}if(venueAdr["x-calconnect-street"]){hentry.venue["street-address"]=new Array();hentry.venue["street-address"][0]=venueAdr["x-calconnect-street"]}if(venueAdr["x-calconnect-city"]){hentry.venue.locality=venueAdr["x-calconnect-city"]}if(venueAdr["x-calconnect-region"]){hentry.venue.region=venueAdr["x-calconnect-region"]}if(venueAdr["x-calconnect-postalcode"]){hentry.venue["post-office-box"]=venueAdr["x-calconnect-postalcode"]}if(venueAdr["x-calconnect-country"]){hentry.venue["country-name"]=venueAdr["x-calconnect-country"]}}}if(a.enclosure){enclosure=new ident.enclosure();enclosure.link=a.enclosure.url;enclosure.type=a.enclosure.type;enclosure.length=a.enclosure.length;hentry.enclosure[hentry.enclosure.length]=enclosure}if(a.group){if(a.group.content){enclosure=new ident.enclosure();if(a.group.content.url){enclosure.link=a.group.content.url}if(a.group.content.type){enclosure.type=a.group.content.type}hentry.enclosure[hentry.enclosure.length]=enclosure}}if(a.date){hentry.published=a.date}if(a.link){hentry.link=a.link}return hentry},parsehCards:function(f,d,a,g){var l=new Array();if(f!=null){if(f.item!=null){if(ident.isArray(f.item)==false){f.item=new Array(f.item)}for(var e=0;e<=f.item.length-1;e++){if(f.item[e].type!=null){var h=new ident.hCard();h.domain=d;h.name=a;h.sourceUrl=g;if(f.item[e].type.meta!=null){if(ident.isArray(f.item[e].type.meta)){for(var m=0;m<=f.item[e].type.meta.length-1;m++){if(f.item[e].type.meta[m].property=="vcard:fn"){h.fn=f.item[e].type.meta[m].content}if(f.item[e].type.meta[m].property=="vcard:tel"){var c=new ident.valueTypeProperty();c.domain=d;c.sourceUrl=g;if(f.item[e].type.meta[m].content.toLowerCase().indexOf("work")>-1){c.type="work"}if(f.item[e].type.meta[m].content.indexOf(" : ")>0){var b=f.item[e].type.meta[m].content.split(" : ");c.value=b[1]}else{c.value=f.item[e].type.meta[m].content}h.tel[h.tel.length]=c}if(f.item[e].type.meta[m].property=="vcard:email"){var i=new ident.valueTypeProperty();i.domain=d;i.sourceUrl=g;i.valueOf=f.item[e].type.meta[m].content;h.email[h.email.length]=i}if(f.item[e].type.meta[m].property=="vcard:title"){if(f.item[e].type.meta[m].content!=undefined){h.title[h.title.length]=f.item[e].type.meta[m].content}}if(f.item[e].type.meta[m].property=="vcard:role"){if(f.item[e].type.meta[m].content!=undefined){h.title[h.title.length]=f.item[e].type.meta[m].content}}}}else{if(f.item[e].type.meta.property=="vcard:fn"){h.fn=f.item[e].type.meta.content}}}if(f.item[e].type.item!=null){if(ident.isArray(f.item[e].type.item)){for(var m=0;m<=f.item[e].type.item.length-1;m++){if(f.item[e].type.item[m].rel=="vcard:photo"){h.photo[h.photo.length]=f.item[e].type.item[m].resource}if(f.item[e].type.item[m].rel=="vcard:url"){h.url[h.url.length]=f.item[e].type.item[m].resource}if(f.item[e].type.item[m].rel=="vcard:org"){if(f.item[e].type.item[m].type!=null){if(f.item[e].type.item[m].type.meta!=null){if(f.item[e].type.item[m].type.meta.property=="vcard:organization-name"){var o=new ident.org();o["organization-name"]=f.item[e].type.item[m].type.meta.content;o.domain=d;o.sourceUrl=g;h.org[h.org.length]=o}}}}if(f.item[e].type.item[m].rel=="vcard:adr"){if(f.item[e].type.item[m].type!=null){if(f.item[e].type.item[m].type.meta!=null){var n=null;if(ident.isArray(f.item[e].type.item[m].type.meta)){h.adr[0]=new ident.adr();h.adr[0].domain=d;h.adr[0].sourceUrl=g;for(var k=0;k<=f.item[e].type.item[m].type.meta.length-1;k++){var n=f.item[e].type.item[m].type.meta[k];if(n.property=="vcard:extended-address"){h.adr[0]["extended-address"][0]=n.content}if(n.property=="vcard:street-address"){h.adr[0]["street-address"][0]=n.content}if(n.property=="vcard:locality"){h.adr[0].locality=n.content}if(n.property=="vcard:region"){h.adr[0].region=n.content}if(n.property=="vcard:postal-code"){h.adr[0]["postal-code"]=n.content}if(n.property=="vcard:country-name"){h.adr[0]["country-name"]=n.content}}}else{var n=f.item[e].type.item[m].type.meta;h.adr[0]=new ident.adr();if(n.property=="vcard:extended-address"){h.adr[0]["extended-address"][0]=n.content}if(n.property=="vcard:street-address"){h.adr[0]["street-address"][0]=n.content}if(n.property=="vcard:locality"){h.adr[0].locality=n.content}if(n.property=="vcard:region"){h.adr[0].region=n.content}if(n.property=="vcard:postal-code"){h.adr[0]["postal-code"]=n.content}if(n.property=="vcard:country-name"){h.adr[0]["country-name"]=n.content}}}}}}}else{if(f.item[e].type.item.rel=="vcard:url"){h.url[h.url.length++]=f.item[e].type.item.resource}}}}if(h.fn!=""){l[l.length]=h}}}}return l},parsehResumes:function(e,d,b,c){var a=new ident.hResume();a.domain=d;a.sourceUrl=c;if(e!=null){if(e.item!=null){if(e.item.type!=null){if(e.item.type.meta!=null){if(e.item.type.meta.property=="resume:summary"){if(e.item.type.meta.content!=undefined){a.summary=e.item.type.meta.content}}}}}}return a},parseXFN:function(e,d,b,c){for(var a=0;a<=e.item.length-1;a++){var f=new Object();f.domain=d;f.sourceUrl=c;f.name=b;if(e.item[a].rel=="xfn:me"){f.link=e.item[a].item.resource;ident.mes[ident.mes.length]=f;ident.xfn[ident.xfn.length]=f;ident.appendDeclaredProfileUrl(f.link);ident.appendDomainNode("",f.link,false,"");ident.appendAllProfileUrls(f.link)}}ident.postProcessDomainNode()},parseObjectsToString:function(a,b){if(ident.isObject(a)){for(prop in a){if(typeof a[prop]=="string"){if(prop=="content"){b+=a[prop]}}if(ident.isObject(a[prop])){b=ident.yql.parseObjectsToString(a[prop],b)}}}return b}};ident.registerParser(ident.yql);