function GEByID(id) {	return d.all ? d.all[id] : d.getElementById(id);}function add_basket(id, articul, name, img) {		var req = new JsHttpRequest();	req.onreadystatechange = function() {		if (req.readyState == 4) {			//alert(req.responseText);			$.prompt(req.responseJS.tmpl,					{callback: function(v, m){						if(v==true){							$(".tov_"+id+"").attr("src", "/admin/loading-small.gif");							qua=m.children('#quant').val();							col=m.children('#colors').val();							if(col) color=col;							else color="Не определён";														var req = new JsHttpRequest();							req.onreadystatechange = function() {								if (req.readyState == 4) {									//alert(req.responseText);									$(".tov_"+id+"").attr("src", "/images/"+img);									$(".tov_"+id+"").attr("alt", "Артикул "+articul+" в корзине");									//$(".tov_"+id+"").attr("style", "position: relative; top: -3px; left: 0");								}							}							req.open(null, "/modul/scripts/srv_basket.php", true);							req.send( { 'status': 'add_basket', 'id': id, 'quant': qua, 'color': color} );						}					},					buttons: { Ok: true, Отмена: false }					}			);					}	}	req.open(null, "/modul/scripts/srv_basket.php", true);	req.send( { 'status': 'add_basket_form', 'id': id } );	}function delBasket(id, i){	//записать все проставленные количества в сессию, потом уже удалять позицию	value=GEByID('f');	var req = new JsHttpRequest();	req.onreadystatechange = function() { 			if (req.readyState == 4) {			//alert(req.responseText);			if(req.responseJS){				 if (req.responseJS.rez != ""){ 					$("#basket_table").empty();					$("#basket_table").html(req.responseJS.tmpl);					//$("#item").html(req.responseJS.mosmsg);				} 			}		}	}	req.open(null, "/modul/scripts/srv_basket.php", false);	req.send( {'status': 'del_basket', 'id': id, 'i': i, 'q': value} );}function view_im(id, src, st){			$("#pict_"+st).attr("src", src);			var cssObj_bold = {				backgroundColor: "#fff",				border: "1px solid #999",				fontWeight: "bold"				};			var cssObj_normal = {				backgroundColor: "#E3D8CC",				border: "1px solid #fff",				fontWeight: ""				};		 $(".t1").each(			function (){				 $(this).css(cssObj_normal);				 // назначаем новый стиль, если папка текущая				 if (this.id == id) {					$(this).css(cssObj_bold);				 }		 }		)//end each}function view_img_big(id, src, st, url){	$("#pict_tovar").attr("src", src);	$("#url_big").val(url+"/big_photo/"+id+".html");	$("#big_photo").attr("style", "visibility:"+st);}function send_letter(articul, img){	var txt='Имя: *<br /><input type="text" id="name" style="width: 190px; border: solid 1px #7F9DB9;  margin-bottom: 10px; font-size: 14px;" maxlength="50" value="" onfocus="this.style.borderColor=\'#7F9DB9\';" /><br />';		txt+='E-mail: *<br /><input type="text" id="email" style="width: 190px; border: solid 1px #7F9DB9;  margin-bottom: 10px; font-size: 14px;" maxlength="50" onfocus="this.style.borderColor=\'#7F9DB9\';" /><br />';		txt+='Телефон: <br /><input type="text" id="phone" style="width: 190px; border: solid 1px #7F9DB9;  margin-bottom: 10px; font-size: 14px;" maxlength="50" onfocus="this.style.borderColor=\'#7F9DB9\';" /><br />';		txt+='Комментарий к артикулу <strong>'+articul+'</strong>: *<br /><textarea name="comm" id="comm" style="width: 290px; height: 100px; border: solid 1px #7F9DB9; font-size: 14px; margin-right: 10px;" onfocus="this.style.borderColor=\'#7F9DB9\';"></textarea>';	$.prompt(txt,{			submit: function(v,m){				if(v==true){					nam = m.children('#name');					mal = m.children('#email');					pho = m.children('#phone');					kuku=m.children('#comm').val();					if(nam.val() == "" || mal.val() == "" || kuku == ""){						if(nam.val() == "") nam.css("border", "solid #ff0000 1px");						if(mal.val() == "") mal.css("border", "solid #ff0000 1px");						if(kuku == "") m.children('#comm').css("border", "solid #ff0000 1px");						return false;						}										var req = new JsHttpRequest();					    req.onreadystatechange = function() {					        if (req.readyState == 4) {					            $.prompt('<p align="center">Спасибо. Ваш комментарий принят.</p>');								//alert(req.responseText);					        }					    }					    req.open(null, "/modul/scripts/articul_comment.php", true);					    req.send( { 'articul': articul, 'id_img': img, 'name': nam.val(), 'email': mal.val(), 'phone': pho.val(), 'comment': kuku } );															return true;				}				else if(v==false) return true;			},			buttons: { Ok: true, Отмена: false }		}	);	}function send_email(){	if($("#email").val()==''){		$.prompt('<p align="center">Ошибка: пустое поле.</p>');		return;	}	value=GEByID('f');		var req = new JsHttpRequest();	req.onreadystatechange = function() {		if (req.readyState == 4) {			$.prompt('<p align="center">'+req.responseJS.mosmsg+'</p>');			$("#email").val("");			//alert(req.responseText);		}	}	req.open(null, "/modul/scripts/send_email.php", true);	req.send( { 'q': value} );}function search_articul(){	if($("#articul").val()==''){		$.prompt('<p align="center">Введите артикул.</p>');		return;	}	document.location.href="/search/?articul="+$("#articul").val();}function print_open(hrf){	pwin=window.open(hrf, 'win2','status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=650,height=485,directories=no,location=no');	pwin.focus();}//--------------------------------Обработка заказа в корзине--------------------------------------//function go_step2(){	value=GEByID('f');	req.onreadystatechange = function() { 		if (req.readyState == 4) {			//alert(req.responseText);			location.href='/my_basket/step2/';		}	}	req.open(null, "/modul/scripts/srv_basket.php", false);	req.send( {'status': 'saveQuant', 'q': value} );  	return;	}function saveQuant(){	value=GEByID('f');	req.onreadystatechange = function() { 		if (req.readyState == 4) {			//alert(req.responseText);		}	}	req.open(null, "/modul/scripts/srv_basket.php", false);	req.send( {'status': 'saveQuant', 'q': value} );  	return;	}function valid_anketa(){	value=GEByID('f');	var req = new JsHttpRequest();	JsHttpRequest.query(		'/modul/scripts/srv_basket.php',		{"q": value, "status": "empty_field"},		function(result, errors) {			//alert(errors);			if (result) {				if (result["post"] != ""){ // то есть есть ошибки					arr=result['post'];					for(i=0; i<arr.length; i++){						if(i==0) $("#"+arr[i]+"").focus();						err_field_style(arr[i]);					}					$.prompt('<p align="center">Заполните обязательные поля!</p>');				}				else{					location.href='/my_basket/step3/';				}			}		},		false	);}function err_field_style(item){	$("#"+item).css("border", "solid #f00 1px");	$("#"+item).css("background-color", "#FFF2F2");	$("#"+item).keypress(function(){		$(this).css("border", "solid #D5C3A7 1px");		$(this).css("background-color", "#fff");	});	}