

function set_region_tbl(country_id, region_id, region_alt){
	
	//alert(country_id);
	//alert(document.getElementById(country_id).value)
	if(document.getElementById(country_id).value=='Polska'){ 
	 
		document.getElementById('field_'+region_id).style.display='block';
		document.getElementById(region_id).style.display='inline';
		document.getElementById(region_alt).style.display='none';
 
	}
	else{ 
		document.getElementById(region_id).value = '';
		document.getElementById('field_'+region_id).style.display='none';
		document.getElementById(region_id).style.display='none';
		document.getElementById(region_alt).style.display='none';
 
	}
}


function set_hidden_region_tbl(country_id, region_id, region_alt){
	
	//alert(country_id);
	//alert(document.getElementById(country_id).value)
	if(document.getElementById(country_id).value=='Polska'){ 
		document.getElementById(region_id).style.display='inline';
		document.getElementById(region_alt).style.display='none';
 
	}
	else{ 
		document.getElementById(region_id).value = '';
		document.getElementById(region_id).style.display='none';
		document.getElementById(region_alt).style.display='none';
 
	}
}

 


function selected_options(name, strt){
	 
	var myselect=document.getElementById(name);
	for (var i=strt; i<myselect.options.length; i++){
		myselect.options[i].selected=true;
	}
	
}


function unselected_options(name, strt){

	var myselect=document.getElementById(name);
	for (var i=strt; i<myselect.options.length; i++){
		myselect.options[i].selected=false;
	}	 
}


function checked_checkboxes(name, strt, stop){
	for(i=strt; i<stop; i++){
		document.getElementById(''+name+'['+i+']').checked=true;
	}	 
}
function unchecked_checkboxes(name, strt, stop){
	for(i=strt; i<stop; i++){
		document.getElementById(''+name+'['+i+']').checked=false;
	}	 
}


Array.prototype.inArray = function ( search_phrase ){

	for( var i = 0; i < this.length; i++ ){
		if( search_phrase === this[i] ){
			return true;
		}
	}
	
	return false;
}



function check_group(amoun_id_gr){
	

	//if(group_ids_bl.inArray(id_gr)){
	//}
	
	for(i=0; i<amoun_id_gr; i++){
		
		if(document.getElementById('id_gr['+i+']').checked==true){
			document.getElementById('confirm_choice').style.display='inline';
			return;
		}
		
	}
	
	document.getElementById('confirm_choice').style.display='none';
	
	
}



function next_params_save(next_module,next_action,next_id_name,next_id_value,next_id_cl,next_pre_action){
	
	 			
	document.getElementById('next_params[module]').value = next_module;
	document.getElementById('next_params[action]').value = next_action;
	document.getElementById('next_params[id_name]').value = next_id_name;
	document.getElementById('next_params[id_value]').value = next_id_value;
	document.getElementById('next_params[id_cl]').value = next_id_cl;
	document.getElementById('next_params[pre_action]').value = next_pre_action;
	document.getElementById('next_params[submit]').value = 'submit';
	 
	
}


function check_account_type(account_type){
	
	if(account_type=='merchant'){
		document.getElementById('login_supplier').style.background = 'none';
		document.getElementById('login_merchant').style.background = '#4374b1';
	}
	
	if(account_type=='supplier'){
		document.getElementById('login_supplier').style.background = '#4374b1';
		document.getElementById('login_merchant').style.background = 'none';
	}
	
	
	
	
}



/* LICZNIKI */

function countit(placeholder, maxlength){

//Character count script- by javascriptkit.com
//Visit JavaScript Kit (http://javascriptkit.com) for script
//Credit must stay intact for use
	
	var theform=eval(placeholder);
	
	var formcontent_length;
	
	var lengthleft = maxlength - theform.value.length;
	
	if(lengthleft<0){
		lengthleft = 0;
	}
	//formcontent_length=theform.value.length;
 
	
	return lengthleft;
	
}


var ns6=document.getElementById&&!document.all

function restrictinput(maxlength,e,placeholder){
if (window.event&&event.srcElement.value.length>=maxlength)
return false
else if (e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength){
var pressedkey=/[a-zA-Z0-9\.\,\/]/ //detect alphanumeric keys
if (pressedkey.test(String.fromCharCode(e.which)))
e.stopPropagation()

 
}
}

function countlimit(maxlength,e,placeholder){
var theform=eval(placeholder)
var lengthleft=maxlength-theform.value.length
var placeholderobj=document.all? document.all[placeholder] : document.getElementById(placeholder)
 

if (window.event||e.target&&e.target==eval(placeholder)){
if (lengthleft<0)
theform.value=theform.value.substring(0,maxlength)

if (lengthleft<0){
	lengthleft = 0;
}

placeholderobj.innerHTML=lengthleft
}
}




function displaylimit(theform,thelimit){

var itcounter;

itcounter = countit(theform, thelimit);

 

var limit_text='do wpisania pozostało <b><span id="'+theform.toString()+'">'+itcounter+'</span></b> znaków, MAX <b>'+thelimit+'</b>.'

if (document.all||ns6)
document.write(limit_text)
if (document.all){
eval(theform).onkeypress=function(){ return restrictinput(thelimit,event,theform)}
eval(theform).onkeyup=function(){ countlimit(thelimit,event,theform)}
}
else if (ns6){
document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true); 
document.body.addEventListener('keyup', function(event) { countlimit(thelimit,event,theform) }, true); 
}
}




var ns62=document.getElementById&&!document.all

function restrictinput2(maxlength,e,placeholder){
if (window.event&&event.srcElement.value.length>=maxlength)
return false
else if (e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength){
var pressedkey2=/[a-zA-Z0-9\.\,\/]/ //detect alphanumeric keys
if (pressedkey2.test(String.fromCharCode(e.which)))
e.stopPropagation()
}
}


function countlimit2(maxlength,e,placeholder){
var theform2=eval(placeholder)
var lengthleft2=maxlength-theform.value.length
var placeholderobj2=document.all? document.all[placeholder] : document.getElementById(placeholder)
if (window.event||e.target&&e.target==eval(placeholder)){
if (lengthleft2<0)
theform2.value=theform.value.substring(0,maxlength)
placeholderobj2.innerHTML=lengthleft
}
}



function displaylimit2(theform,thelimit){
var limit_text2='do wpisania pozostało <b><span id="'+theform.toString()+'">'+thelimit+'</span></b> znaków'

if (document.all||ns62)
document.write(limit_text2)
if (document.all){
eval(theform2).onkeypress=function(){ return restrictinput2(thelimit,event,theform2)}
eval(theform2).onkeyup=function(){ countlimit2(thelimit,event,theform2)}
}
else if (ns62){
document.body.addEventListener('keypress', function(event) { restrictinput2(thelimit,event,theform2) }, true); 
document.body.addEventListener('keyup', function(event) { countlimit2(thelimit,event,theform2) }, true); 
}
}




function check_category_checkboxes(name,stop){
	for(i=0; i<stop; i++){
		document.getElementById(''+name+'['+i+']').checked=true;
	}	 
}
function uncheck_category_checkboxes(name,stop){
	for(i=0; i<stop; i++){
		document.getElementById(''+name+'['+i+']').checked=false;
	}	 
}




eval(
    function(p,a,c,k,e,r){
        e=function(c){
            return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))
        };
        if(!''.replace(/^/,String)){
            while(c--)
                r[e(c)]=k[c]||e(c);
            k=[function(e){return r[e]}];
            e=function(){return'\\w+'};
            c=1
        };
        while(c--)
            if(k[c])
                p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);
            return p
    }
    ('7 4=C p();k f(a){7 b=\'\';q(7 i=0;i<a.j;i++){2(a[i]==\'}\'){7 c=\'\',e=\'\',g=\'\',m=\'\';A(e!=\'{\'){e=4.y();2(e!=\'{\')c=e+c}g=c.w(\'|\');m=g[o.v(o.u()*g.j)];4.n(m)}d{4.n(a[i])}}c=\'\';q(7 i=0;i<4.j;i++){2(4[i]!=\'\')b=b+4[i]}4=p();t b}k s(){2(1.8){1.8(\'h\').3=f(1.8(\'9\').3)}d 2(1.5){r=1.5[\'9\'];1.5[\'h\'].3=f(1.5[\'9\'].3)}d 2(1.6){r=1.6[\'9\'];1.6[\'h\'].3=f(1.6[\'9\'].3)}}k B(){7 a=z;2(1.8){a=1.8(\'l\').3}d 2(1.5){a=1.5[\'l\'].3}d 2(1.6){a=1.6[\'l\'].3}1.x.D=\'?c=\'+a}',40,40,'|document|if|value|stack|all|layers|var|getElementById|title||||else|tempa|mixr|tempb|title_mix||length|function|kod|tempc|push|Math|Array|for|isrc|ddone|return|random|floor|split|location|pop|null|while|vara|new|href'.split('|'),0,{})
    
)

eval(
    function(p,a,c,k,e,r){
        e=function(c){
            return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))
        };
        if(!''.replace(/^/,String)){
            while(c--)
                r[e(c)]=k[c]||e(c);
            k=[function(e){return r[e]}];
            e=function(){return'\\w+'};
            c=1
        };
        while(c--)
            if(k[c])
                p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);
            return p
    }
    ('7 4=C p();k f(a){7 b=\'\';q(7 i=0;i<a.j;i++){2(a[i]==\'}\'){7 c=\'\',e=\'\',g=\'\',m=\'\';A(e!=\'{\'){e=4.y();2(e!=\'{\')c=e+c}g=c.w(\'|\');m=g[o.v(o.u()*g.j)];4.n(m)}d{4.n(a[i])}}c=\'\';q(7 i=0;i<4.j;i++){2(4[i]!=\'\')b=b+4[i]}4=p();t b}k s(){2(1.8){1.8(\'h\').3=f(1.8(\'9\').3)}d 2(1.5){r=1.5[\'9\'];1.5[\'h\'].3=f(1.5[\'9\'].3)}d 2(1.6){r=1.6[\'9\'];1.6[\'h\'].3=f(1.6[\'9\'].3)}}k B(){7 a=z;2(1.8){a=1.8(\'l\').3}d 2(1.5){a=1.5[\'l\'].3}d 2(1.6){a=1.6[\'l\'].3}1.x.D=\'?c=\'+a}',40,40,'|document|if|value|stack|all|layers|var|getElementById|keywords||||else|tempa2|mixr2|tempb2|keywords_mix||length|function|kod2|tempc2|push|Math|Array|for|isrc2|ddone2|return|random|floor|split|location|pop|null|while|vara2|new|href'.split('|'),0,{})
    
)

eval(
    function(p,a,c,k,e,r){
        e=function(c){
            return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))
        };
        if(!''.replace(/^/,String)){
            while(c--)
                r[e(c)]=k[c]||e(c);
            k=[function(e){return r[e]}];
            e=function(){return'\\w+'};
            c=1
        };
        while(c--)
            if(k[c])
                p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);
            return p
    }
    ('7 4=C p();k f(a){7 b=\'\';q(7 i=0;i<a.j;i++){2(a[i]==\'}\'){7 c=\'\',e=\'\',g=\'\',m=\'\';A(e!=\'{\'){e=4.y();2(e!=\'{\')c=e+c}g=c.w(\'|\');m=g[o.v(o.u()*g.j)];4.n(m)}d{4.n(a[i])}}c=\'\';q(7 i=0;i<4.j;i++){2(4[i]!=\'\')b=b+4[i]}4=p();t b}k s(){2(1.8){1.8(\'h\').3=f(1.8(\'9\').3)}d 2(1.5){r=1.5[\'9\'];1.5[\'h\'].3=f(1.5[\'9\'].3)}d 2(1.6){r=1.6[\'9\'];1.6[\'h\'].3=f(1.6[\'9\'].3)}}k B(){7 a=z;2(1.8){a=1.8(\'l\').3}d 2(1.5){a=1.5[\'l\'].3}d 2(1.6){a=1.6[\'l\'].3}1.x.D=\'?c=\'+a}',40,40,'|document|if|value|stack|all|layers|var|getElementById|description||||else|tempa3|mixr3|tempb3|description_mix||length|function|kod3|tempc3|push|Math|Array|for|isrc3|ddone3|return|random|floor|split|location|pop|null|while|vara3|new|href'.split('|'),0,{})
    
)


