function display_block(){
		var argv = display_block.arguments;
		var argc = display_block.arguments.length;
		var obj = document.getElementById( argv[0] );
		if(argc > 1){
			obj.style.display = argv[1];
		}
		else{
			obj.style.display = obj.style.display == "block" ? "none" : "block";    
			obj.style.position = 'absolute';
			obj.style.zindex = obj.style.display == "block" ? 1 : 10;
		}
}

function PrintFlash(path, width, height, params) {
	document.write ('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=" + version + ",0,0,0" width="' + width + '" height="' + height + '">');
	document.write ('<param name=movie value="' + path + '">');
	document.write ('<param name=quality value=high>');
	document.write ('<PARAM NAME=wmode VALUE=transparent>');
	document.write ('<PARAM name=menu value=false>');
	document.write ('<PARAM name=FlashVars value="' + params + '">');
	document.write ('<embed wmode="opaque" src="' + path + '" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="' + width + '" height="' + height +'" FlashVars="' + params + '"></embed>');
	document.write ('</object>');
}

function longMonthArray(){
        this[0] = "января";     this[1] = "февраля";    this[2] = "марта";
        this[3] = "апреля";     this[4] = "мая";        this[5] = "июня";
        this[6] = "июля";       this[7] = "августа";    this[8] = "сентября";
        this[9] = "октября";    this[10] = "ноября";    this[11] = "декабря";
        return (this);
}

function longDayArray(){
        this[0] = "Воскресенье";        this[1] = "Понедельник";        this[2] = "Вторник";
        this[3] = "Среда";      this[4] = "Четверг";    this[5] = "Пятница";
        this[6] = "Суббота";
        return (this);
}

function getLongYear(year){
        if (year > 1900) return year
        return year+1900;
}

function writeDateLong(format){
        longDays = new longDayArray();
        longMonths = new longMonthArray();
        d = new Date();
        day = d.getDate();
        month = d.getMonth();
        year = d.getYear();
        if (format == 0)
          str = longDays[d.getDay()] + ", " + day + " " + longMonths[month] + " " + getLongYear(year) + " г.";
        document.writeln(str);
}

function writeDate(){
        writeDateLong(0);
}

        function add2basket_(id, w, h, quant, go_to, notneedpopup) {

                var URL;
				
				go_to='';
				
                if ( !h )
                    h = 600;
                if ( ! w )
                    w = 800;
                //alert( escape(go_to) );
                size="height="+h+",width="+w+", status=no, toolbar=no, menubar=no, scrollbars=1'";
                size+=",left="+(screen.width -w)/2+",top="+parseInt((screen.height -h)/2);
                URL = '/add.2.basket/' + id + '/' + quant + '/?url=' + (go_to ? escape(go_to) : '');
				//alert('aaa');
                //if( !notneedpopup ){
                    //newWindow = window.open(URL, 'displayWindow', size);
                //}
                //else{
                    //document.location.href=URL+"&notneedpopup=1";
                //}
				document.location.href="/zakform/"+id;
        }

        function add2basket(id,go_to) {
                var URL;
                var h = 200;
                var w = 260;
                var k =document.getElementById("basket_kol_"+id);
                size="height="+h+",width="+w+", status=no, toolbar=no, menubar=no, scrollbars=1'";
                size+=",left="+(screen.width -w)/2+",top="+parseInt((screen.height -h)/2);
                //alert(k.value);
                if(go_to){
                  URL = '/add.2.basket/'+id+'/'+k.value+'/?url='+go_to;
                }
                else{
                  URL = '/add.2.basket/'+id+'/'+k.value+'/';
                }
                newWindow = window.open(URL, 'displayWindow', size);
        }

        function add4basket(a,id,msg,go_to){
          var kobj = document.getElementById("basket_kol_"+id);
          var kol = kobj.value;
          img = new Image();
          img.src = '/add.3.basket/' + id + '/' + kol + '/';
          img.onload = add5basket(msg,go_to);
          if(msg) alert(msg);
          if(go_to) window.location.href = go_to;
        }

        function add5basket(msg,go_to){
          if(msg) alert(msg);
          if(go_to) window.location.href = go_to;
          return;
        }

        // проверка корзинки
        function check_basket2(d) {
                var e;
                var o;
                var obj;
                var i;
                if(d=="->"){
                  document.forms['orderfrm'].submit();
                  return;
                }
                //
                i=0;
                e = d.split(";"); 
                while ( e[i]!="" ){
                  o = e[i].split("->");
                  obj=document.getElementById("z" + o[0]);
                  if(obj){
                    if( IsText(obj,"Заполните, пожалуйста, поле: " + o[1]) != 1 ) return;
                  }
                  i++;
                }
                document.forms['orderfrm'].submit();
                return;
        }

function show_hide(idha) {
	if(document.getElementById(idha).style.display=='block') {
		document.getElementById(idha).style.display='none';
	} else {
		document.getElementById(idha).style.display='block';
	}
}
