function gallery(url){
	var parameter="top=50,left=50,toolbar=no,scrollbars=yes,status=no,resizable=yes,width=300,height=300";
	okno=window.open(url,"gallery",parameter);
}

function regJazdec(checkb){
	if(checkb.checked){
		document.getElementById('regform').style.visibility = 'visible';
		document.getElementById('regform').style.display = 'block';
	}
	else {
		document.getElementById('regform').style.visibility = 'hidden';
		document.getElementById('regform').style.display = 'none';
	}
}
function regJazdecCheck(){
	regJazdec(document.getElementById('regj'))
}

function createCookie(name,value,days) {
        if (days) {
                var date = new Date();
                date.setTime(date.getTime()+(days*24*60*60*1000));
                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 Get_Cookie( name ) {

var start = document.cookie.indexOf( name + "=" );
var len = start + name.length + 1;
if ( ( !start ) &&
( name != document.cookie.substring( 0, name.length ) ) )
{
return null;
}
if ( start == -1 ) return null;
var end = document.cookie.indexOf( ";", len );
if ( end == -1 ) end = document.cookie.length;
return unescape( document.cookie.substring( len, end ) );
}


function eraseCookie(name) {
        createCookie(name,"",-1);
}

function showBanner(pos,ban){
        var seen = readCookie('bp' + pos);
        if(seen) seen = seen + '~' + ban;
        else seen = ban;
        createCookie('bp' + pos,seen,1);
}
function resetBanner(pos){
        eraseCookie('bp' + pos);
}

var ajaxRequest = "/app/vote.php";
var poll;

function vote(node){
	var numId = node.id.replace(/[^0-9]/g, '');
	var parentDiv = node.parentNode.parentNode.parentNode.id;
	var params = "?" + numId + "/";
	poll = new sack();
	poll.requestFile = ajaxRequest + params;
	poll.onCompletion = function() { showVote(numId,parentDiv) };	// Specify function that will be executed after file has been found
	poll.runAJAX();	// Execute AJAX function
}

function showVote(id,parentDiv){
	document.getElementById(parentDiv).innerHTML = poll.response;
}



var ScreenCSS_1 = '<?php echo home ?>styles/page1.css';
var ScreenCSS_2 = '<?php echo home ?>styles/page2.css';

var expDays = 9999;  // How many days to remember the setting
var standardStyle = '2'; // This is the number of your standard style sheet; this will be used when the user did not do anything.
var nameOfCookie = 'switchstyle'; // This is the name of the cookie that is used.

/***********************************************************************************************

	DO NOT CHANGE ANYTHING UNDER THIS LINE, UNLESS YOU KNOW WHAT YOU ARE DOING

***********************************************************************************************/

// This is the main function that does all the work
function switchStyleOfUser(){
	var fontSize = GetCookie(nameOfCookie);
	if (fontSize == null) {
		fontSize = standardStyle;
	}

	var fontSize = "";
	return fontSize;
}

var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

// Function to get the settings of the user
function getCookieVal (offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
	endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

// Function to get the settings of the user
function GetCookie (name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
		return getCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
	}
	return null;
}

// Function to remember the settings
function SetCookie (name, value) {
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = name + "=" + escape (value) +
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
	((path == null) ? "" : ("; path=" + path)) +
	((domain == null) ? "" : ("; domain=" + domain)) +
	((secure == true) ? "; secure" : "");
}

// Function to remove the settings
function DeleteCookie (name) {
	var exp = new Date();
	exp.setTime (exp.getTime() - 1);
	var cval = GetCookie (name);
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

// This function is used when the user gives his selection
function doRefresh(){
	location.reload();
}

// This will call the main function.  Do not remove this, because otherwise this script will do nothing...



document.write(switchStyleOfUser());
