function priceFromSelect(selectValue)
{
	var myDiv = document.getElementById('price') ;
		
		if(netto)
		{
//			alert('promotionEnd:'+promotionEnd[selectValue]+(promotionEnd[selectValue] == '')+' priceSelectPromot:'+priceSelectPromot[selectValue]+' date:'+date);
			if((priceSelectPromot[selectValue] > 0) && (promotionStart[selectValue] == '' || promotionStart[selectValue] <= date) && (promotionEnd[selectValue] == '' || promotionEnd[selectValue] > date))
			{
				
				var priceTax = priceSelectTax[selectValue];
				var price = priceSelect[selectValue];
				var pricePromTax=priceSelectPromotTax[selectValue];
				var priceProm=priceSelectPromot[selectValue];
				
				myDiv.innerHTML = '<img src="'+addr+'shared/'+engin+'/img/prom.gif" alt="" />';
					
				if(product_new > 0)
					myDiv.innerHTML +='<img src="'+addr+'shared/'+engin+'/img/newMini.gif" alt="" />';
				
				if(product_recommend > 0)
					myDiv.innerHTML +='<img src="'+addr+'shared/'+engin+'/img/recomMini.gif" alt="" />';	
					
				myDiv.innerHTML += '<div><span class="label">'+ old_label+'</span> <span class="strike"><span class="value">' + priceTax + ' ' + currency + '</span></span></div>' ;
				myDiv.innerHTML += '<div><span class="label">' + brutto_label + '</span> <span class="value">' + pricePromTax + ' ' + currency + '</span></div>' ;
				myDiv.innerHTML += '<div class="without-tax"><span class="label">' + netto_label + '</span> <span class="value">' + priceProm + ' ' + currency +'</span></div>' ;
					
			}
			else	{
					var priceNetto = priceSelect[selectValue];
					var priceBrutto = priceSelectTax[selectValue];
					myDiv.innerHTML = '';
					if(product_new > 0)
						myDiv.innerHTML += '<img src="'+addr+'shared/'+engin+'/img/newMini.gif" alt="" />';
					if(product_recommend > 0)
						myDiv.innerHTML += '<img src="'+addr+'shared/'+engin+'/img/recomMini.gif" alt="" />';
					myDiv.innerHTML +='<div><span class="label">' + brutto_label + '</span> <span class="value">' + priceBrutto + ' ' + currency +'</span></div>';
					myDiv.innerHTML +='<div class="without-tax"><span class="label">' + netto_label + '</span> <span class="value">' + priceNetto + ' ' + currency + '</span></div>';
				}
					
		}else
			{
				var price = priceSelectTax[selectValue];
				
				
			if((priceSelectPromot[selectValue] > 0) && (promotionStart[selectValue] == '' || promotionStart[selectValue] <= date) && (promotionEnd[selectValue] == '' || promotionEnd[selectValue] > date))
				{
					var priceProm=priceSelectPromotTax[selectValue];
					myDiv.innerHTML = '<img src="'+addr+'shared/'+engin+'/img/prom.gif" alt="" />';
					if(product_new>0)
						myDiv.innerHTML += '<img src="'+addr+'shared/'+engin+'/img/newMini.gif" alt="" />';
					if(product_recommend>0)
					   myDiv.innerHTML += '<img src="'+addr+'shared/'+engin+'/img/recomMini.gif" alt="" />';
					
					myDiv.innerHTML += '<div><span class="label">'+ old_label+' </span> <span class="strike"><span class="value">' + price + ' ' + currency + '</span></span></div>' ;
					myDiv.innerHTML += '<div><span class="label">' + price_label + '</span> <span class="value">' + priceProm + ' ' + currency + '</span></div>' ;
							
				}else
					{
					myDiv.innerHTML = '';
					if(product_new>0)
						myDiv.innerHTML += '<img src="'+addr+'shared/'+engin+'/img/newMini.gif" alt="" />';
					if(product_recommend>0)
						myDiv.innerHTML +='<img src="'+addr+'shared/'+engin+'/img/recomMini.gif" alt="" />';
					myDiv.innerHTML += '<div><span class="label">' + price_label + '</span> <span class="value">' + price + ' ' + currency + '</span></div>';
					}
			}
}
function formPlusMinus(parentElement, sign)
{
 inputElement = parentElement.parentNode.getElementsByTagName('input').item(0);
 if(sign == '+' && (arguments.length==2 || (arguments.length>=3 && arguments[2]==(-1)) || (arguments.length>=3 && inputElement.value < arguments[2]))) inputElement.value++; // arguments[2]==(-1) - gdy produkt jest wyczerpany (nie istnieja informacje na jego temat w bazie danych) dajemy wowczas wolna reke administratorowi
 if(sign == '-' && (inputElement.value>1)) inputElement.value--;
}
function validEmail(frm){
	value = frm.elements['email'].value;
	_qfMsg = '';
	var regex = /^((\"[^\"\f\n\r\t\v\b]+\")|([\w\!\#\$\%\&'\*\+\-\~\/\^\`\|\{\}]+(\.[\w\!\#\$\%\&'\*\+\-\~\/\^\`\|\{\}]+)*))@((\[(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\])|(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9\-])+\.)+[A-Za-z\-]+))$/;
	if (value == '' || !regex.test(value)) {
	   _qfMsg = '- Nie właściwy lub nie isniejący adres e-mail';
	   alert(_qfMsg);
	   return false;
	}
	return true;
}
function number_format( number, decimals, dec_point, thousands_sep ) {
	// +   original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
	// +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
	// *     example 1: number_format(1234.5678, 2, '.', '');
	// *     returns 1: 1234.57
	var i, j, kw, kd, km;
	// input sanitation & defaults
	if( isNaN(decimals = Math.abs(decimals)) ){
		decimals = 2;
	}
	if( dec_point == undefined ){
		dec_point = ",";
	}
	if( thousands_sep == undefined ){
		thousands_sep = ".";
	}
	i = parseInt(number = (+number || 0).toFixed(decimals)) + "";
	if( (j = i.length) > 3 ){
		j = j % 3;
	} else{
		j = 0;
	}
	km = (j ? i.substr(0, j) + thousands_sep : "");
	kw = i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thousands_sep);
	kd = (decimals ? dec_point + Math.abs(number - i).toFixed(decimals).slice(2) : "");
	return km + kw + kd;
}
function flashSite(id,adres)
{
 var popup_width = 570;
 var popup_height = 570;
 var flashFile = 'http://www.tomi.e-s.pl/shared/default/swf/popup.swf';
 var margin_left=((screen.width)/2)-(popup_width/2);
 var margin_top=((screen.height)/2)-(popup_height/2);
 var oNewWin = window.open("about:blank","TomiCollection","width="+popup_width+",height="+popup_height+",top="+margin_top+",left="+margin_left+",resizable=0,scrollbars=no,menubar=no,status=no,toolbar=no,location=no,directories=no");
 oNewWin.document.open();
 oNewWin.document.write('<html>');
 oNewWin.document.write('<head>');
 oNewWin.document.write('<title>TomiCollection</title>');
 oNewWin.document.write('<meta name="title" content="TomiCollection" />');
 oNewWin.document.write('<style type="text/css">html,body{background:#2A2A2A; margin:0; padding:0;} img,object{border:none;} .main {height:'+popup_width+'px; width:'+popup_height+'px; position:absolute; top:50%; left:50%; margin-top:-'+(popup_width/2)+'px; margin-left:-'+(popup_height/2)+'px;}</style>');
 oNewWin.document.write('</head>');
 oNewWin.document.write('<body>');
 oNewWin.document.write('<div class="main">');
 oNewWin.document.write('<object width="'+popup_width+'" height="'+popup_height+'" type="application/x-shockwave-flash" data="'+flashFile+'">');
 oNewWin.document.write('<param name="movie" value="'+flashFile+'" />');
 oNewWin.document.write('<param name="FlashVars" value="id='+id+'&address_xml='+adres+'"/>');
 oNewWin.document.write('<param name="bgcolor" value="#000000" /></object>');
 oNewWin.document.write('</div>');
 oNewWin.document.write('</body>');
 oNewWin.document.write('</html>');
 oNewWin.document.close();
}
function handleKeySearch(e) 
{
  e = (!e) ? window.event : e;
  code = (e.charCode) ? e.charCode : ((e.keyCode) ? e.keyCode : ((e.which) ? e.which : 0));
  if( document.getElementById('searchProductName').value != '')
    var sSearchName = document.getElementById('searchProductName').value;
  if(document.getElementById('searchProductCode').value != '')
    var sSearchIndex = document.getElementById('searchProductCode').value;
  if(document.getElementById('searchProductProducer').value != '')
    var sSearchProducer = document.getElementById('searchProductProducer').value;
  /*var sSearchNarrow = document.getElementById('search_narrow_condition').value;*/
  
  if (e.type == "keydown") {
	if(code == 13) {
	  //location.href = sShopAddr + sLangShort + '/Search/' + sSearchPhrase + '/WYSZUKIWARKA/';
      document.search_form_basic.submit;
	}
  }
}
function handleKeySearch2(e) 
{                   
  e = (!e) ? window.event : e;
  code = (e.charCode) ? e.charCode : ((e.keyCode) ? e.keyCode : ((e.which) ? e.which : 0));
  if( document.getElementById('search_condition1').value != '')
    var sSearchName = document.getElementById('search_condition1').value;
  if(document.getElementById('search_narrow_condition1').value != '')
    var sSearchProducer = document.getElementById('search_narrow_condition1').value;
  else var sSearchProducer = 'Producent';
  
  if (e.type == "keydown") {
    if(code == 13) {
      //location.href = sShopAddr + sLangShort + '/Search/' + sSearchPhrase + '/WYSZUKIWARKA/';
     location.href = sShopAddr + sLangShort + '/Search/' + sSearchName + '/'+ sSearchProducer +'/';
     
    }
  }
      //document.forms['search_form_basic'].submit;
}
function doNothing() {}
function setBoxVisible(_this, sId) {
	var domH1 = $$('#idBottomBox a');
	
	$A(domH1).each(function(dom){
		dom.removeClass('title-visible');
		dom.addClass('title-hidden');
	});
	
	var domCont = $$('#idBottomBox .content');
	$A(domCont).each(function(dom){
		dom.removeClass('content-visible');
		dom.addClass('content-hidden');
	});
	
	_this.removeClass('title-hidden');
	_this.addClass('title-visible');
	
	$(sId).removeClass('content-hidden');
	$(sId).addClass('content-visible');
}
/*function showHide(aShow, aHide){
	
	var i=0;
	if(aHide.length>0)
	for each (var item in aHide) {
	  var id = "";
	  id = String(item);
	  document.getElementById(id).style.display = 'none';
	}
	
	if(aShow.length>0)
	 for each (var item in aShow) {
	  document.getElementById(item).style.display = 'block';
	}
} */
/*
function show(id){
	
	if($(id) != null)
	$(id).style.display = 'block';
}
function hide(id){
	if($(id) != null)
	$(id).style.display = 'none';
	
}
*/
function show(id){
	
	if($(id) != null)
	$(id).disabled = false;
}
function hide(id){
	if($(id) != null)
	$(id).disabled = true;
}
function showHideBox(id){
    if($(id) != null){
        if($(id).style.display == 'block') $(id).style.display = 'none';
        else if($(id).style.display == 'none') $(id).style.display = 'block'
    }  
}
function checkOptionValue(inputObj){
	var objLength = inputObj.length;
	if(objLength == undefined){
		if(inputObj.checked)
			return inputObj.value;
		else
			return "";
	}else{
		for(var i = 0; i < objLength; i++) {
			if(inputObj[i].checked) {
				return inputObj[i].value;
			}
		}
	}
	return "";
}
function selectNewsTab(tabId, contentId){
	
	$('branch-news-title').className = 'news-unselected';
	$('company-news-title').className= 'news-unselected';
	$('branch-news-title-corner').className = 'news-unselected-corner';
	$('company-news-title-corner').className= 'news-unselected-corner-last';
	
	$(tabId).className = 'news-selected';
    if(tabId == 'company-news-title'){
        $(tabId+'-corner').className = 'news-selected-corner-last';
    }
    else{
        $(tabId+'-corner').className = 'news-selected-corner';    
    }
	
	$('branch-news-content').style.display = 'none';
	$('company-news-content').style.display = 'none';
	
	$(contentId).style.display = 'block';
}
function getElementsByClassName(cn){
  var arr = new Array(); 
  var els = document.getElementsByTagName("*");
  var exp= new RegExp("^(.* )?"+cn+"( .*)?$", "g");
  for (var i = 0; i < els.length; i++ ){
    if (exp.test(els[i].className)){
      arr.push(els[i]);
    }
  }
  return arr;
}
function selectAdditionalTab(tabId, contentId){
    
    arrDivs = getElementsByClassName('additional-unselected');
    arrDivsS = getElementsByClassName('additional-selected');
    var currentWidth=0;
    var totalWidth = $('title-additional-id').offsetWidth;
    var tabCount=0;
    tabCount = arrDivs.length + arrDivsS.length;
    for(var i=0;i<arrDivs.length;i++){
        $(arrDivs[i].id).className = 'additional-unselected';
        $(''+arrDivs[i].id+'-corner').className = 'news-unselected-corner';
        $(''+arrDivs[i].id+'-content').style.display = 'none';
        $(arrDivs[i].id).style.width = '';
        currentWidth += $(arrDivs[i].id).offsetWidth;
    }
    for(var i=0;i<arrDivsS.length;i++){
        $(arrDivsS[i].id).className = 'additional-unselected';
        $(''+arrDivsS[i].id+'-corner').className = 'news-unselected-corner';
        $(''+arrDivsS[i].id+'-content').style.display = 'none';
        $(arrDivsS[i].id).style.width = '';
        currentWidth += $(arrDivsS[i].id).offsetWidth;
    }
    
	$(tabId).className = 'additional-selected';	
	$(tabId+'-corner').className = 'news-selected-corner';
    $(tabId+'-content').style.display = 'block';
    var newWidth = totalWidth-currentWidth-(tabCount*7) + $(tabId).offsetWidth -19;
    $(tabId).style.width = newWidth + 'px';
	/*$(tabId).className = 'additional-selected';
    if(tabId == 'fashionable-tab'){
        $('title-additional-id').style.background='white';
    }                                                         
    else{
        $('title-additional-id').style.background='url("../img/additional-unselected-bg.gif") left top repeat-x';
    }
    if(tabId == 'catalog-tab'){
        $(tabId+"-corner").className = 'news-selected-corner-last';
    }
    else{
        $(tabId+"-corner").className = 'news-selected-corner';    
    }
	$('fashionable-content').style.display = 'none';
	$('tailor-content').style.display = 'none';
	$('contest-content').style.display = 'none';
	$('catalog-content').style.display = 'none';
	
	$(contentId).style.display = 'block';*/
}
function selectTreeTab(tabId, contentId, cornerId){
	
	$('title-categories').className = 'categories-unselected';
	$('title-branch').className= 'branch-unselected';
	
    if(tabId == 'title-categories'){
        $(tabId).className = 'categories-selected';    
    }
    if(tabId == 'title-branch'){
        $(tabId).className = 'branch-selected';
    }
	
	$('categories-content').style.display = 'none';
	$('branch-content').style.display = 'none';
	
	$(contentId).style.display = 'block';
}
function selectAttributeTab(tabId,contentId){
	
	$('menu-left-lpg').className = 'menu-left-unselected';
	$('menu-left-cng').className= 'menu-left-unselected';
	
	$(tabId).className = 'menu-left-selected';
	
	$('menu-cat-lpg').style.display = 'none';
	$('menu-cat-cng').style.display = 'none';
	
	$(contentId).style.display = 'block';
}
function selectNewsletterTab(tabId){
	
	$('newsletter-tab-retailer').className = 'newsletter-tab-unselected';
	$('newsletter-tab-wholesaler').className= 'newsletter-tab-unselected';
	
	var userType = tabId.replace('newsletter-tab-','');
//    alert(userType);
	document.newsletterForm.userType.value = userType;
	$(tabId).className = 'newsletter-tab-selected';
	
}
function fontSize(id, size){
	 if($(id) != null)
	 $(id).style.fontSize = size+'px';
}
function showHideSiteMapBranch(id){
	if($('childrenOf'+id) != null && $('picture'+id) != null){
		
		if($('childrenOf'+id).style.display=='none'){
			
			$('picture'+id).src = sShopAddr+'shared/'+sSmartyEngine+'/img/site-map-minus.gif';
			$('childrenOf'+id).style.display='block';
			$('category'+id).style.fontWeight='bold';  
			$('category'+id).style.color='#0066b3';   
		} 
		else{
			$('picture'+id).src = sShopAddr+'shared/'+sSmartyEngine+'/img/site-map-plus.gif';
			$('childrenOf'+id).style.display='none';
			$('category'+id).style.fontWeight='normal';  
			$('category'+id).style.color='#9F9F9F';        
		}
		
	}
}
function showHideSiteMapBranchPages(id){
	
	if($('pageChildrenOf'+id) != null && $('pagePicture'+id) != null){
			
		if($('pageChildrenOf'+id).style.display=='none'){
			$('pagePicture'+id).src = sShopAddr+'shared/'+sSmartyEngine+'/img/site-map-minus.gif';
			$('pageChildrenOf'+id).style.display='block';  
			$('page'+id).style.fontWeight='bold';  
			$('page'+id).style.color='#0066b3';  
		} 
		else{
			$('pagePicture'+id).src = sShopAddr+'shared/'+sSmartyEngine+'/img/site-map-plus.gif';
			$('pageChildrenOf'+id).style.display='none';
			$('page'+id).style.fontWeight='normal';  
			$('page'+id).style.color='#9F9F9F';    
		}
		
	}
}
function showHideMapBranchBlock(id){
    //alert(id);
    if($(id) != null){
        if($(id).style.display=='none'){
            $(id).style.display = 'block';    
            $('pictureBranch').src = sShopAddr+'shared/'+sSmartyEngine+'/img/site-map-minus.gif';
            $('branch').style.fontWeight='bold';  
            $('branch').style.color='#0066b3';  
        }
        else {
            $('pictureBranch').src = sShopAddr+'shared/'+sSmartyEngine+'/img/site-map-plus.gif';
            $(id).style.display = 'none';
            $('branch').style.fontWeight='normal';  
            $('branch').style.color='#9F9F9F';
        }
        
    }
}
function registerUserTypeEnableDisable(producer,distributor){
	
	document.first.user_type[producer_t].disabled=false;
	document.first.user_type['producer_t'].style.backgroundColor='white';
	//$('producer_input').disabled=false;
	
	$('producer_input').style.backgroundColor='white';
	
	$('distributor_input').disabled=true;
}
function set_right_menu_height(height,type){
    var left_height = document.getElementById('main_page_left').offsetHeight;
    var right_height = document.getElementById('menu_right').offsetHeight;
    
    var right_categories_height = document.getElementById('categories-content').offsetHeight;
    var right_branch_height = document.getElementById('branch-content').offsetHeight;
    if(type == 'cat'){
        
        if(left_height>right_categories_height){
            var l_h = left_height -24;
            document.getElementById('menu_right').style.height=(l_h) + "px" ;
        }
        else{                      
            var r_h = right_categories_height - 65;
            document.getElementById('page_content').style.height=(r_h) + "px" ;
        }
                                                              
    }else
    if(type == 'branch'){
                    
        if(left_height>right_branch_height){     
            var l_h = left_height - 24;
            document.getElementById('menu_right').style.height=(l_h) + "px" ;
        }
        else{                                        
            var r_h = right_branch_height - 65; 
            document.getElementById('page_content').style.height=(r_h) + "px" ;
            document.getElementById('menu_right').style.height=(right_branch_height) + "px" ;
        }
        
    }
    else{
                                       
        if(left_height>right_categories_height){
            var l_h = left_height -27;
            document.getElementById('menu_right').style.height=(l_h) + "px" ;
        }
        else{
            var r_h = right_categories_height - 65;
            document.getElementById('page_content').style.height=(r_h) + "px" ;
        }
        
        /*if(left_height>right_height){
            var l_h = left_height - 27;
            /*if(l_h>=1000){
                l_h = l_h + additionalHeight+2;
            }
            else{
                l_h = l_h + additionalHeight;
            }*/
          /*  document.getElementById('menu_right').style.height=(l_h) + "px" ;
        }
        else{
            r_h = right_height - 135;
        
            document.getElementById('page_content').style.height=(r_h) + "px" ;
        }*/   
    }
    
                        /*alert("left first height: " + left_first_height);*/
                        /*alert("branch height: " + right_branch_height);
                        alert("type: " +type);*/
 /*   if(left_height>right_height){
        var l_h = left_height - 27;*/
        /*if(l_h>=1000){
            l_h = l_h + additionalHeight+2;
        }
        else{
            l_h = l_h + additionalHeight;
        }*/
        /*document.getElementById('menu_right').style.height=(l_h) + "px" ;
    }
    else{
        var r_h = right_height - 134;*/
        /*if(l_h>=1000){
            r_h = r_h + additionalHeight+2;
        }
        else{
            r_h = r_h + additionalHeight - 94;
        }*/
     /*   document.getElementById('page_content').style.height=(r_h) + "px" ;
    }*/        
}
function map_page_height(id){
    
    var left_height = document.getElementById('page_content').offsetHeight;
    var right_height = document.getElementById('menu_right').offsetHeight;    
    var div_height = document.getElementById(id).offsetHeight;
    var map_height = document.getElementById('map_height').offsetHeight;     
       if(map_height + 150 + div_height > left_height){
            var r_h = map_height + 170;
            var l_h = r_h -65;
            document.getElementById('menu_right').style.height=(r_h) + "px" ;
            document.getElementById('page_content').style.height=(l_h) + "px" ;
       }
    
}
function otheraddressdata(id){                          
    var right_height = document.getElementById('menu_right').offsetHeight;
    var div_height = document.getElementById('other_address_data_div').offsetHeight;
    
    if($('otheraddresscheckbox').checked === true){
        var height = right_height + 204;
        $('menu_right').style.height=height+'px';
        $('other_address_data_div').style.display = 'block';
    }
    else if($('otheraddresscheckbox').checked === false){
        var height = right_height - div_height - 16;
        $('menu_right').style.height=height+'px';
        $('other_address_data_div').style.display = 'none';
    }
    
}
function invoicedatafields(){                          
    var right_height = document.getElementById('menu_right').offsetHeight;
    var div_height = document.getElementById('invoice_data_fields_div').offsetHeight;
   
    if($('invoice_data_checkbox').checked){
        $('invoice_data_fields_div').style.display='block';
        var height = right_height + 57;
        $('menu_right').style.height=height+'px';
    }
    if($('receipt_data_checkbox').checked){
        $('invoice_data_fields_div').style.display='none';
        var height = right_height - div_height -15;
        $('menu_right').style.height=height+'px';
    }
    
}
function orderdatafields(id){                          
    var right_height = document.getElementById('menu_right').offsetHeight;
    var div_height = document.getElementById(id).offsetHeight;
         
    if($(id).style.display == 'none'){
        $(id).style.display = 'block';
        $('register_info_block').style.display = 'block';
        $('single_order_next_button').style.display = 'block';
        var height = right_height + 629 ;
        $('menu_right').style.height=height+'px';
    }
    else if($(id).style.display == 'block'){
        $(id).style.display = 'none';
        $('register_info_block').style.display = 'none';
        $('single_order_next_button').style.display = 'none';
        var height = right_height - div_height - 52;
        $('menu_right').style.height=height+'px';
    }
    
}
function orderlogonform(id){                          
    var right_height = document.getElementById('menu_right').offsetHeight;
    var div_height = document.getElementById(id).offsetHeight;
         
    if($(id).style.display == 'none'){
        $(id).style.display = 'block'
        var height = right_height + 505 ;
        $('menu_right').style.height=height+'px';
    }
    else if($(id).style.display == 'block'){
        $(id).style.display = 'none'
        var height = right_height - div_height - 17;
        $('menu_right').style.height=height+'px';
    }
    
}
function checkCountryPhone(){
    if($('countrySelect').value == 1){
        if($('userPhone1ID').value == ''){
            $('userPhone1ID').value = '+48';
            $('userPhone2ID').value = '+48';    
        }
    }
    else{
        if($('userPhone1ID').value == '+48'){
            $('userPhone1ID').value = ''
            $('userPhone2ID').value = ''
        }
    }
}
function checkBasketQuantityFormat(input_id,ev){
    
     var myNum = $(input_id).value;
    
     var key_type=((ev.which)||(ev.keyCode));
     
     var string=new String('48_49_50_51_52_53_54_55_56_57_96_97_98_99_100_101_102_103_104_105_37_39');
     if(key_type != null){
        if(!string.match(key_type)){
            $(input_id).focus();
            $(input_id).value='';
            return false;
        }
     }
}
function checkBasketQuantityUnit(form_id,input_id){
    var myNum = $(input_id).value;
    if (myNum != 'undefined' && /^\d*$/.test(myNum) && myNum>0 && myNum != null){
        $(form_id).submit();
        return true;
    }
    else return false;
}
function checkNumeric(input_id,ev){
    var key_type=((ev.which)||(ev.keyCode));
    regEx = /^[1-9][0-9]{0,20}$/;
    var number = $(input_id).value;
    if(!number.match(regEx))
        $(input_id).value='';
    if((number == null || number == '') && key_type!=8)
        $(input_id).value=1;
}
function checkPostal(id,ev){
    
    var key_type=((ev.which)||(ev.keyCode));
    var string=new String('48_49_50_51_52_53_54_55_56_57_96_97_98_99_100_101_102_103_104_105');
    var postal_value = $(id).value;
    if(key_type != null){
        if(!string.match(key_type)){
            $(id).focus();
            var postal_length = postal_value.length;
            var str = postal_value.substr(0,postal_length-1);
            $(id).value = str;
        }
        else var str = postal_value;
     }
    
    if($('countrySelect').value == 1){
        if(str.length == 2 && key_type !=8){
            var str2 = str + "-";
            $(id).value = str2;
        }
        if(str.length == 3 && str.substr(2,3)!="-"){
            var str2 = str.substr(0,2)+"-"+str.substr(2,3);
            $(id).value = str2;
        }
        if(str.length > 6){
            var max_postal_value = str.substring(0,6);
            $(id).value = max_postal_value;
        }
    }
};
function clearSearchForm(oForm){
    var frm_elements = oForm.elements;
    
    for(i=0; i<frm_elements.length; i++) {
        field_type = frm_elements[i].type.toLowerCase();
        switch(field_type) {
            case "text":
            case "password":
            case "textarea":
            case "hidden":
                var name= frm_elements[i].name;
                frm_elements[name].value = "";
            break;
            case "radio":
            case "checkbox":
                if (frm_elements[i].checked) {
                    frm_elements[i].checked = false;            
                }
            break;
            case "select-one":
            case "select-multi":
                frm_elements[i].selectedIndex = 0;
            break;
            default:
            break;
        }
    }
};
function popupPage(popup_width, popup_height, frame_name, file_name){
  var margin_left = ((screen.width)/2) - (popup_width/2) ;
  var margin_top  = ((screen.height)/2) - (popup_height/2) ;
  
  var param = 'menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,fullscreen=no,channelmode=no,width='+popup_width+',height='+popup_height+',left='+margin_left+',top='+margin_top ;
  window.open(file_name, frame_name, param);
};
function sendMessageFromPage(type,id,messageTo,langName){
  var popup_width = 1000 ;
  var popup_height = 600 ;
  var frame_name = 'Formularz' ;
  var file_name = sShopAddr+'ajax/question.php?type='+type+'&id='+id+'&msgTo='+messageTo+'&lang='+langName;
  
  popupPage(popup_width, popup_height, frame_name, file_name) ;
};
function printFromPage(type,id){
  var popup_width = 1000 ;
  var popup_height = 600 ;
  var frame_name = 'Formularz kontaktowy' ;
  var file_name = sShopAddr+'ajax/printer.php?type='+type+'&id='+id;
  
  popupPage(popup_width, popup_height, frame_name, file_name) ;
};
/*function move(name){
    var time = null
        window.location = ''+name+'';
}*/
