mouse postion problems

          var rect1 = Rect (0, 220, 100, 50);
          var rect2 = Rect (200, 220, 100, 50);
          var rect3 = Rect (300, 220, 100, 50);
          var aa ;

      function Update () 
       {
         if (rect1.Contains(Input.mousePosition))
         {
         Debug.Log("khkkkh"); 
         aa=1;
         }

        if(rect2.Contains(Input.mousePosition))
        {
        Debug.Log("ggggg"); 
        aa=1;
        }

       if(rect3.Contains(Input.mousePosition))
       {
       Debug.Log("jjjjj"); 
       aa=1;
       }
    }
    function OnGUI()
     {
       GUI.Button (rect1, "BUTTON1");
   GUI.Button (rect2, "BUTTON2");
   GUI.Button (rect3, "BUTTON3");

   if(aa == 1)
   {
   GUI.Button(Rect(200,200,100,50),"OVER THE BUTTON");
   }

     }

Three buttons are there when mouse is over the any button it should show the message in gui.button my problem is when using if (rect1.Contains(Input.mousePosition)) when i keep mouse over the button no message is displayed when i keep the mouse some distance below the button message is showing i want to use both mouse over with gui elements simultaneously any answer.

GUI coordinate system starts from top left corner of the screen

but mouse coordinate system on screen start form bottom left corner of the screen

try this

var newVec = Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y);

if (rect1.Contains(newVec))...

change Input.mousePosition with newVec everywhere