<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tara Andrei &#187; JavaScript</title>
	<atom:link href="http://andreitara.com/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://andreitara.com</link>
	<description>I could change the world if they would let my allocate more instances of myself.</description>
	<lastBuildDate>Wed, 07 Mar 2012 21:30:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Iframe preloader animation</title>
		<link>http://andreitara.com/2012/03/iframe-preloader-animation/</link>
		<comments>http://andreitara.com/2012/03/iframe-preloader-animation/#comments</comments>
		<pubDate>Wed, 07 Mar 2012 21:29:55 +0000</pubDate>
		<dc:creator>andreiT</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[animation on loading iframe]]></category>
		<category><![CDATA[iframe loading]]></category>

		<guid isPermaLink="false">http://andreitara.com/?p=512</guid>
		<description><![CDATA[I love working with iframe content loading&#8230; noo no way, I actually hate it, but there are situations when loading the content inside the iframe is the only viable technical solution. I am sure you have use it before and maybe you have asked yourself how to add something like a loding animation while the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://andreitara.com/wp-content/uploads/2012/03/images.jpg"><img src="http://andreitara.com/wp-content/uploads/2012/03/images-150x150.jpg" alt="" title="images" width="150" height="150" class="alignleft size-thumbnail wp-image-517" /></a>I love working with iframe content loading&#8230; noo no way, I actually hate it, but there are situations when loading the content inside the iframe is the only viable technical solution. I am sure you have use it before and maybe you have asked yourself how to add something like a loding animation while the frame is loading. I will provide a example but today I am fling lazy so I will use jQuery, the code should be something like:<br />
<span id="more-512"></span></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> ContentLoader <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">function</span> load<span style="color: #009900;">&#40;</span>url<span style="color: #339933;">,</span> onContentLoaded<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		$<span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#content'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;iframe id=&quot;myBelovedIframe&quot; frameborder=&quot;0&quot; width=&quot;500&quot; height=&quot;50&quot;&gt;&lt;/iframe&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'iframe#myBelovedIframe'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'src'</span><span style="color: #339933;">,</span> url<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// On iframe content load</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'iframe#myBelovedIframe'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			onContentLoaded<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
c <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> ContentLoader<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
c.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;http://andreitara.com&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#content'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'loading'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #006600; font-style: italic;">// TODO Add any code that has to be executed after the frame is loaded</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This is how the script should look like, and the HTML could be something like:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&nbsp;
....
&lt;div id=&quot;content&quot; class='loading'&gt;&lt;/div&gt;
...</pre></div></div>

<p>of course you will need also some CSS for the loading animation like:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">&nbsp;
.loading<span style="color: #00AA00;">&#123;</span>
 <span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span><span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'loading.gif'</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Your parents should be so proud of you, you first iframe with loading animation <img src='http://andreitara.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> , now you can celebrate.</p>
]]></content:encoded>
			<wfw:commentRss>http://andreitara.com/2012/03/iframe-preloader-animation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working with models data.store and list in Sencha</title>
		<link>http://andreitara.com/2012/03/working-with-models-data-store-and-list-in-sencha/</link>
		<comments>http://andreitara.com/2012/03/working-with-models-data-store-and-list-in-sencha/#comments</comments>
		<pubDate>Thu, 01 Mar 2012 22:06:07 +0000</pubDate>
		<dc:creator>andreiT</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Sencha]]></category>
		<category><![CDATA[sencha list]]></category>
		<category><![CDATA[sencha model]]></category>
		<category><![CDATA[sencha store]]></category>

		<guid isPermaLink="false">http://andreitara.com/?p=502</guid>
		<description><![CDATA[There is no point in explaining what is MVC, if you don&#8217;t already know what is MVC well dear, then you got an issue &#8230; trust me I am an engineer . OK, now lets see how do we create our models in Sencha and fill the with information form back-end. I will create a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://andreitara.com/wp-content/uploads/2012/02/apple-touch-icon.png"><img src="http://andreitara.com/wp-content/uploads/2012/02/apple-touch-icon-150x150.png" alt="" title="apple-touch-icon" width="150" height="150" class="alignleft size-thumbnail wp-image-413" /></a>There is no point in explaining what is MVC, if you don&#8217;t already know what is MVC well dear, then you got an issue &#8230; trust me I am an engineer <img src='http://andreitara.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> . OK, now lets see how do we create our models in Sencha  and fill the with information form back-end. I will create a models that holds the information related to user contact information. To keep this minimal the model could be something like:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">&nbsp;
<span style="color: #339933;">**</span>
 <span style="color: #339933;">*</span> Model mapping the contact details
 <span style="color: #339933;">*/</span>
Ext.<span style="color: #660066;">regModel</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'ContactDetails'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>        
	<span style="color: #006600; font-style: italic;">//Contact website</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000066;">name</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">'website'</span><span style="color: #339933;">,</span>
		type <span style="color: #339933;">:</span> <span style="color: #3366CC;">'string'</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
	<span style="color: #006600; font-style: italic;">//Twitter account</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000066;">name</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">'twitter'</span><span style="color: #339933;">,</span>
		type <span style="color: #339933;">:</span> <span style="color: #3366CC;">'string'</span>
	<span style="color: #009900;">&#125;</span>
        <span style="color: #006600; font-style: italic;">//TODO Add more  details :), I am lazy  </span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #339933;">**</span>
 <span style="color: #339933;">*</span> Model mapping the contact structure
 <span style="color: #339933;">*/</span>
Ext.<span style="color: #660066;">regModel</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Contact'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #006600; font-style: italic;">//Contact name</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000066;">name</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">'name'</span><span style="color: #339933;">,</span>
		type <span style="color: #339933;">:</span> <span style="color: #3366CC;">'string'</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
	<span style="color: #006600; font-style: italic;">//Contact email</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000066;">name</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">'email'</span><span style="color: #339933;">,</span>
		type <span style="color: #339933;">:</span> <span style="color: #3366CC;">'string'</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
        <span style="color: #006600; font-style: italic;">//Contact details</span>
        <span style="color: #006600; font-style: italic;">// Mapping Contact details model</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000066;">name</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">'detail'</span><span style="color: #339933;">,</span>
		type <span style="color: #339933;">:</span> <span style="color: #3366CC;">'ContactDetails'</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><span id="more-502"></span><br />
OK now that we have created our model lets create our store that use the Contact model</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> ContactStore <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Ext.<span style="color: #660066;">data</span>.<span style="color: #660066;">Store</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #006600; font-style: italic;">// mapping model</span>
	model <span style="color: #339933;">:</span> <span style="color: #3366CC;">'Contact'</span><span style="color: #339933;">,</span>
        <span style="color: #006600; font-style: italic;">// auto load with data from back-end</span>
	autoLoad <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
        <span style="color: #006600; font-style: italic;">// sort our contacts</span>
	sortOnLoad <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
	proxy <span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>		
		type <span style="color: #339933;">:</span> <span style="color: #3366CC;">'ajax'</span><span style="color: #339933;">,</span>
		url <span style="color: #339933;">:</span> <span style="color: #3366CC;">'example.com/contacts.json/'</span><span style="color: #339933;">,</span>		
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
        <span style="color: #006600; font-style: italic;">//Add a custom sorting function by name</span>
	sorters <span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#123;</span>
                <span style="color: #006600; font-style: italic;">//Set field used to sort the </span>
		property <span style="color: #339933;">:</span> <span style="color: #3366CC;">'name'</span><span style="color: #339933;">,</span>		
		sorterFn <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>o1<span style="color: #339933;">,</span> o2<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #003366; font-weight: bold;">var</span> v1 <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">getRoot</span><span style="color: #009900;">&#40;</span>o1<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">property</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">toLowerCase</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
			 v2 <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">getRoot</span><span style="color: #009900;">&#40;</span>o2<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">property</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">toLowerCase</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #000066; font-weight: bold;">return</span> v1 <span style="color: #339933;">&gt;</span> v2 <span style="color: #339933;">?</span> <span style="color: #CC0000;">1</span> <span style="color: #339933;">:</span> <span style="color: #009900;">&#40;</span>v1 <span style="color: #339933;">&lt;</span> v2 <span style="color: #339933;">?</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span> <span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#93;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>We did successfully created our store now lets put out data inside a list, this can be easily done by the following voodoo :</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">&nbsp;
<span style="color: #006600; font-style: italic;">//Create the list of contacts</span>
ContactsList <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Ext.<span style="color: #660066;">List</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
	id <span style="color: #339933;">:</span> <span style="color: #3366CC;">'contactslist'</span><span style="color: #339933;">,</span>
	<span style="color: #006600; font-style: italic;">//Set data source</span>
	store <span style="color: #339933;">:</span> ContactStore
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This is it, now the model strong in you is Luke <img src='http://andreitara.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://andreitara.com/2012/03/working-with-models-data-store-and-list-in-sencha/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Magento product chooser widget in you&#8217;re own module.</title>
		<link>http://andreitara.com/2012/02/using-magento-product-chooser-widget-in-youre-own-module/</link>
		<comments>http://andreitara.com/2012/02/using-magento-product-chooser-widget-in-youre-own-module/#comments</comments>
		<pubDate>Sun, 19 Feb 2012 09:39:10 +0000</pubDate>
		<dc:creator>andreiT</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[magento custom module]]></category>
		<category><![CDATA[magento product selector]]></category>

		<guid isPermaLink="false">http://andreitara.com/?p=442</guid>
		<description><![CDATA[From my personal experience Magento is in the greatest e-commerce platform when it comes to architecture and the way this is built but in the same time the it really piss me off when it comes to documentation. Well the documentation is so fuzzy and the samples are so minimal or outdated, I mean really [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://andreitara.com/wp-content/uploads/2012/02/magento-product-selector.png"><img src="http://andreitara.com/wp-content/uploads/2012/02/magento-product-selector-300x112.png" alt="" title="magento-product-selector" width="300" height="112" class="alignleft size-medium wp-image-447" /></a>From my personal experience Magento is in the greatest e-commerce platform when it comes to architecture and the way this is built but in the same time the it really piss me off when it comes to documentation. Well the documentation is so fuzzy and the samples are so minimal or outdated, I mean really useless. Even when you have to do a really simple task you have to do some reverse engineering and try to understand how to solve your problem (although in the old good days I love playing with decompilers and ASM to try to find out more about how the stuff are done under the hood). But when it comes to have a result in a specified amount of time this is not funny at all.<span id="more-442"></span><br />
OK so one of the task that I had to figure out, was to add a product chooser widget in a custom made component. Sound easy but in reality this was frustrating because I couldn&#8217;t find anything useful and thous guys form Magento community don&#8217;t want to share anything with other (damn bastards), that is the main reason that I am sharing this with you.<br />
Supposing that you already know how to create a module.<br />
The product selector will be triggered by a button and will put all the product SKU in a textbox or something like.<br />
1. create an new JS add it to js folder, this will contain something like :</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">getProductChooser <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>url<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">new</span> Ajax.<span style="color: #660066;">Request</span><span style="color: #009900;">&#40;</span>
    url<span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
        method<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;post&quot;</span><span style="color: #339933;">,</span>
        onSuccess<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #003366; font-weight: bold;">var</span> a <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;chosser-container&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            a.<span style="color: #660066;">update</span><span style="color: #009900;">&#40;</span>b.<span style="color: #660066;">responseText</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            a.<span style="color: #660066;">scrollTo</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> VarienRulesForm <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> <span style="color: #003366; font-weight: bold;">Class</span>.<span style="color: #660066;">create</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
VarienRulesForm.<span style="color: #660066;">prototype</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
    initialize<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">newChildUrl</span> <span style="color: #339933;">=</span> a<span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">shownElement</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">updateElement</span> <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;skus&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">chooserSelectedItems</span> <span style="color: #339933;">=</span> $H<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    initParam<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        b.<span style="color: #660066;">rulesObject</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> d <span style="color: #339933;">=</span> Element.<span style="color: #660066;">down</span><span style="color: #009900;">&#40;</span>b<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;.label&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>d<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            Event.<span style="color: #660066;">observe</span><span style="color: #009900;">&#40;</span>d<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;click&quot;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">showParamInputField</span>.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> b<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #003366; font-weight: bold;">var</span> f <span style="color: #339933;">=</span> Element.<span style="color: #660066;">down</span><span style="color: #009900;">&#40;</span>b<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;.element&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>f<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #003366; font-weight: bold;">var</span> e <span style="color: #339933;">=</span> f.<span style="color: #660066;">down</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.rule-chooser-trigger&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                Event.<span style="color: #660066;">observe</span><span style="color: #009900;">&#40;</span>e<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;click&quot;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">toggleChooser</span>.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> b<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #003366; font-weight: bold;">var</span> c <span style="color: #339933;">=</span> f.<span style="color: #660066;">down</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.rule-param-apply&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>c<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                Event.<span style="color: #660066;">observe</span><span style="color: #009900;">&#40;</span>c<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;click&quot;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">hideParamInputField</span>.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> b<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
                f <span style="color: #339933;">=</span> f.<span style="color: #660066;">down</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>f.<span style="color: #660066;">multiple</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    Event.<span style="color: #660066;">observe</span><span style="color: #009900;">&#40;</span>f<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;change&quot;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">hideParamInputField</span>.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> b<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
                <span style="color: #009900;">&#125;</span>
                Event.<span style="color: #660066;">observe</span><span style="color: #009900;">&#40;</span>f<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;blur&quot;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">hideParamInputField</span>.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> b<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #003366; font-weight: bold;">var</span> a <span style="color: #339933;">=</span> Element.<span style="color: #660066;">down</span><span style="color: #009900;">&#40;</span>b<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;.rule-param-remove&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            Event.<span style="color: #660066;">observe</span><span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;click&quot;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">removeRuleEntry</span>.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> b<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    showChooserElement<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>c<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">chooserSelectedItems</span> <span style="color: #339933;">=</span> $H<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> a <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">updateElement</span>.<span style="color: #660066;">value</span>.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;,&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
            b <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> a.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            b <span style="color: #339933;">=</span> a<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">strip</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>b <span style="color: #339933;">!=</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">chooserSelectedItems</span>.<span style="color: #660066;">set</span><span style="color: #009900;">&#40;</span>b<span style="color: #339933;">,</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #003366; font-weight: bold;">new</span> Ajax.<span style="color: #660066;">Updater</span><span style="color: #009900;">&#40;</span>c<span style="color: #339933;">,</span> c.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;url&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
            evalScripts<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
            parameters<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
                form_key<span style="color: #339933;">:</span> FORM_KEY<span style="color: #339933;">,</span>
                <span style="color: #3366CC;">&quot;selected[]&quot;</span><span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">chooserSelectedItems</span>.<span style="color: #660066;">keys</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
            onSuccess<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">this</span>._processSuccess.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">showChooserLoaded</span>.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> c<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
            onFailure<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">this</span>._processFailure.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    showChooserLoaded<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span> b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        a.<span style="color: #660066;">style</span>.<span style="color: #660066;">display</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;block&quot;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    showChooser<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span> c<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> b <span style="color: #339933;">=</span> a.<span style="color: #660066;">up</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">return</span>
        <span style="color: #009900;">&#125;</span>
        b <span style="color: #339933;">=</span> b.<span style="color: #660066;">down</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.rule-chooser&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">return</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">showChooserElement</span><span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    hideChooser<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span> c<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> b <span style="color: #339933;">=</span> a.<span style="color: #660066;">up</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">return</span>
        <span style="color: #009900;">&#125;</span>
        b <span style="color: #339933;">=</span> b.<span style="color: #660066;">down</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.rule-chooser&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">return</span>
        <span style="color: #009900;">&#125;</span>
        b.<span style="color: #660066;">style</span>.<span style="color: #660066;">display</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;none&quot;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    toggleChooser<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span> c<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> b <span style="color: #339933;">=</span> a.<span style="color: #660066;">up</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">down</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.rule-chooser&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">return</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>b.<span style="color: #660066;">style</span>.<span style="color: #660066;">display</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;block&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            b.<span style="color: #660066;">style</span>.<span style="color: #660066;">display</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;none&quot;</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">cleanChooser</span><span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span> c<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">showChooserElement</span><span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    cleanChooser<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span> c<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> b <span style="color: #339933;">=</span> a.<span style="color: #660066;">up</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">down</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.rule-chooser&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">return</span>
        <span style="color: #009900;">&#125;</span>
        b.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;&quot;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    showParamInputField<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span> c<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">shownElement</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">hideParamInputField</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">shownElement</span><span style="color: #339933;">,</span> c<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#125;</span>
        Element.<span style="color: #660066;">addClassName</span><span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;rule-param-edit&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> d <span style="color: #339933;">=</span> Element.<span style="color: #660066;">down</span><span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;.element&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> b <span style="color: #339933;">=</span> Element.<span style="color: #660066;">down</span><span style="color: #009900;">&#40;</span>d<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;input.input-text&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            b.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>b <span style="color: #339933;">&amp;&amp;</span> b.<span style="color: #660066;">id</span> <span style="color: #339933;">&amp;&amp;</span> b.<span style="color: #660066;">id</span>.<span style="color: #660066;">match</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/__value$/</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">updateElement</span> <span style="color: #339933;">=</span> b
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #003366; font-weight: bold;">var</span> b <span style="color: #339933;">=</span> Element.<span style="color: #660066;">down</span><span style="color: #009900;">&#40;</span>d<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;select&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            b.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">shownElement</span> <span style="color: #339933;">=</span> a
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    hideParamInputField<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span> d<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        Element.<span style="color: #660066;">removeClassName</span><span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;rule-param-edit&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> b <span style="color: #339933;">=</span> Element.<span style="color: #660066;">down</span><span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;.label&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
            c<span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>a.<span style="color: #660066;">hasClassName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;rule-param-new-child&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            c <span style="color: #339933;">=</span> Element.<span style="color: #660066;">down</span><span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;select&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>c <span style="color: #339933;">&amp;&amp;</span> c.<span style="color: #660066;">options</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #003366; font-weight: bold;">var</span> f <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> c.<span style="color: #660066;">options</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>c.<span style="color: #660066;">options</span><span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">selected</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        f.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span>c.<span style="color: #660066;">options</span><span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">text</span><span style="color: #009900;">&#41;</span>
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span>
                <span style="color: #003366; font-weight: bold;">var</span> e <span style="color: #339933;">=</span> f.<span style="color: #660066;">join</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;, &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                b.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> e <span style="color: #339933;">!=</span> <span style="color: #3366CC;">&quot;&quot;</span> <span style="color: #339933;">?</span> e <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;...&quot;</span>
            <span style="color: #009900;">&#125;</span>
            c <span style="color: #339933;">=</span> Element.<span style="color: #660066;">down</span><span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;input.input-text&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>c<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #003366; font-weight: bold;">var</span> e <span style="color: #339933;">=</span> c.<span style="color: #660066;">value</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/(^\s+|\s+$)/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                c.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> e<span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>e <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    e <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;...&quot;</span>
                <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>e.<span style="color: #660066;">length</span> <span style="color: #339933;">&gt;</span> <span style="color: #CC0000;">30</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        e <span style="color: #339933;">=</span> e.<span style="color: #660066;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">30</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;...&quot;</span>
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span>
                b.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> e
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
            c <span style="color: #339933;">=</span> Element.<span style="color: #660066;">down</span><span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;select&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>c.<span style="color: #660066;">value</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">addRuleNewChild</span><span style="color: #009900;">&#40;</span>c<span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#125;</span>
            c.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;&quot;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>c <span style="color: #339933;">&amp;&amp;</span> c.<span style="color: #660066;">id</span> <span style="color: #339933;">&amp;&amp;</span> c.<span style="color: #660066;">id</span>.<span style="color: #660066;">match</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/__value$/</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">hideChooser</span><span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span> d<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">updateElement</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">null</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">shownElement</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">null</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    addRuleNewChild<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> f <span style="color: #339933;">=</span> b.<span style="color: #660066;">id</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/^.*__(.*)__.*$/</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;$1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> h <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span>b.<span style="color: #660066;">id</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/__/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;:&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/[^:]*$/</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;children&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/:/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;__&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> d <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span>
            c<span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> a <span style="color: #339933;">=</span> Selector.<span style="color: #660066;">findChildElements</span><span style="color: #009900;">&#40;</span>h<span style="color: #339933;">,</span> $A<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">&quot;input.hidden&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>a.<span style="color: #660066;">length</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            a.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>k<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>k.<span style="color: #660066;">id</span>.<span style="color: #660066;">match</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/__type$/</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    c <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span> <span style="color: #339933;">*</span> k.<span style="color: #660066;">id</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/^.*__.*?([0-9]+)__.*$/</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;$1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    d <span style="color: #339933;">=</span> c <span style="color: #339933;">&gt;</span> d <span style="color: #339933;">?</span> c <span style="color: #339933;">:</span> d
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #003366; font-weight: bold;">var</span> g <span style="color: #339933;">=</span> f <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;--&quot;</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>d <span style="color: #339933;">+</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> j <span style="color: #339933;">=</span> b.<span style="color: #660066;">value</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> e <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;LI&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        e.<span style="color: #660066;">className</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;rule-param-wait&quot;</span><span style="color: #339933;">;</span>
        e.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> Translator.<span style="color: #660066;">translate</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Please wait, loading...&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        h.<span style="color: #660066;">insertBefore</span><span style="color: #009900;">&#40;</span>e<span style="color: #339933;">,</span> $<span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">up</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">new</span> Ajax.<span style="color: #660066;">Updater</span><span style="color: #009900;">&#40;</span>e<span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">newChildUrl</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
            evalScripts<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
            parameters<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
                form_key<span style="color: #339933;">:</span> FORM_KEY<span style="color: #339933;">,</span>
                type<span style="color: #339933;">:</span> j.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;/&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;-&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
                id<span style="color: #339933;">:</span> g
            <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
            onComplete<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">onAddNewChildComplete</span>.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> e<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
            onSuccess<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">this</span>._processSuccess.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
            onFailure<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">this</span>._processFailure.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    _processSuccess<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> a <span style="color: #339933;">=</span> b.<span style="color: #660066;">responseText</span>.<span style="color: #660066;">evalJSON</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>a.<span style="color: #660066;">ajaxExpired</span> <span style="color: #339933;">&amp;&amp;</span> a.<span style="color: #660066;">ajaxRedirect</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>Translator.<span style="color: #660066;">translate</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Your session has been expired, you will be relogged in now.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            location.<span style="color: #660066;">href</span> <span style="color: #339933;">=</span> a.<span style="color: #660066;">ajaxRedirect</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    _processFailure<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        location.<span style="color: #660066;">href</span> <span style="color: #339933;">=</span> BASE_URL
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    onAddNewChildComplete<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>c<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        $<span style="color: #009900;">&#40;</span>c<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeClassName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;rule-param-wait&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> a <span style="color: #339933;">=</span> c.<span style="color: #660066;">getElementsByClassName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;rule-param&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> b <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> b <span style="color: #339933;">&lt;</span> a.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> b<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">initParam</span><span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#91;</span>b<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    removeRuleEntry<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>b<span style="color: #339933;">,</span> c<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> a <span style="color: #339933;">=</span> Element.<span style="color: #660066;">up</span><span style="color: #009900;">&#40;</span>b<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;li&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        a.<span style="color: #660066;">parentNode</span>.<span style="color: #660066;">removeChild</span><span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    chooserGridInit<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    chooserGridRowInit<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span> b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>a.<span style="color: #660066;">reloadParams</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            a.<span style="color: #660066;">reloadParams</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #3366CC;">&quot;selected[]&quot;</span><span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">chooserSelectedItems</span>.<span style="color: #660066;">keys</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    chooserGridRowClick<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>b<span style="color: #339933;">,</span> d<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> f <span style="color: #339933;">=</span> Event.<span style="color: #660066;">findElement</span><span style="color: #009900;">&#40;</span>d<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;tr&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> a <span style="color: #339933;">=</span> Event.<span style="color: #660066;">element</span><span style="color: #009900;">&#40;</span>d<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">tagName</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;INPUT&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>f<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #003366; font-weight: bold;">var</span> e <span style="color: #339933;">=</span> Element.<span style="color: #660066;">select</span><span style="color: #009900;">&#40;</span>f<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;input&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #003366; font-weight: bold;">var</span> c <span style="color: #339933;">=</span> a <span style="color: #339933;">?</span> e<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">checked</span> <span style="color: #339933;">:</span> <span style="color: #339933;">!</span>e<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">checked</span><span style="color: #339933;">;</span>
                b.<span style="color: #660066;">setCheckboxChecked</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> c<span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    chooserGridCheckboxCheck<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>b<span style="color: #339933;">,</span> a<span style="color: #339933;">,</span> c<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>c<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>a.<span style="color: #660066;">up</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;th&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">chooserSelectedItems</span>.<span style="color: #660066;">set</span><span style="color: #009900;">&#40;</span>a.<span style="color: #660066;">value</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">chooserSelectedItems</span>.<span style="color: #660066;">remove</span><span style="color: #009900;">&#40;</span>a.<span style="color: #660066;">value</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#125;</span>
        b.<span style="color: #660066;">reloadParams</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #3366CC;">&quot;selected[]&quot;</span><span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">chooserSelectedItems</span>.<span style="color: #660066;">keys</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">updateElement</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">chooserSelectedItems</span>.<span style="color: #660066;">keys</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">join</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;, &quot;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></div></div>

<p>2. be sure that the js file will be hooked in the header, for that add the following line to the adminhtlm layout XML (note that my module is called znuv so you would replace wit the popper name):</p>
<p>3. now you have a code that it will add the widget to the interface so let&#8217;s add a backend form with a button that will show the chooser, so for that add the following lines:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$action</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'getProductChooser(\''</span> <span style="color: #339933;">.</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">getUrl</span><span style="color: #009900;">&#40;</span>
<span style="color: #0000ff;">'adminhtml/promo_widget/chooser/attribute/sku/form/rule_conditions_fieldset'</span><span style="color: #339933;">,</span>
<span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'_secure'</span> <span style="color: #339933;">=&gt;</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">app</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getStore</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isAdminUrlSecure</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'?isAjax=true\'); return false;'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$productFieldset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addField</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'trigger'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'button'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
<span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'trigger'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'label'</span> <span style="color: #339933;">=&gt;</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">helper</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'whooparoo'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Choose Products'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'value'</span> <span style="color: #339933;">=&gt;</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">helper</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'whooparoo'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Choose Products'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'class'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'rule-chooser-trigger'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'onclick'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$action</span><span style="color: #339933;">,</span>
<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>So that&#8217;s all, happy coding <img src='http://andreitara.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://andreitara.com/2012/02/using-magento-product-chooser-widget-in-youre-own-module/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sencha touch list and taphold event</title>
		<link>http://andreitara.com/2012/02/sencha-touch-list-and-taphold-event/</link>
		<comments>http://andreitara.com/2012/02/sencha-touch-list-and-taphold-event/#comments</comments>
		<pubDate>Sun, 12 Feb 2012 23:44:22 +0000</pubDate>
		<dc:creator>andreiT</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Sencha]]></category>
		<category><![CDATA[sencha touch]]></category>
		<category><![CDATA[taphold]]></category>

		<guid isPermaLink="false">http://andreitara.com/?p=407</guid>
		<description><![CDATA[Sencha touch allows you to create in no time applications for mobile device and all you need  is love  and&#8230; JavaScript. My latest challenge was to show a menu when user was holding the finger ( not necessary the middle  one  ) on any list element. It tokes me a while but in the end I have  found the magic spell that [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://andreitara.com/wp-content/uploads/2012/02/apple-touch-icon.png"><img class="alignleft  wp-image-413" title="apple-touch-icon" src="http://andreitara.com/wp-content/uploads/2012/02/apple-touch-icon.png" alt="" width="111" height="111" /></a>Sencha touch allows you to create in no time applications for mobile device and all you need  is love <img src='http://andreitara.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />   and&#8230; JavaScript. My latest challenge was to show a menu when user was holding the finger ( not necessary the middle  one <img src='http://andreitara.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />   ) on any list element. It tokes me a while but in the end I have  found the magic spell that solved the problem. So to keep it short the code should look something like:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">//Create the list</span>
FileList <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Ext.<span style="color: #660066;">List</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
<span style="color: #006600; font-style: italic;">// list setting</span>
<span style="color: #006600; font-style: italic;">// another list setting</span>
<span style="color: #006600; font-style: italic;">// ...</span>
<span style="color: #006600; font-style: italic;">/**
* Listeners binding
*/</span>
listeners <span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
el <span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #006600; font-style: italic;">/**
  * Binding tap hold event on list element 
  */</span>
  taphold <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>record<span style="color: #339933;">,</span> btn<span style="color: #339933;">,</span> index<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #006600; font-style: italic;">//Here you can add the required logic </span>
  <span style="color: #009900;">&#125;</span>
 <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://andreitara.com/2012/02/sencha-touch-list-and-taphold-event/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Protecting HTML source code from being stolen</title>
		<link>http://andreitara.com/2010/03/protecting-html-source-code-from-being-stolen/</link>
		<comments>http://andreitara.com/2010/03/protecting-html-source-code-from-being-stolen/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 19:01:45 +0000</pubDate>
		<dc:creator>andreiT</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[hite web page code]]></category>
		<category><![CDATA[html protector]]></category>
		<category><![CDATA[javascript page encryptor]]></category>

		<guid isPermaLink="false">http://www.andreitara.com/?p=222</guid>
		<description><![CDATA[A  lot of people are asking me how they can protect the source code of HTML of they&#8217;re  site from being seen or worst being stolen. Well, the simple and short answer is that you can&#8217;t everything that the browser loads to render it can be seen by the user. The simplest method to protect [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-238" title="011810_home_security" src="http://www.andreitara.com/wp-content/uploads/2010/03/011810_home_security.jpg" alt="011810_home_security" width="243" height="243" />A  lot of people are asking me how they can <strong>protect the source code</strong> of HTML of they&#8217;re  site from being seen or worst being stolen. Well, the simple and <span style="text-decoration: underline;">short answer</span> is that <span style="text-decoration: underline;">you can&#8217;t</span> everything that the browser loads to render it can be seen by the user. The simplest method to protect you&#8217;re source HTML code is  never to publish it on Internet <img src='http://andreitara.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>Well seriously, there are some <strong>meta methods</strong> to <strong>protect</strong> you&#8217;re <strong>HTML</strong> source from being seen by a common user not from an expert user.I will enumerate some methods starting with the simplest.<br />
<span id="more-222"></span></p>
<ul>
<li>The first method, maybe the most stupid one but used by many people (stupid ideas work for stupid people <img src='http://andreitara.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ) is <strong>putting a lot of empty line in front of HTML source</strong>. If the user looks at the source will see just empty white page. But if he scroll down on bottom of the page he will see the source.</li>
<li>The  second method is to disable right click on page. To do that just take a look at next code://Disable right click script III- By Renigade (renigade@mediaone.net)<br />
//For full source code, visit http://www.dynamicdrive.com</p>
<p>var message=&#8221;";<br />
///////////////////////////////////<br />
function clickIE() {if (document.all) {(message);return false;}}<br />
function clickNS(e)<br />
{<br />
if(document.layers||(document.getElementById&amp;&amp;!document.all))<br />
{<br />
if (e.which==2||e.which==3)<br />
{(message);return false;}<br />
}<br />
}</p>
<p>if (document.layers)<br />
{<br />
document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;<br />
}<br />
else<br />
{<br />
document.onmouseup=clickNS;document.oncontextmenu=clickIE;<br />
}</p>
<p>document.oncontextmenu=new Function(&#8220;return false&#8221;)<br />
// &#8211;&gt;</p>
<p>Now that the user can do right click-&gt;show page source,  you have achieved a good protection method,  if you user is a old granny  <img src='http://andreitara.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  that doesn&#8217;t know to use  (Ctrl+U)  shortcut or Edit-&gt;View page soure.</li>
<li>The third method is to <strong>use javascript</strong> to hide the HTML content. A short example is presented next:<br />
Let&#8217;s suppose that the page has the following code:&lt;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221; &#8220;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;&gt;<br />
&lt;html xmlns=&#8221;http://www.w3.org/1999/xhtml&#8221;&gt;<br />
&lt;head&gt;<br />
&lt;meta http-equiv=&#8221;Content-Type&#8221; content=&#8221;text/html; charset=utf-8&#8243; /&gt;<br />
&lt;title&gt;Sample HTML-hide sorece code&lt;/title&gt;<br />
&lt;/head&gt;</p>
<p>&lt;body&gt;<br />
Blah blah blah<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p>
<p>Now what we have to do next is to &#8220;encrypt&#8221; this content, go to http://www.swingnote.com/tools/texttohex.php or a similar page and convert the text source code to an hexa representation. You will obtain something similar to this:<br />
%3c%21%44%4f%43%54%59%50%45%20%68%74%6d%6c%20%50%55%42%4c%49%43%20%5c%22%2d%2f%2f%57%33%43%2f%2f%44%54%44%20%58%48%54%4d%4c%20%31%2e%30%20%54%72%61%6e%73%69%74%69%6f%6e%61%6c%2f%2f%45%4e%5c%22%20%5c%22%68%74%74%70%3a%2f%2f%77%77%77%2e%77%33%2e%6f%72%67%2f%54%52%2f%78%68%74%6d%6c%31%2f%44%54%44%2f%78%68%74%6d%6c%31%2d%74%72%61%6e%73%69%74%69%6f%6e%61%6c%2e%64%74%64%5c%22%3e%20%3c%68%74%6d%6c%20%78%6d%6c%6e%73%3d%5c%22%68%74%74%70%3a%2f%2f%77%77%77%2e%77%33%2e%6f%72%67%2f%31%39%39%39%2f%78%68%74%6d%6c%5c%22%3e%20%3c%68%65%61%64%3e%20%3c%6d%65%74%61%20%68%74%74%70%2d%65%71%75%69%76%3d%5c%22%43%6f%6e%74%65%6e%74%2d%54%79%70%65%5c%22%20%63%6f%6e%74%65%6e%74%3d%5c%22%74%65%78%74%2f%68%74%6d%6c%3b%20%63%68%61%72%73%65%74%3d%75%74%66%2d%38%5c%22%20%2f%3e%20%3c%74%69%74%6c%65%3e%53%61%6d%70%6c%65%20%48%54%4d%4c%2d%68%69%64%65%20%73%6f%72%65%63%65%20%63%6f%64%65%3c%2f%74%69%74%6c%65%3e%20%3c%2f%68%65%61%64%3e%20%20%3c%62%6f%64%79%3e%20%09%42%6c%61%68%20%62%6c%61%68%20%62%6c%61%68%20%3c%2f%62%6f%64%79%3e%20%3c%2f%68%74%6d%6c%3e</p>
<p>The page is the same but now has a different representation that is strange to a common user but remember that this is a <em>meta protection method </em>an advanced user can and will do the reverse method to obtain you&#8217;re source.<br />
The next step is to create the &#8220;protected&#8221; page, create a new HTML document and add the next code:</p>
<p>&lt;script&gt;<br />
<strong>document.write</strong>(<strong>unescape</strong>(&#8220;%3c%21%44%4f%43%54%59%50%45%20%68%74%6d%6c%20%50%55%42%4c%49%43%20%5c%22%2d%2f%2f%57%33%43%2f%2f%44%54%44%20%58%48%54%4d%4c%20%31%2e%30%20%54%72%61%6e%73%69%74%69%6f%6e%61%6c%2f%2f%45%4e%5c%22%20%5c%22%68%74%74%70%3a%2f%2f%77%77%77%2e%77%33%2e%6f%72%67%2f%54%52%2f%78%68%74%6d%6c%31%2f%44%54%44%2f%78%68%74%6d%6c%31%2d%74%72%61%6e%73%69%74%69%6f%6e%61%6c%2e%64%74%64%5c%22%3e%20%3c%68%74%6d%6c%20%78%6d%6c%6e%73%3d%5c%22%68%74%74%70%3a%2f%2f%77%77%77%2e%77%33%2e%6f%72%67%2f%31%39%39%39%2f%78%68%74%6d%6c%5c%22%3e%20%3c%68%65%61%64%3e%20%3c%6d%65%74%61%20%68%74%74%70%2d%65%71%75%69%76%3d%5c%22%43%6f%6e%74%65%6e%74%2d%54%79%70%65%5c%22%20%63%6f%6e%74%65%6e%74%3d%5c%22%74%65%78%74%2f%68%74%6d%6c%3b%20%63%68%61%72%73%65%74%3d%75%74%66%2d%38%5c%22%20%2f%3e%20%3c%74%69%74%6c%65%3e%53%61%6d%70%6c%65%20%48%54%4d%4c%2d%68%69%64%65%20%73%6f%72%65%63%65%20%63%6f%64%65%3c%2f%74%69%74%6c%65%3e%20%3c%2f%68%65%61%64%3e%20%20%3c%62%6f%64%79%3e%20%09%42%6c%61%68%20%62%6c%61%68%20%62%6c%61%68%20%3c%2f%62%6f%64%79%3e%20%3c%2f%68%74%6d%6c%3e&#8221;));<br />
&lt;/script&gt;<br />
As you can see all we are doing is to use javascript to write the content (<strong>document.write</strong> method).<br />
<span style="color: #ff0000;">!!! Important</span> : if user has the javascript disabled he will not see anything because the code will not execute, therefore will  be nothing displayed. Also remember that most of searchengine as Google or Yahoo crawl  the web in text mode,  remember that <span style="text-decoration: underline;">javascript is luxury</span> not a necessity.</li>
<li>Now is time to get serious and speak about some more advanced, a little bit harder to break (not impossible to break), technique   to keep you HTML source protected.The base idea is to encrypt the content of the HTML page, this time really encryption . Let imagine  a function for encryption this time a simple one that is using xor logic function to achieve encryption. The code to do that is showed next:<br />
//Encryptionfunction encrypt(text,key){</p>
<p>var rez=new Array(text.length);<br />
for(i=0;i&lt;text.length;i++){<br />
rez[i]=text.charCodeAt(i) ^key.charCodeAt(i%key.length);<br />
}<br />
return rez;<br />
}</p>
<p>//Decryption</p>
<p>function decrypt(text,key){<br />
var rez=&#8221;";<br />
for(i=0;i&lt;text.length;i++){<br />
rez+=String.fromCharCode(text[i] ^key.charCodeAt(i%key.length));</p>
<p>}<br />
return rez;<br />
}</p>
<p>Using the functions in this form won&#8217;t help to much because the user will see clear what is about, so I am going to obfuscate the code (if you don&#8217;t know what is that google it <img src='http://andreitara.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ). Now the code looks not so friendly :</p>
<p>eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!&#8221;.replace(/^/,String)){while(c&#8211;){d[c.toString(a)]=k[c]||c.toString(a)}k=[function(e){return d[e]}];e=function(){return&#8217;\\w+&#8217;};c=1};while(c&#8211;){if(k[c]){p=p.replace(new RegExp(&#8216;\\b&#8217;+e(c)+&#8217;\\b&#8217;,'g&#8217;),k[c])}}return p}(&#8217;8 c(2,4){9 3=d b(2.5);7(1=0;1&lt;2.5;1++){3[1]=2.6(1)^4.6(1%4.5)}a 3}8 f(2,4){9 3=&#8221;";7(1=0;1&lt;2.5;1++){3+=e.g(2[1]^4.6(1%4.5))}a 3}&#8217;,17,17,&#8217;|i|text|rez|key|length|charCodeAt|for|function|var|return|Array|encrypt|new|String|decrypt|fromCharCode&#8217;.split(&#8216;|&#8217;),0,{}))</p>
<p>The next step is to convert you&#8217;re page in hexa as showed previously in this post, suppost that we are using the same page the hexa will be:</p>
<p>%3c%21%44%4f%43%54%59%50%45%20%68%74%6d%6c%20%50%55%42%4c%49%43%20%5c%22%2d%2f%2f%57%33%43%2f%2f%44%54%44%20%58%48%54%4d%4c%20%31%2e%30%20%54%72%61%6e%73%69%74%69%6f%6e%61%6c%2f%2f%45%4e%5c%22%20%5c%22%68%74%74%70%3a%2f%2f%77%77%77%2e%77%33%2e%6f%72%67%2f%54%52%2f%78%68%74%6d%6c%31%2f%44%54%44%2f%78%68%74%6d%6c%31%2d%74%72%61%6e%73%69%74%69%6f%6e%61%6c%2e%64%74%64%5c%22%3e%20%3c%68%74%6d%6c%20%78%6d%6c%6e%73%3d%5c%22%68%74%74%70%3a%2f%2f%77%77%77%2e%77%33%2e%6f%72%67%2f%31%39%39%39%2f%78%68%74%6d%6c%5c%22%3e%20%3c%68%65%61%64%3e%20%3c%6d%65%74%61%20%68%74%74%70%2d%65%71%75%69%76%3d%5c%22%43%6f%6e%74%65%6e%74%2d%54%79%70%65%5c%22%20%63%6f%6e%74%65%6e%74%3d%5c%22%74%65%78%74%2f%68%74%6d%6c%3b%20%63%68%61%72%73%65%74%3d%75%74%66%2d%38%5c%22%20%2f%3e%20%3c%74%69%74%6c%65%3e%53%61%6d%70%6c%65%20%48%54%4d%4c%2d%68%69%64%65%20%73%6f%72%65%63%65%20%63%6f%64%65%3c%2f%74%69%74%6c%65%3e%20%3c%2f%68%65%61%64%3e%20%20%3c%62%6f%64%79%3e%20%09%42%6c%61%68%20%62%6c%61%68%20%62%6c%61%68%20%3c%2f%62%6f%64%79%3e%20%3c%2f%68%74%6d%6c%3e</p>
<p>now is time to encrypt the hexa representation with a key, so apply encrypt(&#8220;&#8230;hexa text &#8230;.&#8221;,&#8221;&#8230;you personal key&#8230;&#8221;) . I used as key &#8220;secret&#8221; and have obtained this:</p>
<p>86,86,0,87,87,69,86,81,87,87,81,18,86,81,80,87,80,64,86,80,90,87,80,68,86,81,86,87,87,68,86,83,91,87,82,64,86,83,7,87,83,23,86,87,83,87,80,68,86,80,86,87,81,70,<br />
86,81,0,87,81,77,86,81,80,87,87,68,86,80,0,87,87,70,86,87,7,87,87,18,86,87,5,87,80,67,86,86,80,87,81,71,86,87,5,87,87,18,86,81,87,87,80,64,86,81,87,87,87,68,86,<br />
80,91,87,81,76,86,80,87,87,81,16,86,81,0,87,87,68,86,86,82,87,87,17,86,86,83,87,87,68,86,80,87,87,82,70,86,83,82,87,83,17,86,82,80,87,83,77,86,82,87,87,83,77,86,<br />
83,5,87,83,17,86,83,82,87,83,23,86,87,5,87,87,18,86,81,86,87,81,17,86,80,0,87,87,70,86,87,83,87,80,23,86,87,81,87,83,76,86,82,87,87,82,64,86,82,83,87,86,21,86,87,5<br />
,87,87,18,86,82,84,87,82,67,86,82,84,87,87,17,86,82,84,87,86,71,86,87,6,87,83,18,86,82,81,87,83,67,86,87,5,87,80,64,86,80,81,87,87,18,86,82,91,87,83,76,86,82,87,87,<br />
83,16,86,83,0,87,86,69,86,87,5,87,81,64,86,80,87,87,81,64,86,87,5,87,82,76,86,83,91,87,82,64,86,83,7,87,83,23,86,86,82,87,87,16,86,82,87,87,82,70,86,83,82,87,83,17,<br />
86,82,80,87,83,77,86,82,87,87,83,77,86,83,5,87,83,17,86,83,82,87,83,23,86,87,6,87,83,64,86,82,87,87,83,64,86,80,0,87,87,70,86,86,6,87,87,68,86,86,0,87,83,76,86,82,<br />
87,87,83,16,86,83,0,87,87,68,86,82,91,87,83,16,86,83,0,87,83,17,86,82,80,87,86,16,86,80,0,87,87,70,86,83,91,87,82,64,86,82,87,87,82,68,86,86,2,87,87,18,86,87,5,87,<br />
82,67,86,82,84,87,82,67,86,87,6,87,82,67,86,86,80,87,87,17,86,83,5,87,82,70,86,83,84,87,87,18,86,86,82,87,86,77,86,86,90,87,86,77,86,87,5,87,82,76,86,83,91,87,82,64<br />
,86,83,7,87,83,23,86,80,0,87,87,70,86,86,6,87,87,68,86,86,0,87,83,76,86,83,86,87,83,69,86,83,87,87,86,17,86,87,83,87,86,23,86,83,7,87,83,65,86,82,87,87,83,69,86,87,83,<br />
87,83,76,86,82,87,87,82,64,86,82,83,87,87,16,86,83,86,87,82,69,86,82,86,87,83,77,86,82,85,87,86,16,86,80,0,87,87,70,86,81,80,87,83,18,86,83,6,87,82,64,86,83,86,87,83,<br />
17,86,82,87,87,87,16,86,80,87,87,82,77,86,82,83,87,83,65,86,80,0,87,87,70,86,87,83,87,83,71,86,83,5,87,83,17,86,82,87,87,83,65,86,83,6,87,82,64,86,86,7,87,80,23,86,87<br />
,81,87,82,64,86,83,86,87,82,76,86,82,87,87,87,18,86,83,91,87,82,64,86,83,7,87,83,23,86,86,1,87,87,68,86,83,80,87,83,76,86,83,82,87,82,70,86,82,80,87,83,65,86,82,87,87,86,<br />
16,86,82,86,87,82,64,86,83,85,87,87,16,86,86,91,87,80,23,86,87,81,87,87,68,86,87,5,87,86,17,86,87,83,87,86,23,86,82,87,87,83,77,86,82,87,87,83,23,86,83,86,87,86,17,86,<br />
80,80,87,83,69,86,83,7,87,82,68,86,83,0,87,83,65,86,87,83,87,81,76,86,80,87,87,81,16,86,81,0,87,87,16,86,83,91,87,83,77,86,83,87,87,83,65,86,87,83,87,82,71,86,83,5,<br />
87,82,70,86,83,86,87,83,71,86,83,86,87,87,68,86,83,80,87,83,18,86,83,87,87,83,65,86,86,0,87,87,18,86,82,87,87,83,77,86,82,87,87,83,23,86,83,86,87,86,17,86,87,83,87,<br />
86,23,86,87,5,87,83,76,86,83,86,87,83,69,86,83,87,87,86,17,86,87,83,87,87,68,86,86,0,87,83,70,86,83,5,87,83,64,86,82,90,87,86,17,86,87,83,87,85,77,86,81,81,87,83,23,<br />
86,83,82,87,83,76,86,87,83,87,83,70,86,83,0,87,83,69,86,83,91,87,87,68,86,83,81,87,83,23,86,83,82,87,83,76,86,87,83,87,86,23,86,87,5,87,83,70,86,83,5,87,83,64,86,82,<br />
90,87,86,17,86,87,83,87,86,23,86,87,5,87,83,76,86,82,87,87,83,16,86,83,0,87,86,17</p>
<p>Now let&#8217;s create the script,that will display the content of page, that will be the final step:</p>
<p>document.write(unescape(decrypt(new Array(86,86,0,87,87,69,86,81,87,87,81,18,86,81,80,87,80,64,86,80,90,87,80,68,86,81,86,87,87,68,86,83,91,87,82,64,86,83,7,87,83,23,86,87,83,87,80,68,86,80,86,87,81,70,<br />
86,81,0,87,81,77,86,81,80,87,87,68,86,80,0,87,87,70,86,87,7,87,87,18,86,87,5,87,80,67,86,86,80,87,81,71,86,87,5,87,87,18,86,81,87,87,80,64,86,81,87,87,87,68,86,<br />
80,91,87,81,76,86,80,87,87,81,16,86,81,0,87,87,68,86,86,82,87,87,17,86,86,83,87,87,68,86,80,87,87,82,70,86,83,82,87,83,17,86,82,80,87,83,77,86,82,87,87,83,77,86,<br />
83,5,87,83,17,86,83,82,87,83,23,86,87,5,87,87,18,86,81,86,87,81,17,86,80,0,87,87,70,86,87,83,87,80,23,86,87,81,87,83,76,86,82,87,87,82,64,86,82,83,87,86,21,86,87,5<br />
,87,87,18,86,82,84,87,82,67,86,82,84,87,87,17,86,82,84,87,86,71,86,87,6,87,83,18,86,82,81,87,83,67,86,87,5,87,80,64,86,80,81,87,87,18,86,82,91,87,83,76,86,82,87,87,<br />
83,16,86,83,0,87,86,69,86,87,5,87,81,64,86,80,87,87,81,64,86,87,5,87,82,76,86,83,91,87,82,64,86,83,7,87,83,23,86,86,82,87,87,16,86,82,87,87,82,70,86,83,82,87,83,17,<br />
86,82,80,87,83,77,86,82,87,87,83,77,86,83,5,87,83,17,86,83,82,87,83,23,86,87,6,87,83,64,86,82,87,87,83,64,86,80,0,87,87,70,86,86,6,87,87,68,86,86,0,87,83,76,86,82,<br />
87,87,83,16,86,83,0,87,87,68,86,82,91,87,83,16,86,83,0,87,83,17,86,82,80,87,86,16,86,80,0,87,87,70,86,83,91,87,82,64,86,82,87,87,82,68,86,86,2,87,87,18,86,87,5,87,<br />
82,67,86,82,84,87,82,67,86,87,6,87,82,67,86,86,80,87,87,17,86,83,5,87,82,70,86,83,84,87,87,18,86,86,82,87,86,77,86,86,90,87,86,77,86,87,5,87,82,76,86,83,91,87,82,64<br />
,86,83,7,87,83,23,86,80,0,87,87,70,86,86,6,87,87,68,86,86,0,87,83,76,86,83,86,87,83,69,86,83,87,87,86,17,86,87,83,87,86,23,86,83,7,87,83,65,86,82,87,87,83,69,86,87,83,<br />
87,83,76,86,82,87,87,82,64,86,82,83,87,87,16,86,83,86,87,82,69,86,82,86,87,83,77,86,82,85,87,86,16,86,80,0,87,87,70,86,81,80,87,83,18,86,83,6,87,82,64,86,83,86,87,83,<br />
17,86,82,87,87,87,16,86,80,87,87,82,77,86,82,83,87,83,65,86,80,0,87,87,70,86,87,83,87,83,71,86,83,5,87,83,17,86,82,87,87,83,65,86,83,6,87,82,64,86,86,7,87,80,23,86,87<br />
,81,87,82,64,86,83,86,87,82,76,86,82,87,87,87,18,86,83,91,87,82,64,86,83,7,87,83,23,86,86,1,87,87,68,86,83,80,87,83,76,86,83,82,87,82,70,86,82,80,87,83,65,86,82,87,87,86,<br />
16,86,82,86,87,82,64,86,83,85,87,87,16,86,86,91,87,80,23,86,87,81,87,87,68,86,87,5,87,86,17,86,87,83,87,86,23,86,82,87,87,83,77,86,82,87,87,83,23,86,83,86,87,86,17,86,<br />
80,80,87,83,69,86,83,7,87,82,68,86,83,0,87,83,65,86,87,83,87,81,76,86,80,87,87,81,16,86,81,0,87,87,16,86,83,91,87,83,77,86,83,87,87,83,65,86,87,83,87,82,71,86,83,5,<br />
87,82,70,86,83,86,87,83,71,86,83,86,87,87,68,86,83,80,87,83,18,86,83,87,87,83,65,86,86,0,87,87,18,86,82,87,87,83,77,86,82,87,87,83,23,86,83,86,87,86,17,86,87,83,87,<br />
86,23,86,87,5,87,83,76,86,83,86,87,83,69,86,83,87,87,86,17,86,87,83,87,87,68,86,86,0,87,83,70,86,83,5,87,83,64,86,82,90,87,86,17,86,87,83,87,85,77,86,81,81,87,83,23,<br />
86,83,82,87,83,76,86,87,83,87,83,70,86,83,0,87,83,69,86,83,91,87,87,68,86,83,81,87,83,23,86,83,82,87,83,76,86,87,83,87,86,23,86,87,5,87,83,70,86,83,5,87,83,64,86,82,<br />
90,87,86,17,86,87,83,87,86,23,86,87,5,87,83,76,86,82,87,87,83,16,86,83,0,87,86,17),&#8221;<strong>secre</strong>t&#8221;)));</p>
<p>As you can see the key is &#8220;secret&#8221; you must chose a better one dynamic generate on each session stored  in cookies. For extra security obfuscate this cod too:</p>
<p>eval(function(p,a,c,k,e,d){e=function(c){return(c&lt;a?&#8221;:e(parseInt(c/a)))+((c=c%a)&gt;35?String.fromCharCode(c+29):c.toString(36))};if(!&#8221;.replace(/^/,String)){while(c&#8211;){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return&#8217;\\w+&#8217;};c=1};while(c&#8211;){if(k[c]){p=p.replace(new RegExp(&#8216;\\b&#8217;+e(c)+&#8217;\\b&#8217;,'g&#8217;),k[c])}}return p}(&#8216;y.w(A(v(t z(4,4,0,3,3,m,4,b,3,3,b,j,4,b,a,3,a,c,4,a,r,3,a,f,4,b,4,3,3,f,4,8,l,3,9,c,4,8,7,3,8,e,4,3,8,3,a,f,4,a,4,3,b,g,4,b,0,3,b,k,4,b,a,3,3,f,4,a,0,3,3,g,4,3,7,3,3,j,4,3,<br />
5,3,a,o,4,4,a,3,b,q,4,3,5,3,3,j,4,b,3,3,a,c,4,b,3,3,3,f,4,a,l,3,b,h,4,a,3,3,b,i,4,b,0,3,3,f,4,4,9,3,3,d,4,4,8,3,3,f,4,a,3,3,9,g,4,8,9,3,8,d,4,9,a,3,8,k,4,9,3,3,8,k,<br />
4,8,5,3,8,d,4,8,9,3,8,e,4,3,5,3,3,j,4,b,4,3,b,d,4,a,0,3,3,g,4,3,8,3,a,e,4,3,b,3,8,h,4,9,3,3,9,c,4,9,8,3,4,u,4,3,5,3,3,j,4,9,p,3,9,o,4,9,p,3,3,d,4,9,p,3,4,q,4,3,6,3<br />
,8,j,4,9,b,3,8,o,4,3,5,3,a,c,4,a,b,3,3,j,4,9,l,3,8,h,4,9,3,3,8,i,4,8,0,3,4,m,4,3,5,3,b,c,4,a,3,3,b,c,4,3,5,3,9,h,4,8,l,3,9,c,4,8,7,3,8,e,4,4,9,3,3,i,4,9,3,3,9,g,4,8,9,<br />
3,8,d,4,9,a,3,8,k,4,9,3,3,8,k,4,8,5,3,8,d,4,8,9,3,8,e,4,3,6,3,8,c,4,9,3,3,8,c,4,a,0,3,3,g,4,4,6,3,3,f,4,4,0,3,8,h,4,9,3,3,8,i,4,8,0,3,3,f,4,9,l,3,8,i,4,8,0,3,8,d,4,9,<br />
a,3,4,i,4,a,0,3,3,g,4,8,l,3,9,c,4,9,3,3,9,f,4,4,2,3,3,j,4,3,5,3,9,o,4,9,p,3,9,o,4,3,6,3,9,o,4,4,a,3,3,d,4,8,5,3,9,g,4,8,p,3,3,j,4,4,9,3,4,k,4,4,r,3,4,k,4,3,5,3,9,h,4,8,<br />
l,3,9,c,4,8,7,3,8,e,4,a,0,3,3,g,4,4,6,3,3,f,4,4,0,3,8,h,4,8,4,3,8,m,4,8,3,3,4,d,4,3,8,3,4,e,4,8,7,3,8,n,4,9,3,3,8,m,4,3,8,3,8,h,4,9,3,3,9,c,4,9,8,3,3,i,4,8,4,3,9,m,4,<br />
9,4,3,8,k,4,9,s,3,4,i,4,a,0,3,3,g,4,b,a,3,8,j,4,8,6,3,9,c,4,8,4,3,8,d,4,9,3,3,3,i,4,a,3,3,9,k,4,9,8,3,8,n,4,a,0,3,3,g,4,3,8,3,8,q,4,8,5,3,8,d,4,9,3,3,8,n,4,8,6,3,9,c,4,4,<br />
7,3,a,e,4,3,b,3,9,c,4,8,4,3,9,h,4,9,3,3,3,j,4,8,l,3,9,c,4,8,7,3,8,e,4,4,1,3,3,f,4,8,a,3,8,h,4,8,9,3,9,g,4,9,a,3,8,n,4,9,3,3,4,i,4,9,4,3,9,c,4,8,s,3,3,i,4,4,l,3,a,e,4,3,<br />
b,3,3,f,4,3,5,3,4,d,4,3,8,3,4,e,4,9,3,3,8,k,4,9,3,3,8,e,4,8,4,3,4,d,4,a,a,3,8,m,4,8,7,3,9,f,4,8,0,3,8,n,4,3,8,3,b,h,4,a,3,3,b,i,4,b,0,3,3,i,4,8,l,3,8,k,4,8,3,3,8,n,4,<br />
3,8,3,9,q,4,8,5,3,9,g,4,8,4,3,8,q,4,8,4,3,3,f,4,8,a,3,8,j,4,8,3,3,8,n,4,4,0,3,3,j,4,9,3,3,8,k,4,9,3,3,8,e,4,8,4,3,4,d,4,3,8,3,4,e,4,3,5,3,8,h,4,8,4,3,8,m,4,8,3,3,4,<br />
d,4,3,8,3,3,f,4,4,0,3,8,g,4,8,5,3,8,c,4,9,r,3,4,d,4,3,8,3,s,k,4,b,b,3,8,e,4,8,9,3,8,h,4,3,8,3,8,g,4,8,0,3,8,m,4,8,l,3,3,f,4,8,b,3,8,e,4,8,9,3,8,h,4,3,8,3,4,e,4,3,5,3,<br />
8,g,4,8,5,3,8,c,4,9,r,3,4,d,4,3,8,3,4,e,4,3,5,3,8,h,4,9,3,3,8,i,4,8,0,3,4,d),&#8221;x&#8221;)));&#8217;,37,37,&#8217;|||87|86||||83|82|80|81|64|17|23|68|70|76|16|18|77|91|69|65|67|84|<br />
71|90|85|new|21|decrypt|write|secret|document|Array|unescape&#8217;.split(&#8216;|&#8217;),0,{}))</p>
<p>We have an pretty good protection, must remember a <strong>meta HTML protection</strong> because this can be broken by a good hacker.<a href="HIDE_HTML"><br />
</a></li>
</ul>
<p>I hope that this article was helpful I am waiting for you&#8217;re feedback.</p>
<p><strong>[UPDATE:]</strong> here are the source used in this  article<br />
<a href="http://www.andreitara.com/wp-content/uploads/2010/03/Secure_HTML_code.rar">Secure_HTML_code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://andreitara.com/2010/03/protecting-html-source-code-from-being-stolen/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Prototipuri in JAVASCRIPT</title>
		<link>http://andreitara.com/2009/01/prototipuri-in-javascript/</link>
		<comments>http://andreitara.com/2009/01/prototipuri-in-javascript/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 21:36:48 +0000</pubDate>
		<dc:creator>andreiT</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[prototype]]></category>

		<guid isPermaLink="false">http://www.andreitara.com/?p=53</guid>
		<description><![CDATA[Desi javascript nu suporta clase totusi se poate poate programa obiectual si anume folosind prototipuri. Javascript este un limbaj in care gasesti atat cele mai mari idiotenii posibile care s-au putut inventa in vre-un limbaj de programare cat si unele cu adevarat geniale, printre acestea se numara faptul ca un obiect in Javascript este un [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.andreitara.com/wp-content/uploads/2008/11/scripts-icon.png"><img class="alignnone size-medium wp-image-17" title="scripts-icon" src="http://www.andreitara.com/wp-content/uploads/2008/11/scripts-icon.png" alt="" width="128" height="128" /></a>Desi javascript nu suporta clase totusi se poate poate programa obiectual si anume folosind prototipuri. Javascript este un limbaj in care gasesti atat cele mai mari idiotenii posibile care s-au putut inventa in vre-un limbaj de programare cat si unele cu adevarat geniale, printre acestea se numara faptul ca un obiect in Javascript este un container generic la care ii poti adauga oricand o noua proprietate sau &#8220;metoda&#8221;. Mai jos este un exemplu de &#8220;clasa&#8221; (un echivelent al unei clase din limbaje care suporta asa ceva) ce incapsuleaza mecanismul cunoscut si sub denumirea de AJAX.</p>
<p>Pentru cei care nu stiu AJAX este un mecanism de comunicare asicrona cu server-ul, adica pentru a aduce informatie nu este necesara un refresh de pagina.</p>
<p><span id="more-53"></span></p>
<blockquote><p>function AjaxRequest(url)</p>
<p>{</p>
<p>this.url=url;</p>
<p>this.xmlHttp=&#8221;";</p>
<p>this.init=function()</p>
<p>{</p>
<p>try</p>
<p>{</p>
<p>// Firefox, Opera 8.0+, Safari</p>
<p>this.xmlHttp=new XMLHttpRequest();</p>
<p>}</p>
<p>catch (e)</p>
<p>{</p>
<p>// Internet Explorer</p>
<p>try</p>
<p>{</p>
<p>this.xmlHttp=new ActiveXObject(&#8220;Msxml2.XMLHTTP&#8221;);</p>
<p>}</p>
<p>catch (e)</p>
<p>{</p>
<p>try</p>
<p>{</p>
<p>this.xmlHttp=new ActiveXObject(&#8220;Microsoft.XMLHTTP&#8221;);</p>
<p>}</p>
<p>catch (e)</p>
<p>{</p>
<p>alert(&#8220;Your browser does not support AJAX!&#8221;);</p>
<p>return false;</p>
<p>}</p>
<p>}</p>
<p>}</p>
<p>}</p>
<p>this.request=function()</p>
<p>{</p>
<p>this.init();</p>
<p>try{</p>
<p>this.xmlHttp.open(this.requestType,this.url,true);</p>
<p>}</p>
<p>catch(e)</p>
<p>{</p>
<p>this.onLoadFaild(e);</p>
<p>}</p>
<p>this.xmlHttp.send(this.vars);</p>
<p>var parent=this;</p>
<p>this.xmlHttp.onreadystatechange=function()</p>
<p>{</p>
<p>var done = 4, ok = 200;</p>
<p>if (parent.xmlHttp.readyState == done &amp;&amp; parent.xmlHttp.status == ok)</p>
<p>{</p>
<p>if (parent.xmlHttp.responseText)</p>
<p>{</p>
<p>parent.onLoad(parent.xmlHttp.responseText);</p>
<p>}</p>
<p>}</p>
<p>}</p>
<p>}</p>
<p>this.get=function(vars)</p>
<p>{</p>
<p>this.vars=vars;</p>
<p>this.requestType=&#8221;GET&#8221;;</p>
<p>this.request();</p>
<p>}</p>
<p>this.post=function(vars)</p>
<p>{</p>
<p>this.vars=vars;</p>
<p>this.requestType=&#8221;POST&#8221;;</p>
<p>this.request();</p>
<p>}</p>
<p>}</p></blockquote>
<p>Codul este destul de simplu ..aproape ca vorbeste de la sine. Avantajul programarii folosind obiecte este ca utilizare este foarte simpla plus ca putem avea conexiuni multiple pe servere separate</p>
<blockquote><p>script1=new AjaxRequest(&#8220;http://un.site.de.undeva&#8221;);</p>
<p>script1.onLoad=function(sucess){</p>
<p>if(sucess==true){</p>
<p>prelucreaza informatia primita</p>
<p>}</p>
<p>}</p>
<p>script1.get(&#8220;&#8221;);</p>
<p>script2=new AjaxRequest(&#8220;http://un.site.de.altundeva&#8221;);</p>
<p>script2.onLoad=function(sucess){</p>
<p>if(sucess==true){</p>
<p>prelucreaza informatia primita</p>
<p>}</p>
<p>}</p>
<p>script2.get(&#8220;&#8221;);</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://andreitara.com/2009/01/prototipuri-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

