	var acttab;
	var mx_submenus = new Array();
	
	acttab = 1;
	
	function setVisibility(obj, how) {
		document.getElementById(obj).style.display = how;
	}

	function setVisibility22(obj, what) {
		document.getElementById(obj).style.background = what;
	}
	
	function toggleMenu(obj, toggle) {
		for(var mn in mx_submenus) {
			var mn = 'submenu'+mn;
			var ol = document.getElementById(mn+'left');
			ol.className = "display gr2 left-menu-link";
			
			try {
				document.getElementById(mn).style.display = 'none';
			} catch(err) {
				
			}
		}
		
		if(toggle == 0) {
			var ol = document.getElementById(obj+'left');
			
			if(ol.className == "display gr2 left-menu-link-act2") {
				ol.className = "display gr2 left-menu-link";
			} else {
				ol.className = "display gr2 left-menu-link-act2"
			}
			
			return;
		}
		
		if(document.getElementById(obj).style.display == "none") {
			document.getElementById(obj+'left').className = "display gr2 left-menu-link-act";
			$('#'+obj).animate({height: 'show'}, 300);
		} else {
			$('#'+obj).animate(
				{height: 'hide'}, 
				300,
				"",
				function() { document.getElementById(obj+'left').className = "display gr2 left-menu-link"; }
			);
		}
	}


	function refreshInsets(e,leftn,leftc,rightn,rightc,load_xajax,filter)
	{
			for (i = 0; i < 4; i++)
			{
			  if (i == (rightn-1))
			  {
          document.getElementById('b' + i).className = 'act_menu';
			  }
			  else
			  {
  			  if (i == rightn)
  			  {
            document.getElementById('b' + i).className = 'user_menu_la';
  			  }
  			  else
  			  {
  			    if (i == 0)
  			    {
              document.getElementById('b' + i).className = 'user_menu_l';
  			    }
  			    else
  			    {
              document.getElementById('b' + i).className = 'user_menu';
  			    }
  			  }
			  }
			}
			if (rightn == 4)
			{
        document.getElementById('rc').src = '/images/menu_activ_r.gif';
			}
			else
			{
        document.getElementById('rc').src = '/images/menu_passiv_r.gif';
			}
	  
		acttab = rightn;
		if (!acttab) acttab = 0;
		if (acttab == 1) acttab = 0;
		
		if (load_xajax){
			document.getElementById('processing').style.visibility = 'visible';
			xajax_TabChange(acttab, 1, filter);
		}
	}
	
	var exists;
	var allStretch;
	var lastobj;

	function inpscr(str){
		return str.replace("<BR>", "\n");
	}

	function submitRulers() {
		var var3 = '';
		var var2;
		var var1;
		
		var arrIndexPrice = new Array();
		var arrIndexSize = new Array();
		
		arrIndexPrice[1] = 200;
		arrIndexPrice[2] = 500;
		arrIndexPrice[3] = 800;
		arrIndexPrice[4] = 1000;
		arrIndexPrice[5] = 1500;
		arrIndexPrice[6] = 5000;

		arrIndexSize[1] = 7;
		arrIndexSize[2] = 10;
		arrIndexSize[3] = 13;
		arrIndexSize[4] = 16;
		arrIndexSize[5] = 17;
		arrIndexSize[6] = 19;

		var1 = arrIndexPrice[($("#slider_price").slider('values', 0))];
		var2 = arrIndexPrice[($("#slider_price").slider('values', 1))];
		var3 = var3 + 'fPrice>='+var1+';';
		var3 = var3 + 'fPrice<='+var2+';';

		var1 = arrIndexSize[($("#slider_size").slider('values', 0))];
		var2 = arrIndexSize[($("#slider_size").slider('values', 1))];
		var3 = var3 + 'fDisplaySize>='+var1+';';
		var3 = var3 + 'fDisplaySize<='+var2+';';
		
		var3 = Base64.encode(var3);
		var3 = var3.replace('=', '');
		var3 = var3.replace('=', '');
		
		location='/catalog/1/0/'+var3+'/';
	}
	
	function init(gr_id){
		try {
			var stretchers = $$('div.menu_content'); 
			var togglers = $$('div.display'); 
		
			preLoad = new Image(); preLoad.src = '/images/white-arrowd.gif';
		
			var myAccordion = new Fx.Accordion(togglers, stretchers, { opacity: false, alwaysHide: true,
		 		transition: Fx.Transitions.quadOut, show: gr_id, duration: 400,
			
				onActive: function(toggler, stretcher){
					toggler.setStyle('backgroundImage', 'url(\'/images/white-arrowd.gif\')');
				},
		
				onBackground: function(toggler, stretcher){
					toggler.setStyle('backgroundImage', 'url(\'/images/white-arrow.gif\')');
				}
			});
			document.getElementById('fl2_sidemenu').style.visibility = 'visible';
		} catch(e) {
		
		}
	}
	
	function ResetErrors(){
		var stretchers = $$('div.errorBox');
		stretchers.each(function(h3, i){
			h3.outerHTML="";
		});
	}

	function toggleActivity(element) {
		if ($(element).id=='newOfferContactsLink_inactive')
			$(element).id='newOfferContactsLink_active';
		else
			$(element).id='newOfferContactsLink_inactive';
	}
		
	function SwitchArrow(obj){
		if (obj.id != 'ch'){
			obj.style.backgroundImage='url(\'/images/white-arrowd.gif\')';
			if (lastobj) lastobj.style.backgroundImage='url(\'/images/white-arrow.gif\')';
		}
		lastobj = obj;
	} 
		
	function hidePayed(chk){
		if (chk){
			document.getElementById('checkbox1').disabled=true;
			document.getElementById('checkbox2').disabled=true;
			if (document.getElementById('checkbox2').checked) {
				payed2Slider.hide();
				document.getElementById('checkbox2').checked=false;
			}
			if (document.getElementById('checkbox1').checked) {
				payed1Slider.hide();
				document.getElementById('checkbox1').checked=false;
			}
		}
		else{
			document.getElementById('checkbox1').disabled=false;
			document.getElementById('checkbox2').disabled=false;
		}
	}
	
	
/**
*
*  Base64 encode / decode
*  http://www.webtoolkit.info/
*
**/
 
var Base64 = {
 
	// private property
	_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
 
	// public method for encoding
	encode : function (input) {
		var output = "";
		var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
		var i = 0;
 
		input = Base64._utf8_encode(input);
 
		while (i < input.length) {
 
			chr1 = input.charCodeAt(i++);
			chr2 = input.charCodeAt(i++);
			chr3 = input.charCodeAt(i++);
 
			enc1 = chr1 >> 2;
			enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
			enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
			enc4 = chr3 & 63;
 
			if (isNaN(chr2)) {
				enc3 = enc4 = 64;
			} else if (isNaN(chr3)) {
				enc4 = 64;
			}
 
			output = output +
			this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
			this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
 
		}
 
		return output;
	},
 
	// public method for decoding
	decode : function (input) {
		var output = "";
		var chr1, chr2, chr3;
		var enc1, enc2, enc3, enc4;
		var i = 0;
 
		input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
 
		while (i < input.length) {
 
			enc1 = this._keyStr.indexOf(input.charAt(i++));
			enc2 = this._keyStr.indexOf(input.charAt(i++));
			enc3 = this._keyStr.indexOf(input.charAt(i++));
			enc4 = this._keyStr.indexOf(input.charAt(i++));
 
			chr1 = (enc1 << 2) | (enc2 >> 4);
			chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
			chr3 = ((enc3 & 3) << 6) | enc4;
 
			output = output + String.fromCharCode(chr1);
 
			if (enc3 != 64) {
				output = output + String.fromCharCode(chr2);
			}
			if (enc4 != 64) {
				output = output + String.fromCharCode(chr3);
			}
 
		}
 
		output = Base64._utf8_decode(output);
 
		return output;
 
	},
 
	// private method for UTF-8 encoding
	_utf8_encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";
 
		for (var n = 0; n < string.length; n++) {
 
			var c = string.charCodeAt(n);
 
			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}
 
		}
 
		return utftext;
	},
 
	// private method for UTF-8 decoding
	_utf8_decode : function (utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;
 
		while ( i < utftext.length ) {
 
			c = utftext.charCodeAt(i);
 
			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			}
			else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}
			else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}
 
		}
 
		return string;
	}
 
}