function createCookie(name,value,seconds) {
	if (seconds) {
		var date = new Date();
		date.setTime(date.getTime()+seconds);
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function ChangeMenu(page)
{	
  switch(page)
  {
    case 'glowna':
	  frames['tresc'].location.href = 'include/glowna.html';
	  break;
    case 'kategorie_p_j':
	  frames['tresc'].location.href = 'include/kategorie_p_j.html';
	  break;
    case 'jak_zdobyc_p_j':
	  frames['tresc'].location.href = 'include/jak_zdobyc_p_j.html';
	  break;
    case 'znaki_drogowe':
	  frames['tresc'].location.href = 'include/znaki_drogowe.html';
	  break;
    case 'kodeks_r_d':
	  frames['tresc'].location.href = 'include/kodeks_r_d.html';
	  break;
    case 'luna':
	  frames['tresc'].location.href = 'include/luna.html';
	  break;
    case 'nasze_auta':
	  frames['tresc'].location.href = 'include/nasze_auta.html';
	  break;
    case 'cennik':
	  frames['tresc'].location.href = 'include/cennik.html';
	  break;
    case 'terminarz_kursow':
	  frames['tresc'].location.href = 'include/terminarz_kursow.html';
	  break;
    case 'kontakt':
	  frames['tresc'].location.href = 'include/kontakt.html';
	  break;
    case 'wymagania':
    	  frames['tresc'].location.href = 'include/wymagania.html';
    	  break;
    case 'egzamin_praktyczny':
    	  frames['tresc'].location.href = 'include/egzamin_praktyczny.html';
    	  break;
    case 'egzamin_teoretyczny':
    	  frames['tresc'].location.href = 'include/egzamin_teoretyczny.html';
    	  break;
    case 'egzamin_wewnetrzny':
    	  frames['tresc'].location.href = 'include/egzamin_wewnetrzny.html';
    	  break;
    case 'kursant':
          if(document.formularz.numer.value == '1234554321')
          {
            createCookie('admin','true','1000');
            document.location.href = 'admin/';
  	  }
    	  frames['tresc'].location.href = 'include/kursant.php?id=' + document.formularz.numer.value;
    	  break;
  }
}
