/*
>>>Neat Vista tricks:
> General WIndows trivia - 8dot3
8dot3 was, is and from the looks of things always will be the shorthand standard WIndows machines will use. This is simple to understand once you learn it... if a filename is less than eight characters, nothing else is done with it. But if the filename were to be MORE than eight characters... nine characters even, the name of the file gets truncated. If you have two file names with the same first six letters, the number after it increments. For example. LongFilenameA.exe becomes LongFi~1.exe, and LongFilenameB.exe becomes LongFi~2, because the letter that is different is alphabetically the second file. Same for LongFilenameC.exe; LongFi~3, LongFilenameD.exe; LongFi~4 etc.

> Run a screensaver as your desktop wallpaper
Go into command prompt and replace the asterisk with a screensaver:
*.scr /p65552
Using the trivia above, there is one screensaver called PhotoScreensaver.scr. Just shorten it to photos~1.scr. No problem!

> VistaGlazz patcher
VistaGlazz is a user-friendly file patcher that modifies key files on your system to enable use of unsigned themes. Normally, when using a theme, you need to install one that has been signed by Microsoft, most probably posted on one of their website too. There are lots of people who have gone around this with VistaGlazz. It is produced by http://codegazer.com and get this; It's free. No need to take ownership of files or any of that BS, VG does it for you.

Refer to the program's help file for more information. But i can tell you this: Choose to patch style and you will be asked to do all the patching right then and there. If you just patch the system files, then you can still use a theme that supports full transparency and skip the second step altogether.

And oh, this was done with version 1.2 as of this writing. Later version or future WIndows OSs may require different stuff.

> Installing third-party themes
Once VistaGlazz has everything done and dusted, you can use new themes. Be sure to create a system restore point at this step, as if you screw up you can undo what you did with System Restore at boot. After you found a theme online (deviantart.com is a start), look in the archive, (If you need an archiving tool get the latest version of winRAR,) then look for a .theme file and a .msstyles file. Extract those to c:/windows/resources/themes, then open the theme's contents and double-click on the .msstyles file.

Extra stuff may come with the theme! Do not do ANYTHING until you view the readmes that came with the theme.

A note about some themes: Some of them may simply be Aero replacements. If you do not want to replace Aero, then you will need to copy aero.msstyle and rename it to the theme you want to use. Sometimes you may need to even rename the theme because the folder that contains everything is named Aero. Rename before extraction or else lose WIndows Aero (though I am sure a copy exists somewhere on the world wide web).

> Text color and shadow
Since black is the mask, black text disappears. You can experiment with that if you wish; Use a colored background, then black to make text see-through. But here are the usual suspects:

color:black!important;
text-shadow:0px 0px 6px white,0px 0px 6px white,0px 0px 6px white!important;
opacity:0.90!important; OR 0.99, depending on how dark you want it (and yes it does make a difference.)

>>> dwm-overlay.js; Code below. Copy below this text and either create a new file with the code or paste it in the appropriate file.
/******************************************************************************
Copyright 2008 Matthew Holder. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

   1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
   2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*********************************************************************************/


var inFullscreen = false;

var toolbox = null;
var sidebar = null;
var statbar = null;
var browbox = null;
var vScrollBar = null;
var hScrollBar = null;

/*-----------------------------------WHITELIST---------------------------------------------**/


var whiteListItem = new Array(

                              /*ignore whitespace, but don't forget to put the domain in quotes and leave a comma off the last one*/
							  )
							  

/*********getfile method disbled bt mozdev due to bugs:(*/
//  try
//  {		
//    var   whiteListFile = IO.getFile("Profile", "WhiteList.txt")
//  }
//   catch (err)
//  {
//    alert("didn't work")
//  }
//
//while(stream.available())
//whiteListItem.push(stream.readLine());



/************************** interface with dwm                *******************************************/	
var dwm = Components.classes["@sixxgate.com/DwmCalls/CDwmCalls;1"].createInstance();
dwm = dwm.QueryInterface(Components.interfaces.IDwmCalls);


/**************************************Event Handlers*******************************************************/

function DWM_Glasser_OnFullscreen()
{
	this.handleEvent = function(e)
	{
		if (!dwm.GlassEnabled){  return;};
		
		if(e.attrName == "inFullscreen" && e.newValue == "true")
		{
			try
			{
				dwm.ExtendFrameIntoWindow(0, 0, 0, 0);
				ChangeGlasserTheme();
		
			}
			catch (err)
			{   // Something failed
					window.alert(err);
			}
			inFullscreen = true;
		}
		else if (e.attrName == "inFullscreen")
		{
			goGoGadgetGlass()
			inFullscreen = false;
		}
	};
};


/*--------------------------------------------------------------------------------------------------------------------*/
function DWM_Glasser_OnAttrChange()
{
	this.handleEvent = function(e)
	{
		if (!dwm.GlassEnabled || inFullscreen == true) 
		{
			return;
		}          
		else
		{
			goGoGadgetGlass()
		}
   }
}
/*--------------------------------------------------------------------------------------------------------------------*/
function ChangeGlasserTheme()     
{
   if (dwm.GlassEnabled)
   {
	  for (var i = 0; i != window.document.styleSheets.length; ++i)
	  {
		 if (window.document.styleSheets[i].href == "chrome://glasser/skin/overlay.css")
		 {
			window.document.styleSheets[i].disabled = false;
			break;
		 }
	  }
   }
   else
   {
	  for (var i = 0; i != window.document.styleSheets.length; ++i)
	  {
		 if (window.document.styleSheets[i].href == "chrome://glasser/skin/overlay.css")
		 {
			window.document.styleSheets[i].disabled = true;
			break;
		 }
	  }
   }
};
/*--------------------------------------------------------------------------------------------------------------------*/
function DWM_Glasser_OnLoad()    
{
   this.handleEvent = function(e)
   {

		toolbox = window.document.getElementById("navigator-toolbox");
		 if (toolbox)

		toolbox.addEventListener("DOMAttrModified", Glasser_OnFullscreen, false);  
		toolbox.addEventListener("DOMAttrModified", Glasser_OnAttrChange, true); 
		sidebar = window.document.getElementById("sidebar-splitter");
		sidebar.addEventListener("DOMAttrModified", Glasser_OnAttrChange, true);
	  
	 
		statbar = window.document.getElementById("browser-bottombox");
		statbar.addEventListener("DOMAttrModified", Glasser_OnAttrChange, true)
		window.addEventListener("resize", calScrollBar.init, false);
        var fBrowser = document.getElementById("appcontent");   
        if(fBrowser)
         {fBrowser.addEventListener("DOMContentLoaded", OnContentChange, true);};
		 {fBrowser.addEventListener("DOMContentLoaded", Glasser_OnAttrChange, true);};
    	var container = gBrowser.tabContainer;
    	if(container)
         {container.addEventListener("TabSelect", OnContentChange, false);	};
		 {container.addEventListener("TabSelect", Glasser_OnAttrChange, false);	};

	  ChangeGlasserTheme();
  };
};

/********************************************Functions********************************************************/
function DWM_Glasser_OnGlassChange()     
{
   this.handleEvent = function(e)
   {
	  ChangeGlasserTheme();
   };
};

function DWM_OnContentChange()
{
   this.handleEvent = function(e)
  {
	  
		if(gBrowser.selectedBrowser.contentDocument.domain == null) return; 
		var x;
		for (x in whiteListItem)
		{
			if (gBrowser.selectedBrowser.contentDocument.domain==whiteListItem[x])
			var inWhiteList = true;
		}
		if(inWhiteList==true || gBrowser.selectedBrowser.contentDocument.location == "about:blank")
		{ 
			try
			{
				 browbox = window.document.getElementById("browser");
				 
			}
			catch (err)
			{   // Something failed
				window.alert(err);
			}
			inWhiteList = false;
		}
		else
		{
			 browbox = null;
		};
		calScrollBar.init()
  };
};

var calScrollBar =
{
	init: function()
          {
			 
			  calScrollBar.vert();
			  calScrollBar.horz();

		  },
	vert: function()
	{
		
		try
		{
			 var bBrowser = gBrowser.selectedBrowser.contentDocument.body
		      var eBrowser = gBrowser.selectedBrowser.contentDocument.documentElement
			  if(bBrowser == null || eBrowser == null)
			 {return;}
			 else
			 {
				if((bBrowser.scrollHeight > bBrowser.clientHeight) || (eBrowser.scrollHeight > eBrowser.clientHeight))
				{
					vScrollBar = 18;
		
				}
				else
				{
					vScrollBar = 0;
				}
			  }
		}
		catch(error)
		{
		alert(error)
		};
		
	},
	horz: function()
	{
		try
		{
			 var bBrowser = gBrowser.selectedBrowser.contentDocument.body
		     var eBrowser = gBrowser.selectedBrowser.contentDocument.documentElement
			 if(bBrowser == null || eBrowser == null)
			 {return;}
			 else
			 {
				if((bBrowser.scrollWidth > bBrowser.clientWidth) || (eBrowser.scrollWidth > eBrowser.clientWidth))
				{
					hScrollBar = 18;
				}
				else
				{
					hScrollBar = 0;
					
				}
			 }
		}
		catch(error)
		{
		alert(error)
		};
	}
};

function goGoGadgetGlass()
{  
   try
   { 
	var tabbar = gBrowser.tabContainer.boxObject;
	var win = window.document.getElementById("main-window");
	var height = null;
	var top = null;
	var bottom = null;
	var left = null;
	var full = null;
	var aiostoolbar = window.document.getElementById("aios-toolbar");
	var aiosttoolbox = window.document.getElementById("aios-toggle-toolbar");
	
/**********Calaculations for extent of glass into frame******/
/*-------- top  ------*/				
	if(toolbox!=null)
	{    top = tabbar.y + tabbar.height;}
	else
	{top = 0;};
	/*-------- bottom ----*/
	if(statbar!=null)
	{    bottom =  win.boxObject.height - statbar.boxObject.y}
	else
	{bottom = 0;};
	/*--------right -----*/
	
	/*------left---------*/
	if(sidebar!=null)
	{
		if((aiostoolbar == null) || (aiostoolbar != null && sidebar.boxObject.width != 0))
		{    left = sidebar.boxObject.width + sidebar.boxObject.x;}
		else if(aiostoolbar != null && aiostoolbar.boxObject.width == 0 && sidebar.boxObject.width == 0)	
		{    left = aiosttoolbox.boxObject.width}
		else if(aiostoolbar != null && aiostoolbar.boxObject.width != 0 && sidebar.boxObject.width == 0)
		{    left = aiostoolbar.boxObject.width}
	
	}
	else
	{left = 0;};
	
	/*------full---------*/
	if(browbox!=null)
	{full = browbox.boxObject.height;}
	else
	{full = 0;};

/*-------------------------------------------------------------*/

	 dwm.ExtendFrameIntoWindow(top, vScrollBar, bottom+full+hScrollBar, left)  
   }
   catch (err)
   {   // Something failed
		window.alert(err);
   }
}

/*              instantiate all the above event handlers                     */	
var Glasser_OnFullscreen = new DWM_Glasser_OnFullscreen();
var Glasser_OnAttrChange = new DWM_Glasser_OnAttrChange();
var Glasser_OnLoad = new DWM_Glasser_OnLoad();	
var Glasser_OnGlassChange = new DWM_Glasser_OnGlassChange();
var OnContentChange = new DWM_OnContentChange();

/*******            get the ball rolling              ****/	


window.addEventListener("load", Glasser_OnLoad, false); 



/****-------------------------- this bit deals with windows dwm ------------------------------------*****/
    
dwm.AttachToWindow(window);
dwm.OnGlassChange = Glasser_OnGlassChange;
>>>Code ends here. Do not copy this line.

>>> overlay.css; Code below. Copy below this text and either create a new file with the code or paste it in the appropriate file.
/******************************************************************************
Copyright 2008 Matthew Holder. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

 1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
 2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*********************************************************************************/
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);

#personal-bookmarks toolbarbutton {
color: black !important;
text-shadow: white 0px 0px 12px,
		     white 0px 0px 12px,
			 white 0px 0px 12px !important; }

.tabs-newtab-button {margin-bottom: 1px !important;}

.tabs-bottom { display: none !important;
background-color: rgba(255, 255, 255, 00) !important; }

#browser tab {
margin-bottom: 1px;
} 

tab {opacity: 0.95 !important;}
tab:hover {opacity: 0.95 !important;}
tab[selected="true"] {opacity: 0.95 !important;}

#page-proxy-stack
{
margin-left: -3px !important;
}
#identity-box
{
padding-left: 4px !important;
}

#main-window #navigator-toolbox #PersonalToolbar {
 border-top: 0px none !important;
 -moz-appearance: none !important; 
 padding: 0px 0px 0px 0px !important;
}

#main-window #urlbar {
opacity: .99 !important;
-moz-border-radius-topright: 0px !important;
-moz-border-radius-bottomright: 0px !important;
}

#main-window #searchbar .searchbar-textbox {
-moz-border-radius-topright: 0px !important;
-moz-border-radius-bottomright: 0px !important;
}
#main-window #search-container { opacity: .99 !important; }
#main-window #navigator-toolbox #toolbar-menubar { opacity: .99 !important; }



#main-window #navigator-toolbox #nav-bar
{
padding: 0px 0px 0px 4px !important;
}

#main-window #navigator-toolbox #toolbar-menubar
{
background:none !important;
}

#main-window #navigator-toolbox #PersonalToolbar toolbarbutton &gt; label
{
color: black !important;
text-shadow: white 0px 0px 12px,
		     white 0px 0px 12px,
			 white 0px 0px 12px !important;
 opacity: .90 !important;
}

#navigator-toolbox .menubar-text
{
color: black !important;
text-shadow: white 0px 0px 12px,
		     white 0px 0px 12px,
			 white 0px 0px 12px !important;
opacity: .90 !important;
}

#main-window #navigator-toolbox{
margin-left: 0px !important;
margin-right: 0px !important;
margin-top: 0px !important;
}

#browser-bottombox
{background-color: rgb(0, 0, 0) !important;}

.statusbarpanel-text{
color: black !important;
text-shadow: white 0px 0px 12px,
		     white 0px 0px 12px,
			 white 0px 0px 12px !important;
opacity: 0.9 !important; 
}

.findbar-find-fast{
color: black !important;
opacity: 0.9 !important; 
}

#FindToolbar .checkbox-label-box{
color: black !important;
opacity: 0.9 !important;
}

statusbarpanel { 
-moz-appearance: none !important; border: none !important;
}

#FindToolbar {
margin-top: 1px !important;
-moz-appearance: none !important;
background: none !important;
border: 0 none !important;
}

#FindToolbar .toolbarbutton-text {
color: white !important;
opacity: 0.9 !important;
}

#status-bar {
-moz-appearance: none !important;
background-color: rgb(0, 0, 0) !important;
border: 0 none !important;
}



.tabbrowser-tab:not([selected="true"]) > .tab-text {
color: black !important;
text-shadow: white 0px 0px 16px,
		     white 0px 0px 16px,
			 white 0px 0px 16px!important;
opacity: .999 !important;
}

.tabbrowser-tab[selected="true"] {
  background-color: rgba(255, 255, 255, 0.4) !important;
}

.tabbrowser-tab:not([selected="true"]):hover > .tab-text {
color: black !important;
text-shadow: white 0px 0px 16px,
		     white 0px 0px 16px,
			 white 0px 0px 16px,
			 white 0px 0px 16px!important;
opacity: .999 !important;
}

.tab-text {
color: black !important;
opacity: .999 !important;
}

.tabbrowser-tabs {
-moz-appearance: none !important;
background: none !important;
background-color: rgb(0, 0, 0) !important;
border: 0 none !important;
padding-bottom: 0px !important;
}

.bookmark-item { margin: 0 3px 0 3px !important ; }


#main-window #minimize-button
{
	list-style-image: url(chrome://glasser/skin/Minimize.gif);
}

#main-window #restore-button
{
	list-style-image: url(chrome://glasser/skin/Restore.gif);
}

#main-window #close-button
{
	list-style-image: url(chrome://glasser/skin/Close.gif);
}

#main-window #navigator-toolbox
{
	-moz-appearance: none !important;
	border: 0 none !important;
	padding: 0 !important;
}

#main-window #navigator-toolbox toolbar
{
	-moz-appearance: none !important;
	border: 0 none !important;
}

#main-window #navigator-toolbox #toolbar-menubar,
#main-window #navigator-toolbox #PersonalToolbar
{
	opacity: 0.99;
}

#main-window #navigator-toolbox #toolbar-menubar,
#main-window #navigator-toolbox #toolbar-menubar menubar,
#main-window #navigator-toolbox #nav-bar
{
	-moz-appearance: none !important;
}

/* More padding on nav-bar like IE */
#main-window #nav-bar[iconsize="small"]
{
	padding-bottom: 5px !important;
}

#main-window #navigator-toolbox #toolbar-menubar,
#main-window #navigator-toolbox toolbarbutton
{
	background-color: rgba(255, 255, 255, 0.0);
	text-shadow: rgba(255, 255, 255, 0.5) 0px 0px 5px,
		rgba(255, 255, 255, 0.5) 0px 0px 5px,
		rgba(255, 255, 255, 0.5) 0px 0px 5px,
		rgba(255, 255, 255, 0.5) 0px 0px 5px,
		white 0px 0px 6px;
	opacity: 0.99 !important;
}

#main-window:not([active="true"]) #navigator-toolbox #toolbar-menubar menubar > menu
{
	color: black !important;
}

#main-window #navigator-toolbox
{
	background-color: black !important;
}

#identity-box > hbox
{
	-moz-border-radius-topleft: 0 !important;
	-moz-border-radius-bottomleft: 0 !important; */
	-moz-background-clip: padding !important;
}

#main-window #searchbar .searchbar-textbox,
#main-window #urlbar
{
	-moz-background-clip: padding;
	background-color: rgba(255, 255, 255, 0.75) !important;
	opacity: 0.99 !important;
	border: 3px solid white !important;
	-moz-border-top-colors: rgba(255, 255, 255, 0.5) rgba(50, 50, 50, 0.7) rgba(255, 255, 255, 0.95) !important;
	-moz-border-right-colors: rgba(255, 255, 255, 0.5) rgba(50, 50, 50, 0.3) rgba(255, 255, 255, 0.95)!important;
	-moz-border-bottom-colors: rgba(255, 255, 255, 0.5) rgba(50, 50, 50, 0.3) rgba(255, 255, 255, 0.95)!important;
	-moz-border-left-colors: rgba(255, 255, 255, 0.5) rgba(50, 50, 50, 0.7) rgba(255, 255, 255, 0.95)!important;
	-moz-appearance: none !important;
}

#main-window #urlbar[level="high"] > .autocomplete-textbox-container,
#main-window #urlbar[level="high"] > .autocomplete-history-dropmarker
{
	background-color: rgba(245, 246, 190, 0.65) !important;
}

#main-window #searchbar .searchbar-textbox[focused="true"],
#main-window #urlbar[focused="true"]
{
	background-color: rgba(255, 255, 255, 0.99) !important;
	-moz-border-top-colors: rgba(255, 255, 255, 0.5) rgba(50, 50, 50, 0.7) rgba(255, 255, 255, 0.99) !important;
	-moz-border-right-colors: rgba(255, 255, 255, 0.5) rgba(50, 50, 50, 0.3) rgba(255, 255, 255, 0.99)!important;
	-moz-border-bottom-colors: rgba(255, 255, 255, 0.5) rgba(50, 50, 50, 0.3) rgba(255, 255, 255, 0.99)!important;
	-moz-border-left-colors: rgba(255, 255, 255, 0.5) rgba(50, 50, 50, 0.7) rgba(255, 255, 255, 0.99)!important;
}

#main-window #urlbar[level="high"][focused="true"] > .autocomplete-textbox-container,
#main-window #urlbar[level="high"][focused="true"] > .autocomplete-history-dropmarker
{
	background-color: rgba(245, 246, 190, 0.99) !important;
}

#main-window #searchbar .searchbar-textbox:hover:not([focused="true"]),
#main-window #urlbar:hover:not([focused="true"])
{
	background-color: rgba(255, 255, 255, 0.90) !important;
}

#main-window #urlbar[level="high"]:hover:not([focused="true"]) > .autocomplete-textbox-container,
#main-window #urlbar[level="high"]:hover:not([focused="true"]) > .autocomplete-history-dropmarker
{
	background-color: rgba(245, 246, 190, 0.65) !important;
}

>>>Code ends here. Do not copy this line.
>>>End of file
*/