function showHide(id) {
  
	obj = document.getElementById(id);
	obj.style.display = (obj.style.display == "block" ? "none" : "block");
}

function changeState(id) {

		obj = document.getElementById(id);
		document.getElementById(id).value = (obj.value == "open" ? "close" : "open");
}
	
function openBox(iid,cid) {
	image_wrapper = document.getElementById(iid+"_image_wrapper");
	comments_wrapper = document.getElementById(cid+"_comments_wrapper");
	if(image_wrapper.style.display == "none") {
		image_wrapper.style.display = "block";
	}
	
	if(comments_wrapper.style.display == "none") {
		comments_wrapper.style.display = "block";
	}
}
		   
function demo3(id, unique_id, p,div,subproduct) {
	advAJAX.setDefaultParameters({
	  onInitialization : function(obj) {
		//document.getElementById(obj.tag).innerHTML = "Preparing...";
	  },
	  onLoading : function(obj) {
		// document.getElementById(obj.tag).innerHTML = "<div class=\"loadingContainer\"><div>Loading...</div></div>";
	  },
	  onSuccess : function(obj) {
		document.getElementById(obj.tag).innerHTML = obj.responseText;
		// $(div).slide('toggle')
	  },
	  onError : function(obj) { document.getElementById(obj.tag).innerHTML = "Error..."; }
	});
	advAJAX.get({ url: "/tab.php?id="+id+"&unique_id="+unique_id+"&p="+p+"&subproduct="+subproduct, tag: id+unique_id+"_tab" });
	advAJAX.setDefaultParameters({});
}

function ga_load(div_id) {
  
	advAJAX.setDefaultParameters({
	  onInitialization : function(obj) { document.getElementById(obj.tag).innerHTML = "Preparing..."; },
	  onLoading : function(obj) { document.getElementById(obj.tag).innerHTML = "<div class=\"loadingContainer\" style=\"width: 220px; margin: 0 auto;\"><div style=\"text-align: center\">Gathering data from Google Analytics<br/>Please wait...</div></div>"; },
	  onSuccess : function(obj) { document.getElementById(obj.tag).innerHTML = obj.responseText;},
	  onError : function(obj) { document.getElementById(obj.tag).innerHTML = "Error..."; }
	});
	advAJAX.get({ url: "/inc_site/ga.php", tag: div_id });
	advAJAX.setDefaultParameters({});
}
	
function cartupdate(id, action, unique_id) 
{
	var amount = document.getElementById("ilosc"+id).value;
	var add_var = document.getElementById("add_var_"+id).value;
	var buy_options = document.getElementById("c_op_ins_"+unique_id).value;
	var buy_options_text = document.getElementById("c_op_ins_text_"+unique_id).value;
	 
	advAJAX.setDefaultParameters({
		onInitialization : function(obj) {
			document.getElementById(obj.tag).innerHTML = "Preparing...";
		},
		onLoading : function(obj) {
			document.getElementById(obj.tag).innerHTML = "Loading...";
		},
		onSuccess : function(obj) {
			document.getElementById(obj.tag).innerHTML = obj.responseText;
			updateCartComponent();
		},
		onError : function(obj) {
			document.getElementById(obj.tag).innerHTML = "Error...";
		}
	});
	advAJAX.get({ url: "/cart.php?ident="+id+"&amount="+amount+"&action="+action+"&add_var="+encodeURIComponent(add_var)+"&buy_options="+encodeURIComponent(buy_options)+"&buy_options_text="+encodeURIComponent(buy_options_text), tag: "shoppingCart" });
	advAJAX.setDefaultParameters({});
}
	
function infoAlbumUpdate(prodId) {
	advAJAX.setDefaultParameters({
		onInitialization : function(obj) {
			//document.getElementById(obj.tag).innerHTML = "Preparing...";
		},
		onLoading : function(obj) {
			// document.getElementById(obj.tag).innerHTML = "Loading...";
		},
		onSuccess : function(obj) {
			//document.getElementById(obj.tag).innerHTML = obj.responseText;
			updateInfoalbumComponent()
		},
		onError : function(obj) {
			document.getElementById(obj.tag).innerHTML = "Error...";
		}
	});
	advAJAX.get({ url: "/cart.php?action=infoalbum&prodId="+prodId, tag: "infoalbumClipboard" });
	advAJAX.setDefaultParameters({});
}	
function loadCommentLink(commentsUniqueId,gid,module,page) {
	advAJAX.setDefaultParameters({
		onLoading : function(obj) {
			//document.getElementById(commentsUniqueId+"_link").innerHTML = "<img src=/img/ajax-loader.gif border=0>";
		},
		onSuccess : function(obj) {
			document.getElementById(commentsUniqueId+"_link").innerHTML = obj.responseText;
			FB.XFBML.parse(document.getElementById(commentsUniqueId+"_link"));
		}
	});
	advAJAX.get({ url: "/inc/loadCommentLink.php?page="+page+"&gid="+gid+"&module="+module+"&commentsUniqueId="+commentsUniqueId });
	advAJAX.setDefaultParameters({});
}

function loadPic(gid, ext, unique, module, prod_id) {
	index = eval('g'+unique+'_index');
	if((typeof window.allowSwitchPic == 'undefined' || window.allowSwitchPic=='true')  &&  (typeof index == 'undefined' || index!=gid) ) {
		window.allowSwitchPic = 'false';
		advAJAX.setDefaultParameters({
			onLoading : function(obj) {
			},
			onSuccess : function(obj) {
				var effect = new Fx.Tween(obj.tag, {duration: 300});

				var bigPicContainer = document.getElementById('g'+unique);
				if(eval('g'+unique+'_status') == 'closed')
				{
					if(bigPicContainer.style.display == "none")
					{
						bigPicContainer.fade('hide');
						bigPicContainer.style.display = "block";
						var loadPicture = function() {
							if(document.getElementById(obj.tag).innerHTML = obj.responseText)
							{
								effect.start('opacity', 1).chain(function(){
									window.allowSwitchPic = 'true';
									//Slimbox.scanPage();
								});
							}								
						}
						eval('g'+unique+"_status = 'opened'");
						//Slimbox.scanPage();
					}
				}
				
				else {
					var loadPicture = function() {
						effect.start('opacity', 0).chain(
						function(){
							if(document.getElementById(obj.tag).innerHTML = obj.responseText)
							{
								effect.start('opacity', 1).chain(function(){
									window.allowSwitchPic = 'true';
									
									//Slimbox.scanPage();
								});
							}
						});
					}
				}
				var errorFunc = function() {
					window.allowSwitchPic = 'true';
				}
				if(module=='CATPIC')
					var directory = 'categories';
				else if(module=='PRODPIC')
					var directory = 'products';
				
				var myImage = new Asset.image('/storage/webshop_'+directory+'_pic/'+gid+'_main.'+ext, {
					id: 'myImage',
					title: 'myImage',
					onload: loadPicture,
					onerror: errorFunc
				});				
			}
		});
		advAJAX.get({ url: "/inc/changePic.php?gid="+gid+"&ext="+ext+"&module="+module+"&unique="+unique+"&prod_id="+prod_id, tag: "g"+unique });
		advAJAX.setDefaultParameters({});
		eval("g"+unique+"_index = '"+gid+"'");
	}
}			
	
function gallery(gallery, st) {
	advAJAX.setDefaultParameters({
	  onInitialization : function(obj) { document.getElementById(obj.tag).innerHTML = "Preparing..."; },
	  onLoading : function(obj) { document.getElementById(obj.tag).innerHTML = "<img src=/img/mobileshop/loader.gif alt='Loading...' title='Loading...'>"; },
	  onSuccess : function(obj) { document.getElementById(obj.tag).innerHTML = obj.responseText; },
	  onError : function(obj) { document.getElementById(obj.tag).innerHTML = "Error..."; }
	});
	advAJAX.get({ url: "/include/gallery.php?gallery="+gallery+"&st="+st, tag: "gallery_box" });
	advAJAX.setDefaultParameters({});
}		
			
function galleryCategoryList(picId, catId, page) {	
	advAJAX.setDefaultParameters({
			  onLoading : function(obj) { document.getElementById("categoryList").innerHTML = "Loading"; },
	  onSuccess : function(obj) { document.getElementById("categoryList").innerHTML = obj.responseText; }
	});
	advAJAX.get({ url: "/inc_site/galleryCategoryList.php?picId="+picId+"&catId="+catId+"&page="+page });
	advAJAX.setDefaultParameters({});
}		
	
function changeText(picId) {	
	advAJAX.setDefaultParameters({
			  onLoading : function(obj) { document.getElementById("categoryList").innerHTML = "Loading"; },
	  onSuccess : function(obj) { document.getElementById("categoryList").innerHTML = obj.responseText; }
	});
	advAJAX.get({ url: "/inc_site/galleryCategoryList.php?picId="+picId+"&catId="+catId+"&page="+page });
	advAJAX.setDefaultParameters({});
}	
	
function maillist(mail,sname) {
	advAJAX.setDefaultParameters({
			  onLoading : function(obj) { document.getElementById("maillist").innerHTML = "Loading"; },
	  onSuccess : function(obj) { document.getElementById("maillist").innerHTML = obj.responseText; }
	});
	advAJAX.get({ url: "/inc_site/mailing.php?mail="+mail+"&sname="+encodeURIComponent(sname) });
	advAJAX.setDefaultParameters({});
}	
	
function sendMail(message_id, groups) {
	advAJAX.setDefaultParameters({
			  onLoading : function(obj) { document.getElementById("inputBox").innerHTML = " <img src=/img/ajax-loader.gif border=0>"; },
	  onSuccess : function(obj) { document.getElementById("inputBox").innerHTML = obj.responseText; }
	});
	advAJAX.get({ url: "/inc_site/sendMail.php?message_id="+message_id+"&groups="+groups });
	advAJAX.setDefaultParameters({});
}

function addComment(uid, id, module, div, page) {
	var sname="sname"+uid;
	var string="string"+uid;
	var text="text"+uid;
	var form_data="form_data"+uid;
	var uid="message"+uid;
	//var page="page"+page
					 
	document.getElementById(uid).innerHTML = "Loading... <img src=/img/ajax-loader.gif border=0>";
		 
	if (document.getElementById(text)) {
		var checkedText = document.getElementById(text).value;
	} else {
		var checkedText = "";
	}
	
	if (document.getElementById(form_data)) {
		var checkedUpl = document.getElementById(form_data);
	} else {
		var checkedUpl = "";
	}			 

	JsHttpRequest.query('/inc_site/addComment.php', {
			'name': document.getElementById(sname).value, 
			'module': module,
			'div': div,
			'id': id,
			'string': document.getElementById(string).value,  
			'text': checkedText,
			'page': page,
			'upl': checkedUpl
		},
			// Function is called when an answer arrives. 
		function(result, errors) {
			    // Write errors to the debug div.
			document.getElementById(uid).innerHTML = errors; 
		},
		false  // do not disable caching
	);
}
	
function load_file(uid) {
	var form_data = "form_data"+uid;
	var output = "attach"+uid;
		 
	document.getElementById(output).innerHTML = "Loading... <img src=/img/ajax-loader.gif border=0>";
				 
	if (document.getElementById(form_data)) {
		var checkedUpl = document.getElementById(form_data);
	} else {
		var checkedUpl = "";
	}			 
		 
	JsHttpRequest.query('/inc_site/load_file.php', {
			'uid': uid,
			'upl': checkedUpl
		},
		// Function is called when an answer arrives. 
		function(result, errors) {
			// Write errors to the debug div.
			document.getElementById(output).innerHTML = errors; 
		},
		false  // do not disable caching
	);
}	
   
function displayFBComment(id, module, div, amount, imageIndex, width) {
	if(typeof width == "undefined") {
		width = 490;
	}
	advAJAX.setDefaultParameters({
		onLoading : function(obj) {
		},
		onSuccess : function(obj) {
			document.getElementById(obj.tag).innerHTML = obj.responseText;
			FB.XFBML.parse(document.getElementById(obj.tag));
		}
	});
	advAJAX.get({
		url: "/inc/prepareFBCommentUrl.php?id="+id+"&module="+module+"&imageIndex="+imageIndex+"&width="+width, tag: div
	});
	advAJAX.setDefaultParameters({});
}
		
function displayComment(id, module, div, amount, page_id) {	
	advAJAX.setDefaultParameters({
		onLoading : function(obj) {
			document.getElementById(obj.tag).innerHTML = "<img src=/img/ajax-loader.gif border=0>";
		},
		onSuccess : function(obj) {
			document.getElementById(obj.tag).innerHTML = obj.responseText;
		}
	});
	advAJAX.get({
		url: "/include/addCommentsAndMedia.php?id="+id+"&module="+module+"&div="+div+"&amount="+amount+"&page="+page_id, tag: div
	});
	advAJAX.setDefaultParameters({});
}	
	
function delComment(id, unique) {	
	advAJAX.setDefaultParameters({
		onLoading : function(obj) {
			document.getElementById(obj.tag).innerHTML = "Loading...";
		},
		onSuccess : function(obj) {
			document.getElementById(obj.tag).innerHTML = obj.responseText;
		}
	});
	advAJAX.get({
		url: "/inc_site/delComment.php?id="+id, tag: "del"+unique
	});
	advAJAX.setDefaultParameters({});
}					
	
function updateCartComponent() {	
    if(!document.getElementById("updateCartComponent")) return;
	advAJAX.setDefaultParameters({
		onLoading : function(obj) {
			//document.getElementById("updateCartComponent").innerHTML = "Loading...";
		},
		onSuccess : function(obj) {
			$("updateCartComponent").set('tween', {
					duration: 500
				});
			$("updateCartComponent").fade('out');
			update = (function() {
				document.getElementById("updateCartComponent").innerHTML = obj.responseText;
			}).delay(500);
			fadein = (function() {
				$("updateCartComponent").fade('in')
			}).delay(500);
			if(Browser.Engine.trident) {
				removeFilter = (function() {
					$("updateCartComponent").style.removeAttribute('filter');
				}).delay(1400);
			}
		}
	});
	advAJAX.get({ url: "/inc_site/updateCartComponent.php" });
	advAJAX.setDefaultParameters({});
}

function updateInfoalbumComponent() {	
    if(!document.getElementById("infoalbumClipboard")) return;
	advAJAX.setDefaultParameters({
		onLoading : function(obj) {
			//document.getElementById("updateCartComponent").innerHTML = "Loading...";
		},
		onSuccess : function(obj) {
			$("infoalbumClipboard").set('tween', {
					duration: 500
				});
			$("infoalbumClipboard").fade('out');
			update = (function() {
				document.getElementById("infoalbumClipboard").innerHTML = obj.responseText;
			}).delay(500);
			fadein = (function() {
				$("infoalbumClipboard").fade('in')
			}).delay(500);
			if(Browser.Engine.trident) {
				removeFilter = (function() {
					$("infoalbumClipboard").style.removeAttribute('filter');
				}).delay(1400);
			}
		}
	});
	advAJAX.get({ url: "/inc_site/updateInfoalbumComponent.php" });
	advAJAX.setDefaultParameters({});
}
	
function orderDetails(id) {
	advAJAX.setDefaultParameters({
		onInitialization : function(obj) {
			document.getElementById(obj.tag).innerHTML = "Preparing...";
		},
		onLoading : function(obj) {
			document.getElementById(obj.tag).innerHTML = "Loading...";
		},
		onSuccess : function(obj) {
			document.getElementById(obj.tag).innerHTML = obj.responseText;
		},
		onError : function(obj) {
			document.getElementById(obj.tag).innerHTML = "Error...";
		}
	});
	advAJAX.get({
		url: "/inc_site/orderDetails.php?id="+id, tag: "orderDetail"+id
	});
	advAJAX.setDefaultParameters({});
}	
		
function saveOrderComment(id) {
	advAJAX.setDefaultParameters({
		onInitialization : function(obj) { document.getElementById(obj.tag).innerHTML = "Preparing..."; },
		onLoading : function(obj) { document.getElementById(obj.tag).innerHTML = "Loading..."; },
		onSuccess : function(obj) { document.getElementById(obj.tag).innerHTML = obj.responseText; },
		onError : function(obj) { document.getElementById(obj.tag).innerHTML = "Error..."; }
	});
	advAJAX.get({ url: "/../inc_site/saveOrderComment.php?id="+id+"&comment="+encodeURIComponent(document.getElementById("orderCommment"+id).value), tag: "commentStatus"+id });
	advAJAX.setDefaultParameters({});
}	
		
function loadWebshopPic(element_id, id, ext) {
	advAJAX.setDefaultParameters({
		onLoading : function(obj) { document.getElementById(element_id).innerHTML = "Loading..."; },
		onSuccess : function(obj) { 
			document.getElementById(element_id).innerHTML = obj.responseText; 
		}
	});
	advAJAX.get({ url: "/inc/changeWebshopPic.php?id="+id+"&ext="+ext });
	advAJAX.setDefaultParameters({});
}	
																			
function question(mail,sname,productid,firstname,phone,randomnr) {  	
	advAJAX.setDefaultParameters({
		onLoading : function(obj) { document.getElementById(obj.tag).innerHTML = "<br>Loading...<br><br>"; },
		onSuccess : function(obj) { document.getElementById(obj.tag).innerHTML = obj.responseText; }
	});
	advAJAX.get({ url: "inc_site/question.php?mail="+mail+"&sname="+encodeURIComponent(sname)+"&productid="+productid+"&firstname="+encodeURIComponent(firstname)+"&phone="+phone+"&random="+randomnr, tag: "question"+randomnr });
	advAJAX.setDefaultParameters({});
}	
	
function saveTranslations(text_id, lang_id) {
		
	var languages = lang_id.split("|");
	var modifiedUrl = "/inc_site/saveTranslations.php?";

	/* modified for compatibility with Mootools */
	languages.each(function(val, indeks) {
		modifiedUrl += "&tr_"+text_id+"_"+languages[indeks]+"="+encodeURIComponent($("sentence_"+text_id+"_"+languages[indeks]).value);
	})
	
	/* old version 
	for(indeks in languages)
	{
		modifiedUrl += "&tr_"+text_id+"_"+languages[indeks]+"="+encodeURIComponent(document.getElementById("sentence_"+text_id+"_"+languages[indeks]).value);
	}
	*/
	
	advAJAX.setDefaultParameters({
		onInitialization : function(obj) { document.getElementById(obj.tag).innerHTML = "Preparing..."; },
		onLoading : function(obj) { document.getElementById(obj.tag).innerHTML = "Loading..."; },
		onSuccess : function(obj) { document.getElementById(obj.tag).innerHTML = obj.responseText; },
		onError : function(obj) { document.getElementById(obj.tag).innerHTML = "Error..."; }
	});
	advAJAX.get({ url: modifiedUrl, tag: "msg_"+text_id });
	advAJAX.setDefaultParameters({});
}			
	
function translationsList(cId, containerTarget) {
	advAJAX.setDefaultParameters({
		onLoading : function(obj) { document.getElementById(containerTarget).innerHTML = "Loading"; },
		onSuccess : function(obj) { document.getElementById(containerTarget).innerHTML = obj.responseText; }
	});
	advAJAX.get({ url: "/inc_site/translationsList.php?cId="+cId });
	advAJAX.setDefaultParameters({});
}	
	
function translationsListSingleSentence(cId, containerTarget) {
	advAJAX.setDefaultParameters({
		onLoading : function(obj) { document.getElementById(containerTarget).innerHTML = "Loading"; },
		onSuccess : function(obj) { document.getElementById(containerTarget).innerHTML = obj.responseText; }
	});
	advAJAX.get({ url: "/inc_site/translationsListSingleSentence.php?cId="+cId });
	advAJAX.setDefaultParameters({});
}			
	
	// admin functions
function currencyRates() {	
	advAJAX.setDefaultParameters({
		onLoading : function(obj) { document.getElementById("currencyRates").innerHTML = "Update under process, be patient <img src=/img/ajax-loader.gif border=0>"; },
		onSuccess : function(obj) { document.getElementById("currencyRates").innerHTML = obj.responseText; }
	});
	advAJAX.get({ url: "/inc_site/currency.php" });
	advAJAX.setDefaultParameters({});
}		
	
	// admin functions
function search_domain(domain_name, tld) {	
	advAJAX.setDefaultParameters({
		onLoading : function(obj) {
			document.getElementById("domains_results").innerHTML = "<img src=\"/img/ajax-loader.gif\" border=\"0\">";
		},
		onSuccess : function(obj) {
			document.getElementById("domains_results").innerHTML = obj.responseText;
			window.addEvent( 'domready', function(){
				$$( '.moreInfoWrapper' ).each(function(item){
					var boxSlider = new Fx.Slide( item.getElement( '.moreInfo' ), { duration: 500 } );
					boxSlider.hide();
					item.getElements( '.divToggle' ).addEvent( 'click', function() {
						boxSlider.toggle();
						wrapper = item.getElement( '.moreInfo' ).getParent();
						update = (function() {
							wrapper.setStyle('height', '')
						}).delay(1000);
					});
				} );
			} );
		},
		onError : function(obj) {
			document.getElementById("domains_results").innerHTML = "Error...";
		}	
	});
	advAJAX.get({ url: "/inc_site/334.inc.php?domain_name="+encodeURIComponent(domain_name)+"&tld="+tld });
	advAJAX.setDefaultParameters({});
}

function update_buy_options(buy_option_id, product_id, div_id, type) {
  
	advAJAX.setDefaultParameters({
	  //onInitialization : function(obj) { document.getElementById(div_id).innerHTML = "Preparing..."; },
	  //onLoading : function(obj) { document.getElementById(div_id).innerHTML = "<div class=\"loadingContainer\"><div>Loading...</div></div>"; },
	  onSuccess : function(obj) { document.getElementById(div_id).innerHTML = obj.responseText; },
	  onError : function(obj) { document.getElementById(div_id).innerHTML = "Error..."; }
	});
	advAJAX.get({ url: "/inc_site/update_buy_options.php?product_id="+product_id+"&buy_option_id="+buy_option_id+"&buy_option_type="+type, tag: "c_op_"+div_id });
	advAJAX.setDefaultParameters({});
}

function goto_cart() {
	window.location = "/handlekurv/";
}


function update_buy_options_cart(buy_option_id, product_id, div_id, type, element) {
{
	if(document.getElementById("ilosc"+div_id))
		products_count = document.getElementById("ilosc"+div_id).value;
	else if(document.getElementById("ilosc"+product_id))
		products_count = document.getElementById("ilosc"+product_id).value;
	var text = '';
	var price = "";
	var ins_opt = '';
	var ins_opt_text = "";
	var theForm = element.form, z = 0;
	for(z=0; z<theForm.length;z++){
		if(theForm[z].type != 'text')
		{
			val = theForm[z].value.split('|');
			if(theForm[z].type == 'checkbox' && theForm[z].checked == true)
			{
				if(val[1]!="")
				{
					ins_opt += val[0]+",";
				}
			}
			else if(theForm[z].type == 'select-one')
			{
				if(val[0]!='')
					ins_opt += val[0]+",";
			}
			else if(theForm[z].type == 'radio' && theForm[z].checked == true && theForm[z].value != '')
			{
				ins_opt += val[0]+",";
			}
		}
		else
		{
			nameArr = theForm[z].id.split("_");
			name = nameArr[3];
			if(theForm[z].value != '')
				ins_opt_text += name+","+theForm[z].value+'|';
		}
	}
	document.getElementById("c_op_ins_"+div_id).value = ins_opt;
	document.getElementById("c_op_ins_text_"+div_id).value = ins_opt_text;
}
	advAJAX.setDefaultParameters({
		onSuccess : function(obj) { document.getElementById(obj.tag).innerHTML = obj.responseText; },
		onError : function(obj) { document.getElementById(obj.tag).innerHTML = "Error..."; }
	});
	advAJAX.get({ url: "/inc_site/update_buy_options.php?page=cart_tab&unique_id="+div_id+"&product_id="+product_id+"&products_count="+products_count+"&buy_options_text="+ins_opt_text+"&buy_options="+ins_opt+"&buy_option_type="+type, tag: "c_op_"+div_id });
	advAJAX.setDefaultParameters({});
}

function save_buy_options(product_id, div_id) {
	options = document.getElementById("c_op_ins_"+div_id).value;
	products_count = document.getElementById("ilosc"+div_id).value;
	text = document.getElementById("c_op_ins_text_"+div_id).value;
	advAJAX.setDefaultParameters({
	});
	advAJAX.get({ url: "/inc_site/update_buy_options.php?page=cart_tab&action=update&product_id="+product_id+"&buy_options="+options+"&text="+text+"&unique_id="+div_id+"&products_count="+products_count, tag: "c_op_"+div_id });
     advAJAX.setDefaultParameters({});
}

function update_buy_opt_text(element, div_id) {
	if(element.value != '')
	{
		nameArr = element.id.split("_");
		name = nameArr[3];
		document.getElementById("c_op_ins_text_"+div_id).value = name+','+element.value+'|';
	}
	else
		document.getElementById("c_op_ins_text_"+div_id).value = '';
}

function update_products_count(product_id,div_id,element){
	options = document.getElementById("c_op_ins_"+div_id).value;
	text = document.getElementById("c_op_ins_text_"+div_id).value;
	products_count = element.value;
	advAJAX.setDefaultParameters({
		onSuccess : function(obj) { document.getElementById(obj.tag).innerHTML = obj.responseText; },
		onError : function(obj) { document.getElementById(obj.tag).innerHTML = "Error..."; }
	});
	advAJAX.get({ url: "/inc_site/update_buy_options.php?page=cart_tab&unique_id="+div_id+"&product_id="+product_id+"&products_count="+products_count+"&buy_options="+options+"&buy_options_text="+text, tag: "c_op_"+div_id });
	advAJAX.setDefaultParameters({});
}

function confirm_delete_from_cart(message,id){
	if(confirm(message)) {
		advAJAX.setDefaultParameters({
			onSuccess : function(obj) {
				updateCartComponent();
			},
			onError : function(obj) { document.getElementById(obj.tag).innerHTML = "Error..."; }
		});
		advAJAX.get({ url: "/inc_site/updateCart.php?action=delete&id="+id });
		advAJAX.setDefaultParameters({});
	}
}

function update_product_in_cart(id){
	ilosc = document.getElementById("ilosc_"+id).value;
	advAJAX.setDefaultParameters({
		onSuccess : function(obj) {
			updateCartComponent();
		},
		onError : function(obj) { document.getElementById(obj.tag).innerHTML = "Error..."; }
	});
	advAJAX.get({ url: "/inc_site/updateCart.php?action=update&id="+id+"&ilosc="+ilosc });
	advAJAX.setDefaultParameters({});
}

function confirm_delete_from_clipboard(message,id){
	if(confirm(message)) {
		advAJAX.setDefaultParameters({
			onSuccess : function(obj) {
				updateInfoalbumComponent();
			},
			onError : function(obj) { document.getElementById(obj.tag).innerHTML = "Error..."; }
		});
		advAJAX.get({ url: "/inc_site/updateCart.php?action=delete_clipboard&id="+id });
		advAJAX.setDefaultParameters({});
	}
}

function get_fb_like_example() {
	layout = document.getElementById("fb_like_button_layout").value;
	color = document.getElementById("fb_like_button_color").value;
	example = '<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com&amp;layout='+layout+'&amp;show_faces=false&amp;width=450&amp;action=like&amp;colorscheme='+color+'&amp;height=25" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:25px;" allowTransparency="true"></iframe>';
	document.getElementById('fb_likebox_example').innerHTML = example;
}
