function open_window(path, src)

{

 sY = 200;

 sX = 300;

 window.open(path+'window.php?src='+src,'wi','toolbar=no location=no,directories=no,status=yes,menubar=no, scrollbars=no,resizable=yes,fullscreen=no,channelmode=no,width='+sX+',height='+sY+',top=10,left=10');

} 

function open_window2(path, url, sX, sY)

{

scrollbars = 'no';

 if (sX>950) {

    sX=950;

    scrollbars = 'yes';

    }

  if (sY>700) {

    sY=700;

    scrollbars = 'yes';

    }



 window.open(path+'index.php?m=Main&a=ShowImage&imageUrl='+url,'wi','toolbar=no location=no,directories=no,status=yes,menubar=no, scrollbars='+scrollbars+',resizable=yes,fullscreen=no,channelmode=no,width='+sX+',height='+sY+',top=10,left=10');

}

function open_window3(path, url, sX, sY)

{

scrollbars = 'no';

 if (sX>950) {

    sX=950;

    scrollbars = 'yes';

    }

  if (sY>700) {

    sY=700;

    scrollbars = 'yes';

    }



 window.open(path+'getProductImage.php?imageUrl='+url,'wi','toolbar=no location=no,directories=no,status=yes,menubar=no, scrollbars='+scrollbars+',resizable=yes,fullscreen=no,channelmode=no,width='+sX+',height='+sY+',top=10,left=10');

}



function openProductImagesWindow(path, url, sX, sY)

{

 window.open(path+url,'wi2','toolbar=no location=no,directories=no,status=yes,menubar=no, scrollbars=no,resizable=yes,fullscreen=no,channelmode=no,width='+sX+',height='+sY+',top=10,left=10');

}





/* Sticky Tooltip script (v1.0)

* Created: Nov 25th, 2009. This notice must stay intact for usage 

* Author: Dynamic Drive at http://www.dynamicdrive.com/

* Visit http://www.dynamicdrive.com/ for full source code

*/

var stickytooltip={

	tooltipoffsets: [20, -30],

	fadeinspeed: 200, 

	rightclickstick: true, 

	stickybordercolors: ["black", "darkred"], 

	stickynotice1: ["Press \"s\"", "or right click", "to sticky box"],

	stickynotice2: "Click outside this box to hide it", 



	//***** NO NEED TO EDIT BEYOND HERE



	isdocked: false,



	positiontooltip:function($, $tooltip, e){

		var x=e.pageX+this.tooltipoffsets[0], y=e.pageY+this.tooltipoffsets[1]

		var tipw=$tooltip.outerWidth(), tiph=$tooltip.outerHeight(), 

		x=(x+tipw>$(document).scrollLeft()+$(window).width())? x-tipw-(stickytooltip.tooltipoffsets[0]*2) : x

		y=(y+tiph>$(document).scrollTop()+$(window).height())? $(document).scrollTop()+$(window).height()-tiph-10 : y

		$tooltip.css({left:x, top:y})

	},

	

	showbox:function($, $tooltip, e){

		$tooltip.fadeIn(this.fadeinspeed)

		this.positiontooltip($, $tooltip, e)

	},



	hidebox:function($, $tooltip){

		if (!this.isdocked){

			$tooltip.stop(false, true).hide()

			$tooltip.css({borderColor:'black'}).find('.stickystatus:eq(0)').css({background:this.stickybordercolors[0]}).html(this.stickynotice1)

		}

	},



	docktooltip:function($, $tooltip, e){

		this.isdocked=true

		$tooltip.css({borderColor:'darkred'}).find('.stickystatus:eq(0)').css({background:this.stickybordercolors[1]}).html(this.stickynotice2)

	},





	init:function(targetselector, tipid){

		jQuery(document).ready(function($){

			var $targets=$(targetselector)

			var $tooltip=$('#'+tipid).appendTo(document.body)

			if ($targets.length==0)

				return

			var $alltips=$tooltip.find('div.atip')

			if (!stickytooltip.rightclickstick)

				stickytooltip.stickynotice1[1]=''

			stickytooltip.stickynotice1=stickytooltip.stickynotice1.join(' ')

			stickytooltip.hidebox($, $tooltip)

			$targets.bind('mouseenter', function(e){

				$alltips.hide().filter('#'+$(this).attr('data-tooltip')).show()

				stickytooltip.showbox($, $tooltip, e)

			})

			$targets.bind('mouseleave', function(e){

				stickytooltip.hidebox($, $tooltip)

			})

			$targets.bind('mousemove', function(e){

				if (!stickytooltip.isdocked){

					stickytooltip.positiontooltip($, $tooltip, e)

				}

			})

			$tooltip.bind("mouseenter", function(){

				stickytooltip.hidebox($, $tooltip)

			})

			$tooltip.bind("click", function(e){

				e.stopPropagation()

			})

			$(this).bind("click", function(e){

				if (e.button==0){

					stickytooltip.isdocked=false

					stickytooltip.hidebox($, $tooltip)

				}

			})

			$(this).bind("contextmenu", function(e){

				if (stickytooltip.rightclickstick && $(e.target).parents().andSelf().filter(targetselector).length==1){ 

					stickytooltip.docktooltip($, $tooltip, e)

					return false

				}

			})

			$(this).bind('keypress', function(e){

				var keyunicode=e.charCode || e.keyCode

				if (keyunicode==115){ 

					stickytooltip.docktooltip($, $tooltip, e)

				}

			})

		}) 

	}

}



//stickytooltip.init("targetElementSelector", "tooltipcontainer")

stickytooltip.init("*[data-tooltip]", "mystickytooltip")



function delConfirm(link, elemName)

{

	if(confirm("Czy na pewno chcesz usunąć "+elemName+"?"))

		document.location=link;



	return false;

}

function openHelpWindow(file)

{

	sY = 10;

	sX = 300;

	window.open(file,'wi','toolbar=no location=no,directories=no,status=yes,menubar=no, scrollbars=no,resizable=yes,fullscreen=no,channelmode=no,width='+sX+',height='+sY+',top=10,left=10');

}

function elem(id)

{

    return document.getElementById(id);

}



function contactFormMail()

{

  advAJAX.post(

  {

	url : baseUrl+'index.php?m=Main&a=SendContactForm',

	parameters : {

		'client_email' : document.getElementById('client_email').value

	},

	onInitialization : function() {

	  document.getElementById('contactFormSending').style.display='block';

		  document.getElementById('contactFormSendingSuccess').style.display='none';

		  document.getElementById('contactFormSendingFailed').style.display='none';

	},

	onError : function() {

		 alert('Problem z wysłaniem zapytania. Spróbuj jeszcze raz.');

	},

	onSuccess : function(obj) {

		document.getElementById('contactFormSending').style.display='none';

		if (obj.responseText == "<br />") {

			document.getElementById('client_email').value = '';

			document.getElementById('contactFormSendingSuccess').style.display='block';

		}

		else {

			alert(obj.responseText);

			document.getElementById('contactFormSendingFailed').style.display='block';

			//document.getElementById('contactFormSendingFailed').innerHTML = obj.responseText;

		}

	}

  });

}

function addFormNewsletter()

{

  document.getElementById('newsletterFormSendingSuccess2').style.display='none';

  advAJAX.post(

  {

	url : baseUrl+'index.php?m=NewsLetter&a=AddNewsLetterEmail',

	parameters : {

		'ne_email' : document.getElementById('newsletter_email').value

	},

	onInitialization : function() {

	  document.getElementById('newsletterFormSending').style.display='block';

		  document.getElementById('newsletterFormSendingSuccess').style.display='none';

		  document.getElementById('newsletterFormSendingFailed').style.display='none';

	},

	onError : function() {

		 alert('Problem z wysłaniem zapytania. Spróbuj jeszcze raz.');

	},

	onSuccess : function(obj) {

		document.getElementById('newsletterFormSending').style.display='none';

		if (obj.responseText == "<br />") {

			document.getElementById('newsletter_email').value = '';

			document.getElementById('newsletterFormSendingSuccess').style.display='block';

		}

		else {

			alert(obj.responseText);

			document.getElementById('newsletterFormSendingFailed').style.display='block';

			//document.getElementById('contactFormSendingFailed').innerHTML = obj.responseText;

		}

	}

  });

}

function delFormNewsletter()

{

  document.getElementById('newsletterFormSendingSuccess').style.display='none';

  advAJAX.post(

  {

	url : baseUrl+'index.php?m=NewsLetter&a=DelNewsLetterEmail',

	parameters : {

		'ne_email' : document.getElementById('newsletter_email').value

	},

	onInitialization : function() {

	  document.getElementById('newsletterFormSending').style.display='block';

		  document.getElementById('newsletterFormSendingSuccess2').style.display='none';

		  document.getElementById('newsletterFormSendingFailed').style.display='none';

	},

	onError : function() {

		 alert('Problem z wysłaniem zapytania. Spróbuj jeszcze raz.');

	},

	onSuccess : function(obj) {

		document.getElementById('newsletterFormSending').style.display='none';

		if (obj.responseText == "<br />") {

			document.getElementById('newsletter_email').value = '';

			document.getElementById('newsletterFormSendingSuccess2').style.display='block';

		}

		else {

			alert(obj.responseText);

			document.getElementById('newsletterFormSendingFailed').style.display='block';

			//document.getElementById('contactFormSendingFailed').innerHTML = obj.responseText;

		}

	}

  });

}

function contactFormCheck()

{

    errorMsg = '';

    if (isEmpty(document.getElementById('client_email').value)) {

        errorMsg = 'Proszę wpisać adres e-mail';

    }



    if (errorMsg!='') {

        alert(errorMsg);

        return false;

    }



    return true;

}

function newsletterFormCheck()

{

    errorMsg = '';

    if (isEmpty(document.getElementById('newsletter_email').value)) {

        errorMsg = 'Proszę wpisać adres e-mail';

    }



    if (errorMsg!='') {

        alert(errorMsg);

        return false;

    }



    return true;

}



function isEmail(email)

{

    if(-1 == email.indexOf("@")

    	||(-1 != email.indexOf(","))

    	||(-1 != email.indexOf("#"))

    	||(-1 != email.indexOf("!"))

    	||(-1 != email.indexOf(" "))

    	||(-1 != email.indexOf(":"))

    	||(-1 != email.indexOf("("))

    	||(-1 != email.indexOf(")"))

    	//||(-1 != email.indexOf('"'))

    	//||(-1 != email.indexOf("\\"))

    	||(-1 != email.indexOf("/"))

    	||(email.length == (email.indexOf("@")+1) )

    	||(email.length == 0) )

	   return false;



  return true;

}

function isEmpty(theValue)

{

	if (theValue.toString().length==0)

		return true;

	else

		return false;

}



// jQuery SWFObject v1.1.1 MIT/GPL @jon_neal

// http://jquery.thewikies.com/swfobject

(function(f,h,i){function k(a,c){var b=(a[0]||0)-(c[0]||0);return b>0||!b&&a.length>0&&k(a.slice(1),c.slice(1))}function l(a){if(typeof a!=g)return a;var c=[],b="";for(var d in a){b=typeof a[d]==g?l(a[d]):[d,m?encodeURI(a[d]):a[d]].join("=");c.push(b)}return c.join("&")}function n(a){var c=[];for(var b in a)a[b]&&c.push([b,'="',a[b],'"'].join(""));return c.join(" ")}function o(a){var c=[];for(var b in a)c.push(['<param name="',b,'" value="',l(a[b]),'" />'].join(""));return c.join("")}var g="object",m=true;try{var j=i.description||function(){return(new i("ShockwaveFlash.ShockwaveFlash")).GetVariable("$version")}()}catch(p){j="Unavailable"}var e=j.match(/\d+/g)||[0];f[h]={available:e[0]>0,activeX:i&&!i.name,version:{original:j,array:e,string:e.join("."),major:parseInt(e[0],10)||0,minor:parseInt(e[1],10)||0,release:parseInt(e[2],10)||0},hasVersion:function(a){a=/string|number/.test(typeof a)?a.toString().split("."):/object/.test(typeof a)?[a.major,a.minor]:a||[0,0];return k(e,a)},encodeParams:true,expressInstall:"expressInstall.swf",expressInstallIsActive:false,create:function(a){if(!a.swf||this.expressInstallIsActive||!this.available&&!a.hasVersionFail)return false;if(!this.hasVersion(a.hasVersion||1)){this.expressInstallIsActive=true;if(typeof a.hasVersionFail=="function")if(!a.hasVersionFail.apply(a))return false;a={swf:a.expressInstall||this.expressInstall,height:137,width:214,flashvars:{MMredirectURL:location.href,MMplayerType:this.activeX?"ActiveX":"PlugIn",MMdoctitle:document.title.slice(0,47)+" - Flash Player Installation"}}}attrs={data:a.swf,type:"application/x-shockwave-flash",id:a.id||"flash_"+Math.floor(Math.random()*999999999),width:a.width||730,height:a.height||135,style:a.style||""};m=typeof a.useEncode!=="undefined"?a.useEncode:this.encodeParams;a.movie=a.swf;a.wmode=a.wmode||"opaque";delete a.fallback;delete a.hasVersion;delete a.hasVersionFail;delete a.height;delete a.id;delete a.swf;delete a.useEncode;delete a.width;var c=document.createElement("div");c.innerHTML=["<object ",n(attrs),">",o(a),"</object>"].join("");return c.firstChild}};f.fn[h]=function(a){var c=this.find(g).andSelf().filter(g);/string|object/.test(typeof a)&&this.each(function(){var b=f(this),d;a=typeof a==g?a:{swf:a};a.fallback=this;if(d=f[h].create(a)){b.children().remove();b.html(d)}});typeof a=="function"&&c.each(function(){var b=this;b.jsInteractionTimeoutMs=b.jsInteractionTimeoutMs||0;if(b.jsInteractionTimeoutMs<660)b.clientWidth||b.clientHeight?a.call(b):setTimeout(function(){f(b)[h](a)},b.jsInteractionTimeoutMs+66)});return c}})(jQuery,"flash",navigator.plugins["Shockwave Flash"]||window.ActiveXObject);



function showList(){

	$('.showlist li > span').click(function(){

		$('.showlist li .cornerBox').slideUp(300);

		$(this).parent().find('.cornerBox').slideDown(300);

		});

	}

function showMore(){
	$('.showMore').click(function(){
		$('.hidden').slideDown(400);
		$(this).hide();
	});

	$('.hideMore').click(function(){

		$('.hidden').slideUp(400);

		$('.showMore').show();

	});

	$('.awards').click(function(){

		$('.awardsBig').slideDown(400);

		$(this).hide();

	});

	$('.awardsBig').click(function(){

		$(this).slideUp(400);

		$('.awards').slideDown(400);

	});

}

function clickTr(){

  $(".category tbody tr td").click(function() {

  		top.location= $(this).parent().find('td:nth-child(2) a').attr('href');

  		return false;

  	});

	 if(!($('.shopCat').length)){
	   $(".shopTable tbody tr td").click(function() {
		  top.location= $(this).parent().find('td:first-child a').attr('href');
		  return false;
	  });
	}
	 if($('.shopCat').length)
  	$(".shopTable tbody tr td").css('cursor','default');
 }

function alignElement(){

	$('.choiceIn ul li img').each(function(){

		var wysokosc = (-($(this).height()))/2;

		var szerokosc = (-($(this).width()))/2;

		$(this).css('margin-top',wysokosc).css('margin-left',szerokosc);

		});

	$('.choiceIn ul li').click(function(){

		var whatIndex = $(this).index() + 1;

		$('.selectedIn ul li').hide();

		$('.selectedIn ul li:nth-child('+whatIndex+')').fadeIn();

	})

}

function parameters(){

	$('.sh1').click(function(){

		$('.hd1').slideDown();

		$(this).hide();

		$('.sh2').show();

		});

	$('.sh2').click(function(){

		$('.hd1').slideUp();

		$(this).hide();

		$('.sh1').show();

		});

	}

function showFb(){

	$(".fb-box").hover(function(){

			$(".fb-box").stop().animate({right : '0'},300)

		},function(){

		$(".fb-box").stop().animate({right : '-199px'},160)

	})

}

$(window).load(function(){

		alignElement();

	})

$(document).ready(

	function() {

		$('.backBtn').click(function(){

			history.go(-1);

			});

		$('.btn.closeLight').click(function(){

			$('#fancybox-wrap, #fancybox-overlay').fadeOut();

			});

		if(('.showlist').length){showList()};

		showMore();

		parameters();

		$(".light").fancybox({

				'titlePosition'		: 'inside',

				'transitionIn'		: 'none',

				'transitionOut'		: 'none'

			});

		$(".light2").fancybox2({

				'transitionIn'		: 'none',

				'overlayOpacity'    : '0',

				'showCloseButton'   : 'false',

				'transitionOut'		: 'fade',

				'titlePosition' 	: 'over',

				'titleFormat'		: 'null'

			});

		$(".fancyimg").fancybox2();

		$(".shop .contentIn .category th").click(function(){

				var whatTable = $(this).parent().parent().parent().find("tbody");

				$(whatTable).toggle(800);

		});

		$(".gallery li:nth-child(2n+1)").addClass("clearer");

		if(($('.category').length) || (('.shopTable').length))clickTr();

		showFb();

		}

);


