			function showsearch(id){
				document.getElementById(id).className = "on";
			}
			function hideseach(id){
				document.getElementById(id).className = "off";
			}
			function getBrowserInfo() {
			 var t,v = undefined;
			 if (window.opera) t = 'Opera';
			 else if (/MSIE (5\.5|6|7).+Win/.test(navigator.userAgent)) {
			  t = 'IE';
			  var nv = navigator.appVersion;
			  var s = nv.indexOf('MSIE')+5;
			  v = nv.substring(s,s+1);
			 }
			 else if (navigator.appName) t = 'Netscape';
			 return {type:t,version:v};
			}
			 
			function bookmark(a){
			 var url = window.document.location;
			 var title = window.document.title;
			 var b = getBrowserInfo();
			 if (b.type == 'IE' && 8 >= b.version && b.version >= 4) window.external.AddFavorite(url,title);
			 else if (b.type == 'Opera') {
			  a.href = url;
			  a.rel = "sidebar";
			  a.title = url+','+title;
			  return true;
			 }
			 else if (b.type == "Netscape") window.sidebar.addPanel(title,url,"");
			 else alert("Нажмите CTRL-D, чтобы добавить страницу в закладки.");
			 return false;
			}
			
			

	$(document).ready(function(){
		$("#pic_tables img").click(function(){
			
			var pic_num;
			pic_num = $(this).attr("class").replace("door", "");
			jQuery.post("/templates/svobodacentr/image.php", {pic: pics[pic_num]}, function(data){
				$("#door").replaceWith('<div id="door">'+data+'</div>');
			});
			$("#door_top").css("background-image", "url("+pics[pic_num]+")");
			$("#door_handle").css("background-image", "url("+pics[pic_num]+")");
			
			$("#prices1").html($("#doorprice"+pic_num).html());
		});
		
		
		$("#pic_tables span").click(function(){
			
			var pic_num;
			pic_num = $(this).attr("class").replace("doorname", "");
			jQuery.post("/templates/svobodacentr/image.php", {pic: pics[pic_num]}, function(data){
				$("#door").replaceWith('<div id="door">'+data+'</div>');
			});
			$("#door_top").css("background-image", "url("+pics[pic_num]+")");
			$("#door_handle").css("background-image", "url("+pics[pic_num]+")");
			
			$("#prices1").html($("#doorprice"+pic_num).html());
		});
		
		$("#loading").ajaxStart(function(){
			$(this).show();
		})
		.ajaxComplete(function(){
			$(this).hide();
		});
			  
		$('#form_file').ajaxForm({
			beforeSubmit: function(a,f,o) {
				o.dataType = "html";
			},
			success: function(data) {
				if (/errorall/.test(data)) {
					$('#res').html("Ошибка импорта. Возможно Вы просто не прикрепили файлик для импорта");	
				}
				if (/errorfile/.test(data)) {
					$('#res').html("Ошибка файла. Неправильное расширение. Импорт возможен только из файлов csv");	
				}
				if (/erroropen/.test(data)) {
					$('#res').html("Ошибка. Не удалось открыть файл импорта");	
				}
				if (/errorload/.test(data)) {
					$('#res').html("Ошибка загрузки файла.");	
				}
				if (/ok/.test(data)) {
					$('#res').html("Импорт успешно осуществлен.");	
				}
				$("#price").val("");
			}
		});		

	});
	function startelem(){
			jQuery.post("/templates/svobodacentr/image.php", {pic: pics[1]}, function(data){
				$("#door").replaceWith('<div id="door">'+data+'</div>');
			});
			$("#door_top").css("background-image", "url("+pics[1]+")");
			$("#door_handle").css("background-image", "url("+pics[1]+")");
			$("#prices1").html($("#doorprice1").html());
	}
	
	
	
	

	function step2(){
		$.ajax({
			url: "/modules/main/template/custom.php/menu.php",
			type: "POST",
			data: ({catalog: $("#catalog").val()}), 
			success: function(data){
				temp = (rawurldecode(data)).split('!!!');				
				$("#section_id").val(temp[1]); 

    			$("#section").replaceWith(temp[0]);
		    }
		});
		$("#catalog_id").val($("#catalog").val());
		
		
	}
	function step3(){
		$("#section_id").val($("#section").val());   
	}
	

	
	var trans = [];
	var snart = [];
	for(var i=0x410;i<=0x44F;i++)
	{
	   trans[i]=i-0x350;
	   snart[i-0x350] = i;
	}
	trans[0x401] = 0xA8;
	trans[0x451] = 0xB8;
	trans[0x2116] = 0xB9;
	snart[0xA8]   = 0x401;
	snart[0xB8]   = 0x451;
	snart[0xB9]   = 0x2116;

	function rawurlencode(str)
	{
	   if(!trans.length)
		  return str;
	   var ret=[];
	   for(var i=0;i<str.length;i++)
	   {
		  var n=str.charCodeAt(i);
		  if(typeof trans[n]!='undefined')
			 n = trans[n];
		  if (n <= 0xFF)
			 ret.push(n);
	   }
	   
	   var strb = window.escape(String.fromCharCode.apply(null,ret));
	   return strb.replace(/\+/g, '%2B');
	}

	function rawurldecode (str)
	{
	   if(!snart.length)
		  return str;
	   var ret=[];
	   str = unescape(str);
	   for(var i=0;i<str.length;i++)
	   {
		  var n=str.charCodeAt(i);
		  if(typeof snart[n]!='undefined')
			 n = snart[n];
		  ret.push(n);
	   }
	   
	   return String.fromCharCode.apply(null,ret);
	}

$(document).ready( 
	function() {
			$("div.dooors").click(
					function() {
							$("div.dooors").css("color","#555");
							$(this).css("color","#B57144");
					}
				);
	}
);
