﻿document.onmousedown = selectMouse;
document.onmouseup = mouseUp;

var drag = false;
var expand = false;
var expandRight = false;
var expandDown = false;
var expandLeftDown = false;
var thePic;

var hWindow;
var expand_div;
var expand_div_left;
var bWindow;
var HomePanel;
var mainHPanel;

var tempTop;
var theTop;
var tempHeight;
var theHeight;

var tempLeft;
var theLeft;
var tempWidth;
var theWidth;
var tempHeight;
var theHeight;

var maxFlag = false;
var maxDownFlag = false;
var maxRightFlag = false;

var x,y;
var tx,ty;

var trueX = 0;
var trueY = 0;
var trueLeft = 0;
var trueTop = 0;
var hSpace;

var strExpand = "";
var strHTab = "";
var strExpandImg ="";
var strExpandImgLeft = "";
var strmHome ="";

var theZIndex = 10;

var resizeImg;
var finalResizeLoc;

var strExpandRight;
var lockExpandRight = false;

var strExpandDown;
var strExpandDLeft;
  
var myWidth;
var myHeight;

var underResizeImg;

var strHwindowValue = "";
/*************************************************************************************/

function open_Home(window, windowtab, expand, expandImg, bot_window, Panel, mainPanel, hSpacee, mHome, expRight, rSide, expandDownLeft, expandLeftImg, frameId)
{  
  maxFlag = false; 
  maxDownFlag = false;
  maxRightFlag = false;
  
  strHwindowValue = window;
  
  hWindow = document.getElementById(window);
  hWindow.style.visibility = "visible";  
  expand_div = document.getElementById(expand);
  expand_div.style.visibility = "visible";
  expand_div_left = document.getElementById(expandDownLeft);
  expand_div_left.style.visibility = "visible";
  bWindow = document.getElementById(bot_window);
  bWindow.style.visibility = "visible";
  HomePanel = document.getElementById(Panel);
  HomePanel.style.visibility = "visible";  
  mainHPanel = document.getElementById(mainPanel);
  mainHPanel.style.visibility = "visible";
  hSpace = document.getElementById(hSpacee);
  
  var therSide = document.getElementById(rSide);
    
  if(navigator.appName == "Netscape" )
  {
    bWindow.style.cursor = "n-resize";
    therSide.style.cursor = "e-resize";
  }
  
  theZIndex +=10;
  hWindow.style.zIndex = theZIndex;
  bWindow.style.zIndex = theZIndex;
  HomePanel.style.zIndex = theZIndex +2;
  mainHPanel.style.zIndex = theZIndex + 4;
  expand_div.style.zIndex = theZIndex + 6;
  expand_div_left.style.zIndex = theZIndex + 7;
    
  strHTab = windowtab;
  strExpand = ""+expand;
  strExpandImg = ""+expandImg;
  strExpandDLeft = ""+expandDownLeft;
  strExpandImgLeft = ""+expandLeftImg;
  strmHome = mHome;   
  
  strExpandRight = ""+rSide;
  strExpandDown = "" + bot_window;
  
  var ob = document.getElementById(strHTab);
  ob.ondrag=function(){return false;};
  ob.onselectstart=function(){return false;};
  ob.onmousedown = function(){return false;};
  ob.onmouseup = function(){return false;};
	
  var ob2 = document.getElementById(strExpand);
  ob2.ondrag=function(){return false;};
  ob2.onselectstart=function(){return false;};  
  ob2.onmousedown = function(){return false;};
  ob2.onmouseup = function(){return false;};  
  
  var ob3 = document.getElementById(expRight);
  ob3.ondrag=function(){return false;};
  ob3.onselectstart=function(){return false;};
  ob3.onmousedown = function(){return false;};
  ob3.onmouseup = function(){return false;};  
  
  var ob4 = document.getElementById(strExpandDown);
  ob4.ondrag=function(){return false;};
  ob4.onselectstart=function(){return false;};
  ob4.onmousedown = function(){return false;};
  ob4.onmouseup = function(){return false;};  
  
  var ob5 = document.getElementById(strExpandDLeft);
  ob5.ondrag=function(){return false;};
  ob5.onselectstart=function(){return false;};
  ob5.onmousedown = function(){return false;};
  ob5.onmouseup = function(){return false;};    
  
  setOpacity(expand_div, 0);
  setOpacity(expand_div_left, 0);
  
  tempTop = hWindow.style.top;
  theTop  = parseInt(tempTop.substring(0, tempTop.length - 2));
  tempHeight = hWindow.style.height;
  theHeight = parseInt(tempHeight.substring(0, tempHeight.length -2));  
  tempLeft = hWindow.style.left;
  theLeft = parseInt(tempLeft.substring(0, tempLeft.length - 2));
  tempWidth = hWindow.style.width;
  theWidth = parseInt(tempWidth.substring(0, tempWidth.length - 2));
      
  expand_div.style.left = theLeft + theWidth - 20 + "px";
  expand_div.style.top  = theHeight + theTop - 17 + "px";
  
  expand_div_left.style.left = theLeft + "px";
  expand_div_left.style.top =  theHeight + theTop - 7+ "px";
  
  bWindow.style.left = theLeft + "px";
  bWindow.style.top = theHeight + theTop + "px";    
  
  hSpace.width = theWidth - 3 + "px";   
  
  HomePanel.style.left = theLeft + 4 +"px";
  HomePanel.style.top = theTop + 20 + "px";
  HomePanel.style.width = theWidth - 8 +"px";
  HomePanel.style.height = theHeight - 20 + "px";
  
  mainHPanel.style.width = HomePanel.style.width;
  mainHPanel.style.height =HomePanel.style.height;
    
  resizeImg = document.getElementById("theResizeImg");
  underResizeImg = document.getElementById("layerUnderImg");  
  setOpacity(underResizeImg, 0);
    
  if(typeof( window.innerWidth ) == 'number' )
  {
    //Firefox
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  }
  else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
  {
   //IE 6+ 
   myWidth = document.documentElement.clientWidth;
   myHeight = document.documentElement.clientHeight;
  }
  else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
  {
    //IE 4 
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }  
  
  var theFrameID = document.getElementById(frameId);
  if(frameId == "hFrame")
  {
    theFrameID.src = "Home/Default.aspx";
  }
  else if(frameId == "aFrame")
  {
    theFrameID.src = "About/Default.aspx";
  }
  else if(frameId == "pFrame")
  {
    theFrameID.src = "projects/mobileApps.aspx";
  }
  else if(frameId == "bbFrame")
  {
    theFrameID.src = "Blog/Default.aspx";
  }
  else if(frameId == "contactFrame")
  {
    theFrameID.src = "Contact/Default.aspx";
  }
  else if(frameId == "tFrame")
  {
  theFrameID.src = "myHomework/index.html";
  }
  
}

/*************************************************************************************/

function xOutHome()
{
  resetToDefault(); 
  hWindow.style.visibility = "hidden";  
  expand_div.style.visibility = "hidden";
  expand_div_left.style.visibility = "hidden";
  bWindow.style.visibility = "hidden";  
  HomePanel.style.visibility = "hidden"; 
  mainHPanel.style.visibility = "hidden";
}

/*************************************************************************************/

function mouseMove(e)
{  
  e = e || window.event;
  if (drag == true)
  {      
    if(maxFlag == false)
    {  
	    if(e.pageX || e.pageY)
	    {	    	  
	      if(e.pageX > 0 && e.pageY > 0)
	      {	  
	        try
	        {     
		        thePic.style.left = (tx + e.pageX - x) +"px";
		        thePic.style.top = (ty + e.pageY - y) + "px";
                     
                hWindow.style.top = thePic.style.top;
                hWindow.style.left = thePic.style.left;    
                
                tempTop = hWindow.style.top;
                theTop  = parseInt(tempTop.substring(0, tempTop.length - 2));
                tempHeight = hWindow.style.height;
                theHeight = parseInt(tempHeight.substring(0, tempHeight.length -2)); 
                tempLeft = hWindow.style.left;
                theLeft = parseInt(tempLeft.substring(0, tempLeft.length - 2));
                tempWidth = hWindow.style.width;
                theWidth = parseInt(tempWidth.substring(0, tempWidth.length - 2));       
                              
                expand_div.style.left = theLeft+ theWidth - 20 + "px";
                expand_div.style.top  = theHeight + theTop - 15+ "px"; 
                  
                expand_div_left.style.left = theLeft + "px";
                expand_div_left.style.top =  theHeight + theTop - 5+ "px";                
                
                bWindow.style.left = thePic.style.left;
                bWindow.style.top = theHeight + theTop+"px"; 
                
                HomePanel.style.left = theLeft + 4 +"px";
                HomePanel.style.top = theTop + 20 + "px";
             }
             catch(ee){}
	      }	
		    return;
	    }

        if(e.clientX > 0 && e.clientY > 0)
	    {
	      try
	      {
	        thePic.style.left = (tx - x + e.clientX ) + "px";
	        thePic.style.top = (ty - y + e.clientY ) + "px";
        		   	        
            hWindow.style.top = thePic.style.top;
            hWindow.style.left = thePic.style.left;    
            
            tempTop = hWindow.style.top;
            theTop  = parseInt(tempTop.substring(0, tempTop.length - 2));
            tempHeight = hWindow.style.height;
            theHeight = parseInt(tempHeight.substring(0, tempHeight.length -2));  
            tempLeft = hWindow.style.left;
            theLeft = parseInt(tempLeft.substring(0, tempLeft.length - 2));
            tempWidth = hWindow.style.width;
            theWidth = parseInt(tempWidth.substring(0, tempWidth.length - 2));        
                          
            expand_div.style.left = theLeft+ theWidth - 20 + "px";
            expand_div.style.top  = theHeight + theTop - 17+"px";
            
            expand_div_left.style.left = theLeft + "px";
            expand_div_left.style.top =  theHeight + theTop - 7+ "px";             
            
            bWindow.style.left = thePic.style.left;
            bWindow.style.top = theHeight + theTop+"px"; 
            
            HomePanel.style.left = theLeft + 4 +"px";
            HomePanel.style.top = theTop + 20 + "px";
          }
          catch(ee){}        
        }
    }
	return;
  }
  
  if(expand)
  {                     
	if(e.pageX || e.pageY)
	{	  
	    if(tx-x+e.pageX > theLeft+40 && ty- y + e.pageY > theTop+40)
	    {   	   	     	       	      
	       //change the 20 for the actual variable val
		    thePic.style.left = (tx - x + e.pageX - 20 ) +"px";
		    thePic.style.top = (ty- y + e.pageY - 17) + "px";		
		    
		    resizeImg.style.height = e.pageY - theTop + (ty-y) + "px";
		    resizeImg.style.width = e.pageX - theLeft + (tx-x) + "px";
		    
	        expand_div_left.style.top =  (ty- y + e.pageY - 7) + "px";
		     
		    theWidth = e.pageX - theLeft + (tx-x);  
		    theHeight = e.pageY - theTop + (ty- y); 
		    
		    finalResizeLoc = (ty- y + e.pageY);		    		               				
		}				
		return;
    }  
   
   	if(tx-x+e.clientX > theLeft+40 && ty- y + e.clientY > theTop+40)
	{
		thePic.style.left = (tx- x + e.clientX - 20) +"px";
		thePic.style.top = (ty- y + e.clientY - 17) + "px";		
		
		resizeImg.style.height = e.clientY - theTop + (ty-y) + "px";
	    resizeImg.style.width = e.clientX - theLeft + (tx-x) + "px";
	    theWidth = e.clientX - theLeft + (tx-x);  
	    theHeight = e.clientY - theTop + (ty- y);
	    
	    expand_div_left.style.top =  (ty- y + e.clientY - 7) + "px";     
	    
	    finalResizeLoc = (ty- y + e.clientY);	           				
	}
	return;		
  }        
  
  if(expandLeftDown)
  {                     
	if(e.pageX || e.pageY)
	{	  
	    if(e.pageX < theLeft + theWidth -40 && ty- y + e.pageY > theTop+40)
	    {   	   	     	       	      
		    thePic.style.left = e.pageX - 7 +"px";
		    thePic.style.top = (ty - y + e.pageY - 7) + "px";		
		    
		    resizeImg.style.left = e.pageX +"px";		    
		    resizeImg.style.height = e.pageY - theTop + "px";
		    resizeImg.style.width = theLeft + theWidth - e.pageX   + "px";	  		    		    	        		        		               				
		}				
		return;
    }  

    if(e.clientX < theLeft + theWidth -40 && ty- y + e.clientY > theTop+40)
    {   	   	     	       	      
	    thePic.style.left = e.clientX - 7 +"px";
	    thePic.style.top = (ty- y + e.clientY - 7) + "px";		
	    
	    resizeImg.style.left = e.clientX +"px";		    
	    resizeImg.style.height = e.clientY - theTop + "px";
	    resizeImg.style.width = theLeft + theWidth - e.clientX   + "px";	  	    	    	        		        		               				
	}				
	return;       
  }        
  
  
  
if(expandRight)
{
  if (maxRightFlag == false)
  {
    if(e.pageX || e.pageY)
	{	  
	    if(tx-x+e.pageX > theLeft+40)
	    {   	   	     	       	      
		    thePic.style.left = (tx - x + e.pageX - 20 ) +"px";	    	    
		    
		    resizeImg.style.width = e.pageX - theLeft + (tx-x) + "px";
		    theWidth = e.pageX - theLeft + (tx-x);      
		    
		    tempLeft = resizeImg.style.left;
            theLeft = parseInt(tempLeft.substring(0, tempLeft.length - 2));
		    expand_div.style.left = theLeft+ theWidth - 20 + "px";	              				
		}				
		return;
    }  
  }
}    
  
if(expandDown)
{
  if(maxDownFlag == false)
  {
    if(e.pageX || e.pageY)
	{	  
	    if(ty- y + e.pageY > theTop+40)
	    {   	   	     	       	          
		    resizeImg.style.height = e.pageY - theTop + (ty-y) + "px";
		    theHeight = e.pageY - theTop + (ty- y) +3; 
		    
		    finalResizeLoc = (ty- y + e.pageY);	
		    		    
		    tempTop = resizeImg.style.top;
            theTop  = parseInt(tempTop.substring(0, tempTop.length - 2)); 
            expand_div.style.top  = theHeight + theTop - 17 + "px";  
            expand_div_left.style.top =  theHeight + theTop - 7 + "px";      	    		               				
		}				
		return;
     }     
  }        
}
}

/*************************************************************************************/

function selectMouse(e) 
{   
  if(navigator.appName == "Netscape" )
  {
     var window = e.target;    
     x = e.clientX;
     y = e.clientY;       
  }
  else
  {
    var window = event.srcElement;
    x = event.clientX;
    y = event.clientY;        
  }        

  if(window.id == strHTab)
  {
    thePic = document.getElementById(strHTab);
    drag = true;  
    tx = theLeft;
    ty = theTop;
    expand = false;
    expandRight = false;  
    expandDown = false;
    expandLeftDown = false;
    document.onmousemove=mouseMove;
    return false;  
  }
  else if(window.id == strExpandImg)
  {
   if(lockExpandRight == false)
   {
    thePic = document.getElementById(strExpand);
    expand = true;         

    theZIndex+=10;    
    resizeImg.style.zIndex = theZIndex;
    resizeImg.style.visibility = "visible";
    resizeImg.style.width = hWindow.style.width;
    resizeImg.style.height = hWindow.style.height;
    resizeImg.style.left = hWindow.style.left;
    resizeImg.style.top = hWindow.style.top;  
    
    underResizeImg.style.zIndex = theZIndex - 3;  
    underResizeImg.style.visibility = "visible";
    underResizeImg.style.width = myWidth -3 +"px";
    underResizeImg.style.height = myHeight -3 +"px";
 
    tx = theLeft+ theWidth;
    ty = theHeight + theTop; 
    drag = false;
    expandRight = false;  
    expandLeftDown = false;  
    expandDown = false;
    document.onmousemove=mouseMove;
   }
   return false;
  }
  else if(window.id == strExpandImgLeft)
  {
    thePic = document.getElementById(strExpandDLeft);
    expandLeftDown = true;         

    theZIndex+=10;    
    resizeImg.style.zIndex = theZIndex;
    resizeImg.style.visibility = "visible";
    resizeImg.style.width = hWindow.style.width;
    resizeImg.style.height = hWindow.style.height;
    resizeImg.style.left = hWindow.style.left;
    resizeImg.style.top = hWindow.style.top;  
    
    underResizeImg.style.zIndex = theZIndex - 3;  
    underResizeImg.style.visibility = "visible";
    underResizeImg.style.width = myWidth -3 +"px";
    underResizeImg.style.height = myHeight -3 +"px";
 
    tx = theLeft+ theWidth;
    ty = theHeight + theTop; 
    drag = false;
    expand = false;
    expandRight = false;  
    expandDown = false;
    document.onmousemove=mouseMove;
    return false;
  }
  else if(window.id == strExpandRight)
  {
   if(maxRightFlag == false)
   {
    thePic = document.getElementById(strExpandRight);
    expandRight = true;      
    
    if(navigator.appName == "Netscape" )
    {      
     theZIndex+=10;    
     resizeImg.style.zIndex = theZIndex;
     resizeImg.style.visibility = "visible";
     resizeImg.style.width = hWindow.style.width;
     resizeImg.style.height = hWindow.style.height;
     resizeImg.style.left = hWindow.style.left;
     resizeImg.style.top = hWindow.style.top; 
     
     underResizeImg.style.zIndex = theZIndex - 3;  
     underResizeImg.style.visibility = "visible";
     underResizeImg.style.width = myWidth -3 +"px";
     underResizeImg.style.height = myHeight -3 +"px";
    
     tx = theLeft+ theWidth;
     ty = theHeight + theTop;   
    
     expand = false;
     drag = false; 
     expandLeftDown = false;
     expandDown = false;
     document.onmousemove=mouseMove;
    }
   }
    return false;
  }
  else if(window.id == strExpandDown)
  {
   if(maxDownFlag == false)
   {
  
    thePic = document.getElementById(strExpandDown);
    expandDown = true;
    
    if(navigator.appName == "Netscape" )
    {    
     theZIndex+=10;    
     resizeImg.style.zIndex = theZIndex;
     resizeImg.style.visibility = "visible";
     resizeImg.style.width = hWindow.style.width;
     resizeImg.style.height = hWindow.style.height;
     resizeImg.style.left = hWindow.style.left;
     resizeImg.style.top = hWindow.style.top; 
     
     underResizeImg.style.zIndex = theZIndex - 3;  
     underResizeImg.style.visibility = "visible";
     underResizeImg.style.width = myWidth -3 +"px";
     underResizeImg.style.height = myHeight -3 +"px";
    
    tx = theLeft+ theWidth;
    ty = theHeight + theTop;   
  
    document.onmousemove=mouseMove;
    drag = false;
    expandLeftDown = false
    expand = false;
    expandRight = false;  
   }
  }
    return false;
  }
  else  
  {
    drag = false;
    expand = false;
    expandRight = false;  
    expandDown = false;
    expandLeftDown = false;
    return false;
  }
}

/*************************************************************************************/

function mouseUp()
{
  if(expand == true)
  {  
    resizeImg.style.visibility = "hidden";
    underResizeImg.style.visibility = "hidden";

    hWindow.style.height = resizeImg.style.height;
    hWindow.style.width = resizeImg.style.width;
    	
    bWindow.style.width = hWindow.style.width;
    bWindow.style.top = finalResizeLoc+ "px";		         

    var htight = resizeImg.style.height;
    var hteight = parseInt(htight.substring(0, htight.length -2));  
    var wtight = resizeImg.style.width;
    var wteight = parseInt(wtight.substring(0, wtight.length -2));  

    HomePanel.style.height = hteight - 20 + "px";
    HomePanel.style.width = wteight - 8 + "px";
    hSpace.width = hWindow.style.width; 
    mainHPanel.style.width = HomePanel.style.width;
    mainHPanel.style.height = HomePanel.style.height;    
  }  
  
  if(expandLeftDown == true)
  {
    resizeImg.style.visibility = "hidden";
    underResizeImg.style.visibility = "hidden";    
    
    hWindow.style.height = resizeImg.style.height;
    hWindow.style.width = resizeImg.style.width;
    hWindow.style.left = resizeImg.style.left;
    	
    bWindow.style.width = hWindow.style.width;
    bWindow.style.left = resizeImg.style.left;		         

    var htight = resizeImg.style.height;
    var hteight = parseInt(htight.substring(0, htight.length - 2));  
    var wtight = resizeImg.style.width;
    var wteight = parseInt(wtight.substring(0, wtight.length - 2));  
    var ltight = resizeImg.style.left;
    var lteight = parseInt(ltight.substring(0, ltight.length - 2)); 
    var ttight = resizeImg.style.top;
    var tteight = parseInt(ttight.substring(0, ttight.length - 2)); 
   
    HomePanel.style.height = hteight - 20 + "px";
    HomePanel.style.width = wteight - 8 + "px";
    HomePanel.style.left = lteight + 4 +"px";
    hSpace.width = hWindow.style.width; 
    mainHPanel.style.width = HomePanel.style.width;
    mainHPanel.style.height = HomePanel.style.height;	  
    bWindow.style.top = tteight+hteight + "px";
    
    theWidth = wteight;  
	theHeight = hteight; 
    theLeft = lteight;	
    
    thePic.style.left = lteight +"px";
	thePic.style.top = hteight + tteight - 7 + "px";	
    expand_div.style.top = thePic.style.top;
  }  
  
  if(expandRight == true)
  {
    if(navigator.appName == "Netscape" )
    {
     if(maxRightFlag == false)
     {
      resizeImg.style.visibility = "hidden";
      underResizeImg.style.visibility = "hidden";
     
      hWindow.style.width = resizeImg.style.width;    	
      bWindow.style.width = hWindow.style.width;	         

      var wtight = resizeImg.style.width;
      var wteight = parseInt(wtight.substring(0, wtight.length -2));  
 
      HomePanel.style.width = wteight - 8 + "px";
      hSpace.width = hWindow.style.width; 
      mainHPanel.style.width = HomePanel.style.width;
     }     
    }
  }
  
  if(expandDown == true)
  {
    if(navigator.appName == "Netscape" )
    {
      if(maxDownFlag == false)
      {
         resizeImg.style.visibility = "hidden";
         underResizeImg.style.visibility = "hidden";
        
        hWindow.style.height = resizeImg.style.height;
        bWindow.style.top = finalResizeLoc+ "px";		         

        var htight = resizeImg.style.height;
        var hteight = parseInt(htight.substring(0, htight.length -2));  

        HomePanel.style.height = hteight - 20 + "px";

        mainHPanel.style.height = hteight - 20 + "px"; 
      }
     }
   }
    
  drag = false;
  expand = false;
  expandRight = false;
  expandDown = false;
  expandLeftDown = false;
}

/*************************************************************************************/

function maximizeHome()
{
  lockExpandRight = false;  //useless take it away later
 
  hWindow.alt = hWindow.style.left+"-"+hWindow.style.top+"-"+hWindow.style.width+"-"+hWindow.style.height+
  "-"+expand_div.style.left+"-"+expand_div.style.top+"-"+bWindow.style.left+"-"+bWindow.style.top+
  "-"+bWindow.style.width+"-"+HomePanel.style.left+"-"+HomePanel.style.top+"-"+HomePanel.style.width+
  "-"+HomePanel.style.height +"-"+expand_div_left.style.left+"-"+expand_div_left.style.top;  

  expand_div.style.visibility = "hidden"; 
  expand_div_left.style.visibility = "hidden";  
  
  var tabH = document.getElementById(strHTab);
  tabH.ondblclick =  resetWindow;
  
  var homeM = document.getElementById(strmHome);
  homeM.style.display = "none";
  var homeMdef = document.getElementById(strmHome+"Def");
  homeMdef.style.display = "block";
  
  maxFlag = true;
  maxDownFlag = true;
  maxRightFlag = true;
 
  if(typeof( window.innerWidth ) == 'number' )
  {
    //Firefox
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  }
  else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
  {
   //IE 6+ 
   myWidth = document.documentElement.clientWidth;
   myHeight = document.documentElement.clientHeight;
  }
  else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
  {
    //IE 4 
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }       
  
  var menu = document.getElementById("png_1");
  var menuHeight = menu.height;
    
  hWindow.style.left = 0 + "px";
  hWindow.style.top = 0 + "px";
  hWindow.style.width = myWidth - 2 + "px";
  hWindow.style.height = myHeight - 34 + "px"; 
  
  bWindow.style.left = 0 + "px";
  bWindow.style.width = myWidth - 2 + "px";
  bWindow.style.top = myHeight - 34 + "px";
  
  HomePanel.style.left = 3 +"px";
  HomePanel.style.top = 0 + 20 + "px";
  HomePanel.style.width = (myWidth - 2) - 8 +"px";
  HomePanel.style.height = (myHeight - 34) - 20 + "px"; 
  hSpace.width = hWindow.style.width;       
  
  mainHPanel.style.width = HomePanel.style.width;
  mainHPanel.style.height = HomePanel.style.height;
}

/*************************************************************************************/

function resetToDefault()
{
  lockExpandRight = false;
  var tabH = document.getElementById(strHTab);
  tabH.ondblclick = maximizeHome;    
  
  var homeM = document.getElementById(strmHome);
  homeM.style.display = "block";
  var homeMdef = document.getElementById(strmHome+"Def");
  homeMdef.style.display = "none";
  
  maxFlag = false;
  maxDownFlag = false;
  maxRightFlag = false;
    
  var wl = 0;
  var wt = 0;
  var ww = 0;
  var wh = 0;
  
  if(strHwindowValue == "home_window")
  {
    wh = 490;
    ww = 390;
    wt = 20;
    wl = 15;
  }
  else if(strHwindowValue == "about_window")
  {
    wh = 400;
    ww = 780;
    wt = 40;
    wl = 35;
  }
  else if(strHwindowValue == "projects_window")
  {
    wh = 400;
    ww = 760;
    wt = 60;
    wl = 55;
  }
  else if(strHwindowValue == "blog_window")
  {
    wh = 450;
    ww = 700;
    wt = 80;
    wl = 75;
  }
  else if(strHwindowValue == "contact_window")
  {
    wh = 480;
    ww = 410;
    wt = 10;
    wl = 300;  
  }  
  else if(strHwindowValue == "tutorial_window")
  {
    wh = 510;
    ww = 750;
    wt = 50;
    wl = 150;    
  }
  
 
  hWindow.style.left = wl+"px";
  hWindow.style.top = wt+ "px";
  hWindow.style.width = ww+ "px";
  hWindow.style.height = wh + "px";
    
  expand_div.style.left = ww + "px";
  expand_div.style.top  = wh+3+"px";
  expand_div.style.visibility = "visible";
  
  expand_div_left.style.left = wl + "px";
  expand_div_left.style.top = wh +13 +"px"; 
  expand_div.style.visibility = "visible";
  
  bWindow.style.left = wl+"px";
  bWindow.style.top = wt+wh+"px";
  bWindow.style.width = ww+"px";
  
  HomePanel.style.left = wl + 4 + "px";
  HomePanel.style.top = wt +20 + "px";
  HomePanel.style.width =  ww -8 + "px";
  HomePanel.style.height = wh - 20 + "px";
  
  hSpace.width = hWindow.style.width;   
  
  mainHPanel.style.width = HomePanel.style.width;
  mainHPanel.style.height = HomePanel.style.height;    
  
  tempTop = hWindow.style.top;
  theTop  = parseInt(tempTop.substring(0, tempTop.length - 2));
  tempHeight = hWindow.style.height;
  theHeight = parseInt(tempHeight.substring(0, tempHeight.length -2));  
  tempLeft = hWindow.style.left;
  theLeft = parseInt(tempLeft.substring(0, tempLeft.length - 2));
  tempWidth = hWindow.style.width;
  theWidth = parseInt(tempWidth.substring(0, tempWidth.length - 2));

}

/**************************************************************************/

function minimizeHome()
{
  //closePicture();
  hWindow.style.visibility = "hidden";  
  expand_div.style.visibility = "hidden";
  expand_div_left.style.visibility = "hidden";
  bWindow.style.visibility = "hidden";
  HomePanel.style.visibility = "hidden";  
  mainHPanel.style.visibility = "hidden";    
}

/*************************************************************************/

function windowFocus(window, windowtab, expand, expandImg, bot_window, Panel, mainPanel,hSpacee, mHome, expRight, expandLeft, expandLeftImg)
{ 
  hWindow = document.getElementById(window);
  expand_div = document.getElementById(expand);
  expand_div_left = document.getElementById(expandLeft);  
  bWindow = document.getElementById(bot_window);
  HomePanel = document.getElementById(Panel);
  mainHPanel = document.getElementById(mainPanel);
  hSpace = document.getElementById(hSpacee);
  
  strHwindowValue = window;
  
  theZIndex +=10;
  hWindow.style.zIndex = theZIndex;
  bWindow.style.zIndex = theZIndex;
  HomePanel.style.zIndex = theZIndex +2;
  mainHPanel.style.zIndex = theZIndex + 4;
  expand_div.style.zIndex = theZIndex + 6;
  expand_div_left.style.zIndex = theZIndex + 7;
  
  strHTab = windowtab;
  strExpand = ""+expand;
  strExpandImg = ""+expandImg;
  strmHome = mHome;        
  
  strExpandRight = expRight;
  strExpandDown = bot_window;
  strExpandImgLeft = ""+expandLeftImg;
  
  tempTop = hWindow.style.top;
  theTop  = parseInt(tempTop.substring(0, tempTop.length - 2));
  tempHeight = hWindow.style.height;
  theHeight = parseInt(tempHeight.substring(0, tempHeight.length -2));  
  tempLeft = hWindow.style.left;
  theLeft = parseInt(tempLeft.substring(0, tempLeft.length - 2));
  tempWidth = hWindow.style.width;
  theWidth = parseInt(tempWidth.substring(0, tempWidth.length - 2));
      
  expand_div.style.left = theLeft + theWidth - 20 + "px";
  expand_div.style.top  = theHeight + theTop - 17 + "px";
  
  expand_div_left.style.left = theLeft + "px";
  expand_div_left.style.top =  theHeight + theTop - 7+ "px";
  
  
  bWindow.style.left = theLeft + "px";
  bWindow.style.top = theHeight + theTop + "px";  
  
  hSpace.width = theWidth - 3+ "px";   
  
  HomePanel.style.left = theLeft + 4 +"px";
  HomePanel.style.top = theTop + 20 + "px";
  HomePanel.style.width = theWidth - 8 +"px";
  HomePanel.style.height = theHeight - 20 + "px";
  
  mainHPanel.style.width = HomePanel.style.width;
  mainHPanel.style.height =HomePanel.style.height;
}


/**************************************************************************/

function resetWindow()
{
  resizeImg.style.visibility ="hidden";
  lockExpandRight = false;
  var strVal = hWindow.alt;  
  var arrayVal = new Array();
  arrayVal = strVal.split("-");
    
  var tabH = document.getElementById(strHTab);
  tabH.ondblclick = maximizeHome;    
  
  var homeM = document.getElementById(strmHome);
  homeM.style.display = "block";
  var homeMdef = document.getElementById(strmHome+"Def");
  homeMdef.style.display = "none";
  
  maxFlag = false;
  maxDownFlag = false;
  maxRightFlag = false;  

  hWindow.style.left = arrayVal[0];
  hWindow.style.top = arrayVal[1];
  hWindow.style.width = arrayVal[2];
  hWindow.style.height = arrayVal[3];
    
  expand_div.style.left = arrayVal[4];
  expand_div.style.top  = arrayVal[5];
  expand_div.style.visibility = "visible";
  bWindow.style.left = arrayVal[6];
  bWindow.style.top = arrayVal[7];
  bWindow.style.width = arrayVal[8];
  
  HomePanel.style.left = arrayVal[9];
  HomePanel.style.top = arrayVal[10];
  HomePanel.style.width = arrayVal[11];
  HomePanel.style.height = arrayVal[12]; 
  
  expand_div_left.style.left = arrayVal[13];
  expand_div_left.style.top  = arrayVal[14];
  expand_div_left.style.visibility = "visible";
  
  hSpace.width = hWindow.style.width;   
  
  mainHPanel.style.width = HomePanel.style.width;
  mainHPanel.style.height = HomePanel.style.height;    
  
  tempTop = hWindow.style.top;
  theTop  = parseInt(tempTop.substring(0, tempTop.length - 2));
  tempHeight = hWindow.style.height;
  theHeight = parseInt(tempHeight.substring(0, tempHeight.length -2));  
  tempLeft = hWindow.style.left;
  theLeft = parseInt(tempLeft.substring(0, tempLeft.length - 2));
  tempWidth = hWindow.style.width;
  theWidth = parseInt(tempWidth.substring(0, tempWidth.length - 2));

}

/**************************************************************************************/