function Caracteres(objeto,limite,erro,Div)
{
    tamanho = objeto.value.length;
    if (tamanho>limite)
    {
      objeto.value = objeto.value.substring(0,limite);
      document.getElementById(Div).innerHTML = erro;
    }
    else
    {
      document.getElementById(Div).innerHTML = (limite-objeto.value.length);
    }
}

function flash(file, width, height,param)
{
    document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='" + width + "' height='" + height + "'>");
    document.write("<param name='movie' value='" + file + "'/>");
    document.write("<param name='allowFullScreen' value='true'/>");
    document.write("<param name='quality' value='high'/>");
    document.write("<PARAM NAME=FlashVars VALUE='id="+param+"'/>");
    document.write("<embed src='" + file + "' allowFullScreen='true' FlashVars='id="+param+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" + width + "' height='" + height + "'></embed>");
    document.write("</object>");
}

function flashText(file, width, height,param)
{
    document.write("<input type=Text class=\"text\" value=\"<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='" + width + "' height='" + height + "'>");
    document.write("<param name='movie' value='" + file + "'/>");
    document.write("<param name='allowFullScreen' value='true'/>");
    document.write("<param name='quality' value='high'/>");
    document.write("<PARAM NAME=FlashVars VALUE='id="+param+"'/>");
    document.write("<embed src='" + file + "' allowFullScreen='true' FlashVars='id="+param+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" + width + "' height='" + height + "'></embed>");
    document.write("</object>\">");
}

function totalStars(StarPath$,StarPath2$,StarName$,NumeroAtual$,Total$)
{

	var Count$ = 0;

	while(Count$ <= Total$)
	{
		if((Count$ - 1) < NumeroAtual$)
		{
			$(StarName$+Count$).src = StarPath$;
		}
		else
		{
			$(StarName$+Count$).src = StarPath2$;
		}
		
		Count$++;
	}
}

function ShowDiv(Div$)
{

	$(Div$).style.display = 'block';
}

function HideDiv(Div$)
{
	$(Div$).style.display = 'none';
}

function totalStarsRestore(StarPath$,StarPath2$,StarName$,NumeroAtual$,Total$)
{

	var Count$ = 0;

	while(Count$ < Total$)
	{
		if(Count$ < NumeroAtual$)
		{
			$(StarName$+Count$).src = StarPath$;
		}
		else
		{
			$(StarName$+Count$).src = StarPath2$;
		}
		
		Count$++;
	}
}

function apagaComentario(Id$)
{
	carregaAjaxPost("http://wolfnime.com/ajax/Comentario/Apagar/","ComentariosDiv"+Id$,Id$);
}
function openAjax()
{
  var Ajax;
  try
  {
    Ajax = new XMLHttpRequest(); // XMLHttpRequest para browsers mais populares, como: Firefox, Safari, dentre outros.
  }
  catch(ee)
  {
    try
    {
      Ajax = new ActiveXObject("Msxml2.XMLHTTP"); // Para o IE da MS
    }
    catch(e)
    {
      try
      {
        Ajax = new ActiveXObject("Microsoft.XMLHTTP"); // Para o IE da MS
      }
      catch(e) {Ajax = false;}
    }
  }
return Ajax;
}

function carregaAjax4(url,Div)
{
  if(document.getElementById)
  { // Para os browsers complacentes com o DOM W3C.
    //var exibeResultado = document.getElementById(Div); // div que exibir  o resultado.
	if(Div != '')
	{
	  var exibeResultado = document.getElementById(Div); // div que exibir  o resultado.
	}
    var Ajax = openAjax(); // Inicia o Ajax.
    Ajax.open("GET", url, true); // fazendo a requisi  o
    Ajax.onreadystatechange = function()
    {
       //if(Ajax.readyState == 1)
       //{ // Quando estiver carregando, exibe: carregando...
       //  exibeResultado.innerHTML = "<div align=center><strong>Carregando...</strong></div>";
       //}
       if(Ajax.readyState == 4)
       { // Quando estiver tudo pronto.
          if(Ajax.status == 200)
          {
             var resultado = Ajax.responseText; // Coloca o retornado pelo Ajax nessa vari vel
             resultado = resultado.replace(/\+/g," "); // Resolve o problema dos acentos (saiba mais aqui: http://www.plugsites.net/leandro/?p=4)
             resultado = unescape(resultado); // Resolve o problema dos acentos
			 if(Div != '')
			 {
			    if(resultado != '')
				{
			      exibeResultado.innerHTML = resultado;
				}
				else
				{
			      exibeResultado.innerHTML = '';
				}
				//var exibeResultado = document.getElementById(Div); // div que exibir  o resultado.
			 }
          }
          else
          {
             alert("Erro: No ajax - ");
          }
       }
    }
    Ajax.send(null); // submete
  }
}

function $(Elemento)
{

  if( document.getElementById ) // this is the way the standards work
  {
    return  document.getElementById( Elemento );
  }
  else if( document.all ) // this is the way old msie versions work
  {
    return document.all[Elemento];
  }
  else if( document.layers ) // this is the way nn4 works
  {
    return document.layers[Elemento];
  }
  //return document.getElementById(Elemento);
}

function Redireciona($Pagina)
{
	location.href = $Pagina;
}

function pontuaAnime(Parametros,Div)
{
   ajax('ajax/Anime/Pontuar',Div,Parametros);
}

function ajax(site,Div,valor)
{
  var url = "http://wolfnime.com/"+site+"/"+valor+"/";
  
  carregaAjax4(url,Div);
}

function carregaAjaxPost(url,Div,variavel)
{
  if(document.getElementById)
  { // Para os browsers complacentes com o DOM W3C.
    var exibeResultado = document.getElementById(Div); // div que exibir  o resultado.
    var Ajax = openAjax(); // Inicia o Ajax.
    Ajax.open("POST", url, true);
    Ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
    Ajax.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
    Ajax.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
    Ajax.setRequestHeader("Pragma", "no-cache");
    Ajax.send('Comentario='+variavel);
    Ajax.onreadystatechange = function()
    {
       if(Ajax.readyState == 1)
       { // Quando estiver carregando, exibe: carregando...
         exibeResultado.innerHTML = "<div align=center><strong>Carregando...</strong></div>";
       }
       if(Ajax.readyState == 4)
       { // Quando estiver tudo pronto.
          if(Ajax.status == 200)
          {
             var resultado = Ajax.responseText; // Coloca o retornado pelo Ajax nessa vari vel
             resultado = resultado.replace(/\+/g," "); // Resolve o problema dos acentos (saiba mais aqui: http://www.plugsites.net/leandro/?p=4)
             resultado = unescape(resultado); // Resolve o problema dos acentos
			 if(resultado.length > 0)
			 {
               exibeResultado.innerHTML = resultado;
			 }
			 else
			 {
               exibeResultado.innerHTML = '';
			 }
          }
          else
          {
             exibeResultado.innerHTML = "Erro: No ajax.";
          }
       }
    }
    Ajax.send(null); // submete
  }
}

//function Caracteres(a,c,d,f){tamanho=a.value.length;if(tamanho>c){a.value=a.value.substring(0,c);document.getElementById(f).innerHTML=d}else{document.getElementById(f).innerHTML=(c-a.value.length)}};function flash(a,c,d,f){document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='"+c+"' height='"+d+"'>");document.write("<param name='movie' value='"+a+"'/>");document.write("<param name='allowFullScreen' value='true'/>");document.write("<param name='quality' value='high'/>");document.write("<PARAM NAME=FlashVars VALUE='id="+f+"'/>");document.write("<embed src='"+a+"' allowFullScreen='true' FlashVars='id="+f+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+c+"' height='"+d+"'></embed>");document.write("</object>")}function flashText(a,c,d,f){document.write("<input type=Text class=\"text\" value=\"<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='"+c+"' height='"+d+"'>");document.write("<param name='movie' value='"+a+"'/>");document.write("<param name='allowFullScreen' value='true'/>");document.write("<param name='quality' value='high'/>");document.write("<PARAM NAME=FlashVars VALUE='id="+f+"'/>");document.write("<embed src='"+a+"' allowFullScreen='true' FlashVars='id="+f+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+c+"' height='"+d+"'></embed>");document.write("</object>\">")}function totalStars(a,c,d,f,g){var b=0;while(b<=g){if((b-1)<f){$(d+b).src=a}else{$(d+b).src=c}b++}}function ShowDiv(a){$(a).style.display='block'}function HideDiv(a){$(a).style.display='none'}function totalStarsRestore(a,c,d,f,g){var b=0;while(b<=g){if(b<f){$(d+b).src=a}else{$(d+b).src=c}b++}}function apagaComentario(a){carregaAjaxPost("http://localhost/ajax/Comentario/Apagar/","ComentariosDiv"+a,a)}function openAjax(){var a;try{a=new XMLHttpRequest()}catch(ee){try{a=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{a=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){a=false}}}return a}function carregaAjax4(c,d){if(document.getElementById){if(d!=''){var f=document.getElementById(d)}var g=openAjax();g.open("GET",c,true);g.onreadystatechange=function(){if(g.readyState==4){if(g.status==200){var a=g.responseText;a=a.replace(/\+/g," ");a=unescape(a);if(d!=''){if(a!=''){f.innerHTML=a}else{f.innerHTML=''}}}else{alert("Erro: No ajax.")}}};g.send(null)}}function $(a){if(document.getElementById){return document.getElementById(a)}else if(document.all){return document.all[a]}else if(document.layers){return document.layers[a]}}function Redireciona(a){location.href=a}function pontuaAnime(a,c){ajax('ajax/Anime/Pontuar',c,a)}function ajax(a,c,d){var f="http://localhost/"+a+"/"+d+"/";carregaAjax4(f,c)}function carregaAjaxPost(c,d,f){if(document.getElementById){var g=document.getElementById(d);var b=openAjax();b.open("POST",c,true);b.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");b.setRequestHeader("Cache-Control","no-store, no-cache, must-revalidate");b.setRequestHeader("Cache-Control","post-check=0, pre-check=0");b.setRequestHeader("Pragma","no-cache");b.send('Comentario='+f);b.onreadystatechange=function(){if(b.readyState==1){g.innerHTML="<div align=center><strong>Carregando...</strong></div>"}if(b.readyState==4){if(b.status==200){var a=b.responseText;a=a.replace(/\+/g," ");a=unescape(a);if(a.length>0){g.innerHTML=a}else{g.innerHTML=''}}else{g.innerHTML="Erro: No ajax."}}};b.send(null)}}