var requiredMajorVersion = 8;
var requiredMinorVersion = 0;
var requiredRevision = 0;



if (!this.JSON) {
JSON = {};
}
(function(){function f(n){return n<10?'0'+n:n;}
if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return this.getUTCFullYear()+'-'+
f(this.getUTCMonth()+1)+'-'+
f(this.getUTCDate())+'T'+
f(this.getUTCHours())+':'+
f(this.getUTCMinutes())+':'+
f(this.getUTCSeconds())+'Z';};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
if(typeof rep==='function'){value=rep.call(holder,key,value);}
switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
v=partial.length===0?'[]':gap?'[\n'+gap+
partial.join(',\n'+gap)+'\n'+
mind+']':'['+partial.join(',')+']';gap=mind;return v;}
if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+
mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
return str('',{'':value});};}
if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
return reviver.call(holder,key,value);}
cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+
('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
throw new SyntaxError('JSON.parse');};}})();



$(document).ready(function() { 

	$(".ajax_status").bind("ajaxSend", function() {
	   $(".ajax_status").addClass("ajax-loading");
	}).bind("ajaxComplete", function(){
	   $(".ajax_status").removeClass("ajax-loading");
	});
	

	
	if ($(".imgzoom"))
	$(".imgzoom").fancybox();
	
	
	if ($(".OptName"))
	$('body').click(function(e){
	
		//	document.title = e.pageX +', '+ e.pageY + ', ' + e.target.className;

		if ($(e.target).hasClass("stayVis") == false) {
		
			$(".OptName span").removeClass("clicked");
			$(".OptVal").removeClass("vis");
			
		}
	
	});
	
	
	if ($("#miniImages")) {
	
		$("#miniImages").scrollable({
			size:3,
			vertical:true
		}); 


		$("#GalleryScrollDown").bind("click", function() {
			$("#miniImages").scrollable("next");
		});
		
		$("#GalleryScrollUp").bind("click", function() {
			$("#miniImages").scrollable("prev");
		});
		
	}
	
	
		if ($(".pages_scroll_box_scr")) {

		var pg_scroll_api = $(".pages_scroll_box_scr").scrollable({
			size: 10, speed:200,
			activeClass:'div_active',
			items:'page_a',
			onSeek:function() {
			
				var status = this.getStatus(); 
				
				if (status.index >= (status.total - status.size)) {
					$(".pages_scroll_next").fadeOut();
				} else {
					$(".pages_scroll_next").fadeIn();
				}
				
				if (status.index == 0) {
					$(".pages_scroll_prev").fadeOut();
				} else {
					$(".pages_scroll_prev").fadeIn();
				}
				
				//document.title = status.index + " / " + status.total;

			}
     
		}); 

		$(".pages_scroll_next").bind("click", function() {
	
			$(".pages_scroll_box_scr").scrollable("next");
			
		});

		$(".pages_scroll_prev").bind("click", function() {
			$(".pages_scroll_box_scr").scrollable("prev");
		});
		
		var page_to_seek = Math.ceil($("#page_no").attr("value") / 10) - 1;

		$(".pages_scroll_box_scr").scrollable("setPage", page_to_seek);
	
	}

	
	
	if ($.browser.version != "6.0")
	styleCheckboxesAndRadiobuttons();


	$('.prmSelect').selectbox({debug: true});

 
	
	
	   

	
	$("#log_container").bind("click", function(e){
	    ShowLog();
	});
	
	if ($("#login_form")) 
	
		$(".login_input").bind("click blur focus", function(e){
		    if ($(this).val() == "El. paštas" || $(this).val() == "Password") $(this).val("");
		});
		
		$("#login_form").submit(function() {
	        var post_data = $("#login_form").serialize();
	        $.post("index.php?page=users&act=check_login&ajax=1", post_data, function(data){

					if ($.trim(data) == "") {
						window.location = "http://www.a11.lt/lt/mod/users/info.htm";
					} else {
						ShowLog();
						$("#log").html(data);
					}
	        
			});
	        return false;
	    });


	 if ($("#login_f")) 
	
		$(".login_input").bind("click blur focus", function(e){
		    if ($(this).val() == "El. paštas" || $(this).val() == "Password") $(this).val("");
		});
		
		$("#login_f").submit(function() {
	        var post_data = $("#login_f").serialize();
	       
	        $.post("index.php?page=users&act=check_login&ajax=1", post_data, function(data){
					if ($.trim(data) == "") {
						window.location = "http://www.a11.lt/lt/mod/cart/order.htm";
					} else {
						ShowLog();
						$("#log").html(data);
					}
	        
			});
	        return false;
	    });
	
	
	if ($("#AddToCartButton"))
	$("#AddToCartButton").click(function(){

	    var post_data = $("#catalog_item_form").serialize();
			
		$.post("index.php?page=cart&act=insert&ajax=1", post_data, function(data){
		
		//if ($.trim(data) == "") {
			  $("#cart_box").load("index.php?page=cart&act=show_box&ajax=1");
			 	
	   // } else {
				ShowLog(hide = true);
				$("#log").html(data);
	//	}
			  
		});
		
		}
		
	);
	

	if ($("#CompareButton"))
	$("#CompareButton").click(function(){

		    var post_data = $("#catalog_item_form").serialize();
				
			$.post("index.php?page=cart&act=add_compare&ajax=1", post_data, function(data){
			
					if ($.trim(data) == "") {
						$("#compare_box").load("index.php?page=cart&act=show_compare_box&ajax=1");
					} else {
						ShowLog();
						$("#log").html(data);
					}
			
				  
				  
			});
		
	});
	

	
	if ($("#order_form"))
	$("#order_form").submit(function() {
		
	        var post_data = $("#order_form").serialize();
			
	        $.post("index.php?page=cart&act=check_delivery_data&ajax=1", post_data, function(data){
			
	                if ($.trim(data) == "") {
						

						window.location.href=$("#order_form").attr("action");
						
					} else {
						ShowLog();
						$("#log").html(data);
					} 
					
					

	        });

	        return false;

	});	
	
	if ($("#order_payment"))
	
	$("#order_payment").submit(function() {
		
	        var post_data = $("#order_payment").serialize();
			
	        $.post("index.php?page=cart&act=check_payment_data&ajax=1", post_data, function(data){
			//alert($.trim(data));
	                if ($.trim(data) == "") {
						

			//$.post("index.php?page=cart&act=show_google&ajax=1", post_data, function(data){
				
			//});
 
	        $.post("index.php?page=cart&act=check_summary&ajax=1", post_data, function(data){

					//window.location.href=$(".cart_summary").attr("action");
					if ($.trim(data) == "") {
						window.location.href=$("#order_payment").attr("action");
					} else {
						
						$("#log").html(data);
						ShowLog();
					}
			});
	        return false;

						//window.location.href=$("#order_payment").attr("action");
						
					} else {
						ShowLog();
						$("#log").html(data);
					} 
					
					

	        });

	        return false;

	});
	
	
	
	if ( $("#password_form"))
	$("#password_form").submit(function() {
		
	        var post_data = $("#password_form").serialize();
			
	        $.post("./lt/mod/users/recover_password.htm?ajax=1", post_data, function(data){

	                if ($.trim(data) == "") {
						$("#log_inline").load("index.php?page=users&act=message&ajax=1&password_sent=1");
						$("#password_form").fadeOut("slow");
						
					} else {

						$("#log_inline").html(data);
						
					}
	        
			});
	        return false;
	});
	
	
	
	
	if ($("#favoritesForm")) {
		$("#favoritesForm").submit(function() {

	        var post_data = $("#favoritesForm").serialize();
	        $.post("index.php?page=cart&act=add_favorites&ajax=1", post_data, function(data){

					if ($.trim(data) == "") {
					
						var submit_url = $("#submit_url").val();
						window.location.href = submit_url;

					} else {
						
						$("#log").html(data);
						ShowLog();
					}
	        
			});
	        return false;
	    });
		
	}
	
	
	
	if ($(".cart_summary")) {
	
		$(".cart_summary").submit(function() {
		var post_data
			if ($("#agree").attr("checked") == false) {
				
					 $.post("index.php?page=cart&act=check_summary_del&ajax=1", post_data, function(data){
					 if ($.trim(data) == "") {
						window.location.href=$(".cart_summary").attr("action");
					} else {
						$("#log").html(data);
						ShowLog();
					}
			});
			return false;
			}
	    });
		
	}
	
	
	
	
	
	
	
	if ($("#registration_form")) {

	
			if ($("#is_new_registration").val() != "1") {
				if ($("input[name='buyer_type']").val() == "1") {
					highlight_1();
				} else if ($("input[name='buyer_type']").val() == "2") {
					highlight_2();
				}
			}
	
		    $("#registration_form").submit(function() {
			
			
						if ($("#agree").attr("checked") == false) {
					 $.post("index.php?page=cart&act=check_summary_err&ajax=1", post_data, 
					 function(data){
						$("#log").html(data);
						ShowLog();
			}
 			);
			return false;
			}
				
				
			
		        var post_data = $("#registration_form").serialize();
				
		        $.post("index.php?page=users&act=check_registration&ajax=1", post_data, function(data){

		                if ($.trim(data) == "") {
						
							var is_new_reg = $("#is_new_registration").val();
							
							if (is_new_reg == 1) {
								$("#log_inline").load("./lt/mod/users/message.htm?ajax=1&user_registration_ok=1");
								$("#registration_form").fadeOut("slow");
							} else {
								$("#log_inline").load("./lt/mod/users/message.htm?ajax=1&user_update_ok=1");
								$("#registration_form").fadeOut("slow");
							}

						} else {
							ShowLog();
							$("#log").html(data);
						} 

		        });

		        return false;

		});
		
	}
		

});


function ShowLog(hide) {

	if ($("#log_container").css("display") != "none") {
		$("#log_container").fadeOut();
	} else if (hide == true) {
		$("#log_container").fadeIn();
		$(document).ready(function() {
		    setTimeout(function() {
		        $("#log_container").fadeOut();
		    }, 1000);
		}); 
	} else {
		$("#log_container").fadeIn();
	}

}









function RemoveFilter(Id) {
	
	$(".filter_input_"+Id).attr("value", "");
	$(".filter_input_"+Id).attr("checked", "");
	
	$("#OptName"+Id+" span").removeClass("active");

}





function activateFilter(Id) {

		var check_size = 0;
		check_size = $("#OptVal"+Id).find("input[@type=checkbox][@checked]").size();
		check_size2 = $("#OptVal"+Id).find("input[@type=text][value!='']").size(); 
		check_size = check_size + check_size2;
		
		if (check_size > 0) {
			$("#OptName"+Id+" span").addClass("active");
		} else {
			$("#OptName"+Id+" span").removeClass("active");
		}
		
}







function SelectFilter(Id) {

	if ($("#OptVal"+Id)) {
		
		if ($("#OptVal"+Id).hasClass("vis") == false) {
			
			$(".OptName span").removeClass("clicked");
			$(".OptVal").removeClass("vis");
			
			el_offset = $("#OptName"+Id).position();
			$("#OptVal"+Id).css("top", el_offset.top + 19);
			$("#OptVal"+Id).css("left", el_offset.left);
			$("#OptVal"+Id).addClass("vis");
			$("#OptName"+Id+" span").addClass("clicked");

		}
		else {
		
			$(".OptName span").removeClass("clicked");
			$(".OptVal").removeClass("vis");
			
		}
		
	}

}



function commentSubmit() {
				
					var dd = document.getElementById("comment_form");
					var n=0;
				    var err="\n";
						
					var txt = Array();
					
					if (dd.author.value == "") {
					   txt[n]="Vardas";
					   n+=1;
					}
					
					if (dd.comment.value == "") {
					   txt[n]="Komentaras";
					   n+=1;
					}

					if (n >= 1) {
						for (i=0; i<txt.length; i++) {
						  if (txt[i]!="") {
								err += "Neužpildytas laukas ";
								err += '"' + txt[i] + '"';
								err += "\n";
							 } 
						 }
						alert (err);
						return false;
					} else {
						dd.scrt.value = "63985";
						return true;
					}
	
					

				}


	function CheckField(Field, required_fields) {

		if ((( $('[name=' + Field + ']').val() == "" )) && ( InArray(Field, required_fields) )) {
		
			$("#"+Field+"_ast").addClass("status_error");
		
			return true;
			
		} else {
		
			return false;
		
		}

	}
	
	function InArray(needle, haystack, strict) {

		var found = false, key, strict = !!strict;

	    for (key in haystack) {
	        if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {
	            found = true;
	            break;
	        }
	    }

	    return found;
	}


	function CheckForm(required_fields) {
	
		$(".asterix > span").removeClass("status_error");
		var allow_submit = true;
			
		if (required_fields.length == 0) return false;
		
		
		
		
		
		for (i=0;i < required_fields.length; i++) {
			if (CheckField(required_fields[i], required_fields))
			allow_submit = false;
		}
		
		if ($("#in_gift_form").attr("value") == "1") {
		
			if ($("#agreed").attr("checked") == "") allow_submit = false;
		
		}

		
		if (allow_submit) {
			$(".butt_submit").attr("disabled", "");
			return true; 
		}
		else {
			return false;
		}
	
	}









function ChangeOrder(val) {

	$("input[@name='order']").attr("value", val);

	$("#CatalogForm").submit();
}

function ChangeSort(val) {

	if (val) $("input[@name='order']").attr("value", 'DESC');
	//if (val == 'created') $("input[@name='order']").attr("value", 'DESC');
	//if (val == 'final_price') $("input[@name='order']").attr("value", 'ASC');
	//if (val == 'title') $("input[@name='order']").attr("value", 'ASC');
	if (val == 'no') $("input[@name='order']").attr("value", 'ASC');
	
	$("input[@name='sort1']").attr("value", val);
	$("#CatalogForm").submit();

}

function ChangePerPage(val) {

	$("input[@name='perpage']").attr("value", val);
	$("#CatalogForm").submit();

}



function MakeFavorite(obj, id) {


	if ($(obj).is(':checked')) {
		$.post("index.php?page=users&ajax=1&act=insert_favorite&id=" + id, '', function(data){ });	
	} else {
		$.post("index.php?page=users&ajax=1&act=remove_favorite&id=" + id, '', function(data){ });
	}

	return false;
	
}

function UseBonusPoints(obj) {

	if ($(obj).is(':checked')) {
		$.post("index.php?page=cart&ajax=1&act=bonus_points&use=1", '', function(data){
		
		if ($("#cart_main")) $("#cart_main").load("index.php?page=cart&ajax=1");
		
		});	
	} else {
		$.post("index.php?page=cart&ajax=1&act=bonus_points&use=0", '', function(data){
		if ($("#cart_main")) $("#cart_main").load("index.php?page=cart&ajax=1");
		});
	}
	
	
	   
	
}

function RemoveFavorite(id) {

	$.post("index.php?page=users&ajax=1&act=remove_favorite&id=" + id, '', function(data){
		$("#maintext").load("index.php?page=users&act=favorites&ajax=1");
	});

}

function remove_cart_item(item_nr) {
	    $.post("index.php?page=cart&act=remove_item&id=" + item_nr, '', function(data){
			if ($("#cart_box")) $("#cart_box").load("index.php?page=cart&act=show_box&ajax=1");
			if ($("#cart_main")) $("#cart_main").load("index.php?page=cart&ajax=1");
	   
	    });
}


function remove_compare_item(item_nr) {
	    $.post("index.php?page=cart&act=remove_compare_item&id=" + item_nr, '', function(data){
			if ($("#compare_box")) $("#compare_box").load("index.php?page=cart&act=show_compare_box&ajax=1");
			if ($("#compare_main")) $("#compare_main").load("index.php?page=cart&act=compare&ajax=1");
	   
	    });
}



function MakeImgActive(no) {

	var sel_title = $("#gallery_img_title_"+no).val();
	var sel_img_path = $("#gallery_img_path_"+no).val();
	var sel_thumb_path = $("#gallery_thumb_path_"+no).val();
	
	$("#gallery_main_img").attr("title", sel_title);
	$("#gallery_main_img").attr("href", sel_img_path);
	$("#gallery_main_img").css("background-image", 'url('+sel_thumb_path+')');

	$(".miniImg").attr("rel", "efor");
	$("#miniImg"+no).attr("rel", "");

	$(".miniImg").removeClass("activeImg");
	$("#miniImg"+no).addClass("activeImg");

}





function UpdateCart(sbm) {

		var post_data = $("#cart_form").serialize();
		$.post("index.php?page=cart&act=update_counts&ajax=1", post_data, function(data){
	
		if ($.trim(data) != '') {
			data = JSON.parse(data);
		}
		
		if ($.trim(data.title) == "") {
			if ($("#cart_box")) $("#cart_box").load("index.php?page=cart&act=show_box&ajax=1");
			if ($("#cart_main")) $("#cart_main").load("index.php?page=cart&ajax=1");
			
			if (sbm == 1) {
				$("#cart_form").submit();
			}

			
	    } else {
				ShowLog();
				$("#log").html(data.info[0]);
				$("p.sl_cost"+data.det[0]).html('Siūlome pirkti: ' + data.sum[0]);
		}
			
	});
	
}


function OfferSubmit() {

	var post_data = $("#catalog_item_form").serialize();
	
	$.post("index.php?page=cart&act=offer_price&ajax=1", post_data, function(data){
			ShowLog();
			$("#log").html(data);
	});
	
}


function open_wnd(exp_bar,width,height,url,status_bar,scrolls) {
        winName = "_blank";
        theURL = url;
        page_height = (height != '')?height:600;
        page_width = (height != '')?width:500;
        toolbar = (exp_bar == 1)?'yes':'no';
		scrollbars = (scrolls == 1)?'yes':'auto';
        statusbar = (status_bar == 1)?'yes':'no';
        page_top = Math.round((screen.height-page_height)/2);
        page_left = Math.round((screen.width-page_width)/2);
        size = "width="+page_width+",height="+page_height+",top="+page_top+",left="+page_left;
        features = 'status='+statusbar+',toolbar='+toolbar+',scrollbars='+scrollbars+',resizable=yes,'+size;
        window.open(theURL,winName,features);
}

function CartOpenTab3() {
	$("#order_form").submit();
}

function CartOpenTab4() {
	$(".cart_summary").submit();
}

function highlight_1() {
	$("#field5, #field6, #field7, #field9, #field10, #field8, #field11, #field0b").addClass("inactive");
	$("#field1, #field2, #field0a").removeClass("inactive");
	$('#field1 input, #field2 input').attr("disabled", false); 
	$('#field5 textarea, #field6 input, #field7 input, #field8 input, #field9 input, #field10 input, #field11 input').attr("disabled", true); 
}

function highlight_2() {
	$("#field1, #field2, #field11, #field0a").addClass("inactive");
	$("#field5, #field6, #field7, #field8, #field11, #field0b, #field9, #field10").removeClass("inactive");
	$('#field5 textarea, #field6 input, #field7 input, #field8 input, #field9 input, #field10 input, #field11 input').attr("disabled", false); 
	$('#field1 input, #field2 input').attr("disabled", true); 
	
	
}

function show_discount_code(item) {
			
			if ($(item).attr("checked")) {
				$("#discount_input").fadeIn();
			} else {
				$("#discount_input").fadeOut();
			}
}






	function AddToCart(id) {
	
		$("#product_id").attr("value", id);

	    var post_data = $("#CatalogForm").serialize();
			
		$.post("index.php?page=cart&act=insert&ajax=1", post_data, function(data){
		
			
			  $("#cart_box").load("index.php?page=cart&act=show_box&ajax=1");
			  			ShowLog(hide = true);
						$("#log").html(data);
			
			  
		});
		
	}
		
		
		
		

	function Compare(id) {
	
		$("#product_id").attr("value", id);

		    var post_data = $("#CatalogForm").serialize();
				
			$.post("index.php?page=cart&act=add_compare&ajax=1", post_data, function(data){
			
					if ($.trim(data) == "") {
						$("#compare_box").load("index.php?page=cart&act=show_compare_box&ajax=1");
					} else {
						ShowLog();
						$("#log").html(data);
					}
			
				  
				  
			});
		
		}
		
		






function styleCheckboxesAndRadiobuttons() {


	var elements = document.getElementsByTagName('input');
	for (i = 0; i < elements.length; i++) {
		if (elements[i].type == 'checkbox' || elements[i].type == 'radio') {	
			switch (elements[i].className) {

				case 'FavoriteCheckbox':
					createAlternateCheckboxOrRadiobutton(elements[i], i);
				break;

			}
		}
	}
}

function createAlternateCheckboxOrRadiobutton(element, num) {
	var defaultClass = element.className + '-default';
	// Hide the original checkbox.
	element.style.display='none';
	
	// creates the new alternate checkbox
	var altElement = document.createElement('div');
	
	if (element.checked == true) {
		altElement.className = element.className;
	} else {
		altElement.className = defaultClass;
	}
	
	altElement.id = 'alt-' + element.id;
	

	
	element.parentNode.appendChild(altElement);

	// Handles onclick event.
	altElement.onclick = function(){
	
		if (element.checked != true) {
			if (element.type == 'radio') {
			  handleOnClickForRadiobuttons(element.name);
			}
			altElement.className = element.className;
			element.checked = true;
			$.post("index.php?page=users&ajax=1&act=insert_favorite&id=" + element.value, '', function(data){ 	});	
		} else {
			if (element.type == 'radio') {
				handleOnClickForRadiobuttons(element.name);
			}
			altElement.className = defaultClass;
			element.checked = false;
			$.post("index.php?page=users&ajax=1&act=remove_favorite&id=" + element.value, '', function(data){ 	});
		}

		
	}
	
	
	
}

function handleOnClickForRadiobuttons(name) {
	var radiobuttons = document.getElementsByName(name);
	for (i = 0; i < radiobuttons.length; i++) {
			if (radiobuttons[i].type == 'radio') {
			var altRadiobutton = document.getElementById('alt-' + radiobuttons[i].id);
			altRadiobutton.className = radiobuttons[i].className + '-default';
		}
	}
}

function ValidateNumber(fld) {
       window.status = "";
       fld.value=fld.value.replace(',','.');
}
