	function addMultiToCart(pId,cId){
		amount = dojo.byId('c_id_'+pId).value;
		window.location='./?act=addToCart&catId='+cId+'&pId='+pId+'&amount='+amount;
	}

	function setProductRating(isL,pId,value){
		if(isL > 0){
			ajaxRequest('index.php?act=setProductRating&pId='+pId+'&value='+value,'j_product_rate');
		}else{
			ans = window.confirm('Produkty oceniać mogę zalogowani użytkownicy. Czy chcesz się zalogować?');		
			if(ans){
				changeLocation('./?act=loginRequire');
			}
		}
	}
	
	function changeProductOnList(number,catId,search,v_sub){
		var suff = '';
		if(search != '')suff='&searcher=1';
		if(v_sub != '')suff=suff+'&v_sub='+v_sub;
		document.location='./?act=changeProductOnList&number='+number+'&catId='+catId+suff;
	}	

	function setDependentType(dependent){
		ajaxRequest('index.php?act=setDependentType&dependent='+dependent,'o_dependent');
	}	

	function check_user_form()
	{
		var required = function(field) {
			return ['companyName', 'nip', 'phone2', 'country'].indexOf(field.name) === -1;
		};
		var blank = function(field) { return field.value.length < 1; };
	
		var WZOR_EMAIL = /^[0-9a-zA-Z\.\-\_]+\@(([0-9a-zA-Z\-])+\.)+([a-zA-Z\-])+$/;
		var form_fields = document.forms['register_frm'].elements;
		
		for (var i = 0; i < form_fields.length; ++i) {
			var field = form_fields[i];
			if (required(field) && blank(field)) {
				alert('Proszę wypełnić wymagane pola formularza');
				return false;
			}
		}
	
		if(!WZOR_EMAIL.test(form_fields['email'].value))
		{
				alert('Proszę podać prawidłowy adres e-mail');
				return false;
		}
		
		if(form_fields['email'].value != form_fields['email2'].value)
		{
				alert('Adres e-mail niezgodny z powtórzeniem adresu e-mail');
				return false;
		}		
	
		if(form_fields['password'].value != form_fields['password2'].value)
		{
				alert('Hasło niezgodne z powtórzeniem hasła');
				return false;
		}	

		return true;
	}
	
	function check_user_pass()
	{
		var too_short = function(field) { return field.value.length < 3; };
		
		var form_fields = document.forms['password_frm'].elements;
		
		for (var i = 0; i < form_fields.length; ++i) 
		{
			var field = form_fields[i];
			if (too_short(field)) 
			{
				alert('Proszę wpisać hasło składające się z co najmniej 3 znaków.');
				return false;
			}
		}
	
		if(form_fields['password1'].value != form_fields['password2'].value)
		{
				alert('Hasło niezgodne z powtórzeniem hasła');
				return false;
		}	

		return true;
	}
	
	function check_buy_address_form()
	{
		var required = function(field) {
			return ['companyName', 'nip', 'phone2', 'addinfo', 'country'].indexOf(field.name) === -1;
		};
		var blank = function(field) { return field.value.length < 1; };
	
		var WZOR_EMAIL = /^[0-9a-zA-Z\.\-\_]+\@(([0-9a-zA-Z\-])+\.)+([a-zA-Z\-])+$/;
		var form_fields = document.forms['buy_address_frm'].elements;
		
		for (var i = 0; i < form_fields.length; ++i) {
			var field = form_fields[i];
			if (required(field) && blank(field)) {
				alert('Proszę wypełnić wymagane pola formularza');
				return false;
			}
		}
	
		if(!WZOR_EMAIL.test(form_fields['email'].value))
		{
				alert('Proszę podać prawidłowy adres e-mail');
				return false;
		}
		
		return true;		
	}
	
	
	/**
	 * Rozwijanie/zwijanie poszczeg�lnych kat. w drzewku produkt�w
	 */
	function toggleCategoryTree(category_id) {
		var category = $('cat_' + category_id);
		if (!category) return;
		Effect.toggle(category, 'blind', { duration: 0.3 });
		return false;
	}	
	
	
	function refreshUserAvatar(){
		ajaxRequest('index.php?act=refreshUserAvatar','curr_user_avatar');
	}
	
function pr_showData(pId){
		ajaxRequest('index.php?act=showProductData&pId='+pId,'product_tab_cont');
	}
	
	function pr_showGallery(pId){
		ajaxRequest('index.php?act=showProductGallery&pId='+pId,'product_tab_cont');
	}
	
	function pr_showClientsProduct(pId){
		ajaxRequest('index.php?act=showClientsProduct&pId='+pId,'product_tab_cont');
	}
	
	function pr_showComments(pId)
	{
		ajaxRequest('index.php?act=showProductComments&pId='+pId,'product_tab_cont');
	}
	
function tab_setChecked(tab_item,tab_name,twoLine)  
{
	var c = 1;
	var ul_tab = document.getElementById(tab_name+'_'+c);
	
	
	
	while(ul_tab != null)
	{
		if (twoLine) {
			ul_tab.className = 'com_tab com1 com_tab_two_line com1com1';
		} else {
			ul_tab.className = 'com_tab com1';
		}
		
		c++;
		ul_tab = document.getElementById(tab_name+'_'+c);
	}
			if (twoLine) {
				tab_item.className = 'com_tab com0 com_tab_two_line';
			} else {
				tab_item.className = 'com_tab com0';
			}
}	

/***********************************************
* Show Hint script- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
		
var horizontal_offset="0px" //horizontal offset of hint box from anchor link

/////No further editting needed

var vertical_offset="-15px" //horizontal offset of hint box from anchor link. No need to change.
var ie=document.all
var ns6=document.getElementById&&!document.all

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1
if (whichedge=="rightedge"){
var windowedge=ie && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-30 : window.pageXOffset+window.innerWidth-40
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth+parseInt(horizontal_offset)
}
else{
var windowedge=ie && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
}
return edgeoffset
}

function showhint(menucontents, obj, e, tipwidth){
if ((ie||ns6) && document.getElementById("hintbox")){
dropmenuobj=document.getElementById("hintbox")
dropmenuobj.innerHTML=menucontents
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (tipwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=tipwidth
}
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"
dropmenuobj.style.visibility="visible"
obj.onmouseout=hidetip
}
}

function hidetip(e){
dropmenuobj.style.visibility="hidden"
dropmenuobj.style.left="-500px"
}

function createhintbox(){
var divblock=document.createElement("div")
divblock.setAttribute("id", "hintbox")
document.body.appendChild(divblock)
}

if (window.addEventListener)
window.addEventListener("load", createhintbox, false)
else if (window.attachEvent)
window.attachEvent("onload", createhintbox)
else if (document.getElementById)
window.onload=createhintbox

var TOOLS = {


	showTab: function(tab,targ){
		var target = null;
		if(targ=='promo_tab')target = targ;
		else if(targ=='most_tab')target = targ;
		else if(targ=='view_tab')target = targ;
		if (target != null) {
			ajaxRequest('index.php?act=showTab&type=' + tab, target);
		}	
	}

}