﻿if (!window.MakoLab) window.MakoLab=new Object(); window.MakoLab.__namespace=true;
if (!window.MakoLab.Modules) window.MakoLab.Modules=new Object(); window.MakoLab.Modules.__namespace=true;
if (!window.MakoLab.Modules.Arcus) window.MakoLab.Modules.Arcus=new Object(); window.MakoLab.Modules.Arcus.__namespace=true;
if (!window.MakoLab.Modules.Arcus.Lead) window.MakoLab.Modules.Arcus.Lead=new Object();

MakoLab.Modules.Arcus.Lead.OnTINValidate=function(sender,e)
{
	var Value=e.Value.replace(/-/g,"");
	var ValidArray=[6,5,7,2,3,4,5,6,7];
	var ValidSum=0;
	for (var Index=0; Index<9; Index++)
		ValidSum+=ValidArray[Index]*parseInt(Value.charAt(Index));
	ValidSum=ValidSum%11;
	ValidSum=(ValidSum==10?0:ValidSum);
	e.IsValid=(ValidSum.toString()==Value.charAt(9)?true:false);
}

MakoLab.Modules.Arcus.Lead.OnUniqueIDValidate=function(sender,e)
{
	var Value=e.Value.replace(/-/g,"");
	var ValidArray=[8,9,2,3,4,5,6,7];
	var ValidSum=0;
	for (var Index=0; Index<8; Index++)
		ValidSum+=ValidArray[Index]*parseInt(Value.charAt(Index));
	ValidSum=ValidSum%11;
	ValidSum=(ValidSum==10?0:ValidSum);
	e.IsValid=(ValidSum.toString()==Value.charAt(8)?true:false);
}

if (!window.MakoLab.UI) window.MakoLab.UI=new Object(); window.MakoLab.UI.__namespace=true;
if (!window.MakoLab.UI.Skins) window.MakoLab.UI.Skins=new Object(); window.MakoLab.UI.Skins.__namespace=true;
if (!window.MakoLab.UI.Skins.Skin) window.MakoLab.UI.Skins.Skin=new Object();

MakoLab.UI.Skins.Skin.OnMenuMouseOver=function(evt,MenuID)
{
	if (!evt) evt=window.event;
	var Source=(evt.srcElement?evt.srcElement:evt.target);
	if ((Source!=null)&&(Source.id!=undefined)&&(Source.id!=null)&&(Source.id==MenuID)&&(Source.nodeParsed==undefined))
	{
		var Divs=Source.getElementsByTagName("div");
		if (Divs.length>0)
		{
			for (var Index=0; Index<Divs.length; Index++)
			{
				var SubMenu=document.getElementById(Divs[Index].id.replace(new RegExp("(.*)ctr(\\d+)","gi"),"$1sub$2"));
				if (SubMenu!=null)
				{
					SubMenu.parentNode.removeChild(SubMenu);
					Divs[Index].appendChild(SubMenu);
					Divs[Index].getElementsByTagName("span")[1].onclick=Divs[Index].onclick;
					Divs[Index].onmouseover=null;
					Divs[Index].onclick=function(evt)
					{
						if (!evt) evt=window.event;
						evt.cancelBubble=true;
						evt.returnValue=false;
						var Source=MakoLab.UI.Skins.Skin.currentMenuItem;
						if ((Source!=undefined)&&(Source!=null))
						{
							if (Source.className.toLowerCase().indexOf("selected")!= -1)
								Source.className=Source.className.replace(/(selected)/gi," $1");
							for (var Index=0; Index<Source.childNodes.length; Index++)
							{
								if ((Source.childNodes[Index].nodeType==1)&&(Source.childNodes[Index].nodeName.toLowerCase()=="table"))
								{
									Source.childNodes[Index].style.display="none";
									if (Source.childNodes[Index].className.toLowerCase().indexOf("selected")!= -1)
										Source.childNodes[Index].className=Source.childNodes[Index].className.replace(/(selected)/gi," $1");
								}
							}
						}
						Source=(evt.srcElement?evt.srcElement:evt.target);
						if (Source.className.toLowerCase().indexOf(" selected")!= -1)
							Source.className=Source.className.replace(/\s(selected)/gi,"$1");
						for (var Index=0; Index<Source.childNodes.length; Index++)
						{
							if ((Source.childNodes[Index].nodeType==1)&&(Source.childNodes[Index].nodeName.toLowerCase()=="table"))
							{
								Source.childNodes[Index].style.display=(Source.childNodes[Index].style.display=="none"?"":"none");
								if (Source.childNodes[Index].className.toLowerCase().indexOf(" selected")!= -1)
									Source.childNodes[Index].className=Source.childNodes[Index].className.replace(/\s(selected)/gi,"$1");
							}
						}
						MakoLab.UI.Skins.Skin.currentMenuItem=Source;
						return false;
					}
					Divs[Index].style.width="100%";
					Divs[Index].onmouseover=function(evt)
					{
						if (!evt) evt=window.event;
						var Source=(evt.srcElement?evt.srcElement:evt.target);
						Source.style.cursor="pointer";
					}
					Divs[Index].onmouseout=function(evt)
					{
						if (!evt) evt=window.event;
						var Source=(evt.srcElement?evt.srcElement:evt.target);
						Source.style.cursor="auto";
					}
					if (Divs[Index].className.toLowerCase().indexOf("selected")!= -1)
					{
						MakoLab.UI.Skins.Skin.currentMenuItem=Divs[Index];
					}
				}
			}
		}
		Source=Source.getElementsByTagName("span")[0].getElementsByTagName("span")[0];
		for (var Index=0; Index<Source.childNodes.length; Index++)
		{
			if ((Source.childNodes[Index].nodeType==1)&&(Source.childNodes[Index].nodeName.toLowerCase()=="table"))
			{
				var SubMenu=document.getElementById(Source.childNodes[Index].id.replace(new RegExp("(.*)sub(\\d+)","gi"),"$1ctr$2"));
				if (SubMenu!=null)
				{
					var Menu=Source.childNodes[Index];
					Menu.className=Menu.className.replace("MenuChildItem","MenuSubChildItem");
					Menu.parentNode.removeChild(Menu);
					SubMenu.cells[1].appendChild(Menu);
					Index--;
					SubMenu.onmouseover=null;
					if (SubMenu.onclick!=null)
					{
						SubMenu.getElementsByTagName("span")[1].onclick=SubMenu.onclick;
						SubMenu.onclick=function(evt)
						{
							if (!evt) evt=window.event;
							evt.cancelBubble=true;
							evt.returnValue=false;
							var Source=(evt.srcElement?evt.srcElement:evt.target);
							var IsSelected=(Source.parentNode.className.indexOf("MenuChildItemSelected")!=-1?true:false);
							for (var Index=0; Index<Source.childNodes.length; Index++)
							{
								if ((Source.childNodes[Index].nodeType==1)&&(Source.childNodes[Index].nodeName.toLowerCase()=="table"))
									Source.childNodes[Index].style.display=(Source.childNodes[Index].style.display=="none"?(IsSelected?"none":""):(IsSelected?"":"none"));
							}
							if (IsSelected)
								Source.parentNode.className=Source.parentNode.className.replace("MenuChildItemSelected","MenuChildItemselected");
							else if (Source.parentNode.className.indexOf("MenuChildItemselected")!= -1)
								Source.parentNode.className=Source.parentNode.className.replace("MenuChildItemselected","MenuChildItemSelected");
							return false;
						}
						SubMenu.onmouseover=function(evt)
						{
							if (!evt) evt=window.event;
							var Source=(evt.srcElement?evt.srcElement:evt.target);
							Source.style.cursor="pointer";
						}
						SubMenu.onmouseout=function(evt)
						{
							if (!evt) evt=window.event;
							var Source=(evt.srcElement?evt.srcElement:evt.target);
							Source.style.cursor="auto";
						}
					}
				}
			}
		}
		Source.nodeParsed=true;
	}
}

MakoLab.UI.Skins.Skin.OnLoad=function(evt)
{
	if (document.getElementById("MainMenu")!=null)
	{
		MakoLab.UI.Skins.Skin.OnMenuMouseOver({ target: document.getElementById("MainMenu") },"MainMenu");
		var Tables=document.getElementById("MainMenu").getElementsByTagName("table");
		for (var Index=0; Index<Tables.length; Index++)
		{
			for (var RowIndex=0; RowIndex<Tables[Index].rows.length; RowIndex++)
			{
				if (Tables[Index].rows[RowIndex].className.toLowerCase().indexOf("selected")!= -1)
				{
					Tables[Index].className=Tables[Index].rows[RowIndex].className;
					break;
				}
			}
		}
	}
	var ProductCategories=document.getElementById("ProductCategories");
	if (ProductCategories!=null)
	{
		var ContentWidth=0;
		var PrevCategory=null;
		var NextCategory=null;
		for (var Index=0; Index<ProductCategories.childNodes.length; Index++)
		{
			if ((ProductCategories.childNodes[Index].nodeType==1)&&(ProductCategories.childNodes[Index].style.display=="")&&
				(ProductCategories.childNodes[Index].className!="Feed"))
				ContentWidth+=ProductCategories.childNodes[Index].scrollWidth;
		}
		for (var Index=0; Index<ProductCategories.parentNode.childNodes.length; Index++)
		{
			if (ProductCategories.parentNode.childNodes[Index].className=="PrevCategory")
				PrevCategory=ProductCategories.parentNode.childNodes[Index];
			if (ProductCategories.parentNode.childNodes[Index].className=="NextCategory")
				NextCategory=ProductCategories.parentNode.childNodes[Index];
		}
		if (ContentWidth>ProductCategories.parentNode.clientWidth)
		{
			PrevCategory.style.display="";
			NextCategory.style.display="";
			ProductCategories.style.left=PrevCategory.scrollWidth+"px";
		}
	}
	MakoLab.UI.Skins.Skin.OnWindowResize(evt);
	window.onresize=MakoLab.UI.Skins.Skin.OnWindowResize;
	MakoLab.UI.Skins.Skin.OnValidatorsLoad(evt);
	if (window.s4upl)
	{
		s4uext=s4upl();
		var Img=document.createElement("img");
		Img.src="http://stat.4u.pl/cgi-bin/s.cgi?i=arcus10"+s4uext;
		Img.width=0;
		Img.height=0;
		document.body.appendChild(Img);
	}
	_uacct="UA-1800031-1";
	if (window.urchinTracker!=undefined)
		urchinTracker();
}

MakoLab.UI.Skins.Skin.OnValidatorsLoad=function()
{
	if ((Page_Validators!=undefined)&&(Page_Validators.length>0)&&(Page_Validators[0].addEventListener))
	{
		for (var Index=0; Index<Page_Validators.length; Index++)
		{
			if (Page_Validators[Index]._validatorHandled==undefined)
			{
				eval("document.getElementById(\""+Page_Validators[Index].id+"\").onpropertychange=function() { if (arguments.length>0) { arguments[0].propertyName=arguments[0].attrName; if (arguments[0].propertyName=='style') arguments[0].propertyName+='.visibility'; } "+Page_Validators[Index].getAttribute("onpropertychange")+" }");
				Page_Validators[Index].addEventListener("DOMAttrModified",Page_Validators[Index].onpropertychange,false);
				Page_Validators[Index]._validatorHandled=true;
			}
		}
	}
}

MakoLab.UI.Skins.Skin.OnWindowResize=function(evt)
{
	var IsMargin=((!window.opera?document.documentElement.clientWidth:document.body.clientWidth)>=1297?true:false);
	if (window.navigator.userAgent.indexOf("MSIE 6.0")== -1)
	{
		var Skin=null;
		var Form=document.forms['Form'];
		for (var Index=0; Index<Form.childNodes.length; Index++)
		{
			if ((Form.childNodes[Index].nodeType==1)&&(Form.childNodes[Index].className=="Skin"))
			{
				Skin=Form.childNodes[Index];
				break;
			}
		}
		if (Skin!=null)
		{
			var Height=0;
			var Margin=document.getElementById("Margin");
			if (Margin==null)
			{
				Margin=document.createElement("div");
				Margin.className="Margin";
				Margin.id="Margin";
			}
			for (var Index=0; Index<Skin.childNodes.length; Index++)
			{
				if (Skin.childNodes[Index].nodeType==1)
				{
					if ((Skin.childNodes[Index].nodeName.toLowerCase()=="div")&&(Skin.childNodes[Index].className!="Feed")&&(Skin.childNodes[Index].className!="Margin"))
					{
						if (Skin.childNodes[Index].className!="Bottom")
						{
							Skin.childNodes[Index].style.marginLeft=(IsMargin==true?"67px":"0px");
							if ((Skin.childNodes[Index].className=="Page")&&(Margin.parentNode==null))
							{
								if (!Skin.childNodes[Index].addEventListener)
									Skin.childNodes[Index].onresize=MakoLab.UI.Skins.Skin.OnPageHeightChanged;
								else
									Skin.childNodes[Index].addEventListener("DOMAttrModified",MakoLab.UI.Skins.Skin.OnPageHeightChanged,false);
							}
						}
						else
						{
							Margin.scanner=Skin.childNodes[Index];
							Height=Skin.childNodes[Index].offsetTop+(window.navigator.userAgent.indexOf("MSIE")!=1?(window.navigator.userAgent.indexOf("MSIE 6.0")!= -1?-2:-1):-1);
							Skin.childNodes[Index].getElementsByTagName("div")[0].style.marginLeft=(IsMargin==true?"71px":"0px");
							if ((window.navigator.userAgent.indexOf("MSIE")!= -1)&&(window.navigator.userAgent.indexOf("MSIE 6.0")!= -1))
								Skin.childNodes[Index].getElementsByTagName("div")[0].style.marginLeft=(IsMargin==true?"36px":"0px");
						}
					}
				}
			}
			Margin.style.height=Height+"px";
			if (IsMargin==true)
				Margin.style.display="";
			else
				Margin.style.display="none";
			if (Margin.parentNode==null)
				Skin.insertBefore(Margin,Skin.childNodes[0]);
		}
	}
}

MakoLab.UI.Skins.Skin.OnPageHeightChanged=function(evt)
{
	if (!evt) evt=window.event;
	var Source=(evt.srcElement?evt.srcElement:evt.target);
	var Margin=document.getElementById("Margin");
	if (Margin!=null)
		Margin.style.height=Margin.scanner.offsetTop+(window.navigator.userAgent.indexOf("MSIE")!=1?(window.navigator.userAgent.indexOf("MSIE 6.0")!= -1?-2:-1):-1)+"px";
}

MakoLab.UI.Skins.Skin.LoadLightBox=function()
{
	setTimeout("MakoLab.UI.Skins.Skin.ImportJS(window.location.protocol+\"//\"+window.location.host+MakoLab.UI.Skins.Skin.Path+\"../js/jquery.js\",\"jQuery\",MakoLab.UI.Skins.Skin.OnjQueryLoad);",100);
}

MakoLab.UI.Skins.Skin.ImportJS=function(Source,Object,OnLoadEventHandler)
{
	var Script=document.createElement("script");
	Script.type="text/javascript";
	Script.src=Source;
	if (OnLoadEventHandler)
		MakoLab.UI.Skins.Skin.ImportJSOnLoad(Object,OnLoadEventHandler);
	document.getElementsByTagName('head')[0].appendChild(Script);
}

MakoLab.UI.Skins.Skin.ImportJSOnLoad=function(Object,CallBack)
{
	var Interval=setInterval(function()
	{
		if (eval("typeof "+Object)!="undefined")
		{
			clearInterval(Interval);
			CallBack();
		}
	},50);
}

MakoLab.UI.Skins.Skin.OnjQueryLoad=function()
{
	jQuery.noConflict();
	MakoLab.UI.Skins.Skin.ImportJS(window.location.protocol+"//"+window.location.host+MakoLab.UI.Skins.Skin.Path+"../js/jquery.lightbox-0.5.js","lightbox",MakoLab.UI.Skins.Skin.OnLightBoxLoad);
}

MakoLab.UI.Skins.Skin.OnLightBoxLoad=function()
{
	jQuery('#Gallery a').lightBox({
		imageLoading: MakoLab.UI.Skins.Skin.Path+"images/lightbox-ico-loading.gif",
		imageBtnPrev: MakoLab.UI.Skins.Skin.Path+"images/lightbox-btn-prev.gif",
		imageBtnNext: MakoLab.UI.Skins.Skin.Path+"images/lightbox-btn-next.gif",
		imageBtnClose: MakoLab.UI.Skins.Skin.Path+"images/lightbox-btn-close.gif",
		imageBlank: MakoLab.UI.Skins.Skin.Path+"images/lightbox-blank.gif",
		containerBorderSize: 0,
		txtImage: "",
		txtOf: "/",
		keyToClose: "z",
		keyToPrev: "n",
		keyToNext: "p",
		fixedNavigation: true,
		showThumbnails: true
	});
}

MakoLab.UI.Skins.Skin.OnCategoryTabClick=function(evt,Container,ProductCategories,Category)
{
	if (!evt) evt=window.event;
	var Source=(evt.srcElement?evt.srcElement:evt.target);
	while (Source.nodeName.toLowerCase()!="a")
		Source=Source.parentNode;
	ProductCategories=document.getElementById(ProductCategories);
	for (var Index=0; Index<ProductCategories.childNodes.length; Index++)
	{
		if ((ProductCategories.childNodes[Index].nodeType==1)&&(ProductCategories.childNodes[Index].className!="Feed"))
		{
			if (ProductCategories.childNodes[Index].getElementsByTagName("a")[0].innerHTML==Source.innerHTML)
				ProductCategories.childNodes[Index].className+=" ProductCategorySelected";
			else
				ProductCategories.childNodes[Index].className=ProductCategories.childNodes[Index].className.replace(" ProductCategorySelected","");
		}
	}
	Container=document.getElementById(Container);
	for (var Index=0; Index<Container.childNodes.length; Index++)
	{
		if ((Container.childNodes[Index].nodeType==1)&&(Container.childNodes[Index].className!="Feed"))
		{
			if ((Container.childNodes[Index].id!=undefined)&&(Container.childNodes[Index].id==Category))
				Container.childNodes[Index].style.display="";
			else
				Container.childNodes[Index].style.display="none";
		}
	}
	evt.cancelBubble=true;
	evt.returnValue=false;
	return false;
}

MakoLab.UI.Skins.Skin.OnCategoryNavigationClick=function(evt,Direction,ProductCategories)
{
	if (!evt) evt=window.event;
	var Source=(evt.srcElement?evt.srcElement:evt.target);
	ProductCategories=document.getElementById(ProductCategories);
	var CurrentPosition=parseInt(ProductCategories.style.left.replace(/px/gi,""));
	var NewPosition=null;
	var TotalWidth=0;
	var ShiftSum=0;
	var CategoryTabs=0;
	var Count=0;
	switch (Direction)
	{
		case -1:
			{
				for (var Index=0; Index<ProductCategories.childNodes.length; Index++)
				{
					if ((ProductCategories.childNodes[Index].nodeType==1)&&(ProductCategories.childNodes[Index].className!="Feed")&&(ProductCategories.childNodes[Index].scrollWidth>0))
					{
						CategoryTabs++;
						if (NewPosition==null)
						{
							ShiftSum+=ProductCategories.childNodes[Index].clientWidth;
							if (ShiftSum-(22+Count*4)>Direction*CurrentPosition)
								NewPosition= -(ShiftSum+Direction*22+Count*4);
						}
						TotalWidth+=ProductCategories.childNodes[Index].clientWidth;
						Count++;
					}
				}
				if (TotalWidth-ShiftSum<ProductCategories.parentNode.clientWidth)
					NewPosition+=ProductCategories.parentNode.clientWidth-(TotalWidth-ShiftSum+44+(CategoryTabs-1)*4);
				break;
			}
		case 1:
			{
				for (var Index=0; Index<ProductCategories.childNodes.length; Index++)
				{
					if ((ProductCategories.childNodes[Index].nodeType==1)&&(ProductCategories.childNodes[Index].className!="Feed")&&(ProductCategories.childNodes[Index].scrollWidth>0))
					{
						CategoryTabs++;
						ShiftSum+=ProductCategories.childNodes[Index].clientWidth;
						if (ShiftSum-(-22+Count*4)<Math.abs(CurrentPosition))
							NewPosition= -(ShiftSum-22+Count*4);
						TotalWidth+=ProductCategories.childNodes[Index].clientWidth;
						Count++;
					}
				}
				if (NewPosition==null)
					NewPosition=26;
				if (NewPosition>26)
					NewPosition=0;
				break;
			}
	}
	ProductCategories.style.left=NewPosition+"px";
}

MakoLab.UI.Skins.Skin.SetCookie=function(Name,Val,Days,Path,Domain,Secure)
{
	var Expires;
	if (Days)
	{
		Expires=new Date();
		Expires.setTime(Expires.getTime()+(Days*24*60*60*1000));
	}
	document.cookie=Name+"="+escape(Val)+((Expires)?"; expires="+Expires.toGMTString():"")+((Path)?"; path="+Path:"")+((Domain)?"; domain="+Domain:"")+((Secure)?"; secure":"");
}

MakoLab.UI.Skins.Skin.ShowPopUp=function(Text,Url)
{
	var PopUp=window.open("","_blank","width=400,height=200,resizable=0,location=0,menubar=0,scrollbars=0,status=0,toolbar=0");
	if ((PopUp!=undefined)&&(PopUp!=null))
		PopUp.document.write(Text.replace(/\|Url\|/gi,Url));
}

MakoLab.UI.Skins.Skin.OnBackClick=function(evt)
{
	if (window.history.length>0)
		window.history.back();
	else
		window.location.href=window.location.protocol+"//"+window.location.host;
	return false;
}

if (window.addEventListener)
	window.addEventListener("load",MakoLab.UI.Skins.Skin.OnLoad,false);
else
	window.attachEvent("onload",MakoLab.UI.Skins.Skin.OnLoad);