function SelectSubCat(co1, co2)
{
	//obj.style.color='gray';	
	obj = document.getElementById(co1);
	obj2 = document.getElementById(co2);
	pos = obj.innerHTML.search("»");
	cate = obj.innerHTML.substr(pos+2);	
	obj.style.fontWeight = 'bold';
	obj2.style.fontWeight = 'bold';
	obj.innerHTML = "&nbsp; »"+cate;
	
}

function UnSelectSubCat(co1, co2)
{
	obj = document.getElementById(co1);
	obj2 = document.getElementById(co2);
	pos = obj.innerHTML.search("»");
	cate = obj.innerHTML.substr(pos+1);	
	obj.style.fontWeight = 'normal';
	obj2.style.fontWeight = 'normal';
	obj.innerHTML = "» "+cate;
	
}




function SelectCategoryGroup(co)
{
	
	co.style.color='gray';
	co.innerHTML = "&nbsp;"+co.innerHTML;	
}

function UnSelectCategoryGroup(co)
{
	co.style.color='black';
	co.innerHTML = co.innerHTML.substr(6);	
	
}




function SendNewProposition(form)
{
	//alert(id);   
	var xmlHttpReq = false;
    var self = this;

	if ((form.new_grupa.value != "") && (form.new_kategoria.value!=""))
	{
		x= "new_grupa=" + encodeURI(form.new_grupa.value)
			+"&new_kategoria=" + encodeURI(form.new_kategoria.value);	

		form.new_grupa.value="";
		form.new_kategoria.value="";

		if (window.XMLHttpRequest) {
	        self.xmlHttpReq = new XMLHttpRequest();
	    }
	    // IE
	    else if (window.ActiveXObject) {
	        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
	    }
	    
	    self.xmlHttpReq.open('POST', "/inc/newproposition.inc.php", true);
	    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	    self.xmlHttpReq.onreadystatechange = function() {
	        if (self.xmlHttpReq.readyState == 4) {	        	
				document.getElementById("advert").innerHTML =  self.xmlHttpReq.responseText;
				scroll(0,0);
	        }
	    }     
		
		self.xmlHttpReq.send(x);
		
	}
}

function SaveToNewsletter(form)
{	
	if (form.nl_email.value == "")
	{
		alert('Wprowadź email!');
	}
	else	
	if(form.nl_regulamin.checked==false)
	{
		alert('Zaakceptuj regulamin');
	}
	else
	{
		window.location='/newsletter,'
		+encodeURI(form.nl_email.value);
	}
}

