function loadAdvice( intAdviceId )
{
    advAJAX.get
    (
        {
            url: "?module=Process&action=GetAdvice",
            parameters:
            {
                "intAdviceId": intAdviceId
            },
            onSuccess: function( obj )
            {
                document.getElementById( 'content' ).innerHTML = obj.responseText;
            },
            onError: function( obj )
            {
                document.getElementById( 'content' ).innerHTML = 'Wystąpił błąd.';
            }
        }
    );
};

function check_adv(ilosc, id)
{
	var counter=0;
	
	for(var i=0; i<ilosc; i++)
	{
		if(document.getElementById(id+i).style.display=="block")
		{
			counter++;	
		}
	}
	
	if(counter==ilosc)
	{
		document.getElementById('print_send').style.display="block";
		writeCookie(id, "1");
		
	}
}
function sprawdzPorady(){
	//zapamiętywanie porad
	if(readCookie("adv")=="1" && document.getElementById('adv0'))
	{
		for(var a=0; a<5; a++)
		{
			if(document.getElementById('adv'+ a))
			document.getElementById('adv'+ a).style.display="block";
		}
		
		document.getElementById('print_send').style.display="block";
	}
	else if(readCookie("trob")=="1" && document.getElementById('trob0'))
	{
		for(b=0; b<3; b++)
		{
			if(document.getElementById('trob'+ b))
			document.getElementById('trob'+ b).style.display="block";
		}
		document.getElementById('print_send').style.display="block";
	}
	else if(readCookie("sol")=="1")
	{
		if(document.getElementById('sol0'))
		{
		document.getElementById('sol0').style.display="block";
		document.getElementById('print_send').style.display="block";
		}
	}
}

//Cookie
// Example:
// alert( readCookie("myCookie") );
function readCookie(name)
{
  var cookieValue = "";
  var search = name + "=";

  if(document.cookie.length > 0)
  { 
    offset = document.cookie.indexOf(search);
    if (offset != -1)
    { 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  return cookieValue;
}

// Example:
// writeCookie("myCookie", "my name", 24);
// Stores the string "my name" in the cookie "myCookie" which expires after 24 hours.
function writeCookie(name, value, hours)
{
  var expire = "";

  if(hours != null)
  {
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire;
}



function SprawdzFormularz1(f) {

    if (document.getElementById("imie1").value =='') {
    alert('Nie podałeś/aś swojego imienia.');
    return false;
    }

    if ( ((document.getElementById("email1").value.indexOf('@',1))==-1)||(document.getElementById("email1").value.indexOf('.',1))==-1 ) {
    alert('Podałeś/aś  błędny adres e-mail');
    return false;
    }

    if (document.getElementById("priv1").checked == false ) {
    alert('Musisz zgodzić się z Polityka Prywatności.');
    return false;
    } 

    else {
    return true;
    }
    }
function SprawdzFormularz2(f) {

    if (document.getElementById("imie2").value =='') {
    alert('Nie podałeś/aś swojego imienia.');
    return false;
    }

    if ( ((document.getElementById("email2").value.indexOf('@',1))==-1)||(document.getElementById("email2").value.indexOf('.',1))==-1 ) {
    alert('Podałeś/aś  błędny adres e-mail');
    return false;
    }

    if (document.getElementById("priv2").checked == false ) {
    alert('Musisz zgodzić się z Polityka Prywatności.');
    return false;
    } 

    else {
    return true;
    }
    }

function SprawdzFormularz3(f) {

    if ( ((document.getElementById("mail_input").value.indexOf('@',1))==-1)||(document.getElementById("mail_input").value.indexOf('.',1))==-1 ) {
    alert('Podałeś/aś  błędny adres e-mail');
    return false;
    }

    if (document.getElementById("priv3").checked == false ) {
    alert('Musisz zgodzić się z Polityka Prywatności.');
    return false;
    } 

    else {
    return true;
    }
    }
		
function stat(e)
	{
		if(e=='horoskop')
		{
			document.writeln('<'+'scr'+'ipt type="text/javascript" src="http://s1.hit.stat24.com/_'+(new Date()).getTime()+'/script.js?id=nSc7y7_f1AEYZ1mrdZCnrJR7DtxiGme7mNkGCw2zGhL.J7/l=11"></'+'scr'+'ipt>');
		}
		if(e=='galeria')
		{
			document.writeln('<'+'scr'+'ipt type="text/javascript" src="http://s1.hit.stat24.com/_'+(new Date()).getTime()+'/script.js?id=px2b6ze55AHtQklXkDmXjoYg.GMFrkwy6ZtjdbH9Lar.F7/l=11"></'+'scr'+'ipt>');
		}
		if(e=='etarot')
		{
			document.writeln('<'+'scr'+'ipt type="text/javascript" src="http://s1.hit.stat24.com/_'+(new Date()).getTime()+'/script.js?id=B8M7yydu1AFX7Vlpr1iv9bQY.GMyzUwyONxjdTUDBbH.S7/l=11"></'+'scr'+'ipt>');
		}
		
	}
