	#include <stdio.h>
	#include <conio.h>
	#include <process.h>
	#include <string.h>
	#include <dos.h>
	#include <graphics.h>
	#include <barkn.h>
	#include <mouse.h>

/*  void ret(int x,int y,int x1,int y1)
  {
  rect(x+1,y+1,x1+1,y1+1,15);
  rect(x,y,x1,y1,0);
  } */

  struct closes
  {
   int x,y,x1,y1;
  };
  struct close1
  {
  struct closes cl[10];
  }closes={{ {110,275,160,295},{180,275,230,295},{425,105,441,118} }};

  void  close(int i)
  {
      int u,n;
      hidemouse();
rect_bar(closes.cl[i].x,closes.cl[i].y,closes.cl[i].x1,closes.cl[i].y1,0,7);
if(i==2)
{
	 setcolor(0);
	  /*left*/
	line(430,109,435,114);
	line(429,109,434,114);
  /*right*/
	line(430,114,435,109);
	line(429,114,434,109);
}
setcolor(0);
font("litt.chr",5);
if(i==0)
{
delay(100);
button(110,275,160,295,2,0,5,3,0);
setcolor(0);
outtextxy(130,278,"OK  ");
}
if(i==1)
{
  delay(100);
  button(180,275,230,295,2,0,5,3,0);
 setcolor(0);
 outtextxy(190,278,"QIUT");
}
  sound(30);
  delay(200);
  nosound();
  }

    struct kord
  {
   int x;
   int y;
   int radius;
  }al;

  struct cord
  {
  struct kord cord[10];
  }cor={{ {120,160,2},{120,185,2},{120,210,2},{120,235,2},
  {340,170,2},{340,190,2},{340,210,2} }};
   struct tab
   {
   int t[10];
   }tab={3,6,0,4};

	  struct mom
  {
  int x,y,x1,y1;
  };

  struct mom1
  {
  struct mom m[10];
  }mouse={{
  {cor.cord[0].x-9,cor.cord[0].y-9,cor.cord[0].x+150,cor.cord[0].y+9},
  {cor.cord[1].x-9,cor.cord[1].y-9,cor.cord[1].x+150,cor.cord[1].y+9},
  {cor.cord[2].x-9,cor.cord[2].y-9,cor.cord[2].x+150,cor.cord[2].y+9},
  {cor.cord[3].x-9,cor.cord[3].y-9,cor.cord[3].x+150,cor.cord[3].y+9},
  {cor.cord[4].x-9,cor.cord[4].y-9,cor.cord[4].x+100,cor.cord[4].y+9},
  {cor.cord[5].x-9,cor.cord[5].y-9,cor.cord[5].x+100,cor.cord[5].y+9},
  {cor.cord[6].x-9,cor.cord[6].y-9,cor.cord[6].x+100,cor.cord[6].y+9},
  {cor.cord[7].x-9,cor.cord[7].y-9,cor.cord[7].x+100,cor.cord[7].y+9}
   }};

 void menu(void)
 {
  button(100,100,450,300,2,0,5,3,0);
//  rect(110,275,160,295,0);
  button(110,275,160,295,2,0,5,3,0);

  button(180,275,230,295,2,0,5,3,0);

    setcolor(0);

  outtextxy(130,282,"OK  ");
  outtextxy(190,282,"QIUT");

  setfillstyle(SOLID_FILL,1);
  bar(104,104,445,119);
  setcolor(5);
	line(103,120,445,120);
	line(445,120,445,103);

  ret(107,128,300,265);
  ret(320,128,436,265);

  button(425,105,441,118,2,0,5,3,0);
  setcolor(0);
	  /*left*/
	line(430,109,435,114);
	line(429,109,434,114);
  /*right*/
	line(430,114,435,109);
	line(429,114,434,109);

	  ten_textxy(110,107,"PROGMAN",15,3);

   font("litt.chr",5);
   setcolor(0);
  outtextxy(120,130,"Where Do You Want Go");

  outtextxy(340,130,"What Do You");
  outtextxy(350,142,"Pusk Erly");

  font("litt.chr",4);
   setcolor(0);

   colorcir(120,160,5,7);
   colorcir(120,185,5,0);
   colorcir(120,210,5,7);
   colorcir(120,235,5,7);

   colorcir(340,170,5,0);
   colorcir(340,190,5,7);
   colorcir(340,210,5,7);

  rect(cor.cord[1].x+7,cor.cord[1].y-7,290,cor.cord[1].y+7,0);


   outtextxy(130,155,"WINDOWS             ");
   outtextxy(130,180,"NORTON              ");
   outtextxy(130,205,"EXIT INT AUTOEXEC   ");
   outtextxy(130,230,"USER PRORAMM FOR DOS");

   outtextxy(360,165,"NONE       ");
   outtextxy(350,185,"SCANDISK   ");
   outtextxy(350,205,"TEST DISK C");

   setcolor(15);
   outtextxy(180,105,"( START UTILITES PROGRAMM )");

 }
 struct abmn
 {
 int a,b,m,n;
 };
 struct ab
 {
 struct abmn ab[3];
 }abmn={{ {0,2,0,1},{1,3,1,4},{0,0,0,0} }};

struct n
{
int n[10];
}nan;
	    int 	Interface(int *sol)
 {


 int  uu,i,k,u,n=1;
 int s=0,rr=0,p=0;
 int a=abmn.ab[0].a,b=abmn.ab[0].b,m=abmn.ab[0].m;
 int y1[2]={290,430};

	for(;;)
		{
	k=0;
	     nan.n[s]=n;

		if(kbhit())
		{
			i=getch();
			 nan.n[s]=n;
			 *sol=nan.n[1];
			if(i==27) {close(1);break;}
			if(i==13) {close(p);return(nan.n[0]);}


			if(i==9)
			{
			hidemouse();
			rr++;
			s++;
			if(s>1)s=0;
		rect(cor.cord[n].x+7,cor.cord[n].y-7,y1[m],cor.cord[n].y+7,7);
			a=abmn.ab[s].a;
			b=abmn.ab[s].b;
			m=abmn.ab[s].m;
			n=nan.n[s];
			if(rr==1)n=4;
		rect(cor.cord[n].x+7,cor.cord[n].y-7,y1[m],cor.cord[n].y+7,0);
		mouse_show();
			}

		       if(i==0)
			{
			 i=getch();

			if(i==77)
				{
				 p++;
				 if(p>1)p=p-1;
    rect(closes.cl[p-1].x,closes.cl[p-1].y,closes.cl[p-1].x1,closes.cl[p-1].y1,7);
    rect(closes.cl[p].x,closes.cl[p].y,closes.cl[p].x1,closes.cl[p].y1,0);
				}
			if(i==75)
			{
				 p--;
				 if(p<0)p=p+1;
    rect(closes.cl[p+1].x,closes.cl[p+1].y,closes.cl[p+1].x1,closes.cl[p+1].y1,7);
    rect(closes.cl[p].x,closes.cl[p].y,closes.cl[p].x1,closes.cl[p].y1,0);
			}


			if(i==80)
				{
				hidemouse();
				 n++;
				 if(n>tab.t[a])n=n-1;

		rect(cor.cord[n-1].x+7,cor.cord[n-1].y-7,y1[m],cor.cord[n-1].y+7,7);
		rect(cor.cord[n].x+7,cor.cord[n].y-7,y1[m],cor.cord[n].y+7,0);
		circ(cor.cord[n-1].x,cor.cord[n-1].y,cor.cord[n-1].radius,7);
		circ(cor.cord[n].x,cor.cord[n].y,cor.cord[n].radius,0);
		mouse_show();
				}
			 if(i==72)
				{
				hidemouse();
				n--;
				if(n<tab.t[b])n=n+1;
	rect(cor.cord[n+1].x+7,cor.cord[n+1].y-7,y1[m],cor.cord[n+1].y+7,7);
	       rect(cor.cord[n].x+7,cor.cord[n].y-7,y1[m],cor.cord[n].y+7,0);
				 circ(cor.cord[n+1].x,cor.cord[n+1].y,cor.cord[n].radius,7);
				 circ(cor.cord[n].x,cor.cord[n].y,cor.cord[n].radius,0);
		mouse_show();
				}

			}
		}

	 k=mousestatys(425,105,441,118,1);
	 if(k==1){close(2);break;}

	 k=mousestatys(110,275,160,295,1);
	 if(k==1){rect(closes.cl[1].x,closes.cl[1].y,closes.cl[1].x1,closes.cl[1].y1,7);close(0);return(nan.n[0]);}

	 k=mousestatys(180,275,230,295,1);
	 if(k==1){rect(closes.cl[0].x,closes.cl[0].y,closes.cl[0].x1,closes.cl[0].y1,7);close(1);break;}


      // first mouse control

	 for(u=0;u<4;u++)
	 {
      k=mousestatys(mouse.m[u].x,mouse.m[u].y,mouse.m[u].x1,mouse.m[u].y1,1);
	   if(k==1)
	   {
	   if(n!=u && s!=0)
	     {
		hidemouse();
			rr++;
			s++;
			if(s>1)s=0;
      rect(cor.cord[n].x+7,cor.cord[n].y-7,y1[m],cor.cord[n].y+7,7);
			a=abmn.ab[s].a;
			b=abmn.ab[s].b;
			m=abmn.ab[s].m;
			n=nan.n[s];
			if(rr==1)n=4;
	   rect(cor.cord[n].x+7,cor.cord[n].y-7,y1[m],cor.cord[n].y+7,0);
	   mouse_show();
	    }
	      if(n!=u)
	      {
	      hidemouse();
	      rect(cor.cord[n].x+7,cor.cord[n].y-7,y1[0],cor.cord[n].y+7,7);
	      rect(cor.cord[u].x+7,cor.cord[u].y-7,y1[0],cor.cord[u].y+7,0);
	      circ(cor.cord[n].x,cor.cord[n].y,cor.cord[n].radius,7);
	      circ(cor.cord[u].x,cor.cord[u].y,cor.cord[n].radius,0);
	      mouse_show();
	       n=u;
	       }
	      }
	   }

	 //second mouse control
	  for(uu=4;uu<7;uu++)
	      {
	      k=mousestatys(mouse.m[uu].x,mouse.m[uu].y,mouse.m[uu].x1,mouse.m[uu].y1,1);
	   if(k==1)
		{
	     if(n!=uu && s!=1)
	     {
		   hidemouse();
			rr++;
			s++;
			if(s>1)s=0;
	  rect(cor.cord[n].x+7,cor.cord[n].y-7,y1[m],cor.cord[n].y+7,7);
			a=abmn.ab[s].a;
			b=abmn.ab[s].b;
			m=abmn.ab[s].m;
			n=nan.n[s];
			if(rr==1)n=4;
	   rect(cor.cord[n].x+7,cor.cord[n].y-7,y1[m],cor.cord[n].y+7,0);
	   mouse_show();
	    }
	      if(n!=uu)

			{

	      hidemouse();
	      rect(cor.cord[n].x+7,cor.cord[n].y-7,y1[1],cor.cord[n].y+7,7);
	      rect(cor.cord[uu].x+7,cor.cord[uu].y-7,y1[1],cor.cord[uu].y+7,0);
	      circ(cor.cord[n].x,cor.cord[n].y,cor.cord[n].radius,7);
	      circ(cor.cord[uu].x,cor.cord[uu].y,cor.cord[n].radius,0);
	      mouse_show();
	       n=uu;
			}
		}
	      }

	}
}

 void  start_programm()
 {
 int n,s,p;
 char al[10];
 n=Interface(&s);
 if(s==0);
 if(s==1)system("scandisk.exe");
 if(s==2)system("aidstest.exe c: /g");

 if(n==0)system("win.com");
 if(n==1)system("nc.exe");
 if(n==2);
 if(n==3)system("lexicon.exe");
 }



 void main(void)

 {
 int l;
 // system("pv c:\\3dmax\\picture\\best\\progman.tif");
  int grdriver=DETECT,grmode;
  initgraph(&grdriver,&grmode,"c:\\borlandc\\bgi\\");
  palette();
  menu();
  mouse_show();
  start_programm();
  delmouse();
  closegraph();

 }


























































































































