$.extend({URLEncode:function(c){var o='';var x=0;c=c.toString();var r=/(^[a-zA-Z0-9_.]*)/;
  while(x<c.length){var m=r.exec(c.substr(x));
    if(m!=null && m.length>1 && m[1]!=''){o+=m[1];x+=m[1].length;
    }else{if(c[x]==' ')o+='+';else{var d=c.charCodeAt(x);var h=d.toString(16);
    o+='%'+(h.length<2?'0':'')+h.toUpperCase();}x++;}}return o;},
URLDecode:function(s){var o=s;var binVal,t;var r=/(%[^%]{2})/;
  while((m=r.exec(o))!=null && m.length>1 && m[1]!=''){b=parseInt(m[1].substr(1),16);
  t=String.fromCharCode(b);o=o.replace(m[1],t);}return o;}
});


function foooterOnBottomPosition(){
//	var window = $(document).height();
//	var body   = $('body').height();
//	var main   = $('#main').height(); 
//	
//	if(window >body){
//		var margin = window - body-10;
//		//alert(margin+" win:"+window+" body:"+body)
//		$('#footer').css('margin-top',margin+'px');
//		//$('#footer').css('border','red 1px solid');
//		//$('#footer').css('margin-bottom','-2px;');
//	}
}



function showBlockMenu(el){
	if($(el).children('span').html()=='+')
		$(el).children('span').html("-");
	else
		$(el).children('span').html("+");
		
		
		
	if ($(el).parent('div').children('ul').css('display') == 'none') {
		$(el).parent('div').children('ul').show("slow");
		$.cookie($(el).parent('div').attr('class'), 't');
	}else {
		$(el).parent('div').children('ul').hide("slow");
		$.cookie($(el).parent('div').attr('class'), null);

	}
}
function setBlockMenu(){
	var cookies = document.cookie.split(';');
	for (var i=0; i<cookies.length; i++) {
		
		var z = cookies[i].split('=');
		if(z[1]=='t'){
			
			$('.'+z[0]).children('ul').show();
			$('.'+z[0]).children('h3').children('span').html("-");
		}
	};

}
function runEffect(el1, el2){
    if (el1 != null) {//puff
        $(el1).hide("blind", {
                direction: "right"
        }, 500);
        $(el2).show("blind", {direction: "right"}, 500);
    }
};

var indexSdide = 0;
var tabSlide = 0;
var scrollpartnersIs = false;
function setScrolToPartners(){

$('div.pasek-partnerow').mousewheel(function(event,delta){
                        scrollpartnersIs = true;
                        var media = $('div.pasek-partnerow table');
                        if (delta > 0) {
                                var step = 72;

                                if((parseInt(media.css('margin-left')))<=0){
                                     //   $('#search').val("zzz "+parseInt(media.css('margin-left')));
                                        media.css('margin-left', parseInt(media.css('margin-left'))+step);
                                }
                        } else {
                                var step = 72;
                                if(!(($('div.pasek-partnerow table').width()-800)<Math.abs(parseInt(media.css('margin-left'))))){
                                        //$('#search').val("aaa "+($('div.pasek-partnerow table').width())+"   "+ parseInt(media.css('margin-left')));
                                        media.css('margin-left', parseInt(media.css('margin-left'))-step);
                                }
                        }
            }, null, true);

}
var scrollPartnersFront =true;
function nextSlidePartner(){

        if (tabSlide.length > 0) {
                if(indexSdide>0)
                 $(tabSlide[indexSdide-1]).parent().hide();
             
                if (indexSdide + 8 < tabSlide.length) {
                        $(tabSlide[indexSdide+11 ]).parent().show();
                        runEffect(tabSlide[indexSdide], tabSlide[indexSdide+11 ]);
                        indexSdide++;
                } else {
                        indexSdide = 0;
                        $('div.pasek-partnerow img').hide();
                        for(x=0;x<11;x++){
                           $(tabSlide[x]).show();
                           $(tabSlide[x]).parent().show();
                        }
                }
                setTimeout('nextSlidePartner()', 2000);
        }
}


function partnersLogos(){
       tabSlide = $('div.pasek-partnerow img');
     
        if(tabSlide.length>8)
            setTimeout('nextSlidePartner()', 2000);
}
function sizeUpPartner(){
     
var options = {from: {width: 117},to: {width: 138}};
var options2 = {to: {width: 117}};


 $("div.partner-item img").mouseenter(function(){
    
     if($(this).css('z-index')!='100'){
        $(this).css('z-index', '100');

	$(this).animate({
                    opacity: 0.4
                  }, 300 );
     }
    }).mouseleave(function(){
        if($(this).css('z-index')=='100'){
            $(this).css('z-index', '0');
            $(this).animate({
                    opacity: 1
                  }, 300 );
        }
    });   
}

var widhPartner = null;
var widhPartnerAll =0;

function moweElPartner(){

        if(scrollPartnersFront)
            setScrolToPartners();
        scrollPartnersFront = false;
    widhPartner = $('div.pasek-partnerow table td').width();
    var x =  $('div.pasek-partnerow table').css('margin-left');
     if(typeof(x)!='string')
            return;

    var z =  x.replace('px', '');
    var y = parseInt(z);

    widhPartnerAll = y - widhPartner;
    if(!scrollpartnersIs)
        partnerMove();
    scrollpartnersIs = false;
 
 setTimeout('moweElPartner()', 5000);
 //$('#search').val(($('div.pasek-partnerow table').width()+widhPartnerAll));
  if(($('div.pasek-partnerow table').width()+widhPartnerAll -800)<=0){
        $('div.pasek-partnerow table').css('margin-left', '0px');
        widhPartnerAll = 0;
  }
}

function partnerMove(){
        var x =  $('div.pasek-partnerow table').css('margin-left');
       
        if(x=='auto'){
            $('div.pasek-partnerow table').css('margin-left', '0px');
            x = '0px';
        }
        var z =  x.replace('px', '');
        var y = parseInt(z);
 
        $('div.pasek-partnerow table').css('margin-left', (y-1)+'px');
        //$('#search').val((widhPartnerAll)+" "+y);
        if((widhPartnerAll-3)<y){
            setTimeout('partnerMove()', 5);
        }
}

var indexSdide4 = -1;
var tabSlide4 = $('div.temporary-offer img');

	function runEffect4(el1, el2){
			if (el1 != null) {//puff
				$(el1).hide("drop", {
					direction: "left"
				}, 500);

			}

			setTimeout(function(){
				$(el2).show("drop", {direction: "right"}, 500);
				}, 500);
	};
	function nextSlidePartner4(){

		if (tabSlide4.length > 0) {
			if (indexSdide4 == -1) {
				runEffect4(null, tabSlide4[0])
				indexSdide4 = 0;
			}
			else {
				if (indexSdide4 + 1 < tabSlide4.length) {
					runEffect4(tabSlide4[indexSdide4], tabSlide4[indexSdide4 + 1])
					indexSdide4++;
				}
				else {
					runEffect4(tabSlide4[indexSdide4], tabSlide4[0])
					indexSdide4 = 0;
				}

			}
			setTimeout('nextSlidePartner4()', 5000);
		}
	}


function sendMessageToOffice(val){

	var tab = $("#contact-form input, textarea, select");
	var email =/[^1-9][a-zA-Z_1-9\-]+@[^1-9][a-zA-Z_1-9\-]+\.[\-a-zA-Z_1-9\.]+/;
	var phone = /\+*([0-9]+|\(\s*[0-9]+\s*\))(\s*\-\s*[0-9]+|\s*[0-9]+|\(\s*[0-9]+\s*\))+/;
	var zip = /[0-9]{2,3}\s*\-*\s*[0-9]{3,3}/;
	var text = /[^<>]+/;
	var return1 = true;
	$("#contact-form input, textarea, select").css('border','1px solid #B1B2B2');
	$("input.formsubmit").css('border','none');
	for(i=0;i<tab.length;i++){
		
		if(tab[i].name=='email'){
			if(!tab[i].value.match(email)){
				tab[i].style.border = "red 2px solid";
				return1 = false;
			}
		}else
		if(tab[i].name=='title'){
				if(!tab[i].value.match(text)){
					tab[i].style.border = "red 2px solid";
					return1 = false;
				}
                }else
		if(tab[i].name=='name'){
				if(!tab[i].value.match(text)){
					tab[i].style.border = "red 2px solid";
					return1 = false;
				}
		}else
                if(tab[i].name=='surname'){
				if(!tab[i].value.match(text)){
					tab[i].style.border = "red 2px solid";
					return1 = false;
				}
		}else
		if(tab[i].name=='zip'){
			if(!tab[i].value.match(zip)&&tab[i].value!=''&&tab[i].value!=null){
				tab[i].style.border = "red 2px solid";
				return1 = false;
			}
		}else
		if(tab[i].name=='phone'&&tab[i].value!=''&&tab[i].value!=null){
			if(!tab[i].value.match(phone)){
				tab[i].style.border = "red 2px solid";
				return1 = false;
			}
		}else
		if(tab[i].name=='content'){
			if(tab[i].value==''||tab[i].value==null){
				tab[i].style.border = "red 2px solid";
				return1 = false;
			}
		}else
                 if(val==1&&tab[i].name=='kom'){
                     if(!tab[i].value.match(phone)){
				tab[i].style.border = "red 2px solid";
				return1 = false;
			}
                 }else
		if(val==1&&tab[i].name=='phone'){
			if(!tab[i].value.match(phone)){
				tab[i].style.border = "red 2px solid";
				return1 = false;
			}
		}

	}

	if(return1){
               
		$("#contact-form").submit();
	}
	return return1;
}






function ie7(){
   $('img#rodzina').css('top','-490px');
   $('div#gwiazdka').css('top', '-92px');
   $('#gwiazdka_1').css('top', '-90px');

    //$('div#gwiazdka').css('top','12px');
   $('#solid-club-program-partnerski').css('top', '-133px');
   $('div#menu').css('top','-48px');
   $('div.e-faktura ').css('top','-39px');
   $('div.register').css('top','-31px');
   $('div#under-menu').css('margin-top','-23px');
   $('div#login-in').css('top', '-15px');
   $('#partner-in').css('top', '-51px');
   $('#client-in').css('top', '-87px');
   $('div#main').css({width:'885px'});
   $('.flash-replaced div').hide();
    //alert("ie 7")
}






var menuRight = false;

var stop = false;
var el2, step2 = 0;
var widObject = 0;
var menuSlideRun = false;
var marginName = 'margin-left';
var x = 1;
var menuLodad = null;
//var xxx =0 ;
function menuSetShow(){
   
  //  $('div.unser-menu-inside').text(xxx+" "+menuRight);
  // xxx++;
   
    if(menuRight){
         menuLodad.unsetMenuSart();
         setTimeout('menuSetShow()', 5000);
    }else
       $('div.menu-rigth').hide('slow');
   
    menuRight = false;
  
}

function move5(){
            menuSlideRun = true;
            var margin = parseInt($(el2).css(marginName).replace('px', ''));
            if((widObject+90)>Math.abs(margin+step2)&&(margin+step2)<80){
                $(el2).css(marginName, (margin+step2)+'px');
                //$("#cos input").val( (margin+step2)+"   "+stop+"  "+x+" "+step2);
            }

            //$('#search').val(marginName+" "+margin+"  step "+step2);
            x++;
            if(!stop)
                setTimeout("move5();", 2);
            else
                menuSlideRun = false;
        }

function setMenuMove(menu, moveEl, link, tabTd ){
       var setSizeEl  = false;
        if($.browser.msie){
                $(moveEl).css('margin-left', '0px');
                $(moveEl).css('left', '0px');
        }
       function move1(el, step ){
            el2 = el;
            step2 =step;
            stop = false;
            if(widObject == 0){
                widObject = $(el2).width()-720;
                $(el2).css('width', widObject+'px');
            }

            if($.browser.msie&& marginName != 'left'){
                
                if(!(parseInt($.browser.version)==7))
                    $(el).css('position','relative');
               
                if((parseInt($.browser.version)==7))
                    marginName = 'margin-left';//'left';
                else
                    marginName = 'left';              
                widObject = $(el2).width()-720;
            }
            var margin = parseInt($(el).css(marginName).replace('px', ''));
            if((widObject+90)>=Math.abs(margin+step2)&&(margin+step2)<80)
                $(el).css(marginName, (margin+step)+'px');

            if(!stop){
                 setTimeout("move5()", 2);
            }
       }

       function setResizeMenu(el, el1, el0){             
             menuRight = true;
             $(el).css('font-size','21px');
             $(el).css('width',  ($(el).children('a').width()+4)+'px');
             $(el).parent('td').css('vertical-align','top');
             if(typeof(el0)!='undefined'){
               $(el0).css('font-size','16px' );
               $(el0).css('width',  ($(el0).children('a').width()+4)+'px');
               $(el0).parent('td').css('vertical-align','middle');
             }
             if(typeof(el1)!='undefined'){
               $(el1).css('font-size','16px' );
               $(el1).css('width',  ($(el1).children('a').width()+4)+'px');
               $(el1).parent('td').css('vertical-align','middle');
             }
        }

       this.unsetMenuSart = function(){
           menuRight = true;
           if(!setSizeEl){
                unsetMenu(link, tabTd);
                setSizeEl = true;
           }
       }

        function unsetMenu(link, tabTd){
              menuRight = true;
              $(link).css('font-size','11px');
              $(tabTd).css('vertical-align','bottom');
              var nextTab =  $(link);
               for(i=0;i<nextTab.length;i++){
                   $(nextTab[i]).css('width', ($(nextTab[i]).children('a').width()+2)+'px');
               }
               if(widObject<($(el2).width()-720))
                widObject = $(el2).width()-720;
        }

       var tabMenu = $(link);
       $(link).css('font-size', '11px');

       $(tabTd).css('height','50px');
       $(tabTd).css('vertical-align','bottom');
       for(i=0;i<tabMenu.length;i++){
           $(tabMenu[i]).attr('id', 'menuMack'+i);
           $(tabMenu[i]).css('width', ($(tabMenu[i]).children('a').width()+2)+'px');
       }



    $(menu).mousewheel(function(event,delta){
            scrollpartnersIs = true;
            var media = $(moveEl);
            if($.browser.msie&& marginName != 'left'){

                if(!(parseInt($.browser.version)==7))
                    $(el).css('position','relative');

                if((parseInt($.browser.version)==7))
                    marginName = 'margin-left';//'left';
                else
                    marginName = 'left';
                widObject = $(el2).width()-720;
            }
            if (delta > 0) {
                    var step = 32;

                    if((parseInt(media.css(marginName)))<=0){
                            //$('#search').val("zzz "+parseInt(media.css('margin-left')));
                            media.css(marginName, parseInt(media.css('margin-left'))+step);
                    }
            } else {
                    var step = 32;
                    if(!($(media).parent('div').width()+30<Math.abs(parseInt(media.css(marginName))))){
                            //$('#search').val($(media).parent('div').width());
                            media.css(marginName, parseInt(media.css('margin-left'))-step);
                    }
            }
    }, null, true);

    $(menu).mousemove(
    function(e){
       var width = $(document).width();
       var tt =  width - $(menu).width();
       tt = tt/2;
       var move = e.pageX-tt;
    //  $('#search').val(($(menu).width() + move)+"   "+($(menu).width() - move));
       menuRight = true;
       if(($(menu).width()+move)<853&&($(menu).width() + move)>=800){
            unsetMenu(link,tabTd);
           if($.browser.msie){
               if(($(menu).width() + move)<=810)
                   step2 = 10;
               else if(($(menu).width() + move)>810&&($(menu).width() + move)<=820)
                   step2 = 5;
               else if(($(menu).width() + move)>820&&($(menu).width() + move)<830)
                   step2 = 3;
               else if(($(menu).width() + move)>=830)
                   step2 = 1;
               else
                   step2 = 1;
              // $('#search').val();
               move1($(moveEl), step2 )
           }else{
               if(($(menu).width() + move)<=810)
                   step2 = 10;
               else if(($(menu).width() + move)>810&&($(menu).width() + move)<=820)
                   step2 = 5;
               else if(($(menu).width() + move)>820&&($(menu).width() + move)<830)
                   step2 = 3;
               else if(($(menu).width() + move)>=830)
                   step2 = 1;
               else
                   step2 = 1;

               if(!menuSlideRun){
                    stop = true;
                    move1($(moveEl), step2 );
               }
           }
       }else if(($(menu).width() - move) < 52){
            unsetMenu(link,tabTd);
           if($.browser.msie){
               if(($(menu).width() - move)>=34)
                   step2 = -1;
               else if(($(menu).width() - move)<20&&($(menu).width() - move)>=35)
                   step2 = -3;
               else if(($(menu).width() - move)<10&&($(menu).width() - move)>=20)
                   step2 = -5;
               else if(($(menu).width() - move)>=10)
                   step2 = -10;
               else
                   step2 = -1;
               move1($(moveEl), step2 )
           }else{
               if(($(menu).width() - move)>=34)
                   step2 = -1;
               else if(($(menu).width() - move)<20&&($(menu).width() - move)>=35)
                   step2 = -3;
               else if(($(menu).width() - move)<10&&($(menu).width() - move)>=20)
                   step2 = -5;
               else if(($(menu).width() - move)<10)
                   step2 = -10;
               else
                   step2 = -1;
               if(!menuSlideRun){
                    stop = true;
                    move1($(moveEl), step2 );
               }
           }
       }else{
            
           stop = true;
           
           var $target = $(e.target);
           var el =  null;
           var el0 = null;
           var el1 = null;

           //a, td
           
           if($target.is('td')){
                $target = $(e.target).children('div');
           }
           if($target.is('a')){
               $target = $(e.target).parent('div');
 
           }

           
           if($target.is('div')){

             if($($target[0]).css('font-size')!='21px'){
                unsetMenu(link,tabTd);
               
             }

              var id1 =   parseInt($($target[0]).attr('id').replace('menuMack', ''));
              if(id1>=0){
                  el =  $($target[0]);
                  el0 = null;
                  el1 = null;

                  if(id1>0)
                    el0 = '#menuMack'+(id1-1);

                  if(typeof($('#menuMack'+(id1+1)))!='undefined')
                    el1 ='#menuMack'+(id1+1);
                setResizeMenu(el, el1, el0);
              }
           }
       }
    });
     $(menu).bind("mouseleave",function(){
            stop = true;
             unsetMenu(link,tabTd);
            menuRight = true;
        });

        return this;
}
var nextPartner = 0;
var maxPartner = 5;
 function nextPartner111(){
        if(maxPartner>nextPartner){
           var ccc = 'div.showPartner'+nextPartner;
           var ccc2 = 'div.showPartner'+(nextPartner+1);
           if(typeof($(ccc))!='undefind'){
               $(ccc).hide();
               $(ccc2).show();
                nextPartner++;
           }
          
        }
    }
   function setPartnerShow(val){
       for(i=0;i<=maxPartner;i++){
           var ccc = 'div.showPartner'+i;
           $(ccc).hide();
       }
       var ccc2 = 'div.showPartner'+(val);
       $(ccc2).show();
        nextPartner = val;
   }


    function privusPartner111(){
        if(nextPartner > 0){
             var ccc = 'div.showPartner'+nextPartner;
               var ccc2 = 'div.showPartner'+(nextPartner-1);
            if(typeof($(ccc))!='undefind'){
              
               $(ccc).hide();
               $(ccc2).show();
               nextPartner--;
            }
        }
    }
function setPartnerPage(){
    var path = location.pathname.split('/');

    if(path[path.length-2]=='page'&&parseInt(path[path.length-1])>=0){
        
        var z =0;
        while(nextPartner<parseInt(path[path.length-1])){
            nextPartner111();
            $( ".slider-re1" ).slider('value', nextPartner);
            if(z == 100){
                //nextPartner =1;
                break;
            }
            z++;
        }
    }
}
function menuRightIe7(){
     if(typeof($('#solid-news'))!='undefined'){
        var ssss = $('#solid-news').html()
        $('#solid-news').remove();
        $('#solid-current-content').append(ssss)
     }
     if($('#solid-current-content').html()==null&&typeof($('.partners-all'))!='undefined'){
        $('#solid-current-content').remove();
        $('.partners-all').attr('id','solid-current-content');
     }
                //partners-all
     var el = "#solid-current-content";
                  //  partners-all

     $(".slider-re").slider({
            orientation: "vertical",
            range: "max",
            min: 0,
            max: $(el).height(),
            value: $(el).height(),
            slide: function( event, ui ) {
                    ui.value -=$(el).height()-20;
                    $(el).css("margin-top", "" + ui.value + "px");
            }
    });

    $('#main-left-content-id').css({overflow: 'hidden',height:'404px'});
    //$(el).css('position','relative');
    $('#main-left-content-id').mousewheel(function(event,delta){

        var media = $(this).find('#solid-current-content');
        if (delta > 0) {
                var step = 40;
                if(parseInt(media.css('margin-top'))>-40)
                        step = parseInt(media.css('margin-top'));
                //$('#search').val("while "+(parseInt(media.css('top'))+step)+"  value "+$( ".slider-re" ).slider('value'));
                if(parseInt(media.css('margin-top'))<=0){
                       // $('#search').val("while "+(parseInt(media.css('margin-top'))+step)+"  value "+$( ".slider-re" ).slider('value'));
                        media.css('margin-top', parseInt(media.css('margin-top'))+step);
                        $( ".slider-re" ).slider('value',($(el).height()+(parseInt(media.css('margin-top'))+step)));
                }
        } else {
                var step = 40;
                if((parseInt(media.css('margin-top'))+$(el).height())<40)

                step = (parseInt(media.css('margin-top'))+$(el).height());

                if((parseInt(media.css('margin-top'))+$(el).height())>=0){
                        //$('#search').val("while "+($("#all-slide").height()-(parseInt(media.css('top'))+step))+"  value "+$( ".slider-re" ).slider('value'));
                        media.css('margin-top', parseInt(media.css('margin-top'))-step);
                        $( ".slider-re" ).slider('value',($(el).height()+(parseInt(media.css('margin-top'))-step)));
                }
        }
    }, null, true);
    $(el).css('margin-top','0px');
}
function setSliderRight(){
    if($('#main-left-content-id').height()>450){
       
         if(!($.browser.msie&&parseInt($.browser.version)==7)){
                if(typeof($('#solid-news'))!='undefined'){
                    var ssss = $('#solid-news').html()
                    $('#solid-news').remove();
                    $('#solid-current-content').append(ssss)
                }
                if($('#solid-current-content').html()==null&&typeof($('.partners-all'))!='undefined'){
                    $('#solid-current-content').remove();
                    $('.partners-all').attr('id','solid-current-content');
                }
                //partners-all
                var el = "#solid-current-content";
                  //  partners-all

                $(".slider-re").slider({
                                orientation: "vertical",
                                range: "max",
                                min: 360,
                                max: $(el).height()-61,
                                value: $(el).height(),
                                slide: function( event, ui ) {
                                        ui.value -=$(el).height()-20;
                                        $(el).css("top", "" + ui.value + "px");
                                }
                        });

                        $('#main-left-content-id').css({overflow: 'hidden',height:'404px'});
                        $(el).css('position','relative');
                        $('#main-left-content-id').mousewheel(function(event,delta){

                        var media = $(this).find('#solid-current-content');
                        if (delta > 0) {
                                var step = 40;
                                if(parseInt(media.css('top'))>-40)
                                        step = parseInt(media.css('top'));
                                //$('#search').val("while "+(parseInt(media.css('top'))+step)+"  value "+$( ".slider-re" ).slider('value'));
                                if(parseInt(media.css('top'))<=0){
                                        //$('#search').val("while "+(parseInt(media.css('top'))+step)+"  value "+$( ".slider-re" ).slider('value'));
                                        media.css('top', parseInt(media.css('top'))+step);
                                        $( ".slider-re" ).slider('value',($(el).height()+(parseInt(media.css('top'))+step)));
                                }
                        } else {
                                var step = 40;
                                if((parseInt(media.css('top'))+$(el).height())<40)

                                step = (parseInt(media.css('top'))+$(el).height());

                                if((parseInt(media.css('top'))+$(el).height())>=360){
                                        //$('#search').val("while "+($("#all-slide").height()-(parseInt(media.css('top'))+step))+"  value "+$( ".slider-re" ).slider('value'));
                                        media.css('top', parseInt(media.css('top'))-step);
                                        $( ".slider-re" ).slider('value',($(el).height()+(parseInt(media.css('top'))-step)));
                                }
                        }
            }, null, true);
                $(el).css('top','0px');
         }else{
           
             if($('#main-left-content-id').height()>580){
               menuRightIe7();
             }
         }
    }

}

function getRabat(){
  var text =  $('.jazin-section a span').text();
  var patt1=new RegExp("[0-9]+%");
  return patt1.exec(text);
}
function getRabatKwota(){
  var text =  $('.jazin-section a span').text();
  var patt1=new RegExp("[0-9]+-[0-9]+");
  return patt1.exec(text);
}
function getRabatKwota2(){
  var text =  $('.jazin-section a span').text();
  var patt1=new RegExp("[0-9]+\\s*zł");
  return patt1.exec(text);
}

function setWidthSortment(){
    if($.browser.msie&&parseInt($.browser.version)==7)
        $('#solid-current-content').css({position: 'relative',top:'-670px'});

    if($.browser.msie&&parseInt($.browser.version)!=8)
        if($('#solid-current-content').width()>435){
            var plass = 50;
            if($.browser.msie)
                plass = -20;
            var w1 = $('#solid-current-content').width();
            var w2 = $('div.main-left-content').width();
            var w3 =w2 +(w1 - 435)+plass;
            $('div.main-left-content').width(w3);
            
        }
}

var srcStarNew = null;
var starComback = null;
var catPage = true;
var widthSortmentIe7 = false;
$('div#main').css({width:'985px'});


function setPartnersWhile(){
    if($('div.partners-all')){
            $( ".slider-re1" ).slider({range: "max",max: (maxPartner),value: 0,slide: function( event, ui ) {setPartnerShow(ui.value);}});
            $('#partners-scroll').mousewheel(function(event,delta){
                if (delta > 0) {
                         privusPartner111();
                        $( ".slider-re1" ).slider('value', nextPartner);
                } else {
                         nextPartner111();
                         $( ".slider-re1" ).slider('value', nextPartner);
                }
             }, null, true);
     }
}


String.prototype.startsWith = function(str)
{return (this.match("^"+str)==str)}
function onload1(){

        if($('#user_uid')){
            $('#user_uid').css('color', '#B1B2B2');
            $('#user_uid').focus(function() {
                 
              if( $('#user_uid').val().trim().match("^"+'nr. MOP')=='nr. MOP'){
                   $('#user_uid').val('');
                   $('#user_uid').css('color', '#000');
              }
            });
        }

        if($('#user_email')){
            $('#user_email').css('color', '#B1B2B2');
            $('#user_email').focus(function() {

              if( $('#user_email').val().trim().match("^"+'e-mail')=='e-mail'){
                   $('#user_email').val('');
                   $('#user_email').css('color', '#000');
              }
            });
        }

	$('.box-front-solidclub').corner("top");
	$('input[type="text"]').focus(function(){
            if($(this).val()=='Login...'||$(this).val()=='Szukaj...'){
		$(this).val('');
		$(this).css('color', '#000000');
            }
	});
       
       // if(catPage)
         //setSliderRight();
       
        if($.browser.msie&&parseInt($.browser.version)==7)
             ie7();
        
        $('h2.contentheading').hide();

        tabSlide4 = $('div.temporary-offer img');
        setTimeout('nextSlidePartner4()', 100);
        moweElPartner();
        sizeUpPartner();

        var  ff = $('div#main-all').height() - $('div.box-first-text').height();
        ff = ff - $('div.banners-all').height();

        $('div.banners-all').css('margin-top', (ff/8)+'px');
        menuLodad = setMenuMove($('div.menu-rigth'), $('div.menu-rigth table'), $('div.menu-rigth table div'), $('div.menu-rigth table td'));
       
        
        if($('div#content-polityka'))
            $('div#content-polityka').css("top", "0px");

        if($('div#all-slide'))
            $('div#all-slide').css("top", "0px");

        

 setPartnerPage();
if(srcStarNew!=null){
    //position:
    $('#gwiazdka_1').html(srcStarNew);

    $('#gwiazdka_1').show();

    $('#gwiazdka').css('position','absolute');
    $('#gwiazdka').css('top','245px');
    if($.browser.msie&&parseInt($.browser.version)==7)
        $('#rodzina').css('top', '-485px');
    var h = $(document).width();
    var left = 0;
    if(h - $('#heder-obrazki-div').width()>0){
        h = h - $('#heder-obrazki-div').width();
        left = h/2 +$('#heder-obrazki-div').width() - 160;
        h= h/2+$('#heder-obrazki-div').width();
      //  h = h-$('#gwiazdka').width();
    }else{
        h = h +$('#heder-obrazki-div').width()+10;
        left = h/2 +$('#heder-obrazki-div').width() - 160;
    }
    $('#gwiazdka').css('left',left+'px');
    
    $('#gwiazdka').animate({
        left:h+"px",
        top:"10px"
    }, 1500 );

   
    
}else if(starComback!=null){
    $('#gwiazdka_1').css('height', '160px');
    $('#gwiazdka_1').show();
    $('#gwiazdka').css('position','absolute');
    $('#gwiazdka').css('top','10px');
    

    var h = $(document).width();
    var left = 0;

    if(h - $('#heder-obrazki-div').width()>0){
        h = h - $('#heder-obrazki-div').width();
        left = h/2 +$('#heder-obrazki-div').width() - 115;
        h= h/2+$('#heder-obrazki-div').width();
      //  h = h-$('#gwiazdka').width();
    }else{
        h = h +$('#heder-obrazki-div').width()+10;
        left = h/2 +$('#heder-obrazki-div').width() - 115;
    }
    $('#gwiazdka').css('left',h+'px');
   // $('#gwiazdka').css('left',left+'px');

    $('#gwiazdka').animate({
        left:left+"px",
        top:"225px"
    }, 1500 );
    setTimeout('$(\'#gwiazdka_1\').hide();$(\'#gwiazdka\').css({\'cursor\':\'pointer\',\'left\':\'785px\',\'top\':\'-86px\', \'position\':\'relative\', \'width\':\'160px\'}); ', 1710);
    setTimeout('$(\'#gwiazdka\').css(\'top\',\'-86px\')', 1700)
}
if(widthSortmentIe7)
    $('div#main').css({width:'985px'});
   // setWidthSortment();
 if($.browser.msie){
            $('#username').css('margin-left', '32px');
            $('#username').css('margin-top', '15px');
            $('#password').css('margin-left', '32px');
            $('#fieldset-g1  ul.errors li').css('margin-left', '32px');
            $('#fieldset-g1  label').css('margin-left', '32px');
            $('#fieldset-g1  ul.errors li').css('margin-left', '35px');
            $('#fieldset-g1  ul.errors li').css('margin-bottom', '-10px');
            $('#fieldset-g1  ul.errors li').css('margin-top', '10px');
            $('#fieldset-g1  legend').css('margin-left', '8px');
            $('#solid-current-content').css('width', '600px');

 }

 $("#contact-form input, textarea, select").css('border','1px solid #B1B2B2');
 $("input.formsubmit").css('border','none');
}

function refreschPage(){
   // location.href = location.href;
}

var indexFlash = 1;
function swichFlash(){
    if(typeof(arrayFlash)!='undefined'){
      
        if(indexFlash>0){
            $(arrayFlash[indexFlash-1]).hide();
            $(arrayFlash[indexFlash]).show();
        }else{
             $(arrayFlash[arrayFlash.length-1]).hide();
             $(arrayFlash[indexFlash]).show();
        }
        
        if(arrayFlash.length-1==indexFlash)
            indexFlash = 0;
        else
            indexFlash++;

    }
    setTimeout('swichFlash()', 20000);
}


function swichInfoShortToLong(el){



    $('#short-info').toggle();
    $('#long-info').toggle();
    $('#info-back').toggle();
    $('#info-next').toggle();
    $('#solid-news').toggle();
    $('#infolinia').toggle();
   // $('#kontakt').toggle();
   // if($.browser.msie&&parseInt($.browser.version)==8){
    $('#solid-current-content').css('height',$('#info-partner-tab').height()+'px');
    if($.browser.msie&&parseInt($.browser.version)==7&&$('#info-partner-tab').css('top')=='-670px'){
        //$('#search').val($('#info-partner-tab').height());
        $('#info-partner-tab').css({position: 'relative',top:'-430px'});
       // $('#solid-current-content').css('height','1px');
    }else if($.browser.msie&&parseInt($.browser.version)==7){
        //$('#solid-current-content').css('height','1px');
        // $('#info-partner-tab').css({position: 'relative',top:'-670px'});
    }

    var h =  $('#solid-current-content').height();

    $('.main-left-content').css('height',h+'px');

   

    var countBack =90;
    if($.browser.msie)
        countBack =22
   
    while($('.partner-title-info').text().length< countBack){
        $('.partner-title-info').append('&nbsp;');
       // $('#search').val($('.partner-title-info').text().length)
    }
}

function setDisableProsent(val ,el){
    var r = /\d+/gi
   
    if(val.match(r)!=null){
        $('#prosent').removeAttr('disabled');
        $('div#compan-rabat').html('<div id="rabat">'+$(el).val()+'<span>%</span></div>');
        $('div#compan-rabat').css('background','url("'+$('#base').attr('href')+'/public/image/gwiazdka_1.png") scroll left bottom  no-repeat');
        $(el).attr('checked', 'checked');
}else{
        $('#prosent').attr('disabled', 'disabled');
        if($(el).val()=='upust'){
             $('div#compan-rabat').html('');
             $('div#compan-rabat').css('background','url("'+$('#base').attr('href')+'/public/image/upust.png") scroll left bottom  no-repeat');
              $(el).attr('checked', 'checked');
        }
        if($(el).val()=='super oferta'){
             $('div#compan-rabat').html('');
             $('div#compan-rabat').css('background','url("'+$('#base').attr('href')+'/public/image/super.png") scroll left bottom  no-repeat');
              $(el).attr('checked', 'checked');
        }
    }

    
}

function setDisableProsent2(val , el2, dd){
    var r = /\d+/gi

    if(dd){
        if(val.match(r)!=null){
            $(el2).css('height', '158px');
            $(el2).html('');
            $(el2).html('<div id="rabat">'+val+'<span>%</span></div>');
            $(el2).css('background','url("'+$('#base').attr('href')+'/public/image/gwiazdka_1.png") scroll   no-repeat');
        }else{

            if(val=='upust'){
                // $(el2).html('');
                 $(el2).children('img').attr('src',$('#base').attr('href')+'/public/image/upust.png');
            }
            if(val=='super oferta'){
                // $(el2).html('');
                 $(el2).children('img').attr('src',$('#base').attr('href')+'/public/image/super.png');
            }
        }
    }else{

        if(val.match(r)!=null){

            $(el2).html('<div class="rabat">'+val+'<span>%</span></div>');
            $(el2).css('background','url("'+$('#base').attr('href')+'/public/image/rabat.png") scroll 50% 50%  no-repeat');
        }else{

            if(val=='upust'){
                 $(el2).html('');
                 $(el2).css('background','url("'+$('#base').attr('href')+'/public/image/upust_1.png") scroll 50% 50%   no-repeat');
            }
            if(val=='super oferta'){
                 $(el2).html('');
                 $(el2).css('background','url("'+$('#base').attr('href')+'/public/image/super-oferta.png") scroll 50% 50%   no-repeat');
            }
        }
    }

}

function setStarSuper(src){
   
    $('#gwiazdka').html('<img src="'+ src+'" alt="" >');
}




window.onload = onload1;








