
/*
 * Video API para UOL Mais
 * Copyright (c) 2008 UOL
 * 
 * 1.0.18
 * Unpacked version at /uolmais/versoes/video-basic-api.1.0.18.js
 * Unpacked version at /uolmais/versoes/video-default-markup.1.0.18.js
 * 
 */

var MARKUP=MARKUP||{};MARKUP.tags=function(){var G=jQuery;var E="";var B=false;for(var D=0;D<this.length;D++){var A=this[D];var F=false;if(list_tags!=null){for(var C=0;C<list_tags.length;C++){if(A.id==list_tags[C]){F=true}}}if(F){continue}E+=(B)?", ":"";B=true;E+='<a href="'+MARKUP.getLink("tag",A.id+"|"+A.description)+'">'+A.description+"</a>"}return E};MARKUP.dateString=function(A){if(A.constructor==Date){return A.getYear()+"/"+A.getMonth()+"/"+A.getDate()+" "+A.getHours()+"h"+A.getMinutes()}else{return A.replace(/.*([0-9]{4})-([0-9]{2})-([0-9]{2}).+([0-9]{2}):([0-9]{2}):([0-9]{2}).*/,"$3/$2/$1 $4h$5")}};MARKUP.paging=function(){var D='<div class="media-nav clearfix">		<ul class="clearfix">';if(jQuery("#videoInfo").size()<1){D+='<li class="viewMode"><a href="#lista" class="switchToList">Ver em lista</a> <a href="#galeria" class="switchToGalery">Ver em galeria</a></li>'}D+='<li class="paging">';D+="Páginas: ";var B=(this.currentPage-4<1)?1:this.currentPage-4;var A=(this.currentPage+4>this.totalPages)?this.totalPages:this.currentPage+4;for(var C=B;C<=A;C++){if(C==this.currentPage){D+='<span class="current">'+C+"</span> "}else{D+='<a href="'+MARKUP.getLink("page",C)+'">'+C+"</a> "}}D+='			</li>			<li class="nextprev">';if(this.previousPage==null){D+='<span class="prevdisabled">anterior</span> | '}else{D+='<a class="prevenabled" href="'+MARKUP.getLink("page",this.previousPage)+'">anterior</a> | '}if(this.nextPage==null){D+='<span class="nextdisabled">próxima</span>'}else{D+='<a class="nextenabled" href="'+MARKUP.getLink("page",this.nextPage)+'">próxima</a>'}D+="			</li>		</ul>	</div>";return D};MARKUP.getLink=function(A,B){if(A>=1){B=A;A="page"}var C=unescape(document.location.href.toString());if(C.replace(/\?.*/,"")!=medialistURL){C=medialistURL}C=(C.match(/\?/))?C:C+"?";switch(A){case"page":if(_GET("currentPage")){C=C.replace(/currentPage=[0-9]+/,"currentPage="+B)}else{C=C+"&amp;currentPage="+B}break;case"tab":C=C.replace(/&*currentPage=[0-9]+/gm,"");if(_GET("sort")){C=C.replace(/sort=[^&]+/,"sort="+B)}else{C=C+"&amp;sort="+B}break;case"tag":C=C.replace(/(&*currentPage=[0-9]+|&*q=[^&]+)/gm,"");B=B.split("|");if(_GET("tagId")){C=C.replace(/tagId=[^&]+/,"tagId="+B[0])}else{C=C+"&amp;tagId="+B[0]}if(_GET("tagName")){C=C.replace(/tagName=[^&]+/,"tagName="+B[1])}else{C=C+"&amp;tagName="+B[1]}break;case"search":C=C.replace(/(currentPage=[0-9]+|tagId=[^&]+|tagName=[^&]+)/gm,"");if(_GET("q")){C=C.replace(/q=[^&]+/,"currentPage="+B)}else{C=C+"&amp;q="+B}break}C=C.replace("?&amp;","?");return C};MARKUP.mediaLink=function(D){var B=parseDate(D.publishedAt);var C=window.firstDate||new Date(0);if(lastDate<B||C>=B||(CODPROFILE!=="conteudoUOL"&&D.codProfile!==CODPROFILE)){var A=medialistURL.replace(/\/[^\/]*$/,"/")+"assistir.jhtm?media="+D.id}else{var A=upsiBaseURL.replace(/\/[^\/]*$/,"/");A+=D.publishedAt.toString().replace(/([0-9]{4})-([0-9]{2})-([0-9]{2}).*/,"$1/$2/$3/");A+=D.id.replace(/.*-/g,"")+".jhtm?"+D.id}return A};MARKUP.listTitle=function(){var B="Nenhum vídeo foi encontrado.";if(_GET("q")){var A='A busca <strong>"'+_GET("q")+'"</strong> '+((this.totalItems==0)?"não":"")+" teve<strong> "+((this.totalItems>0)?this.totalItems:"")+"</strong> resultado"+((this.totalItems!=1)?"s":"")+"."}else{if(_GET("tagName")){var A="<strong>"+((this.totalItems>0)?this.totalItems:"Nenhum")+"</strong> vídeo"+((this.totalItems>1)?"s":"")+" com a tag <strong>"+_GET("tagName")+"</strong>."}else{var A="<strong>"+((this.totalItems>0)?this.totalItems:"Nenhum")+"</strong> vídeo"+((this.totalItems>1)?"s":"")+" publicado"+((this.totalItems>1)?"s":"")+"."}}return A};MARKUP.messageNoResult=function(){return"Nenhum resultado foi encontrado para a sua busca."};MARKUP.defaultMediaItem=function(C){var E=jQuery;var D="",B=MARKUP.mediaLink(this),A="";if(C==1){if(E(MARKUP.mediaListLoopSelector).is(".skip_one")){return D}A='class="first"'}D+="<tr "+A+'>		<td class="imagem"><a href="'+B+'" target="_top"><img src="'+this.thumbnail+'-medium.jpg" /></a></td>		<td class="descricao">			<dl>				<dt class="title"><a href="'+B+'" target="_top"><strong>'+this.title+"</strong> ("+this.duration+')</a></dt>				<dd class="description">'+this.description+'</dd>				<dd class="tags"><strong>Tags:</strong> ';D+=MARKUP.tags.apply(this.tags);D+='				</dd>			</dl>		</td>		<td class="props">			<dl>';D+=(this.publishedAt&&this.publishedAt!="9999-01-01 00:00:00")?'<dd class="date"><strong>Publicação:</strong> <span class="mediaDate">'+MARKUP.dateString(this.publishedAt)+"</span></dd>":"";D+=(this.rating!=null)?'<dd class="rating">Avaliação: <img  class="rateimg" src="http://cr.i.uol.com.br/uolmais/small-'+((Math.round(this.rating*2)/2)).toString().replace(".","")+'.gif" alt="Nota: '+this.rating+'" title="Nota: '+this.rating+'" /></dd>':"";D+=(this.views!=null)?'<dd class="views">Visitas: <strong>'+this.views+"</strong></dd>":"";D+=(this.favorites!=null)?'<dd class="views">Favoritos: <strong>'+this.favorites+"</strong></dd>":"";D+=(this.comments!=null)?'<dd class="comments">Comentários: <strong>'+this.comments+"</strong></dd>":"";D+="			</dl>		</td>	</tr>";return D};MARKUP.resumedMediaItem=function(B){var D=jQuery;var A=MARKUP.mediaLink(this);isFirst=(B==1)?'class="first"':"";var C="<tr "+isFirst+'>		<td class="imagem"><a href="'+A+'" target="_top"><img src="'+this.thumbnail+'-medium.jpg" /></a></td>		<td class="descricao">			<dl>				<dd class="date"><span class="mediaDate">'+MARKUP.dateString(this.publishedAt)+'</span></dd>				<dt class="title"><a href="'+A+'" target="_top"><strong>'+this.title+"</strong> ("+this.duration+')</a></dt>				<dd class="description">'+this.description+"</dd>			</dl>		</td>	</tr>";return C};MARKUP.galeryMediaItem=function(B){var D=jQuery;var C=((B-1)%3==0&&B!=1)?"<hr />":"",A=MARKUP.mediaLink(this);if(B==1&&D(MARKUP.mediaListLoopSelector).is(".skip_one")){return C}C+='		<dl class="item">			<dd class="imagem"><a href="'+A+'" target="_top"><img src="'+this.thumbnail+'-large.jpg" /></a></dd>			<dt class="title"><a href="'+A+'" target="_top"><strong>'+this.title+"</strong> ("+this.duration+')</a></dt>			<dd class="props">				<dl>';C+=(this.publishedAt&&this.publishedAt!="9999-01-01 00:00:00")?'<dd class="date"><strong>Publicação:</strong> <span class="mediaDate">'+this.publishedAt.toString().replace(/([0-9]{4})-([0-9]{2})-([0-9]{2}).*/,"$3/$2/$1")+"</span></dd>":"";C+=(this.rating!=null)?'<dd class="rating">Avaliação: <img  class="rateimg" src="http://cr.i.uol.com.br/uolmais/small-'+((Math.round(this.rating*2)/2)).toString().replace(".","")+'.gif" alt="Nota: '+this.rating+'" title="Nota: '+this.rating+'" /></dd>':"";C+=(this.views!=null)?'<dd class="views">Visitas: <strong>'+this.views+"</strong></dd>":"";C+=(this.favorites!=null)?'<dd class="views">Favoritos: <strong>'+this.favorites+"</strong></dd>":"";C+=(this.comments!=null)?'<dd class="comments">Comentários: <strong>'+this.comments+"</strong></dd>":"";C+="				</dl>			</dd>		</dl>";return C};MARKUP.media=function(){var B=this.storage+"/embed.swf?mediaId="+this.mediaId+"&amp;p=canaluol&amp;path="+this.filePath+"&amp;id="+this.fileID+"&amp;host="+this.storage+"&amp;start_loading=true&amp;start_paused=false&amp;show_related=false&amp;embed=false&amp;";var A="";if(jQuery.browser.msie){A+='<object width="100%" height="100%" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,15,0"><param name="movie" value="'+B+'"></param><param name="allowfullscreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param name="wmode" value="transparent"></param><param name="bgcolor" value="#000000"></param><param name="quality" value="autolow"></param></object>'}else{A+='<embed width="100%" bgcolor="#000000" allowscriptaccess="always" height="100%" allowfullscreen="true" wmode="transparent" quality="autolow" src="'+B+'" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>'}return A};MARKUP.comment=function(B){var A=(B==1)?'class="first"':"";var C="	<dl "+A+'>		<dt><a href="'+this.authorPage+'">'+this.author+'</a></dt>		<dd class="text">'+this.description+'</dd>		<dd class="date">'+this.publishedAt.replace(/([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})/i,"$3/$2/$1, $4:$5h")+"</dd>	</dl>	";return C};MARKUP.mediaStats=function(){var A='	<ul>		<li class="rating">Nota: <img  class="rateimg" src="http://ec.i.uol.com.br/uolmais/small-'+((Math.round(this.rating*2)/2)).toString().replace(".","")+'.gif" alt="Nota: '+this.rating+'" title="Nota: '+this.rating+'" /></li>		<li class="rate"><span>Dê sua nota:</span><span id="votePlace"></span></li>		<li class="audience">Visitas: <strong>'+this.views+'</strong></li>		<li class="favorites">Favoritos: <strong>'+this.favorites+'</strong></li>		<li class="comments">Comentários: <strong>'+this.comments+"</strong></li>	</ul>	";return A};MARKUP.mediaInfo=function(){var B=jQuery;var C=this.player+"?path="+this.filePath+"&amp;amp;id="+this.fileID+"&amp;amp;host="+this.storage+"&amp;amp;mediaId="+this.id;var A="		<p>"+this.description+'</p>		<dl class="tags">			<dt>Tags:</dt>			<dd>';A+=MARKUP.tags.apply(this.tags);A+='			</dd>		</dl>		<dl class="tocopy">			<dt>URL:</dt>			<dd><input type="text" name="url_field" value="'+document.location.href+'" /></dd>		</dl>		<dl class="tocopy">			<dt>Código:</dt>			<dd><input type="text" name="embed_field" value="&lt;object width=&quot;100%&quot; height=&quot;368&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;'+C+"&quot; /&gt;&lt;param name=&quot;wmode&quot; value=&quot;window&quot; /&gt;&lt;embed width=&quot;100%&quot; height=&quot;368&quot; wmode=&quot;window&quot; src=&quot;"+C+'&quot; type=&quot;application/x-shockwave-flash&quot;/&gt;&lt;/object&gt;"/></dd>		</dl>	';return A};
