//--------------------------------------------------------------------
function SetCookie( sName, sValue ,monthsExpiry)
{
    if ( sName.length < 1 )
        return;

    if ( sValue.length >0)
    {
        var expDate = new Date();		// Date() retorna avui
        expDate.setMonth( expDate.getMonth()+monthsExpiry );

        document.cookie = ""+ sName + "=" + sValue + "; " + "expires=" + expDate.toGMTString();
    }
    else
    {
        //  this will cause the named cookie to be deleted.
        document.cookie = sName + "=";
    }
}
//--------------------------------------------------------------------
function GetCookie(sName)
{
    var sValue = "";
    var index = 0;

    if( document.cookie )
        index = document.cookie.indexOf( sName + "=" );
    else
        index = -1;

    if ( index >= 0 ){
        var countbegin = (document.cookie.indexOf( "=", index ) + 1);
        if (countbegin >0)
        {
            var countend = document.cookie.indexOf( ";", countbegin );
            if ( countend < 0 )
                countend = document.cookie.length;
            sValue = document.cookie.substring( countbegin, countend );
        }
        else
        {
            sValue = "";
        }
    }
    return sValue;
}
//----------------
function wr(q){

document.write(q);

}
//----------------
function ShowBns(){

if (reged){
	wr('<table class="bonus" width="540"><tr><td>');
	wr('<form action="https://www.paypal.com/cgi-bin/webscr" method="post" >');
	wr('All images copyright &copy; Juan Trujillo Tarradas<br>');
	wr('If you want to give a bonus to the author of the program and these photos/puzzles:<br>');
	wr('<input type="hidden" name="cmd" value="_xclick">');
	wr('<input type="hidden" name="business" value="sales@brainsbreaker.com">');
	wr('<input type="hidden" name="item_name" value="Bonus to the author of BrainsBreaker jigsaws">');
	wr('<input type="hidden" name="item_number" value="BBBONUS">');
	wr('<input type="hidden" name="no_shipping" value="1">');
	wr('<input type="hidden" name="no_note" value="1">');
	wr('<input type="hidden" name="currency_code" value="USD">');
	wr('<input type="hidden" name="tax" value="0">');
	wr('<input type="hidden" name="bn" value="PP-DonationsBF">');
	wr('<input type="image" src="pplbonus.gif" border="0" name="submit" alt="Make payments with PayPal - it\'s fast, free and secure!">');
//	wr('<input type="submit" value="Bonus for Juan" name="submit" >');
	wr('<br>It\'s greatly appreciated!');
	wr('<br><\/form><\/td><\/tr><\/table>');
}
}

