/* $Id: action.js 4377 2009-10-26 23:06:19Z mwoszcz $ */
function gel(id){
	return document.getElementById(id);
}
function getScrollHeight(){
	var h = window.pageYOffset |
	document.body.scrollTop |
	document.documentElement.scrollTop;
	return h;
}
function init(){
	if(gel('email'))
	{
		if(gel('email').value == '')
		{
			gel('email').setAttribute('value', jsDict['enterEmail']);
		}
		if(gel('password').value == '')
		{
			gel('password_input').innerHTML = '<input type="text" value="'+jsDict['enterPassword']+'" id="password" name="password" onfocus="checkPassFocus(\'password\');" onblur="checkPassBlur(\'password\');"/>';
		}
	}
	if(gel('email2') && $('#popup_on').val() == '1')
	{
		if(gel('email2').value == '')
		{
		gel('email2').setAttribute('value', jsDict['enterEmail']);
		}
		if(gel('password2').value == '')
		{
		gel('password_input2').innerHTML = '<input type="text" value="'+jsDict['enterPassword']+'" id="password" name="password" onfocus="checkPassFocus(\'password\');" onblur="checkPassBlur(\'password\');"/>';
		}
	}
	if(gel('login_pop')) gel('login_pop').style.height = gel('content').clientHeight + 'px';
	if (navigator.appVersion.indexOf("X11")!=-1)
		$('.lin_x').html('<img src="/img/default/x_gray.gif" onclick="linMenuHide()"')

}


window.onload = init;

function linMenuHide()
{
	$('.menu_browse').css("display", "none");
	$('.header_submenu_na').css("background-image", "none");
	$('.header_submenu_na').css("padding-right", "12px");
	$('.menu_left_img').css('display', 'none');
	$('.menu_browse_element').css('background-color', '#ffffff');
	$('.menu_browse_element').css('border', '0');
}
function checkEmailFocus(id){
	if(gel(id).value == jsDict['enterEmail'])
	{
		gel(id).value='';
	}
}

function checkEmailBlur(id){
	if(gel(id).value == '')
	{
		gel(id).value=jsDict['enterEmail'];
	}
}
function checkPassFocus(id){
	if(gel(id).value == jsDict['enterPassword'])
	{
	var input3=document.getElementById('password');
	var input4= input3.cloneNode(false);
	input4.type='password';
	input4.value = '';
	input3.parentNode.replaceChild(input4,input3);
	input4.focus();
	input4.select();
	}
}
function checkPassBlur(id){
	if(gel(id).value == '')
	{
		gel('password_input').innerHTML = '<input type="text" value="'+jsDict['enterPassword']+'" id="password" name="password" onfocus="checkPassFocus(\'password\');" onblur="checkPassBlur(\'password\');"/>'
		var input=document.getElementById('password');
		var input2= input.cloneNode(false);
		input2.type='text';
		input2.value = jsDict['enterPassword'];
		input.parentNode.replaceChild(input2,input);
	}
}



function findPosition(el){
	var obj=document.getElementById(el);
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
		curleft += obj.offsetLeft
		curtop += obj.offsetTop
		}
	}
	return Array(curleft, curtop);
}
function show_pf(num){
	if(num==1)
	{
		gel('person').style.display='block';
		gel('firm').style.display='none';
	}
	if (num==2)
	{
		gel('person').style.display='none';
		gel('firm').style.display='block';
	}
}
function femShow(){
	$("#add_fem").toggle();
	$(this).toggleClass("active");
	if(gel('add_fem').style.display =='none')
	gel('check_add_fem').setAttribute('value', '0');
	else
	gel('check_add_fem').setAttribute('value', '1');
	return false;
}
function ma_show_pf(num){
	if(num==1)
	{
	$("#sex_radio").css("display", "block");
	$("#name").css("display", "block");
	$("#add_fem_show").css("display", "block");
	$("#add_company").css("display", "none");
	$("#name_f").css("display", "none");
	}
	if (num==2)
	{
	$("#sex_radio").css("display", "none");
	$("#name").css("display", "none");
	$("#add_fem_show").css("display", "none");
	$("#add_fem").css("display", "none");
	$("#add_company").css("display", "block");
	$("#name_f").css("display", "block");
	}
}
jQuery.fn.slideFadeToggle = function(speed, easing, callback) {
	return this.animate({opacity: 'toggle', height: 'toggle', width:'toggle'}, speed, easing, callback);
};
function selectShow(id, parentId, top, left){
	pos= findPosition(parentId);
	gel(id).style.top=pos[1]+top+'px';
	gel(id).style.left=pos[0]+left+'px';
	$('#'+id).slideFadeToggle('fast');
}
function selectHide(id){
	$('#'+id).slideFadeToggle('fast');
}
function fadeChangeDeliv(){
	pos = findPosition('checkoutChangeImg');
	gel('changeDelivery').style.top =pos[1]-3+'px';
	gel('changeDelivery').style.left =pos[0]-175+'px';;
	$('#changeDelivery').slideFadeToggle('fast');
}
function fadeChangeAddr(lang){
	pos = findPosition('checkout_ant_adr_'+lang);
	gel('changeAddr').style.top =pos[1]-3+'px';
	gel('changeAddr').style.left=pos[0]-175+'px';;
	$('#changeAddr').slideFadeToggle('fast');
}
function ref(instance_or_id){
	return(typeof(instance_or_id)=="string")?document.getElementById(instance_or_id):instance_or_id;
}
var addListener=function(){
	if(window.addEventListener){
		return function(el,type,fn){
		el.addEventListener(type,fn,false);
	};
	}
	else if(window.attachEvent){
	return function(el,type,fn){
	var f=function(){
	fn.call(el,window.event);
	};
	el.attachEvent('on'+type,f);
	};
	}
	else{
	return function(el,type,fn){
	el['on'+type]=fn;
	}
	}
}();
function hasAncestor(element,ancestor){
	var el=ref(element);
	var an=ref(ancestor);
	while(el!=document&&el!=null){
		if(el==an)return true;
			el=el.parentNode;
	}
	return false;
}
var webMenuBrowse={};
function webshopMenuBrowse(e, menuId, parentId,  uDiv, eventType, lpos, tpos, webshop){
	hideWebMenuBrowse();
	webMenuBrowse.id = menuId;
	webMenuBrowse.uDiv = uDiv;
	webMenuBrowse.webshop = webshop;
	webMenuBrowse.parentId = (parentId)?parentId:$(menuId).parentNode.id;
	webMenuBrowse.eventType = (eventType)?eventType:"mouseover";
	pos = findPosition(parentId);
	gel(webMenuBrowse.id).style.display="block";
	gel(webMenuBrowse.uDiv).style.backgroundImage = "url(/img/"+webshop+"/"+uDiv+"_a.gif)";
	gel(menuId).style.left = pos[0]+(lpos)+"px";
	gel(menuId).style.top = pos[1]+(tpos)+"px";
}
function hideWebMenuBrowse(){
	if(webMenuBrowse.id)
	{
		gel(webMenuBrowse.id).style.display = "none";
		gel(webMenuBrowse.uDiv).style.backgroundImage = "url(/img/"+webMenuBrowse.webshop+"/"+webMenuBrowse.uDiv+".gif)";
	}
}
var menuBrowse={};
function fmenuBrowse(e,menuId,parentId,eventType, findposid,lpos, tpos, webshop,leftImage, chk){
	
	group = parentId.substring(3)

	if (!gel('chk'+group))
	{
	$('#men'+group).html('<img src="/img/default/m_loader.gif" alt="'+jsDict['loading']+'" />');
	$.post("/ajaxMenuCreate.php",
		{
			group : group
		},
			function(data){
				$('#men'+group).html(data);
			}
		);
	}


	$('.sub_menu_browse').css("display", "none");
	hideMenuBrowse();
	menuBrowse.id=menuId;
	menuBrowse.leftImage=leftImage;
	menuBrowse.parentId=(parentId)?parentId:$(menuId).parentNode.id;
	menuBrowse.eventType=(eventType)?eventType:"click";
	pos = findPosition(parentId);

	gel(leftImage).style.display = "block";
	gel(menuBrowse.id).style.display="block";
	gel(menuId).style.left = pos[0]+(lpos)+"px";
	if(nhead == 1)
	    gel(menuId).style.top = pos[1]+(tpos)+10+"px";
	else
	    gel(menuId).style.top = pos[1]+(tpos)+"px";
	gel(parentId).style.backgroundImage="url(/img/"+webshop+"/sub_menu_right.gif)";
	gel(parentId).style.paddingRight="0px";

}		
function hideMenuBrowse(){
	if(menuBrowse.id){
		gel(menuBrowse.id).style.display="none";
		gel(menuBrowse.parentId).style.backgroundImage ="";
		gel(menuBrowse.parentId).style.paddingRight="12px";
		gel(menuBrowse.leftImage).style.display = "none";
		$('.sub_menu_browse').css("display", "none");
		menuBrowse={};
	}
}
var subMenuBrowse={};
function subMenu(e, menuId, parentId, eventType,  findPosId,lpos, tpos){
	hideSubMenuBrowse();
	pos1 = findPosition(findPosId);
	subMenuBrowse.id=menuId;
	subMenuBrowse.parentId=(parentId)?parentId:$(menuId).parentNode.id;
	subMenuBrowse.eventType=(eventType)?eventType:"click";
	var parentHeight = gel(subMenuBrowse.parentId).offsetHeight;
	gel(subMenuBrowse.parentId).style.backgroundColor="#F8F8F8";
	gel(subMenuBrowse.parentId).style.borderTop="1px solid";
	gel(subMenuBrowse.parentId).style.borderBottom="1px solid"
	gel(subMenuBrowse.parentId).style.borderColor = "#d2d2d2";
	gel(subMenuBrowse.parentId).style.height = parentHeight -6 + 'px';
	gel(subMenuBrowse.id).style.left =lpos+"px";
	gel(subMenuBrowse.id).style.display="block";
}
function hideSubMenu(){
	if (navigator.appVersion.indexOf("X11")==-1)
		$('.sub_menu_browse').css("display", "none");
}
function hideSubMenuBrowse(){
	if(subMenuBrowse.id)
	{
		gel(subMenuBrowse.id).style.display="none";
		gel(subMenuBrowse.parentId).style.backgroundColor="#fff";
		gel(subMenuBrowse.parentId).style.border="none";
		gel(subMenuBrowse.parentId).style.height = 'auto';
	}
	subMenuBrowse={};
}
var subSortMenuBrowse={};
function subSortMenu(e, menuId, parentId, eventType,  findPosId,lpos, tpos){
	hideSubSortMenuBrowse();
	pos1 = findPosition(findPosId);
	subSortMenuBrowse.id=menuId;
	subSortMenuBrowse.parentId=(parentId)?parentId:$(menuId).parentNode.id;
	subSortMenuBrowse.eventType=(eventType)?eventType:"click";
	var parentHeight = gel(subSortMenuBrowse.parentId).offsetHeight;
	gel(subSortMenuBrowse.parentId).style.backgroundColor="#F8F8F8";
	gel(subSortMenuBrowse.parentId).style.borderTop="1px solid";
	gel(subSortMenuBrowse.parentId).style.borderBottom="1px solid"
	gel(subSortMenuBrowse.parentId).style.borderColor = "#d2d2d2";
	gel(subSortMenuBrowse.parentId).style.height = parentHeight -6 + 'px';
	gel(subSortMenuBrowse.id).style.left =lpos+"px";
	gel(subSortMenuBrowse.id).style.display="block";
}
function hideSortSubMenu(){
	$('.sub_menu_browse_sort').css("display", "none");
}
function hideSubSortMenuBrowse(){
	if(subSortMenuBrowse.id)
	{
		gel(subSortMenuBrowse.id).style.display="none";
		gel(subSortMenuBrowse.parentId).style.backgroundColor="#fff";
		gel(subSortMenuBrowse.parentId).style.border="none";
		gel(subSortMenuBrowse.parentId).style.height = 'auto';
	}
subSortMenuBrowse={};
}

function fmainMenuBrowse(id, webshop, col){			
if (gel('header_menu_btn_1'))
{
for ($i=1; $i<=6; $i++)
	{
		if(gel('subMenu'+$i))
		{
			gel('subMenu'+$i).style.display='none';
		}
		
		gel('header_menu_btn_'+$i).style.backgroundImage ='none';
		
		gel('a_menu_'+$i).style.color ='#ffffff';
		if (nhead==1)
		    gel('header_menu_btn_'+$i).style.paddingRight='8px';
		else
		    gel('header_menu_btn_'+$i).style.paddingRight='5px';
		gel('menu_right_'+$i).style.display='none';
		}

	if(gel('subMenu'+id))
	{
		gel('subMenu'+id).style.display='block';
	}
	gel('header_menu_btn_'+id).style.backgroundImage ='url(/img/'+webshop+'/main_btn.gif)';
	if (nhead==1)
	    gel('header_menu_btn_'+id).style.paddingRight='2px';
	else
	    gel('header_menu_btn_'+id).style.paddingRight='0px';
	gel('menu_right_'+id).style.display="block";
	gel('a_menu_'+id).style.color =col;
}
}
function showWebshops(id, webshop, col){
	for ($i=1; $i<=6; $i++){
	if(gel('subMenu'+$i))
	{
		gel('subMenu'+$i).style.display='none';
	}
	gel('header_menu_btn_'+$i).style.backgroundImage ='none';
	gel('a_menu_'+$i).style.color ='#ffffff';
	gel('header_menu_btn_'+$i).style.paddingRight='5px';
	gel('menu_right_'+$i).style.display='none';
	if(gel('subMenu'+id))
	{
		$('#subMenu'+id).css('display', 'block');
	}
	gel('header_menu_btn_'+id).style.backgroundImage ='url(/img/'+webshop+'/main_btn.gif)';
	if(nhead == 1)
	gel('header_menu_btn_'+id).style.paddingRight='3px';
	else
	    gel('header_menu_btn_'+id).style.paddingRight='0px';
	gel('menu_right_'+id).style.display = 'block';
	gel('a_menu_'+id).style.color =col;
}}
addListener(document,"mouseover",function(e){
	var el=e.target||e.srcElement;
	if (webMenuBrowse&&webMenuBrowse.eventType&&webMenuBrowse.parentId)
	{
		if (e.type.indexOf(webMenuBrowse.eventType) !=-1 && !hasAncestor(el, webMenuBrowse.parentId))
			hideWebMenuBrowse();
	}
	if(menuBrowse&&menuBrowse.eventType&&menuBrowse.parentId&&navigator.appVersion.indexOf("X11")==-1)
	{
	if(e.type.indexOf(menuBrowse.eventType)!=-1&&!hasAncestor(el,menuBrowse.parentId))
	hideMenuBrowse();
	}
	if(subMenuBrowse&&subMenuBrowse.eventType&&subMenuBrowse.parentId&&navigator.appVersion.indexOf("X11")==-1)
	{
	if(e.type.indexOf(subMenuBrowse.eventType)!=-1&&!hasAncestor(el,subMenuBrowse.parentId))
		hideSubMenuBrowse();
	}
	}
);
function showAllLimit(id){
	$("#limit"+id).toggle('normal');
	if (gel('more'+id).innerHTML == jsDict['more'])
	{
		gel('more'+id).innerHTML = jsDict['less'];
	}
	else if(gel('more'+id).innerHTML == jsDict['less'])
	{
	gel('more'+id).innerHTML = jsDict['more'];
	}
}
function changeSemiMulti(id, ean){
	if (id==1)
	{
		gel('offer_arrow_1_'+ean).style.display="block";
		gel('catalog_semi_1_'+ean).style.display="block";
		gel('offer_arrow_2_'+ean).style.display="none";
		gel('catalog_semi_2_'+ean).style.display="none";
	}
	else if (id==2)
	{
	gel('offer_arrow_2_'+ean).style.display="block";
	gel('catalog_semi_2_'+ean).style.display="block";
	gel('offer_arrow_1_'+ean).style.display="none";
	gel('catalog_semi_1_'+ean).style.display="none";
	}
}
function RegisterNumberChanged(select,div, num){
	display = false;
	if (select.options[select.selectedIndex].value == 'inny numer')
	{
		display = true;
	}
	if (num == 0)
	{
		gel(div).style.display = display ? "block" : "none";
		gel(div+'lab').style.display = display ? "block" : "none";
	}
	else
	{
		gel(div+ num).style.display = display ? "block" : "none";
	}
}
function RegisterAddDelivery(){   
	gel('addDeliveryAddress').value="1";
	gel('register_3').value="1";
	document.register_3.submit();
}
function RegisterAcceptRules(checkbox,msg){
	if(gel(checkbox).checked===true)
	{
		return true;
	}
	alert(msg);
	return false;
}
function checkQuantity(input){
	var re = /^[0-9]*$/;
	if (!re.test(input.value))
	{
		input.value = input.value.replace(/[^0-9]/g,"");
	}
	if (input.value == '0')
	{
		input.value = input.value = 1;
	}
}
function checkQuantityOnBlur(input){
	if (input.value < 1)
	{
		input.value = input.value = 1;
	}
}
function checkPhone(input){
	var re = /^[0-9]*$/;
	if (!re.test(input.value)) {
		input.value = input.value.replace(/[^0-9]/g,"");
	}
}
function checkNIP(input){
	var re = /^[0-9]*$/;
	if (!re.test(input.value)) 
		input.value = input.value.replace(/[^0-9]/g,"");
}

function checkZipCode(input,which,kind){
	var re = /^[0-9]*$/;
	if (!re.test(input.value)) {
		input.value = input.value.replace(/[^0-9]/g,"");
	}
if (which == 1){
	if (input.value.length == 2) {
		if(kind == 0){
			$('#zipcode2').focus();
		}else{
			$('#zipcode2_'+kind).focus();
		}
	}
}
}
var tooltip=null;
var tooltip=function(){
var id = 'tt';
var top = 3;
var left = 3;
var maxw = 300;
var speed = 10;
var timer = 20;
var endalpha = 80;
var alpha = 20;
var tt,t,c,b,h;
var ie = document.all ? true : false;
return{
show:function(v,w){
if(tt == null){
tt = document.createElement('div');
tt.setAttribute('id',id);
t = document.createElement('div');
t.setAttribute('id',id + 'top');
c = document.createElement('div');
c.setAttribute('id',id + 'cont');
b = document.createElement('div');
b.setAttribute('id',id + 'bot');
tt.appendChild(t);
tt.appendChild(c);
tt.appendChild(b);
document.body.appendChild(tt);
tt.style.opacity = 0;
tt.style.filter = 'alpha(opacity=0)';
document.onmousemove = this.pos;
}
tt.style.display = 'block';
c.innerHTML = v;
tt.style.width = w ? w + 'px' : 'auto';
if(!w && ie){
t.style.display = 'none';
b.style.display = 'none';
tt.style.width = tt.offsetWidth;
t.style.display = 'block';
b.style.display = 'block';
}
if(tt.offsetWidth > maxw){tt.style.width = maxw + 'px'}
h = parseInt(tt.offsetHeight) + top;
clearInterval(tt.timer);
tt.timer = setInterval(function(){tooltip.fade(1)},timer);
},
pos:function(e){
var u = ie ? event.clientY + document.documentElement.scrollTop : e.pageY;
var l = ie ? event.clientX + document.documentElement.scrollLeft : e.pageX;
tt.style.top = (u - h) + 'px';
tt.style.left = (l + left) + 'px';
},
fade:function(d){
var a = alpha;
if((a != endalpha && d == 1) || (a != 0 && d == -1)){
var i = speed;
if(endalpha - a < speed && d == 1){
i = endalpha - a;
}else if(alpha < speed && d == -1){
i = a;
}
alpha = a + (i * d);
tt.style.opacity = alpha * .01;
tt.style.filter = 'alpha(opacity=' + alpha + ')';
}else{
clearInterval(tt.timer);
if(d == -1){tt.style.display = 'none'}
}
},
hide:function(){
clearInterval(tt.timer);
tt.timer = setInterval(function(){tooltip.fade(-1)},timer);
}
};
}();


function showReminderBox()
{
$('#reminder_content').slideToggle('normal');
if (gel('reminder_more').innerHTML == jsDict['more'])
{
gel('reminder_more').innerHTML = jsDict['less'];
}
else if(gel('reminder_more').innerHTML == jsDict['less'])
{
gel('reminder_more').innerHTML = jsDict['more'];
}
}
function showNewsBox()
{
$('#news_content').slideToggle('normal');
if (gel('news_more').innerHTML == jsDict['news_more'])
{
gel('news_more').innerHTML = jsDict['news_less'];
}
else if(gel('news_more').innerHTML == jsDict['news_less'])
{
gel('news_more').innerHTML = jsDict['news_more'];
}
}
function showListsComments(ean)
{
$('#comment_'+ean).slideFadeToggle('slow');
}
jQuery.fn.highlightFade = function(settings) {
var o = (settings && settings.constructor == String) ? {start: settings} : settings || {};
var d = jQuery.highlightFade.defaults;
var i = o['interval'] || d['interval'];
var a = o['attr'] || d['attr'];
var ts = {
'linear': function(s,e,t,c) { return parseInt(s+(c/t)*(e-s)); },
'sinusoidal': function(s,e,t,c) { return parseInt(s+Math.sin(((c/t)*90)*(Math.PI/180))*(e-s)); },
'exponential': function(s,e,t,c) { return parseInt(s+(Math.pow(c/t,2))*(e-s)); }
};
var t = (o['iterator'] && o['iterator'].constructor == Function) ? o['iterator'] : ts[o['iterator']] || ts[d['iterator']] || ts['linear'];
if (d['iterator'] && d['iterator'].constructor == Function) t = d['iterator'];
return this.each(function() {
if (!this.highlighting) this.highlighting = {};
var e = (this.highlighting[a]) ? this.highlighting[a].end : jQuery.highlightFade.getBaseValue(this,a) || [255,255,255];
var c = jQuery.highlightFade.getRGB(o['start'] || o['colour'] || o['color'] || d['start'] || [255,255,128]);
var s = jQuery.speed(o['speed'] || d['speed']);
var r = o['final'] || (this.highlighting[a] && this.highlighting[a].orig) ? this.highlighting[a].orig : jQuery.curCSS(this,a);
if (o['end'] || d['end']) r = jQuery.highlightFade.asRGBString(e = jQuery.highlightFade.getRGB(o['end'] || d['end']));
if (typeof o['final'] != 'undefined') r = o['final'];
if (this.highlighting[a] && this.highlighting[a].timer) window.clearInterval(this.highlighting[a].timer);
this.highlighting[a] = { steps: ((s.duration) / i), interval: i, currentStep: 0, start: c, end: e, orig: r, attr: a };
jQuery.highlightFade(this,a,o['complete'],t);
});
};

jQuery.highlightFade = function(e,a,o,t) {
e.highlighting[a].timer = window.setInterval(function() { 
var newR = t(e.highlighting[a].start[0],e.highlighting[a].end[0],e.highlighting[a].steps,e.highlighting[a].currentStep);
var newG = t(e.highlighting[a].start[1],e.highlighting[a].end[1],e.highlighting[a].steps,e.highlighting[a].currentStep);
var newB = t(e.highlighting[a].start[2],e.highlighting[a].end[2],e.highlighting[a].steps,e.highlighting[a].currentStep);
jQuery(e).css(a,jQuery.highlightFade.asRGBString([newR,newG,newB]));
if (e.highlighting[a].currentStep++ >= e.highlighting[a].steps) {
jQuery(e).css(a,e.highlighting[a].orig || '');
window.clearInterval(e.highlighting[a].timer);
e.highlighting[a] = null;
if (o && o.constructor == Function) o.call(e);
}
},e.highlighting[a].interval);
};
jQuery.highlightFade.defaults = {
start: [255,255,128],
interval: 50,
speed: 400,
attr: 'backgroundColor'
};
jQuery.highlightFade.getRGB = function(c,d) {
var result;
if (c && c.constructor == Array && c.length == 3) return c;
if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))
return [parseInt(result[1]),parseInt(result[2]),parseInt(result[3])];
else if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))
return [parseFloat(result[1])*2.55,parseFloat(result[2])*2.55,parseFloat(result[3])*2.55];
else if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))
return [parseInt("0x" + result[1]),parseInt("0x" + result[2]),parseInt("0x" + result[3])];
else if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))
return [parseInt("0x"+ result[1] + result[1]),parseInt("0x" + result[2] + result[2]),parseInt("0x" + result[3] + result[3])];
};
jQuery.highlightFade.asRGBString = function(a) {
return "rgb(" + a.join(",") + ")";
};
jQuery.highlightFade.getBaseValue = function(e,a,b) {
var s, t;
b = b || false;
t = a = a || jQuery.highlightFade.defaults['attr'];
do {
s = jQuery(e).css(t || 'backgroundColor');
if ((s  != '' && s != 'transparent') || (e.tagName.toLowerCase() == "body") || (!b && e.highlighting && e.highlighting[a] && e.highlighting[a].end)) break; 
t = false;
} while (e = e.parentNode);
if (!b && e.highlighting && e.highlighting[a] && e.highlighting[a].end) s = e.highlighting[a].end;
if (s == undefined || s == '' || s == 'transparent') s = [255,255,255];
return jQuery.highlightFade.getRGB(s);
};
function slideId(id)
{
$(id).slideToggle('fast');
if (gel(id).innerHTML == jsDict['more'])
{
gel(id).innerHTML = jsDict['less'];
}
else if(gel(id).innerHTML == jsDict['less'])
{
gel(id).innerHTML = jsDict['more'];
}
}
function changeLabels(l1,l2)
{
$('#idFname').html(l1);
$('#idSname').html(l2);
}
function showZoomPhoto(ean,host,name,dtu, mark37)
{
if (gel('z_'+ean)==null)
{
    html = '<img src="'+host+'/products/zoom/'+ean+'_z.jpg?'+dtu+'" alt="'+name+'" id="z_'+ean+'"/>';
    if (mark37 == 1){
	html = html + '<img  class="podaruj_zoom" title="Podaruj dzieciom słońce" alt="Podaruj dzieciom słońce" src="/img/default/sign_gs_big.png"/>';
    }

$('#catalog_photo_zoomed').html('');
$('#catalog_photo_zoomed').css('display', 'none');
$('#catalog_photo_zoomed').html(html);
$('#catalog_photo_zoomed').slideFadeToggle(250);
}
else
{
$('#catalog_photo_zoomed').toggle();
$('#catalog_photo_zoomed').html('');
}
}
function showMoreFilters(id)
{
$('#hidden_'+id).slideFadeToggle('slow');
if (gel('more_'+id).innerHTML == jsDict['more'])
{
gel('more_'+id).innerHTML = jsDict['less'];
}
else if(gel('more_'+id).innerHTML == jsDict['less'])
{
gel('more_'+id).innerHTML = jsDict['more'];
}
}
function showWineSort()
{
$('#wine_sort_content').slideFadeToggle('fast');
}
function basketTermToggle()
{
$('#basket_reserved_details').toggle('');
$('#basket_change_term').toggle('');
$('.basket_user').css('height', '50px');
$('.basket_line').css('display', 'block');
}
function basketChangeAddrr()
{
$('#besket_change_menu').slideFadeToggle('fast');	
}
function editExpressSearch(){
if(gel('express_search_results').style.display == 'none')
{
gel('express_search_results').style.display = 'block';
$('#express_search').toggle(500);
$('#express_search_change').toggle();
}
else
{
gel('express_search_results').style.display = 'none';
$('#express_search').toggle(500);
$('#express_search_change').toggle();
}
}
function showSort()
{
$('#pagination_sort_box').slideFadeToggle('normal');	
}
function loginPopShow()
{
if(gel('login_pop').style.display == 'none')
{
$('#login_pop').toggle(500);
divSwap('login_pop_box','box_login_popup');
$('#popup_on').val('1');		
}
else
{
$('#login_pop').toggle(500);
$('#popup_on').val('0');
}
}
function openWishList(ean)
{
$("#wish2_"+ean).toggle(300);
}
function showReviewTA()
{
$('#add_review').toggle(500);
$('#prduct_review_btn_add').toggle(250);
$('#prduct_review_btn_show').toggle(250);
}
function showConfirm(id)
{
$(id).toggle(300);
}
function showConfirm2(id, prod_id)
{
var pos = findPosition(prod_id);
var left = 30;
$(id).css('top', pos[1]+'px');
$(id).css('left', pos[0]+left+'px');
$(id).toggle(300);
}
function showPopWeight()
{
$('#pop_change_weight').toggle(800);
}
function showPopIKnow()
{
$('#pop_change_iknow').toggle(800);
}
function hideAlternatives(ean)
{
$('#alternatives_'+ean).toggle(800);
}
function hightLightAddr(id, count)
{
count++;
for (i=1; i < count; i++)
{
gel('baket_addr_'+i).style.backgroundColor = "#ffffff";
gel('baket_addr_'+i).style.color = "#565656";  
}
gel('baket_addr_'+id).style.backgroundColor = "#980147";
gel('baket_addr_'+id).style.color = "#ffffff";
return false;
}
function shoppingPopToggle(id)
{
$('#shoppingPop_'+id).toggle(500);
}
function selectShoppingAct(ean,id, count)
{
count++;
for (i=1; i < count; i++)
{
gel('shopping_element_'+ean+'_'+i).style.backgroundColor = "#ffffff";
gel('shopping_element_'+ean+'_'+i).style.color = "#565656";  
}
gel('shopping_element_'+ean+'_'+id).style.backgroundColor = "#565656";
gel('shopping_element_'+ean+'_'+id).style.color = "#ffffff";

return false;
}
function cat2Resize(noheader)
{
if (gel('catalog_2_box')){
var windowWidth=document.body.offsetWidth;

if (noheader!=1)
{
if (((windowWidth-160) > 1000) && (gel('catalog_2_box'))){
gel('header_menu_bg').style.width = windowWidth - 204 + 'px';
gel('header').style.width = '100%';
gel('header_info_top').style.width = windowWidth - 350 + 'px';
gel('fast_search').style.width = windowWidth - 800 + 'px';
gel('express_se').style.marginRight= '-'+(windowWidth - 1050)+ 'px';

}
else
{	
gel('header').style.width = '1024px';
gel('header_menu_bg').style.width = "";
gel('fast_search').style.width = '220px';
gel('header_info_top').style.width = '350px';
gel('express_se').style.marginRight="30px";
}}
if (gel('catalog_2_box')){
(gel('catalog_2_box').style.width=windowWidth-350 + 'px');
}
}
}
function shoppingSubToggle(ean)
{
$('#sub_add_sl_'+ean).toggle(500);
}
function select_wish_list(list_n, id, ean)
{
$('.add_new_list_input').css("display", "none");
$('#create_new_list_'+id+'_'+ean).toggle(350);
if (gel('list_pop_new_'+list_n+'_'+ean))
$('#list_pop_new_'+list_n+'_'+ean).toggle(350);
if (gel('list_pop_new_'+list_n))
$('#list_pop_new_'+list_n).toggle(350);
}
function select_wish_list2(id, ean)
{
$('#create_new_list_'+id+'_'+ean).toggle(350);
}
function showInputList(id, id2)
{
$('#'+id).toggle();
$('#'+id2).toggle();
}
function showPopLists()
{
$('#new_lists_pop').toggle(500);
}

function ClientLoginBoxReload(showMsg)
{
	if($('#popup_on').val() == '1')
	{
		divSwap('login_pop_box','box_login_popup');
		if(showMsg == true) 
			setTimeout("$('#login_pop_error').html(jsDict['passwordSend'])",400);
	}
	else
	{
		divSwap('login_box','box_login');
		if(showMsg == true) 
			setTimeout("$('#login_error').html(jsDict['passwordSend'])",400);

		setTimeout("init()",500);	
	}
}
function close_shopping_timeout(){
$('#pop_shopping_timeout').css('display','none');
var today = new Date();
var expires_date = new Date( today.getTime() + (3600000) );
document.cookie = 'timeout_warn=true;expires=' + expires_date.toGMTString();
}
function areaLimit(field,limit)
{
if($(field).val().length > limit) { $(field).val($(field).val().substring(0, limit))}
}
function infoPopShow(ean)
{
$('.catalog_2_pop_info').css('display', 'none');
$('#catalog_info_'+ean).toggle(450);
$('.wishlist_pop_cat_2').css('display', 'none');
}
function showSortMenu(count, id, crb_main, xSort, cGroup)
{
	if(xSort=='1')
		sortId='srt_ajx';
	else
		sortId='srt_ajx2';
	
	$('#'+sortId).html('<img src="/img/default/m_loader.gif" alt="'+jsDict['loading']+'" />');
	$.post("/ajax/srtAjx",
		{
			crb_main : crb_main,
			xSort : xSort,
			cGroup: cGroup
		},
			function(data){
				$('#'+sortId).html(data);
			}
		);
	
	$("#menu_browse_cat_s"+count).toggle(200);
}
function submitForom(evt, formObj)
{
if(document.all)
{
var key=window.event.keyCode;
}
else
{
var key=0;
if(evt.keycode) key=evt.keycode;
else if(typeof(evt.which)!='undefined') key=evt.which;
}
if(key==13) formObj.submit();
}
function cat2Info(ean_cat2)
{ 
$('.cat_2_info_cont').css("display", "none")
$('.catalog_2_info').css("display", "none")
if (gel('info2_'+ean_cat2).style.display=="none")
{
$('#cat_2_info_cont_'+ean_cat2).css("display", "block");
setTimeout(function (){$('#info2_'+ean_cat2).css('display', 'block')}, 300);
}
return false;
}
function clearInDiv(divId)
{
gel(divId).innerHTML = "";
}
function clLiPop(dId)
{
$('#'+dId).toggle();
gel(dId).innerHTML=""
}

function showWebshops(id, webshop, col){
for ($i=1; $i<=6; $i++){
if(gel('subMenu'+$i))
{
gel('subMenu'+$i).style.display='none';
}
gel('header_menu_btn_'+$i).style.backgroundImage ='none';
gel('a_menu_'+$i).style.color ='#ffffff';
gel('header_menu_btn_'+$i).style.paddingRight='5px';
gel('menu_right_'+$i).style.display='none';
if(gel('subMenu'+id))
{
$('#subMenu'+id).css('display', 'block');
}
gel('header_menu_btn_'+id).style.backgroundImage ='url(/img/'+webshop+'/main_btn.gif)';
gel('header_menu_btn_'+id).style.paddingRight='0px';
gel('menu_right_'+id).style.display = 'block';
gel('a_menu_'+id).style.color =col;
}}

function cpShow(input_id, what)
{
	if(what == 1){
		$("#wd_"+input_id).css('display', 'none');
		$("#wg_"+input_id).css('display', 'none');
		$("#wgq_"+input_id).css('display', 'none');
		$("#hm_"+input_id).css('display', 'block');
		
	}else if(what == 2){
		$("#hm_"+input_id).css('display', 'none');
		$("#wg_"+input_id).css('display', 'none');
		$("#wgq_"+input_id).css('display', 'none');
		$("#wd_"+input_id).css('display', 'block');
	}else if(what == 3)
	{
		$("#hm_"+input_id).css('display', 'none');
		$("#wd_"+input_id).css('display', 'none');
		$("#wg_"+input_id).css('display', 'block');
		$("#wgq_"+input_id).css('display', 'block');
	}
}

function cpHide(input_id)
{
	$("#wd_"+input_id).css('display', 'none');
	$("#hm_"+input_id).css('display', 'none');
	$("#wg_"+input_id).css('display', 'none');
	$("#wgq_"+input_id).css('display', 'none');
}

function calcRefund(ean, value)
{
	var total = $("#price_"+ean).val() * value;
	total = Math.round(total*100)/100;
	$("#refund_det_"+ean).html(total);
}
function janex(ean, ean_v, id1, id2, var_kind, v_fprice )
{
	$('#variations_'+ean).val(ean_v);
	$(id1).html(var_kind);
	$(id2).toggle(350);
}
function prepClick(ean)
{
	$('#preparation').toggle(350);
	if (!window.XMLHttpRequest)
	{
		var pos = findPosition('product_var_'+ean)
		$('#preparation').css('top', pos[1]-50);
		$('#preparation').css('left', pos[0]);
	}
}
function changeStErr(txt, val)
{
	$('#error_type').val(val);
	$('#err_title').html(txt);
}
function quteCancel()
{
    $('#for_q_i').val('0');
    $('.for_quote').css('display', 'none');
    $('#for_q_m').html('');
}
function basketChangeAddrr2()
{
    $('#new_change_addr').toggle();
}
function hightLightAddr2(id, count)
{
count++;
for (i=1; i < count; i++)
{
gel('baket_addr_'+i).style.backgroundColor = "#E7E7E7 ";
gel('baket_addr_'+i).style.color = "#5D5D5D";
}
gel('baket_addr_'+id).style.backgroundColor = "#5D5D5D";
gel('baket_addr_'+id).style.color = "#ffffff";
return false;
}