![lloron](http://static.forosdelweb.com/fdwtheme/images/smilies/chillando.png)
![Afirmando](http://static.forosdelweb.com/fdwtheme/images/smilies/afirmar.gif)
<script type="text/javascript">
var earnings = <?php echo $row_Usuarios['earnings']; ?>;
var currentUrl = null;
var urls = new Array();
var adids = new Array();
var timer = 49;
var currentWindow;
$(document).ready(function()
{
$("#viewad").button({ icons: { primary: "ui-icon-play" } }).hide();
$('#earnings').html('$'+roundNumber(earnings,6));
$('#earnings').hide();
$('#start-surfing').bind('click', function()
{
$("#dialog-message").dialog({
modal: true,
width: 700,
title: 'Surf Ads',
resizable: false,
draggable: false
});
$("#viewad").show();
});
$("#viewad").bind('click',function() {
$('#earnings').show();
$("#viewad").hide();
// we have to open it here on the click event to protect against b10ck3r in ch0r0me...
currentWindow = window.open('youtube_auto_credit.php?start=y&sid=& sid2=&siduid=0', 'videoad', ',type=fullWindow,fullscreen,scrollbars=yes', false);
window.blur();
window.focus();
nextUrl();
});
});
function isWindowClosed()
{
if (!currentWindow || typeof currentWindow == 'undefined' || currentWindow && currentWindow.closed)
{
return true;
}
else
{
return false;
}
}
function roundNumber(num, dec) {
var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
return result;
}
function increaseEarnings()
{
earnings = earnings + 1;
$('#earnings').html('$'+roundNumber(earnings,6));
}
Object.size = function(obj) {
var size = 0, key;
for (key in obj) {
if (obj.hasOwnProperty(key)) size++;
}
return size;
};
function nextUrl()
{
$.get("youtube_auto_credit.php" + '?next=go&sid=&sid2=&siduid=0',function(data){
timer = Math.round(data.timer/10);
$('#timer').html(timer);
if(data.status == 'MAX_CLICKS')
{
doneSurfing();
}
else if(data.status == 'TOO_FAST')
{
alert('You are surfing too fast!');
}
else if(data.status == 'LOGIN')
{
alert('You are not logged in');
}
else
{
//alert(data.url);
//if(typeof data.url=='undefined')
//{
//alert('Sorry, the server is having issues, please try again later by refreshing this page.');
//}
//else
//{
if(isWindowClosed())
{
currentWindow = window.open(data.url, 'videoad', ',type=fullWindow,fullscreen,scrollbars=yes', false);
window.blur();
window.focus();
}
else
{
currentWindow.location = data.url;
increaseEarnings();
}
setTimeout(function() { progresscount(timer) }, 1000);
//}
}
},'json');
}
function doneSurfing()
{
url = 'youtube_auto_credit.php?done=y&sid=&sid2=&siduid= 0';
currentWindow.location = url;
}
function progresscount(time)
{
if(time == 0)
{
if(isWindowClosed() == true)
{
$("#dialog-message").dialog('close');
}
else
{
nextUrl();
}
}
else
{
time--;
$('#timer').html(time);
setTimeout(function() { progresscount(time) }, 1000);
}
}
</script>
<script type="text/javascript">