function setvisibility(id, parent)
{
	if(id != null) {
		if(document.getElementById(id).style.display!='none')
			{
				document.getElementById(id).style.display='none';
				if(parent!=null)
				    parent.style.backgroundPosition='right 0px;';
		    }
	    else
		{
			document.getElementById(id).style.display='block';
			if(parent!=null)
				    parent.style.backgroundPosition='right -31px;';
		}
	}
}

function changeMainBg(cos)
{
	document.getElementById('main_page').style.backgroundColor = '#FCF9EF';
	document.getElementById('main_page').style.backgroundImage = "url('gfx/tlo_pod_domek.jpg')"
	document.getElementById('main_page').style.backgroundRepeat = "repeat-x";
	document.getElementById('main_page').style.backgroundPosition = "center 1px";
	
	document.getElementById('flash_mainpage').style.background = 'transparent none';
}

function changeSection(nr, count)
{
    for(var i=1; i<=count; i++)
    {
	if(i==nr)
	{
	    document.getElementById('sekcja_'+i).style.display='block';
	    document.getElementById('page_nr'+i).style.color='#e89a32';
	    document.getElementById('page_nr'+i).style.fontWeight='bold';
	}
	else
	{
	    document.getElementById('sekcja_'+i).style.display='none';
	    document.getElementById('page_nr'+i).style.color='#452e0f';
	    document.getElementById('page_nr'+i).style.fontWeight='normal';
	}
    }
}

function schetCookie(c_name,c_value,time) {
	var nasze_cookie = getCookie(c_name);
	if (nasze_cookie!=null && nasze_cookie!="") {
		alert("MAM CIASTKO!");
	}
}


function setCookie(c_name, c_value) {
	time = (2*1000*60*60);

	var waznosc=new Date();
	waznosc.setTime(waznosc.getTime()+time);
	document.cookie = c_name+"="+escape(c_value)+";expires="+waznosc.toGMTString();
}

function getCookie(c_name) {
	if (document.cookie.length>0) {
		c_start = document.cookie.indexOf(c_name + "=");
		if (c_start!=-1) {
			c_start = c_start + c_name.length+1; 
			c_end = document.cookie.indexOf(";", c_start);
			if (c_end == -1) c_end = document.cookie.length;

			return unescape(document.cookie.substring(c_start,c_end));
		}
		else
		    return null;
	}
	else {
		return null;
	}
	
}

//house

function callExternalInterface(fid,boolek) {
	thisMovie(fid).checkCookie(boolek);
}

function thisMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName]
	}
	else {
		return document[movieName]
	}
}




var old_class = '';
function classOfFaq(element) {
	old_class = element.className;
	if(old_class == 'active') {
		var new_class = 'hover active';
	}
	else {
		var new_class = 'hover';
	}
	element.className = new_class;
}

function classOfFaqOff(element) {
	element.className = old_class;
}

//advices

function showAdvices(){
	if($('#select1 :selected').val() != ''){
		window.location.replace("/porady.xml?topics_group="+$('#select1 :selected').val());
	}
	else{
		window.location.replace("/porady.xml");
	}
}

function showSingleAdvice(){
	
	if($('#select2 :selected').val() != ''){
		window.location.replace($('#select2 :selected').val());
	}
}

