function strSeparator(nr, sep, coIle){
if(!arguments.length){
		return; 
	} else {
		sep = (sep.length<1) ? ".":sep;
		coIle = (coIle<2) ? 3:(coIle>=nr.length) ? 3:coIle;
		var counter=0;
		var output="";
	}
	for(var i=nr.length; i>=0; i--){
		output = nr.charAt(i)+output;
		if(counter%coIle==0 && counter!=0){
			if(nr.charAt(i-1)) output=""+sep+output
		}
		counter++;
	}
return output;
}

function testEmail2(ident){
    var wzor=/^[.0-9a-zA-Z_-]+(@|\(at\))+[.0-9a-zA-Z_-]+\.[a-z]{2,3}$/i;
    if(!wzor.test(ident.value)) ident.value='';
}
function testkom(numer)
{
    var isGSM = false;    
    var tel=numer.replace(/[^0-9]/g,"");    
    if(tel=='') return '';
    tel = (tel.length==9) ? "0"+tel:tel;
    if(tel.length==10 )  isGSM = true;
    //jesli to komorka to zwroc i nie parsuj dalej
    if(isGSM) return "0"+strSeparator(tel.substr(1, tel.length), "-", 3);       
    else return '';
    return tel;
}
function testPhone(ident){ ident.value=testkom(ident.value); }
function useStyle(ident,style)
    {
    if (ident == '') return '';
    //if (_get(ident) != undefined)
	{
	_get(ident).setAttribute('class',style);    
	_get(ident).setAttribute('className',style);
	}
    }

function setStyle(str,styl){
    str=str.replace(/[)(+ !]/g,',');
    str=str.replace(/[,]{1,}/g,',');
    str=str.replace(/(^[, ])|([, ]$)/g,'');    
    var t=str.split(',');
    for(var i=0 ;i<t.length ;i++){
	if(_get(t[i])!=null) useStyle(t[i],styl);
	if(_get(t[i]+'_sel')!=null) useStyle(t[i]+'_sel',styl);	
    }	
    return str;	
}



function send()
{
	document.opinia.submit();
	return true;
	var problem=_get('typ');
	problem=(problem!=null)? problem.value:'';
	var str='';
	if(problem=='') str='typ';
	str='+tresc+(email,telefon)';
    setStyle(str,'');
    var wynik=Tart(str);
    alert(wynik);
    setStyle(wynik,'error_sel');
    if(wynik!='') alert('Proszę wypełnić '+wynik+'')
    else document.opinia.submit();
    return true;
}


function changeTyp(ident){
	_get('prenum').style.display=(ident.value==5)? '':'none';
}
 