	var folder_on = new Image()
	folder_on.src = "/obj/img/arr_r.gif"
	var folder_off = new Image()
	folder_off.src = "/obj/img/arr_off.gif"

    function aT_show(name,act) {
	    if(act)
	    {
	        document.images[name].src = folder_on.src
	    }
	    else
	    {
	        document.images[name].src = folder_off.src
	    }
	}

	function clickHandler()  {
	    var targetId, srcElement, targetElement;
	    srcElement = window.event.srcElement;
	    if (srcElement.className == "lmnu") {
	        targetId = srcElement.id + "details";
	        targetElement = document.all(targetId);
	        if (targetElement.style.display == "none") {
	            targetElement.style.display = "";
	        }
	        else {
	            targetElement.style.display = "none";
	        }
	     }
	}
	function winopen (popupURL,width,height) {
	        var popup = window.open(popupURL,"popup",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=' + width + ',height=' + height );
	        popup.focus();
	        if( navigator.appName.substring(0,8) == "Netscape" ) {
	                popup.location = popupURL;
	        }
	}
    function loadpage(urla,fram,pid,ses,brend,sex,collection,pnum){
	    window.frames[fram].document.location = urla + "?pid=" + pid + "&SESSION=" + ses;
	    document.all.bag.scrollTop = 0;
        takethat(brend,sex,collection,pnum);
	}
	function takethat(brend,sex,collection,pnum) {
	        var popupURL = "/basket.php?brend=" + brend + "&sex=" + sex + "&collection=" + collection + "&pgnum=" + pnum;
	        var popup = window.open(popupURL,"popup",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=200,height=60');
	        popup.focus();
	        if( navigator.appName.substring(0,8) == "Netscape" ) {
	                popup.location = popupURL;
	        }
	}
	function sub_zakaz(){
		document.forms["pre_zakaz"].ac.value=0;
		document.forms["pre_zakaz"].submit();
	}
	function sub_del(id){
		document.forms["pre_zakaz"].ac.value=1;
		document.forms["pre_zakaz"].itemid.value=id;
		document.forms["pre_zakaz"].submit();
	}
	function sub_ch(){
		document.forms["pre_zakaz"].ac.value=2;
		document.forms["pre_zakaz"].submit();
	}
	function CheckForm() {
	    var i,j;
	    var str = '';

	    var bad_field;
	    var fields = new Array();
	    var prompts = new Array();

	    fields[fields.length] = 'fio1';
	    prompts[prompts.length] = 'Контактное лицо';

	    fields[fields.length] = 'tel';
	    prompts[prompts.length] = 'Телефон';

	    for (i = 0; i < fields.length; i++){
	        var field = document.forms["zakaz"].elements[fields[i]];
	        var is_bad=0;
	        if(field.type == null) {
	            is_bad=1;
	            for(j=0;j<field.length;++j) {
	                if(field[j].checked==true) is_bad=0;
	            }
	            if(is_bad==1 && str=='') field=field[0];
	        }
	        else switch(field.type) {
	            case 'select-one':
	                if(field[field.selectedIndex].value == '') is_bad=1;
	                break;
	            default:
	                if (field.value == '') is_bad=1;
	        }

	        if (is_bad == 1) {
	            if (str != '') {
	                str += '\n';
	            }
	            else{
	                bad_field = field;
	            }
	            str += prompts[i];
	        }

	    }
	    if (str != ''){
	        alert("Не заполнены необходимые поля:\n" + str);
	        bad_field.focus();
	        return false;
	    }
	        return true;
	}
	function autoclear() {
	    if (document.forms["zakaz"].elements['adres'].value == ''){
	        document.forms["zakaz"].elements['adres'].value='';
	    }
	}
	function CheckPas() {
	    if (!CheckForm()) return false;
	    return true;
	}
    function inbasket(pid,ses,brend,sex,collection) {
	        var popupURL = "/inbasket.php?pid=" + pid + "&brend=" + brend + "&sex=" + sex + "&collection=" + collection;
	        var popup = window.open(popupURL,"popup2",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=200,height=60');
	        popup.focus();
	        if( navigator.appName.substring(0,8) == "Netscape" ) {
	                popup.location = popupURL;
	        }
            window.opener.window.frames['bag'].document.location = "/bag.php";
    }