naw=navigator.appName;
naw2=navigator.userAgent;
naw3=navigator.platform

opera=false;
safari=false;
chrome=false;
mozilla=false;
explorer=false;
explorer7=false;
explorer8=false;
explorer6=false;
explorer5=false;
explorer55=false;
konqueror=false;

windows=false
mac=false
linux=false

if (naw2.indexOf("Safari")!=-1&&naw2.indexOf("Chrome")==-1) {safari=true;}
if (naw2.indexOf("Chrome")==-1) {chrome=true;}
if (naw2.indexOf("Konqueror")!=-1) {konqueror=true;}
if (naw.indexOf("Netscape")!=-1) {mozilla=true;}
if (naw.indexOf("Explorer")!=-1 && naw2.indexOf("Opera")==-1) {
    explorer=true;
	if (naw2.indexOf("MSIE 5.0")!=-1) explorer5=true;
	if (naw2.indexOf("MSIE 5.5")!=-1) explorer55=true;
	if (naw2.indexOf("MSIE 6.0")!=-1) explorer6=true;
	if (naw2.indexOf("MSIE 7.0")!=-1) explorer7=true;
	if (naw2.indexOf("MSIE 8.0")!=-1) explorer8=true;
}

if (naw2.indexOf("Opera")!=-1) {opera=true;}

if (naw3.indexOf("Win")!=-1) {windows=true;}
if (naw3.indexOf("Mac")!=-1) {mac=true;}
if (naw3.indexOf("Linux")!=-1) {linux=true;}

if (mac) {
	document.writeln('<style type=text/css>\n');
	document.writeln('.age_category {height: 38px;overflow: hidden;}\n');
	document.writeln('.age_category ul {}\n');
	document.writeln('.age_category ul li {}\n');
	document.writeln('.age_category ul li a {margin-left: 3px !important;margin-right: 5px !important;}\n');
	document.writeln('.age_category ul li.right a {margin-left: 4px !important;margin-right: 2px !important;}\n');
	document.writeln('.age_category ul li span.small {}\n');
	document.writeln('\n<:/style>');
}

function checkBoxOrRadioButtonBox(idOfTheCheckBox, boxType, formElementToChange, arrayToDisabled, arrayElements) {

if (formElementToChange) this.formElementToChange=formElementToChange; else this.formElementToChange=false;
this.checkOrRadioItems=new Array();
document.getElementById(idOfTheCheckBox).checkRadioItems=this.checkOrRadioItems;
document.getElementById(idOfTheCheckBox).formElementToChange=this.formElementToChange;

if (boxType||boxType==1) {
	checkOrRadioContainer=document.getElementById(idOfTheCheckBox).getElementsByTagName("span");

	for (i=0;i<checkOrRadioContainer.length;i++) {
		if (checkOrRadioContainer[i].parentNode.className=="radioButtonOn") {
			this.checkOrRadioItems[i]=true;
			this.formElementToChange.value=i;
		} else this.checkOrRadioItems[i]=false;
		checkOrRadioContainer[i].onclick=function (e) {
			if (e) {obj=e.target;} else {obj=event.srcElement;}
			divsToBeCleared=obj.parentNode.parentNode.getElementsByTagName('span')
			for (i2=0;i2<divsToBeCleared.length;i2++) {
				divsToBeCleared[i2].parentNode.numberInOrder=i2;
				divsToBeCleared[i2].parentNode.className="";
				divsToBeCleared[i2].parentNode.parentNode.checkRadioItems[i2]=false;
			}		
			
			obj.parentNode.className="radioButtonOn";
			obj.parentNode.parentNode.checkRadioItems[obj.parentNode.numberInOrder]=true;										
			obj.parentNode.parentNode.formElementToChange.value=obj.parentNode.numberInOrder
			
			if(window.executionAfterRadioChange) {
				executionAfterRadioChange();
			}
			
		}
	}
} else {

	checkOrRadioContainer=document.getElementById(idOfTheCheckBox).getElementsByTagName("span")
	
	
	for (i=0;i<checkOrRadioContainer.length;i++) {
		if (checkOrRadioContainer[i].parentNode.className=="checkBoxOn") this.checkOrRadioItems[i]=true; else this.checkOrRadioItems[i]=false;
		checkOrRadioContainer[i].parentNode.numberInOrder=i;
		checkOrRadioContainer[i].onclick=function (e) {
			if (e) {obj=e.target;} else {obj=event.srcElement;}
			if (obj.parentNode.className=="checkBoxOn") {
				obj.parentNode.className="";
				obj.parentNode.parentNode.checkRadioItems[obj.parentNode.numberInOrder]=false;
			} else {
				obj.parentNode.className="checkBoxOn";
				obj.parentNode.parentNode.checkRadioItems[obj.parentNode.numberInOrder]=true;
			}
			obj.parentNode.parentNode.formElementToChange.value="";
			for (i=0;i<obj.parentNode.parentNode.checkRadioItems.length;i++) {
					if (obj.parentNode.parentNode.formElementToChange.value.length>0) {przecinek=":"} else {przecinek="";}
					if (obj.parentNode.parentNode.checkRadioItems[i]==true) obj.parentNode.parentNode.formElementToChange.value+=przecinek+i;
			}
			if(arrayElements && arrayToDisabled){
			    showHide(arrayToDisabled, arrayElements);
			}
		}
	}

	// poczatkowa wartosc hiddena
	this.formElementToChange.value="";
	for (i=0;i<this.checkOrRadioItems.length;i++) {
		if (this.formElementToChange.value.length>0) {przecinek=":"} else {przecinek="";}
			if (this.checkOrRadioItems[i]==true) this.formElementToChange.value+=przecinek+i;
		}
	
	}
	
}
				
function showHide(arrayToDisabled, arrayElements){
    for(var j = 0; j < arrayToDisabled.length; j++)
        $('#'+arrayToDisabled[j]).toggleClass('grey');	
        			    
    for(var j = 0; j < arrayElements.length; j++){
        if($('#'+arrayElements[j]).is(":disabled")) {
            $('#'+arrayElements[j]).removeAttr('disabled');
        } else {
            $('#'+arrayElements[j]).attr('disabled', 'disabled');
        }
       //$('#'+arrayElements[j]).val());
    }
}
				
function sendForm(direction){
    var siteVal=($('#site').val());
    $('#direction').val(direction);
 
    $('#registerForm').submit();
}





function show(id) {
	 obj = document.getElementById(id);
	 obj.style.display='';
}

function hide(id) {	
 obj = document.getElementById(id);
 obj.style.display='none';
}

function hs(id) {
if(document.getElementById(id).style.display=='none')
 { show(id); }
else
 { hide(id); }
}