<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/" version="2.0">
    <channel>
        <title>Ralph Varjabedian</title>
        <link>http://varjabedian.net/Default.aspx</link>
        <description>Sharing .NET Code and ideas</description>
        <language>en-US</language>
        <copyright>Ralph Varjabedian</copyright>
        <managingEditor>ralph@varjabedian.net</managingEditor>
        <generator>Subtext Version 1.9.5.177</generator>
        <image>
            <title>Ralph Varjabedian</title>
            <url>http://varjabedian.net/images/RSS2Image.gif</url>
            <link>http://varjabedian.net/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/RalphVarjabedian" type="application/rss+xml" /><item>
            <title>It's been a while...</title>
            <link>http://varjabedian.net/archive/2009/01/13/its-been-a-while.aspx</link>
            <description>&lt;p&gt;Hello everybody,&lt;/p&gt;
&lt;p&gt;It's been a while since I posted here, mainly because my hardisk crashed on me on the 31st of December &lt;img alt="" src="/Providers/BlogEntryEditor/FCKeditor/editor/images/smiley/msn/regular_smile.gif" /&gt; it could not make it till the coming year. After the crash and a new hardisk, I decided to upgrade to Windows XP, I had vista before &lt;img alt="" src="/Providers/BlogEntryEditor/FCKeditor/editor/images/smiley/msn/teeth_smile.gif" /&gt; and Life is Great again :) I had some trouble finding the drivers, but eventually I found everything I need... Some simple differences to note, VS2008 took around one hour to install on XP. SP1 of VS2008 took less than 30 minutes to install, I remember I had to wait hours to finish installing SP1 when I had Vista... Makes you wonder what is it doing?! Mind you that when I had Vista, all the graphics effects were stripped down to gain maximum performance, most unnecessary services were stopped but still it was extremely slow compared to XP. Hopefully Windows 7 will be much better. Within the near future I will be giving a presentation at Microsoft offices in Lebanon on speeding up your WebApplications. I will keep you posted.&lt;/p&gt;&lt;img src="http://varjabedian.net/aggbug/27.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/RalphVarjabedian/~4/Ut0FYP6qjso" height="1" width="1"/&gt;</description>
            <dc:creator>Ralph Varjabedian</dc:creator>
            <guid>http://varjabedian.net/archive/2009/01/13/its-been-a-while.aspx</guid>
            <pubDate>Tue, 13 Jan 2009 11:01:40 GMT</pubDate>
            <wfw:comment>http://varjabedian.net/comments/27.aspx</wfw:comment>
            <comments>http://varjabedian.net/archive/2009/01/13/its-been-a-while.aspx#feedback</comments>
            <wfw:commentRss>http://varjabedian.net/comments/commentRss/27.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Increase the performance of your website, manage script dependencies in ease, (Revisiting sss.aspx)</title>
            <category>5 minutes tips</category>
            <category>ASP.NET</category>
            <category>JavaScript</category>
            <link>http://varjabedian.net/archive/2008/12/07/increase-the-performance-of-your-website-manage-script-dependencies-in.aspx</link>
            <description>&lt;p&gt;I have updated sss.aspx to include a couple of more features and here is what it can do for you now.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;The most important benefit is it allows you to combine several script files (CSS or js) into one file to return to your client, this helps increase performance of your website by minimizing the http requests the page requires. &lt;/li&gt;    &lt;li&gt;The returning stream tries to use GZip compression if supported by the client browser. This further increases load speeds of your site. &lt;/li&gt;    &lt;li&gt;You can specify default script files to include always. &lt;/li&gt;    &lt;li&gt;Proper cashing headers and proper generation of 302 response codes (not modified) to minimize the transfer of scripts to the client browser. Script files are sent back to the client browser only if they have been modified. Two headers are processed to achieve this, "If-Modified-Since, Last-modified"  and "If-None-Match, ETag". &lt;/li&gt;    &lt;li&gt;The ability to process your script files on the server to modify them before you send them back to the client (server side scripts), for example, your css files could have two colors replaced by variables [[COLOR1]], [[COLOR2]] and these variables could be replaced with the actual colors that you want to send to the client browser when requested. Using this you could achieve things like custom css files per client account (custom colors for each client account), or it could be used to specify different strings (inside JavaScript files) depending on the current language set. &lt;/li&gt;    &lt;li&gt;Last, but not least, a feature I am enthusiastic about. You can put special comments in your css, js files to indicate file dependencies. If for example you have two javascript files common.js and popups.js. If popups.js depends on common.js then you write a special comment in the beginning of the popups.js file to indicate that common.js is needed. sss.aspx properly parses this "dependency tree" and combines the files properly, in the proper order and serves them back to the client browser. If you have a lot of javascript files, you know you have the headache of specifying them in the correct order in the html/aspx files. If you "describe" your dependencies correctly in all your files by including these special comments, then you will not have to worry about this anymore, when you specify a javascript file that you need, the scripts it depends on are automatically added. &lt;/li&gt; &lt;/ol&gt;  &lt;blockquote&gt;   &lt;p&gt;To use sss.aspx, it is very simple. &lt;/p&gt;    &lt;p&gt;1. add the file sss.aspx it to your site (no need to recompile).&lt;/p&gt;    &lt;p&gt;2. instead of including your script files like this:&lt;/p&gt;    &lt;div&gt;     &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&amp;lt;script language=&lt;span style="color: #006080"&gt;"javascript1.2"&lt;/span&gt; src=&lt;span style="color: #006080"&gt;"common.js"&lt;/span&gt; type=&lt;span style="color: #006080"&gt;"text/javascript"&lt;/span&gt;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script language=&lt;span style="color: #006080"&gt;"javascript1.2"&lt;/span&gt; src=&lt;span style="color: #006080"&gt;"sample.js"&lt;/span&gt; type=&lt;span style="color: #006080"&gt;"text/javascript"&lt;/span&gt;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script language=&lt;span style="color: #006080"&gt;"javascript1.2"&lt;/span&gt; src=&lt;span style="color: #006080"&gt;"engine.js"&lt;/span&gt; type=&lt;span style="color: #006080"&gt;"text/javascript"&lt;/span&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/blockquote&gt;

&lt;blockquote dir="ltr" style="margin-right: 0px"&gt;
  &lt;p&gt;Add this now.&lt;/p&gt;

  &lt;div&gt;
    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;script&lt;/span&gt; &lt;span style="color: #ff0000"&gt;language&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="javascript1.2"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;src&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="sss.aspx?sample.js,engine.js"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;type&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="text/javascript"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;script&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;Note how the file common.js was omitted from the list, this is because the files sample.js and engine.js start with the comment:&lt;/p&gt;

  &lt;div&gt;
    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #008000"&gt;/* &amp;lt;sss include="common.js"/&amp;gt; */&lt;/span&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;This comment will make sss.aspx combine the file common.js with sample.js and engine.js in the proper order and serve them back as one file.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you have any comments, please let me hear about them. I tried to be straight to the point in this post, if some things are not clear enough, let me know and I will gladly explain more. You can use fiddler2 (http proxy debugger) to check the results of using sss.aspx. &lt;/p&gt;

&lt;p&gt;Another important tip for increasing your site's load speeds is to enable "Content Expiration" in IIS.&lt;/p&gt;

&lt;div class="wlWriterSmartContent" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:6800ac2d-ebc4-4e44-8554-c5f7bd0bf7a2" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;p&gt;Download the latest &lt;a href="http://varjabedian.net/resources/Revisit.aspxfromServerSideJavascriptPost_13EAD/sss.zip" target="_blank"&gt;sss.aspx file here&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;img src="http://varjabedian.net/aggbug/26.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/RalphVarjabedian/~4/_QDQqlHRlCk" height="1" width="1"/&gt;</description>
            <dc:creator>Ralph Varjabedian</dc:creator>
            <guid>http://varjabedian.net/archive/2008/12/07/increase-the-performance-of-your-website-manage-script-dependencies-in.aspx</guid>
            <pubDate>Sun, 07 Dec 2008 11:50:50 GMT</pubDate>
            <wfw:comment>http://varjabedian.net/comments/26.aspx</wfw:comment>
            <comments>http://varjabedian.net/archive/2008/12/07/increase-the-performance-of-your-website-manage-script-dependencies-in.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://varjabedian.net/comments/commentRss/26.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Printer Friendly Pages in 5 minutes</title>
            <category>5 minutes tips</category>
            <category>ASP.NET</category>
            <link>http://varjabedian.net/archive/2008/11/14/printer-friendly-pages-in-5-minutes.aspx</link>
            <description>&lt;p&gt;I answered a post the other day about an easy way to have printer friendly look of pages in your web application and I decided to blog it here. You just need 5 minutes to have all your pages in your web application printer ready, ok maybe a bit more, like 10 minutes :)&lt;/p&gt;  &lt;p&gt;When you design your web application, have your pages implement a master page, let us call it MainMaster.Master. Create another master page, call it PrinterFriendlyMaster.Master and make sure it has the same content holders as your MainMaster.Master, however make it printer friendly, without a header, maybe simpler footer, no background color, maybe different CSS files, etc... anything you need to do to have it ready for printers. Create a base class for all your pages, let us call it BasePage, it is a simple class like this:&lt;/p&gt;  &lt;div&gt;   &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System;
&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Web;

&lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt; telephone.NOC
{
    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; BasePage : System.Web.UI.Page
    {
        &lt;span style="color: #0000ff"&gt;protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Page_PreInit(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, EventArgs e)
        {
            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (Request[&lt;span style="color: #006080"&gt;"print"&lt;/span&gt;] != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)
                Page.MasterPageFile = &lt;span style="color: #006080"&gt;"~/PrinterFriendlyPage.master"&lt;/span&gt;;
        }
    }
}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Have all your pages derive from BasePage class.&lt;/p&gt;

&lt;p&gt;Now at runtime, when you add a query string to a URL with print=1 the Page_PreInit of BasePage will detect that and will switch the master page dynamically to the printer friendly one, simple, modular and fast to implement.&lt;/p&gt;&lt;img src="http://varjabedian.net/aggbug/25.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/RalphVarjabedian/~4/BmcCVQLk47c" height="1" width="1"/&gt;</description>
            <dc:creator>Ralph Varjabedian</dc:creator>
            <guid>http://varjabedian.net/archive/2008/11/14/printer-friendly-pages-in-5-minutes.aspx</guid>
            <pubDate>Fri, 14 Nov 2008 15:00:41 GMT</pubDate>
            <wfw:comment>http://varjabedian.net/comments/25.aspx</wfw:comment>
            <comments>http://varjabedian.net/archive/2008/11/14/printer-friendly-pages-in-5-minutes.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://varjabedian.net/comments/commentRss/25.aspx</wfw:commentRss>
        </item>
        <item>
            <title>An expandable JavaScript popups engine</title>
            <category>JavaScript</category>
            <link>http://varjabedian.net/archive/2008/10/27/an-expandable-javascript-popups-engine.aspx</link>
            <description>&lt;p&gt;Hello everybody, its been a while I haven't posted anything, I've been very busy :) But I promise you today's post will be good, or at least I hope so. Read on...&lt;/p&gt;
&lt;p&gt;Every website needs to show alerts, popups, layers, whatever you want to call them. New Web 2.0 websites need this more as they show information with popups about the asynchronous actions the end user does. Take a look at Google Reader for example, my favorite RSS reader, when you do things like scroll down, you see a small popup (or a layer if you want) that is a simple div with a different background color that shows on the top of the page centered, displaying things like "Loading..." etc.&lt;/p&gt;
&lt;p&gt;What I will present to you in this post is an engine for displaying such popups in a snap. Adding the engine to your site is very simple, you just have to include some JavaScript files in your pages. Please check my earlier post on &lt;a target="_blank" href="http://varjabedian.net/archive/2008/08/31/server-side-css-server-side-javascript.aspx"&gt;Server side JavaScript&lt;/a&gt; because it contains a small engine that allows you to serve JavaScript files to the client browser in a more efficient manner. Let me start with a simple syntax of adding a simple popup to your site, it is as easy as this:&lt;/p&gt;
&lt;div&gt;
&lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"&gt;CommonPopupsEngine.GetHtmlPopup(0, &lt;span style="color: rgb(0, 96, 128);"&gt;"&amp;lt;div class='popup'&amp;gt;Loading...&amp;lt;/div&amp;gt;"&lt;/span&gt;).&lt;br /&gt;   Center(CommonPopupsEngine.CenterHorizontal).&lt;br /&gt;   ShowDialog();&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;This will show a div in the middle of the page (horizontal) saying "Loading...". The CSS class popup will customize it's color, background color and so on. &lt;/p&gt;
&lt;p&gt;The first parameter is the channel, I will defer the explanation of this till later, for now set it always to zero. The next parameter is the actual html text of the popup you want to add, in this case it is a simple div with a CSS class. The function GetHtmlPopup at this point returns an object that is called "PopupCollection". The "PopupCollection" object is considered as one popup, visually speaking, however the name is set to collection because each visual popup you show, could be created from several html elements and not just one, for example if you want to add a shadow to your popup, then the popup will have your html code that was specified with the function call and another html element behind your element that is casting the shadow, together they form the visual popup that you see. &lt;/p&gt;
&lt;p&gt;The PopupCollection object has several functions defined on it including ShowDialog() which will show the PopupCollection once called. The PopupCollection functions use the chaining method, which means each function returns "this" at the end of it to enable chaining the functions one after the other, this technique makes it easy to customize the PopupCollection in an easy memorable/expandable way without having to shove everything as parameters on one function.&lt;/p&gt;
&lt;p&gt;The engine also offers you Grayouts to popups. Grayouts are when the whole page fades before showing the popup. Adding a grayout is as easy as calling AddGrayout() on your PopupCollection object, similarly for adding a shadow, you call AddShadow(). These two functions have a restriction on the order that you call them. If you want them, you have to call them in the beginning of the chain and the AddShadow() should be before the AddGrayout().&lt;/p&gt;
&lt;p&gt;The functions that you can use in chaining are:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;AddShadow&lt;/strong&gt;: Adds a shadow to your PopupCollection. &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;AddGrayout&lt;/strong&gt;: Adds a grayout to your PopupCollection. &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;SetDimensions&lt;/strong&gt;: Sets the position/dimensions of your PopupCollection. It takes 4 parameters, each of the parameters is optional and you specify null if you do not want to specify it. The parameters are x, y, width and height. The parameters are self explanatory. &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Center&lt;/strong&gt;: Center the element instead of specifying dimensions using SetDimensions. You can call this method without any parameter and it will put the PopupCollection in the middle of the page. Or you can pass it one of the following parameters: CommonPopupsEngine.CenterVertical, CommonPopupsEngine.CenterHorizontal, CommonPopupsEngine.CenterBoth. &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;SetFadeInDelay&lt;/strong&gt;: Usually the popups show and hide, however if you call this function passing it a delay value (in milliseconds), it will FadeIn. &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;SetFadeOutDelay&lt;/strong&gt;: Same as above but for closing the dialog. &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;EnableUserPositioning&lt;/strong&gt;: Enables the PopupCollection to be dragged by the end user. &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;AutoCloseDialogAfter&lt;/strong&gt;:If you want to have the PopupCollection close automatically after a period of time, call this function passing it the delay in milliseconds. &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;ShowDialog&lt;/strong&gt;:Usually this is the last function you call in the chain, it will display the PopupCollection. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;An example on the usage of these:&lt;/p&gt;
&lt;div&gt;
&lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"&gt;CommonPopupsEngine.GetHtmlPopup(0, &lt;br /&gt;    &lt;span style="color: rgb(0, 96, 128);"&gt;"&amp;lt;div class='popup'&amp;gt;An error has occurred&amp;lt;/div&amp;gt;"&lt;/span&gt;)&lt;br /&gt;    .AddShadow()&lt;br /&gt;    .AddGrayout()&lt;br /&gt;    .SetDimensions(&lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;, 40)&lt;br /&gt;    .Center(CommonPopupsEngine.CenterHorizontal)&lt;br /&gt;    .SetFadeInDelay(300)&lt;br /&gt;    .SetFadeOutDelay(400)&lt;br /&gt;    .EnableUserPositioning()&lt;br /&gt;    .ShowDialog();&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;This example will show a popup that says "An error has occurred" inside a div having the CSS Class 'popup', It will have a Shadow and a Grayout, it will be centered horizontally and its Y coordinates will be 40 pixels from the top. The popup will FadeIn in 300 milliseconds and will FadeOut in 400 milliseconds. The popup can be dragged by the end user.&lt;/p&gt;
&lt;p&gt;You can also easily open an Iframe in a popup by using a call like this:&lt;/p&gt;
&lt;div&gt;
&lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"&gt;CommonPopupsEngine.GetIFramePopup(channel, &lt;span style="color: rgb(0, 96, 128);"&gt;"http://www.yahoo.com/"&lt;/span&gt;,&lt;br /&gt;    450, 250, 200, 100, &lt;span style="color: rgb(0, 0, 255);"&gt;true&lt;/span&gt;)&lt;br /&gt;    .AddShadow(&lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;, 10)&lt;br /&gt;    .AddGrayout()&lt;br /&gt;    .SetFadeInDelay(300)&lt;br /&gt;    .SetFadeOutDelay(400)&lt;br /&gt;    .ShowDialog();&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;More examples can be seen in the file commonpopup.js in the attached example project.&lt;/p&gt;
&lt;p&gt;To close the popups, there is one easy function to call CommonPopupsEngine.CloseTopmostPopupCollection. This function can be called without any parameter, in this case, it will close the last PopupCollection that was showed on the page. You can also pass it a specific channel to indicate to close the top most popup of a specific channel, I will explain the channels next.&lt;/p&gt;
&lt;p&gt;When you show several popups, the engine stacks them on top of each other. And when you close the popups, it will close the topmost and shows the ones under it. If you want to have a different stack on the page, then this is what the channel is for, a channel is a stack of popups, specifying a different channel instructs the engine to use a different stack for the popups internally. &lt;a href="http://varjabedian.net/resources/AnexpandableJavaScriptpopupsengine_9DD1/Clipboard02.gif"&gt;&lt;img height="34" width="52" border="0" src="http://varjabedian.net/resources/AnexpandableJavaScriptpopupsengine_9DD1/Clipboard02_thumb.gif" alt="Clipboard02" style="border: 0px none ;" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;The engine takes care of the z-index of the popups that it shows transparently for you. It also makes sure that each individual html element in a PopupCollection has the proper z-index set for it (usually this is dictated by the order of the elements in the PopupCollection, this is why the AddShadow() and AddGrayout() has an order restriction when you call them in the chain). &lt;/p&gt;
&lt;p&gt;The popup engine is written in the file commonpopupsengine.js, in the top of the file, there are few customizable parameters that affect how the engine works, they are put between two comments called configuration.&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;CommonPopupsEngine_startupZIndex&lt;/strong&gt;: &lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;p&gt;This is the startup z-index that the engine uses to manage the z-indexes of the PopupCollections you show. You might need to raise this value if you have your own popups or your own elements that have higher z-indexes.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;CommonPopupsEngine_maxPopupCollectionElements&lt;/strong&gt;: &lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;p&gt;As described in the paragraph above, the engine takes care of the z-index of the individual elements of the PopupCollection, to do so correctly, it needs to know the maximum number of html elements that may exist in one single PopupCollection, this is this value. Usually you will not need to change this value however if you want to expand this code you will need to understand this more. On a later post, I will go into more details to explain how you can expand the code here.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;CommonPopupsEngine_useGlobalZIndex&lt;/strong&gt;: &lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;p&gt;If this value is set to true, then even if you have multiple channels, the last popup will be shown on top of all including all channels. If you have this set to false, if you open two popups in two different channels then they will have the same z-index and they will be shown both as on top and not just one.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;CommonPopupsEngine_onlyShowToplevelPopup&lt;/strong&gt;: &lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;p&gt;When this is set to true, if you open more than one popup, then only the last popup will be seen. When you show a new popup, the current one will be hidden and when you close the topmost popup, then if there is a popup below it, it will be shown again.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Here are some snapshots:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://varjabedian.net/resources/AnexpandableJavaScriptpopupsengine_9DD1/IframeLoading.gif"&gt;&lt;img height="142" width="244" border="0" src="http://varjabedian.net/resources/AnexpandableJavaScriptpopupsengine_9DD1/IframeLoading_thumb.gif" alt="Iframe Loading" style="border: 0px none ;" /&gt;&lt;/a&gt; &lt;a href="http://varjabedian.net/resources/AnexpandableJavaScriptpopupsengine_9DD1/IfameLoaded.gif"&gt;&lt;img height="147" width="244" border="0" src="http://varjabedian.net/resources/AnexpandableJavaScriptpopupsengine_9DD1/IfameLoaded_thumb.gif" alt="Ifame Loaded" style="border: 0px none ;" /&gt;&lt;/a&gt; &lt;a href="http://varjabedian.net/resources/AnexpandableJavaScriptpopupsengine_9DD1/PopupExample.gif"&gt;&lt;img height="126" width="244" border="0" src="http://varjabedian.net/resources/AnexpandableJavaScriptpopupsengine_9DD1/PopupExample_thumb.gif" alt="PopupExample" style="border: 0px none ;" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Let me know if you have any comments or if you need further help.&lt;/p&gt;
&lt;p&gt;Hope this helps you. &lt;/p&gt;
&lt;div style="margin: 0px; padding: 0px; display: inline;" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:0091a52f-0ec5-45ae-bc2b-1648dab22b6a" class="wlWriterSmartContent"&gt;
&lt;p&gt; &lt;a target="_blank" href="http://varjabedian.net/resources/AnexpandableJavaScriptpopupsengine_9DD1/CommonPopupsClientside.zip"&gt;Here is the sample project with the source code to download.&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;&lt;img src="http://varjabedian.net/aggbug/24.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/RalphVarjabedian/~4/XsXYCUIp2mU" height="1" width="1"/&gt;</description>
            <dc:creator>Ralph Varjabedian</dc:creator>
            <guid>http://varjabedian.net/archive/2008/10/27/an-expandable-javascript-popups-engine.aspx</guid>
            <pubDate>Mon, 27 Oct 2008 12:25:37 GMT</pubDate>
            <wfw:comment>http://varjabedian.net/comments/24.aspx</wfw:comment>
            <comments>http://varjabedian.net/archive/2008/10/27/an-expandable-javascript-popups-engine.aspx#feedback</comments>
            <wfw:commentRss>http://varjabedian.net/comments/commentRss/24.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Server side CSS? Server side JavaScript?</title>
            <category>5 minutes tips</category>
            <category>ASP.NET</category>
            <category>JavaScript</category>
            <link>http://varjabedian.net/archive/2008/08/31/server-side-css-server-side-javascript.aspx</link>
            <description>&lt;p&gt;The other day we were restructuring some CSS files in a project I am working on. And we were thinking of the best way to specify one CSS file differently for each end user account in the project since each end user has the ability to control some aspects of the way the site looks when he/she logs in. Specifically each end user can control two main colors in the site's design. After some thoughts we ended up feeling we wanted somehow &lt;strong&gt;server side CSS&lt;/strong&gt; in which we can write our CSS but instead of hardcoding two colors in the file, we want them as variables that we can inject from the server side from some code behind. &lt;/p&gt;
&lt;p&gt;Initially I tried out some experiments with aspx files to serve CSS but there were some issues and the solution was not complete. I ended up writing one aspx file, that I called sss.aspx (server side script) which is used to read the CSS files locally, process them (replace variables in them) and then serve them back. The code was also written to support JavaScript files as well and not just CSS files. &lt;/p&gt;
&lt;p&gt;To use this file, instead of specifying your CSS file like this:&lt;/p&gt;
&lt;div&gt;
&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;link&lt;/span&gt; &lt;span style="COLOR: #ff0000"&gt;rel&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="stylesheet"&lt;/span&gt; &lt;span style="COLOR: #ff0000"&gt;type&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="text/css"&lt;/span&gt; &lt;span style="COLOR: #ff0000"&gt;href&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="sample.css"&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;p&gt;You specify your CSS like this now:&lt;/p&gt;
&lt;div&gt;
&lt;pre style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;link&lt;/span&gt; &lt;span style="COLOR: #ff0000"&gt;rel&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="stylesheet"&lt;/span&gt; &lt;span style="COLOR: #ff0000"&gt;type&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="text/css"&lt;/span&gt; &lt;span style="COLOR: #ff0000"&gt;href&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="sss.aspx?sample.css"&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;p&gt;You can also specify several files beside each other, comma separated and the script file will combine them all together into one file and return them to the client, the order of the files on the query string is the order of combing the files. This has the benefit of speeding things since you are now sending all your files as one file in one connection instead of sending several files and waiting in queue due to the 2 connections per domain limitation of the browser. There is a part of the code in sss.aspx file where you can add some default files there that you would always want to serve by default without needing to add the files to the query string. You can also use this file to do the same exact thing with .js files (JavaScript files). The sss.aspx file can be easily modified to include your own script types as well, if you have something other than .css or .js. &lt;/p&gt;
&lt;p&gt;The script also supports returning the result as GZIP or DEFLATE compressed, if the client browser supports it. And finally it provides proper cashing handling and proper Last-Modified headers handling. Once the file combined is served to the client, it will not be served again as long as you do not modify the source CSS or JS files. I have written the C# code inline to make it very easy to add to your own projects, just add the sss.aspx file.&lt;/p&gt;
&lt;p&gt;Here is a recap of the benefits:&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Server side script files (CSS and JavaScript) where you can replace server side variables with their appropriate values (method: ReplaceScriptVariables) &lt;/li&gt;
    &lt;li&gt;Combine several script files into one file to speed things up. &lt;/li&gt;
    &lt;li&gt;The returned stream will be compressed if the client browser supports it. &lt;/li&gt;
    &lt;li&gt;Automatically add common script files that you need in all your site without having to specify them each time. &lt;/li&gt;
    &lt;li&gt;Proper cashe handling and proper Last-Modified headers handling. &lt;/li&gt;
    &lt;li&gt;Add your script file types easily. &lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;div class="wlWriterSmartContent" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:cd2162a6-6d39-447d-a28e-70bce45562c5" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"&gt;
&lt;p&gt;Here is a &lt;a target="_blank" href="http://varjabedian.net/resources/ServersideCSSServersideJavaScript_9EEA/ServerSideCss_3.rar"&gt;very small sample project that includes the sss.aspx file.&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;&lt;img src="http://varjabedian.net/aggbug/23.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/RalphVarjabedian/~4/kM8Ps484FXM" height="1" width="1"/&gt;</description>
            <dc:creator>Ralph Varjabedian</dc:creator>
            <guid>http://varjabedian.net/archive/2008/08/31/server-side-css-server-side-javascript.aspx</guid>
            <pubDate>Sun, 31 Aug 2008 11:22:58 GMT</pubDate>
            <wfw:comment>http://varjabedian.net/comments/23.aspx</wfw:comment>
            <comments>http://varjabedian.net/archive/2008/08/31/server-side-css-server-side-javascript.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://varjabedian.net/comments/commentRss/23.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Wordle !</title>
            <category>Interesting finds</category>
            <link>http://varjabedian.net/archive/2008/08/22/wordle.aspx</link>
            <description>&lt;p&gt;I stumbled across a very nice site with a nice idea. Basically you add a bunch of words or even simpler, you provide an RSS URL and then the site will create for you an image of the most common words (the more popular the word, the bigger the size) in a nice layout. Go ahead, &lt;a href="http://wordle.net/" target="_blank"&gt;check it out&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://varjabedian.net/resources/Wordle_BA7D/20080822_134758.gif"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="155" alt="2008-08-22_134758" src="http://varjabedian.net/resources/Wordle_BA7D/20080822_134758_thumb.gif" width="244" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://varjabedian.net/aggbug/22.aspx" width="1" height="1" /&gt;&lt;img src="http://feeds.feedburner.com/~r/RalphVarjabedian/~4/OdvBiMEruTM" height="1" width="1"/&gt;</description>
            <dc:creator>Ralph Varjabedian</dc:creator>
            <guid>http://varjabedian.net/archive/2008/08/22/wordle.aspx</guid>
            <pubDate>Fri, 22 Aug 2008 10:23:35 GMT</pubDate>
            <wfw:comment>http://varjabedian.net/comments/22.aspx</wfw:comment>
            <comments>http://varjabedian.net/archive/2008/08/22/wordle.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://varjabedian.net/comments/commentRss/22.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>
