if(! EL){
function EasyLayer(){ }
EasyLayer.prototype={
	vendor				: 'Refero Group SRL', 
	product				: 'Easy Layer', 
	version				: '0.9', 
	vendorWeb			: 'http://www.referogroup.com', 
	web					: 'http://www.easylayer.info', 
	
	appendChild			: true, 
	bringToParent			: true, 
	childs				: new Array(), 
	iFrames				: new Array(), 
	parentEL				: false, 
	parent				: false, 
	CFDevMode			: false, 
	messageClsTimeInSec	: 10, 
	messageShow			: true, 
	hashAddressing			: true,  // ----------------
	hashNoListenIfPre		: '_', 
	hashDest				: '', 
	hashDefAddress		: '', 
	aHashOnSend			: false, 
	aHashOnLoad			: false, 
	aHashSendPost 		: {'EL_load_via_ajax' : 'true'}, 
	replaceAHrefToHash 		: true,  // -----------
	loadHashAfterPageDone	: true, 
	hashToPageOnLoad 		: true, 
	control				: false, 
	alt					: false, 
	shift					: false, 
	keysArray				: new Array(), 
	AdobeFlash			: false, 
	aReqType				: 'GET', 
	aIsAsync				: true, 
	aOnSend				: false, 
	aOnLoad				: false, 
	xmlhttp				: false, 
	aDest				: '', 
	aDestFunction			: false, 
	aLoaderSameDest 		: false, 
	replaceRadioBox		: false, 
	replaceCheckBox		: false, 
	replaceSelects			: false, 
	replaceAlerts			: false, 
	ieCanvasInit			: true, 
	selectMaxVizRows		: 15, 
	SWFileUpload			: '/ELFilesUpload-1.0.0.swf', 
	replaceFileUpload		: true, 
	multipleFileUpload		: true, 
	fileUploadEmptyText	: 'For upload files click here', 
	fileUploadSelectedText	: 'One or more file(s) selected', 
	browserSpeed			: 0, 
	submitErrorStyle 		: '; border:3px solid #ff0000; margin:-3px; ', 
	defaultDateSeparator 	: "-", 
	defaultDateFormat 		: "ymd", 

	
	defaultStyles			: {
		select	: {
			def			: 'position:absolute; top:0px; left:0px; margin:-1px; background-color:#eee; border:1px solid #aaa; padding-left:2px; font-size:11pt; -moz-border-radius:2px; -webkit-border-radius:2px; -khtml-border-radius:2px; border-radius:2px; ', 
			hover		: 'border:1px solid #c36500; ', 
			active		: ''
		}, 
		radio		: {
			unChecked	: {
				def		: 'position:absolute; top:0px; left:0px; border:2px solid #aaa; background-color:#ccc; -moz-border-radius:10px; -webkit-border-radius:10px; -khtml-border-radius:10px; border-radius:10px; ', 
				hover	: 'border:2px solid #777; ', 
				focus	: ''
			}, 
			checked	: {
				def		: 'position:absolute; top:0px; left:0px; border:2px solid #0a0; background-color:#4f4; -moz-border-radius:10px; -webkit-border-radius:10px; -khtml-border-radius:10px; border-radius:10px; ', 
				hover	: 'border:2px solid #777; ', 
				focus	: ''
			}, 
			checkObj		: ''
		}, 
		checkbox		: {
			unChecked	: {
				def		: 'position:absolute; top:0px; left:0px; border:2px solid #aaa; background-color:#ccc; -moz-border-radius:3px; -webkit-border-radius:3px; -khtml-border-radius:3px; border-radius:3px; ', 
				hover	: 'border:2px solid #777; ', 
				active	: ''
			}, 
			checked	: {
				def		: 'position:absolute; top:0px; left:0px; border:2px solid #0a0; background-color:#4f4; -moz-border-radius:3px; -webkit-border-radius:3px; -khtml-border-radius:3px; border-radius:3px; ', 
				hover	: 'border:2px solid #777; ', 
				active	: ''
			}, 
			checkObj		: ''
		}, 
		tab			: {
			def		: 'display:inline; padding:5px; padding-top:2px; padding-bottom:2px; width:40px; cursor:pointer; margin:2px; -moz-border-radius-topleft:3px; -webkit-border-top-left-radius:3px; -khtml-border-top-left-radius:3px; border-top-left-radius:3px; -moz-border-radius-topright:3px; -webkit-border-top-right-radius:3px; -khtml-border-top-right-radius:3px; border-top-right-radius:3px; ', 
			unSelected	: {
				def		: 'background-color:#eee; border:2px solid #ccc; border-bottom:2px solid #ffcb19; ', 
				hover	: 'background-color:#fff; '
			}, 
			selected	: {
				def		: 'background-color:#ffcb19; border:2px solid #ffcb19; ',  
				hover	: 'background-color:#fff; border:2px solid #fff; '
			}, 
			content	: ''
		}, 
		alert			: {
			window		: 'position:relative; top:20%; left:50%; margin-left:-120px; border:1px solid #333; background-color:#fff; width:240px; max-width:240px; z-index:1001; -moz-border-radius:3px; -webkit-border-radius:3px; -khtml-border-radius:3px; border-radius:3px; box-shadow:0px 2px 10px rgba(0, 0, 0, .9); -moz-box-shadow:0px 2px 10px rgba(0, 0, 0, .9); -webkit-box-shadow:0px 2px 10px rgba(0, 0, 0, .9); -khtml-box-shadow:0px 2px 10px rgba(0, 0, 0, .9); ', 
			header		: 'padding:5px; margin:0px; background-color:#e00; font-weight:bold; font-size:8pt; color:#fff; -moz-border-radius-topleft:3px; -webkit-border-top-left-radius:3px; -khtml-border-top-left-radius:3px; border-top-left-radius:3px; -moz-border-radius-topright:3px; -webkit-border-top-right-radius:3px; -khtml-border-top-right-radius:3px; border-top-right-radius:3px; ', 
			headerText	: 'Alert', 
			alert			: 'padding:10px; font-size:11pt; font-weight:normal; color:#a00; margin:0px; ', 
			button		: 'margin-left:auto; display:block; padding:3px; margin-right:6px; font-size:10pt; ', 
			buttonCont	: 'margin:3px; width:100%; ', 
			background	: 'position:fixed; top:0px; left:0px; width:100%; height:100%; background-color:#000; opacity:.6; z-index:1000; '
		}, 
		
		menubar		: {
			appear	: 'mouseover', 
			0	: { //level 1
				ul		: 'margin:0px; padding:0px; ', 
				def		: 'float:left; padding:2px; margin:0px; background-color:#aaa; color:#555; ', 
				hover	: 'background-color:#eee; '
			}, 
			1	: { //level 2
				ul		: 'position:absolute; top:20px; left:2px; margin:0px; padding:0px; display:none; width:60px; ', 
				def		: 'clear:both; padding:3px; margin:0px; background-color:#bbb; color:#777; ', 
				hover	: 'background-color:#ddd; '
			}, 
			2	: { //level 3
				ul		: 'position:absolute; top:2px; left:60px; margin:0px; padding:0px; display:none; width:60px; ', 
				def		: 'clear:both; padding:3px; margin:0px; background-color:#bbb; color:#777; ', 
				hover	: 'background-color:#ddd; '
			}
		}, 
		
		message			: 'display:block; position:fixed; box-shadow:0px 0px 5px rgba(0, 0, 0, .8); -moz-box-shadow:0px 0px 5px rgba(0, 0, 0, .8); -webkit-box-shadow:0px 0px 5px rgba(0, 0, 0, .8); -khtml-box-shadow:0px 0px 5px rgba(0, 0, 0, .8); z-index:100; border:1px solid #aaa; padding:5px; background-color:#eee; top:-1px; left:50%; opacity:.9; -moz-border-radius-bottomleft:5px; -webkit-border-bottom-left-radius:5px; -khtml-border-bottom-left-radius:5px; border-bottom-left-radius:5px; -moz-border-radius-bottomright:5px; -webkit-border-bottom-right-radius:5px; -khtml-border-bottom-right-radius:5px; border-bottom-right-radius:5px; '
	}, 
	
	browser				: {
							IE					: !!(window.attachEvent && !window.opera),
							Opera				: !!window.opera,
							FireFox				: navigator.userAgent.indexOf('Firefox/') > -1,
							WebKit				: navigator.userAgent.indexOf('AppleWebKit/') > -1,
							Gecko				: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
							MobileSafari			: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
						},
	
	refreshTimeInMiliSec	: 40, 
	inputRadios			: new Array(), 
	systemI				: 0, 
	messageI				: 0, 
	loadFunctionLoaded		: false, 
	initFunctionLoaded		: false, 
	openedSelection		: false, 
	hashLoading			: false, 
	aWhileLoading			: false, 
	vibra				: new Array(), 
	staticFunctions			: new Array(), 
	staticFunctionArgs		: new Array(), 
	dynamicFunctions		: new Array(), 
	dynamicFunctionArgs	: new Array(), 
	savedHash			: document.location.hash.substring(1, document.location.hash.length), 
	dayArrayShort 			: new Array('Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'), 
	dayArrayMed 			: new Array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'), 
	dayArrayLong 			: new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'), 
	monthArrayShort 		: new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'), 
	monthArrayMed 		: new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec'), 
	monthArrayLong 		: new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'), 
	ELpickerDIV 			: "ELDatePicker", 
	xVar1 				: false, 
//	iFrameDivID 			: "datepickeriframe", 

	
	working : function(){
		alert('Congratulation! ' + this.product + ' v' + this.version + ' is working fine!');
	}, 
	
	__master : function(){
		EL.systemI += EL.refreshTimeInMiliSec;
		if(EL.messageI > (EL.messageClsTimeInSec * 1000))
			EL.message();
		if(EL.messageI > 0)
			EL.messageI += EL.refreshTimeInMiliSec;
		for(var sfKey in EL.staticFunctions){
			var xargs = '';
			for(var argKey in EL.staticFunctionArgs[sfKey])
				xargs += ', EL.staticFunctionArgs[sfKey][' + argKey + ']';
			eval('EL.staticFunctions[sfKey](sfKey' + xargs + ');');
		}
		EL.tmpDynamicFunctions = new Array();
		EL.tmpDynamicFunctionArgs = new Array();
		for(var dfKey in EL.dynamicFunctions){
			EL.tmpDynamicFunctions[dfKey] = EL.dynamicFunctions[dfKey];
			EL.tmpDynamicFunctionArgs[dfKey] = EL.dynamicFunctionArgs[dfKey];
		}
		EL.dynamicFunctions = new Array();
		EL.dynamicFunctionArgs = new Array();
		for(var dfKey in EL.tmpDynamicFunctions){
			var xargs = '';
			for(var argKey in EL.tmpDynamicFunctionArgs[dfKey])
				xargs += ', EL.tmpDynamicFunctionArgs[dfKey][' + argKey + ']';
			eval('EL.tmpDynamicFunctions[dfKey](dfKey' + xargs + ');');
		}
	}, 
	
	init : function(){
		if(! this.initFunctionLoaded){
			this.initFunctionLoaded = true;
			try{
				if(navigator.plugins && navigator.mimeTypes['application/x-shockwave-flash']){
					FLVer = navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin.description.split(' ');
					delete FLVer[0];
					delete FLVer[1];
					this.AdobeFlash = FLVer.join(' ').trim();
				}else{
					try{
						try { 
							var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6'); 
							try {
								axo.AllowScriptAccess = 'always';
							} catch(e) {
								FLVer = '6,0,0'; 
							} 
						} catch(e) {} 
						FLVer = new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
						this.AdobeFlash = FLVer.replace(/,/g, '.');
					}catch(e){}
				}
			}catch(e){}
//			this.browserSpeed = this.getBrowserSpeed(); 
			window['o'] = window['O'] = new Array();
//			setInterval(this.__master, this.refreshTimeInMiliSec);
		}
	}, 
	
	load : function(){
		if(! this.loadFunctionLoaded){
			
			this.loadFunctionLoaded = true;
//			this.browserSpeed = this.getBrowserSpeed(); 
			
			this.connectDocuments();
			
			window.events('keydown', function(e){
				var key = (window.event) ? event : e;
				EL.control	= key.controlKey;
				EL.alt	= key.altKey;
				EL.shift	= key.altShift;
			});
			
			window.events('keypress', function(e){
				var key = (window.event) ? event : e;
				EL.control	= key.controlKey;
				EL.alt	= key.altKey;
				EL.shift	= key.altShift;
				if(EL.keysArray[key.keyCode + ((key.controlKey) ? '-c' : '') + ((key.altKey) ? '-a' : '') + ((key.shiftKey) ? '-s' : '')])
					EL.keysArray[key.keyCode + ((key.controlKey) ? '-c' : '') + ((key.altKey) ? '-a' : '') + ((key.shiftKey) ? '-s' : '')](key);
			});
			
			window.events('keyup', function(e){
				var key = (window.event) ? event : e;
				EL.control	= key.controlKey;
				EL.alt	= key.altKey;
				EL.shift	= key.altShift;
			});
			
			if(EL.E({'rel' : 'ajaxWhileLoading'})[0]){
				EL.aWhileLoading = EL.E({'rel' : 'ajaxWhileLoading'})[0];
				EL.aWhileLoading.s({'display' : 'none'});
			}else EL.aWhileLoading = false;
			
			if((EL.hashAddressing) && (EL.loadHashAfterPageDone) && (EL.hashDest != '') && (EL.savedHash != '')){
				EL.loadHashedPage();
			}
			
			var SWFiles = EL.E({'rel' : '_EL_SWFILE'});
			if(SWFiles.length > 0)
				for(var current in SWFiles){
					var inpE = SWFiles[current];
					sID = JSFunction = (inpE.a('id')) ? inpE.a('id') : '_EL_SELECT_CONT_' + current;
					window[sID] = function(xsID, actName, fileName, pr1, pr2){
						if(actName == 'Progress'){
							EL.message(((fileName) ? '[' + fileName + '] ' : '') + actName + ': ' + parseInt(EL.scaleRange(0, ((pr2) ? pr2 : 100000000), ((pr1) ? pr1 : 1), 0, 100)) + '%');
						}else if((actName == 'Loaded')){
							window[xsID + 'load']();
						}else EL.message(((fileName) ? '[' + fileName + '] ' : '') + actName + ((pr1) ? ': ' + pr1 : '')  + ' ' + ((pr2) ? ' ' + pr2 : ''));
					}
					window[sID + 'load'] = inpE.onload;
					sParams=inpE.a('ELSWFILE').split('|');
					sReceiver 	= (sParams[0]) ? sParams[0] : 'post.php';
					sFilter 	= (sParams[1]) ? sParams[1] : '*.*';
					sDesc 	= (sParams[2]) ? sParams[2] : 'All files (*.*)';
					sPost 	= (sParams[3]) ? sParams[3] : 'Filedata'; 
					SWFSet = {'width' : inpE.w(), 'height' : inpE.h(), 'allowScriptAccess' : 'always', 'allowNetworking' : 'true', 'swfLiveConnect' : 'true', 'wmode' : 'transparent', 'bgcolor' : 'transparent', 'quality' : 'high', 'scale' : 'noscale'};
					inpE.s({'position' : 'relative', 'top' : '0px', 'left' : '0px'}).add('div', {'style' : {'position' : 'absolute', 'top' : '0px', 'left' : '0px', 'width' : inpE.w() + 'px', 'height' : inpE.h() + 'px'}}).addSWF(this.SWFileUpload + '?fileFilter=' + sFilter + '&fileDesc=' + sDesc + '&Receiver=' + sReceiver + '&JSFunction=' + JSFunction + '&PostName=' + sPost, SWFSet);
			}
			
			EL.replaceSelect();
			EL.replaceRadio();
			EL.replaceCheck();
			EL.replaceUpload();
			EL.replaceAlert();
			window['o']['css'] = {};
			this.setChildsToO(window);
			var xrules = (document.all) ? 'rules' : 'cssRules';
			for (var XK = 0; XK < document.styleSheets.length; XK++){
				for (var XB = 0; XB < document.styleSheets[XK][xrules].length; XB++){
					window['o']['css'][document.styleSheets[XK][xrules][XB].selectorText] = document.styleSheets[XK][xrules][XB].style;
				}
			}
			EL._replaceAHrefToHash();
//			window['o']['w'] = window;
//			window['o']['d'] = document;
//			window['o']['a'] = EL.E({'tag' : 'a'});
//			window['o']['div'] = EL.E({'tag' : 'div'});
//			window['o']['img'] = EL.E({'tag' : 'img'});
		}
	}, 
	
	showWindow : function(width, height, title, sUrl, closeImage){
		var MW = document.createElement('div');
		MW.id = 'ELpWindow';
		MW.setAttribute('style', 'display:table; position:fixed; top:50%; left:50%; margin-left:-' + parseInt(width / 2) + 'px; margin-top:-' + parseInt(height / 2) + 'px; width:' + width + 'px; padding:5px; z-index:5001; ');
		document.body.appendChild(MW);
		
		var MWBg = document.createElement('div');
		MWBg.id = 'ELpWindowBG';
		MWBg.setAttribute('style', 'position:fixed; top:0px; left:0px; width:100%; height:100%; z-index:5000; background-color:rgba(0, 0, 0, .5); ');
		document.body.appendChild(MWBg);
		
		var MWbg = document.createElement('div');
		MWbg.id = 'ELwindowBg';
		MW.appendChild(MWbg);
		var MWins = document.createElement('div');
		MWins.id = 'ELwindowIns';
		MW.appendChild(MWins);
		var MWinsIn = document.createElement('div');
		MWinsIn.setAttribute('style', 'position:relative; ');
		MWins.appendChild(MWinsIn);
		var MWSpan = document.createElement('span');
		MWSpan.innerHTML = title;
		MWinsIn.appendChild(MWSpan);
		var MWimg = document.createElement('img');
		MWimg.src = closeImage;
		MWimg.setAttribute('onclick', 'document.body.removeChild(document.getElementById("ELpWindowBG")); document.body.removeChild(document.getElementById("ELpWindow")); ');
		MWimg.setAttribute('style', 'position:absolute; top:-4px; right:-4px; ');
		MWinsIn.appendChild(MWimg);
		var MWIframe = document.createElement('iframe');
		MWIframe.id = 'windowFrame';
		MWIframe.setAttribute('style', 'width:' + width + 'px; height:' + height + 'px; ');
		if(sUrl){
			MWIframe.src = sUrl;
		}
		MWinsIn.appendChild(MWIframe);
	}, 
	
	closeWindow : function(){
		if(document.getElementById("ELpWindow")){
			document.body.removeChild(document.getElementById("ELpWindowBG"));
			document.body.removeChild(document.getElementById("ELpWindow"));
		}
	}, 

	closeWindowAfterAlert : function(alertString){
		document.body.removeChild(document.getElementById("ELpWindowBG"));
		document.body.removeChild(document.getElementById("ELpWindow"));
		alert(alertString);
	}, 
	
	datePicker : function(targetDateField, displayBelowThisObject, dtFormat, dtSep){
		if (!displayBelowThisObject)
			displayBelowThisObject = targetDateField;
		
		defaultDateSeparator = (dtSep) ? dtSep : EL.defaultDateSeparator;
		defaultDateFormat = (dtFormat) ? dtFormat : EL.defaultDateFormat;
		
		var x = displayBelowThisObject.offsetLeft;
		var y = displayBelowThisObject.offsetTop + displayBelowThisObject.offsetHeight ;
		var parent = displayBelowThisObject;
		while (parent.offsetParent){
			parent = parent.offsetParent;
			x += parent.offsetLeft;
			y += parent.offsetTop ;
		}
		EL.drawDatePicker(targetDateField, x, y);
	}, 

	drawDatePicker : function(targetDateField, x, y){
		var dt = EL.getFieldDate(targetDateField.value);
		if (! document.getElementById(EL.ELpickerDIV)){
			var newNode = document.createElement("div");
			newNode.setAttribute("id", EL.ELpickerDIV);
			newNode.setAttribute("class", "dpDiv");
			newNode.setAttribute("style", "visibility: hidden;");
			document.body.appendChild(newNode);
		}
		var pickerDiv = document.getElementById(EL.ELpickerDIV);
		pickerDiv.style.position = "absolute";
		pickerDiv.style.left = x + "px";
		pickerDiv.style.top = y + "px";
		pickerDiv.style.visibility = (pickerDiv.style.visibility == "visible" ? "hidden" : "visible");
		pickerDiv.style.display = (pickerDiv.style.display == "block" ? "none" : "block");
		pickerDiv.style.zIndex = 10000;
		EL.refreshDatePicker(targetDateField.name, dt.getFullYear(), dt.getMonth(), dt.getDate());
	}, 

	refreshDatePicker : function(dateFieldName, year, month, day){
		var thisDay = new Date();
		if ((month >= 0) && (year > 0)){
			thisDay = new Date(year, month, 1);
		}else{
			day = thisDay.getDate();
			thisDay.setDate(1);
		}
		var crlf = "\r\n";
		var TABLE = "<table cols='7' class='dpTable'>" + crlf;
		var xTABLE = "</table>" + crlf;
		var TR = "<tr class='dpTR'>";
		var TR_title = "<tr class='dpTitleTR'>";
		var TR_days = "<tr class='dpDayTR'>";
		var TR_todaybutton = "<tr class='dpTodayButtonTR'>";
		var xTR = "</tr>" + crlf;
		var TD = "<td class='dpTD' onMouseOut='this.className=\"dpTD\";' onMouseOver=' this.className=\"dpTDHover\";' ";    // leave this tag open, because we'll be adding an onClick event
		var TD_title = "<td colspan=5 class='dpTitleTD'>";
		var TD_buttons = "<td class='dpButtonTD'>";
		var TD_todaybutton = "<td colspan=7 class='dpTodayButtonTD'>";
		var TD_days = "<td class='dpDayTD'>";
		var TD_selected = "<td class='dpDayHighlightTD' onMouseOut='this.className=\"dpDayHighlightTD\";' onMouseOver='this.className=\"dpTDHover\";' ";    // leave this tag open, because we'll be adding an onClick event
		var xTD = "</td>" + crlf;
		var DIV_title = "<div class='dpTitleText'>";
		var DIV_selected = "<div class='dpDayHighlight'>";
		var xDIV = "</div>";
		var html = TABLE;
		html += TR_title;
		html += TD_buttons + EL.getButtonCode(dateFieldName, thisDay, -1, "&lt;") + xTD;
		html += TD_title + DIV_title + EL.monthArrayLong[ thisDay.getMonth()] + " " + thisDay.getFullYear() + xDIV + xTD;
		html += TD_buttons + EL.getButtonCode(dateFieldName, thisDay, 1, "&gt;") + xTD;
		html += xTR;
		html += TR_days;
		for(i = 0; i < EL.dayArrayShort.length; i++)
			html += TD_days + EL.dayArrayShort[i] + xTD;
		html += xTR;
		html += TR;
		for (i = 0; i < thisDay.getDay(); i++)
			html += TD + "&nbsp;" + xTD;
		do{
			dayNum = thisDay.getDate();
			TD_onclick = " onclick=\"EL.updateDateField('" + dateFieldName + "', '" + EL.getDateString(thisDay) + "');\">";
			html += (dayNum == day) ? TD_selected + TD_onclick + DIV_selected + dayNum + xDIV + xTD : TD + TD_onclick + dayNum + xTD;
			html += (thisDay.getDay() == 6) ? xTR + TR : '';
			thisDay.setDate(thisDay.getDate() + 1);
		}while (thisDay.getDate() > 1)
		if(thisDay.getDay() > 0){
			for (i = 6; i > thisDay.getDay(); i--)
				html += TD + "&nbsp;" + xTD;
		}
		html += xTR;
		var today = new Date();
		var todayString = "Today is " + EL.dayArrayMed[today.getDay()] + ", " + EL.monthArrayMed[ today.getMonth()] + " " + today.getDate();
		html += TR_todaybutton + TD_todaybutton;
		html += "<button class='dpTodayButton' onClick='EL.refreshDatePicker(\"" + dateFieldName + "\");'>this month</button> ";
		html += "<button class='dpTodayButton' onClick='EL.updateDateField(\"" + dateFieldName + "\");'>close</button>";
		html += xTD + xTR;
		html += xTABLE;
		document.getElementById(EL.ELpickerDIV).innerHTML = html;
	}, 

	getButtonCode : function(dateFieldName, dateVal, adjust, label){
		var newMonth = (dateVal.getMonth () + adjust) % 12;
		var newYear = dateVal.getFullYear() + parseInt((dateVal.getMonth() + adjust) / 12);
		if (newMonth < 0){
			newMonth += 12;
			newYear += -1;
		}
		return "<button class='dpButton' onClick='EL.refreshDatePicker(\"" + dateFieldName + "\", " + newYear + ", " + newMonth + ");'>" + label + "</button>";
	}, 

	getDateString : function(dateVal){
		var dayString = "00" + dateVal.getDate();
		var monthString = "00" + (dateVal.getMonth()+1);
		dayString = dayString.substring(dayString.length - 2);
		monthString = monthString.substring(monthString.length - 2);
		switch (defaultDateFormat) {
			case "dmy" :
				return dayString + defaultDateSeparator + monthString + defaultDateSeparator + dateVal.getFullYear();
			case "ymd" :
				return dateVal.getFullYear() + defaultDateSeparator + monthString + defaultDateSeparator + dayString;
			case "mdy" :
			default :
				return monthString + defaultDateSeparator + dayString + defaultDateSeparator + dateVal.getFullYear();
		}
	}, 

	getFieldDate : function(dateString){
		var dateVal, dArray, d, m, y;
		try{
			dArray = EL.splitDateString(dateString);
			if (dArray){
				switch(defaultDateFormat){
					case "dmy" :
						d = parseInt(dArray[0], 10);
						m = parseInt(dArray[1], 10) - 1;
						y = parseInt(dArray[2], 10);
						break;
					case "ymd" :
						d = parseInt(dArray[2], 10);
						m = parseInt(dArray[1], 10) - 1;
						y = parseInt(dArray[0], 10);
						break;
					case "mdy" :
					default :
						d = parseInt(dArray[1], 10);
						m = parseInt(dArray[0], 10) - 1;
						y = parseInt(dArray[2], 10);
						break;
				}
				dateVal = new Date(y, m, d);
			}else if(dateString){
				dateVal = new Date(dateString);
			}else{
				dateVal = new Date();
			}
		}catch(e){
			dateVal = new Date();
		}
		return dateVal;
	}, 

	splitDateString : function(dateString){
		var dArray;
		if (dateString.indexOf("/") >= 0)
			dArray = dateString.split("/");
		else if (dateString.indexOf(".") >= 0)
			dArray = dateString.split(".");
		else if (dateString.indexOf("-") >= 0)
			dArray = dateString.split("-");
		else if (dateString.indexOf("\\") >= 0)
			dArray = dateString.split("\\");
		else
			dArray = false;
		return dArray;
	}, 

	updateDateField : function(dateFieldName, dateString){
		var targetDateField = document.getElementsByName (dateFieldName).item(0);
		if (dateString)
			targetDateField.value = dateString;
		var pickerDiv = document.getElementById(EL.ELpickerDIV);
		pickerDiv.style.visibility = "hidden";
		pickerDiv.style.display = "none";
		targetDateField.focus();
		if(typeof targetDateField.onchange == 'function')
			targetDateField.onchange();
		if ((dateString) && (typeof(datePickerClosed) == "function"))
			datePickerClosed(targetDateField);
	}, 

	_replaceAHrefToHash : function(){
		aobjs = EL.T('a');
		if(EL.replaceAHrefToHash){
			for(ai in aobjs)
				if((aobjs[ai]) && (aobjs[ai].href))
					if((aobjs[ai].href.indexOf('#') == -1) && (aobjs[ai].target != '_blank') && (aobjs[ai].a('el') != 'none') && (aobjs[ai].rel != 'NoEL') && (aobjs[ai].href.toUpperCase().substr(0, 4) != 'JAVA')){
						newaddress = aobjs[ai].href.split('/');
						xnewaddress = [];
						for(i = 0; i < newaddress.length - 3; i++){
							xnewaddress[i] = newaddress[(i + 3)];
						}
						aobjs[ai].href = '#/' + xnewaddress.join('/');
			}
		}
	}, 
	
	_makeMenuIn : function(element, depth){
		for(var current in element.childNodes)
			if(element.childNodes[current].tagName == 'LI'){
				inpE = element.childNodes[current];
				cLevel = depth + 1;
				do{
				}while(typeof EL.defaultStyles.menubar[--cLevel] == 'undefined');
				inpE.ELprop = {
					absDepth	: depth, 
					depth	: cLevel, 
					def		: 'position:relative; top:0px; left:0px; ' + EL.defaultStyles.menubar[cLevel].def, 
					hover	: EL.defaultStyles.menubar[cLevel].hover
				};
				inpE.setAttribute('style', 'position:relative; top:0px; left:0px; ' + EL.defaultStyles.menubar[cLevel].def);
				inpE.mOver(function(){
					this.setAttribute('style', this.ELprop.def + this.ELprop.hover);
					for(var lis in this.childNodes)
						if((this.childNodes[lis].tagName == 'UL') && (this.childNodes[lis].none()))
							this.childNodes[lis].s({'display' : 'block'});
				});
				inpE.mOut(function(){
					this.setAttribute('style', this.ELprop.def);
					for(var lis in this.childNodes)
						if(this.childNodes[lis].tagName == 'UL'){
							cLevel = this.ELprop.depth + 2;
							do{
							}while(typeof EL.defaultStyles.menubar[--cLevel] == 'undefined');
							this.childNodes[lis].setAttribute('style', EL.defaultStyles.menubar[cLevel].ul);
					}
				});
				for(var lis in inpE.childNodes)
					if(inpE.childNodes[lis].tagName == 'UL'){
						cLevel = depth + 2;
						do{
						}while(typeof EL.defaultStyles.menubar[--cLevel] == 'undefined');
						inpE.childNodes[lis].setAttribute('style', EL.defaultStyles.menubar[cLevel].ul);
						EL._makeMenuIn(inpE.childNodes[lis], (depth + 1));
				}
		}
	}, 
	
	makeMenu : function(menuID){
		if(EL.$(menuID).tagName != 'UL'){
			return false;
		}
		elm = EL.$(menuID);
		elm.ELprop = {
			opened	: false, 
			timer	: false
		};
		elm.setAttribute('style', EL.defaultStyles.menubar[0].ul);
		elm.mOver(function(){
//			this.ELprop.timer = setTimeout("alert('alma'); ", 2000);
		});
		EL._makeMenuIn(elm, 0);
	}, 
	
	loadSelectOptions : function(selectObject, fromUrl, reload){
		if(typeof reload == 'undefined'){
			reload = true;
		}
		if(reload){
			while (selectObject.options.length > 0)
				selectObject.options[0]=null;
		}
		savedSync = this.aIsAsync;
		this.aIsAsync = false;
		eval(EL.aReq(fromUrl));
		this.aIsAsync = savedSync;
		xi = 0;
		if(optionsReturn){
			for(i in optionsReturn)
				selectObject.options[xi++] = new Option(optionsReturn[i], i);
			selectObject.options.selectedIndex=0;
		}
	}, 
	
	replaceUpload : function(){
		if((this.replaceFileUpload) && (currents = this.E({'tag' : 'INPUT', 'type' : 'file'})))
			for(var current in currents)
				if((currents[current].type) && (! currents[current].a('_EL_CONT_ID')) && (currents[current].getAttribute('EL'))){
					var inpE = currents[current];
					if(this.multipleFileUpload){
						inpE.setAttribute('multiple', 'On');
						if(inpE.name.substr((inpE.name.length - 2), 2) != '[]')
							inpE.name += '[]';
					}
					inpE.events('change', function(){
						EL.$(this.getAttribute('_EL_CONT_ID')).firstChild.nodeValue = EL.fileUploadSelectedText.replace('%F', this.value);
						EL.$(this.getAttribute('_EL_FCONT_ID')).s({'width' : EL.$(this.getAttribute('_EL_CONT_ID')).w() + 'px'});
					});
					dID = '_EL_FILE_CONT_' + current;
					daID = '_EL_FILE_FCONT_' + current;
					inpE.s({'opacity' : '.01', 'fontSize' : '100pt'}).add('div', {
						'value' : this.fileUploadEmptyText, 
						'id' : dID, 
						'style' : {
							'display' : 'inline', 
							'position' : 'relative', 
							'top' : '0px', 
							'left' : '0px', 
							'padding' : '2px'
						}}, 'after').add('div', {
							'id' : daID, 
							'style' : {
								'position' : 'absolute', 
								'top' : '0px', 
								'left' : '0px', 
								'overflow' : 'hidden', 
								'width' : this.$(dID).w() + 'px', 
								'height' : this.$(dID).h() + 'px'
							}}).appendChild(inpE);
					inpE.setAttribute('_EL_CONT_ID', dID);
					inpE.setAttribute('_EL_FCONT_ID', daID);
		}
	}, 
	
	replaceRadio : function(){
		if((EL.replaceRadioBox) && (currents = EL.E({'tag' : 'INPUT', 'type' : 'radio'})))
			for(var current in currents)
				if((currents[current].type) && (! currents[current].a('_EL_RADIO_CONT')) && (currents[current].getAttribute('EL').upper() == 'true')){
					var inpE = currents[current];
					inpE.a({'_EL_RADIO_CONT' : 'CHANGED'});
					var nexts = inpE.nextSibling;
					var pares = inpE.parentNode;
					xd = document.createElement('div');
					thDisplay = inpE.display() ? inpE.display() : 'inline-block';
					xd.setAttribute('style', 'position:relative; top:0px; left:0px; display:' + thDisplay + '; ');
					xd.appendChild(inpE);
					pares.insertBefore(xd, ((nexts) ? nexts : pares.lastChild));
					md = document.createElement('div');
					md.setAttribute('style', ((inpE.checked) ? this.defaultStyles.radio.checked.def : this.defaultStyles.radio.unChecked.def));
					inpE.s({'position' : 'relative', 'zIndex' : '100000', 'opacity' : '.01'});
					md.s({'width' : inpE.w() + 'px', 'height' : inpE.h() + 'px'});
					if(inpE.rel)
						md.innerHTML = inpE.rel;
					inpE.events('change', function(){
						this.nextSibling.setAttribute('style', ((this.checked) ? EL.defaultStyles.radio.checked.def : EL.defaultStyles.radio.unChecked.def));
						this.nextSibling.s({'width' : this.w() + 'px', 'height' : this.h() + 'px'});
						if(allRadio = EL.E({'tag' : 'INPUT', 'type' : 'radio', 'name' : this.name}))
							for(var cRadio in allRadio)
								if((allRadio[cRadio].type) && (allRadio[cRadio].a('_el_set') != 'nochange')){
									tRadio = allRadio[cRadio];
									tRadio.nextSibling.setAttribute('style', ((tRadio.checked) ? EL.defaultStyles.radio.checked.def : EL.defaultStyles.radio.unChecked.def));
									tRadio.nextSibling.s({'width' : tRadio.w() + 'px', 'height' : tRadio.h() + 'px'});
						}
					}, false);
					inpE.events('mouseover', function(){
						this.nextSibling.setAttribute('style', ((this.checked) ? EL.defaultStyles.radio.checked.def + EL.defaultStyles.radio.checked.hover : EL.defaultStyles.radio.unChecked.def + EL.defaultStyles.radio.unChecked.hover));
						this.nextSibling.s({'width' : this.w() + 'px', 'height' : this.h() + 'px'});
					});
					inpE.events('mouseout', function(){
						this.nextSibling.setAttribute('style', ((this.checked) ? EL.defaultStyles.radio.checked.def : EL.defaultStyles.radio.unChecked.def));
						this.nextSibling.s({'width' : this.w() + 'px', 'height' : this.h() + 'px'});
					});
					inpE.events('focus', function(){
						this.nextSibling.setAttribute('style', ((this.checked) ? EL.defaultStyles.radio.checked.def + EL.defaultStyles.radio.checked.hover + EL.defaultStyles.radio.checked.focus : EL.defaultStyles.radio.unChecked.def + EL.defaultStyles.radio.unChecked.hover + EL.defaultStyles.radio.unChecked.focus));
						this.nextSibling.s({'width' : this.w() + 'px', 'height' : this.h() + 'px'});
					});
					inpE.events('blur', function(){
						this.nextSibling.setAttribute('style', ((this.checked) ? EL.defaultStyles.radio.checked.def : EL.defaultStyles.radio.unChecked.def));
						this.nextSibling.s({'width' : this.w() + 'px', 'height' : this.h() + 'px'});
					});
					xd.appendChild(md);
		}
	}, 
	
	replaceCheck : function(){
		if((EL.replaceCheckBox) && (currents = EL.E({'tag' : 'INPUT', 'type' : 'checkbox'})))
			for(var current in currents)
				if((currents[current].type) && (! currents[current].a('_EL_CHECK_CONT')) && (currents[current].getAttribute('EL').upper() == 'true')){
					var inpE = currents[current];
					inpE.a({'_EL_CHECK_CONT' : 'CHANGED'});
					var nexts = inpE.nextSibling;
					var pares = inpE.parentNode;
					xd = document.createElement('div');
					thDisplay = inpE.display() ? inpE.display() : 'inline-block';
					xd.setAttribute('style', 'position:relative; top:0px; left:0px; display:' + thDisplay + '; ');
					xd.appendChild(inpE);
					pares.insertBefore(xd, ((nexts) ? nexts : pares.lastChild));
					md = document.createElement('div');
					md.setAttribute('style', ((inpE.checked) ? this.defaultStyles.checkbox.checked.def : this.defaultStyles.checkbox.unChecked.def));
					inpE.s({'position' : 'relative', 'zIndex' : '100000', 'opacity' : '.01'});
					if(inpE.rel){
						md.s({'width' : inpE.w() + 'px', 'height' : inpE.h() + 'px'});
						md.innerHTML = inpE.rel;
					}else{
						md.s({'width' : inpE.w() + 'px', 'height' : inpE.h() + 'px', 'fontSize' : '1pt'});
						md.innerHTML = '&nbsp;';
					}
					inpE.events('change', function(){
						this.nextSibling.setAttribute('style', ((this.checked) ? EL.defaultStyles.checkbox.checked.def : EL.defaultStyles.checkbox.unChecked.def));
						this.nextSibling.s({'width' : this.w() + 'px', 'height' : this.h() + 'px'});
					}, false);
					inpE.events('mouseover', function(){
						this.nextSibling.setAttribute('style', ((this.checked) ? EL.defaultStyles.checkbox.checked.def + EL.defaultStyles.checkbox.checked.hover : EL.defaultStyles.checkbox.unChecked.def + EL.defaultStyles.checkbox.unChecked.hover));
						this.nextSibling.s({'width' : this.w() + 'px', 'height' : this.h() + 'px'});
					});
					inpE.events('mouseout', function(){
						this.nextSibling.setAttribute('style', ((this.checked) ? EL.defaultStyles.checkbox.checked.def : EL.defaultStyles.checkbox.unChecked.def));
						this.nextSibling.s({'width' : this.w() + 'px', 'height' : this.h() + 'px'});
					});
					inpE.events('focus', function(){
						this.nextSibling.setAttribute('style', ((this.checked) ? EL.defaultStyles.checkbox.checked.def + EL.defaultStyles.checkbox.checked.hover + EL.defaultStyles.checkbox.checked.focus : EL.defaultStyles.checkbox.unChecked.def + EL.defaultStyles.checkbox.unChecked.hover + EL.defaultStyles.checkbox.unChecked.focus));
						this.nextSibling.s({'width' : this.w() + 'px', 'height' : this.h() + 'px'});
					});
					inpE.events('blur', function(){
						this.nextSibling.setAttribute('style', ((this.checked) ? EL.defaultStyles.checkbox.checked.def : EL.defaultStyles.checkbox.unChecked.def));
						this.nextSibling.s({'width' : this.w() + 'px', 'height' : this.h() + 'px'});
					});
					xd.appendChild(md);
		}
	}, 
	
	replaceSelect : function(){
		if((this.replaceSelects) && (currents = this.E({'tag' : 'SELECT'})))
			for(var current in currents)
				if((currents[current].type) && (! currents[current].a('_EL_SELECT_CONT')) && (currents[current].size = '1') && (currents[current].getAttribute('EL').upper() == 'true')){
					var inpE = currents[current];
					inpE.a({'_EL_SELECT_CONT' : 'CHANGED'});
					var nexts = inpE.nextSibling;
					var pares = inpE.parentNode;
					xd = document.createElement('div');
					xd.setAttribute('style', 'position:relative; top:0px; left:0px; ');
					xd.appendChild(inpE);
					pares.insertBefore(xd, ((nexts) ? nexts : pares.lastChild));
					md = document.createElement('div');
					md.setAttribute('style', this.defaultStyles.select.def);
					md.s({'width' : inpE.w() + 'px', 'height' : inpE.h() + 'px'});
					inpE.s({'position' : 'relative', 'zIndex' : '100000', 'opacity' : '.01'});
					md.innerHTML = inpE.options[inpE.options.selectedIndex].text + '<div style="position:absolute; top:1px; right:3px; font-size:9pt; ">&#9660;</div>';
					inpE.events('change', function(){
						this.nextSibling.innerHTML = this.options[this.options.selectedIndex].text + '<div style="position:absolute; top:1px; right:3px; font-size:9pt; ">&#9660;</div>';
					}, false);
					inpE.events('mouseover', function(){
						this.nextSibling.setAttribute('style', EL.defaultStyles.select.def + EL.defaultStyles.select.hover);
						this.nextSibling.s({'width' : this.w() + 'px', 'height' : this.h() + 'px'});
					});
					inpE.events('mouseout', function(){
						this.nextSibling.setAttribute('style', EL.defaultStyles.select.def);
						this.nextSibling.s({'width' : this.w() + 'px', 'height' : this.h() + 'px'});
					});
					inpE.events('focus', function(){
						this.nextSibling.setAttribute('style', EL.defaultStyles.select.def + EL.defaultStyles.select.hover + EL.defaultStyles.select.active);
						this.nextSibling.s({'width' : this.w() + 'px', 'height' : this.h() + 'px'});
					});
					inpE.events('blur', function(){
						this.nextSibling.setAttribute('style', EL.defaultStyles.select.def);
						this.nextSibling.s({'width' : this.w() + 'px', 'height' : this.h() + 'px'});
					});
					xd.appendChild(md);
		}
	}, 
	
	replaceAlert : function(){
		if(this.replaceAlerts){
			window.alert = function(alertString){
				var ams = document.createElement('div')
				ams.setAttribute('style', 'position:fixed; top:0px; left:0px; width:100%; height:100%; z-index:1000; ');
				document.getElementsByTagName('body')[0].appendChild(ams);
				var abg = document.createElement('div');
				abg.setAttribute('style', EL.defaultStyles.alert.background);
				ams.appendChild(abg);
				var awn = document.createElement('div');
				awn.setAttribute('style', EL.defaultStyles.alert.window);
				ams.appendChild(awn);
				var ahd = document.createElement('h3');
				ahd.setAttribute('style', EL.defaultStyles.alert.header);
				ahd.innerHTML = EL.defaultStyles.alert.headerText;
				awn.appendChild(ahd);
				var aal = document.createElement('h2');
				aal.setAttribute('style', EL.defaultStyles.alert.alert);
				aal.innerHTML = alertString;
				awn.appendChild(aal);
				var abc = document.createElement('div');
				abc.setAttribute('style', EL.defaultStyles.alert.buttonCont);
				awn.appendChild(abc);
				var abt = document.createElement('button');
				abt.setAttribute('style', EL.defaultStyles.alert.button);
				abt.value = 'OK';
				abt.innerHTML = 'OK';
				abt.events('click', function(){
					document.getElementsByTagName('body')[0].removeChild(this.parentNode.parentNode.parentNode);
				});
				abc.appendChild(abt);
			}
		}
	}, 
	
	$ : function(elementId){
		if(document.getElementById(elementId)){
			if(this.isArray(elementId)){
				return this.E(elementId);
			}else if(this.isFunction(elementId)){
				elementId();
			}else{
				return document.getElementById(elementId);
			}
		}
	}, 
	
	$rem : function(elementId){
		if(this.$(elementId)){
			this.$(elementId).parentNode.removeChild(this.$(elementId));
		}else{
			return false;
		}
	}, 
	
	_ : function(elementName, order){
		order = (order) ? order : 0;
		if(document.getElementsByName(elementName)[order]){
			return document.getElementsByName(elementName)[order];
		}else{
			return document.getElementsByName(elementName);
		}
	}, 
	
	_rem : function(elementName, order){
		order = (order) ? order : 0;
		if(this._(elementName, order)){
			this._(elementName, order).parentNode.removeChild(this._(elementName, order));
		}else{
			return false;
		}
	}, 
	
	T : function(elementTag, order){
		if(document.getElementsByTagName(elementTag)[order]){
			return document.getElementsByTagName(elementTag)[order];
		}else{
			return document.getElementsByTagName(elementTag);
		}
	}, 
	
	Trem : function(elementTag, order){
		order = (order) ? order : 0;
		if(document.getElementsByTagName(elementTag)[order]){
			this.T(elementTag, order).parentNode.removeChild(this.T(elementTag, order));
		}else{
			return false;
		}
	}, 
	
	f : function(formName, fItems){
		if(fItems){
			for(var item in fItems)
				document[formName][item].value=fItems[item];
			return document[formName]
		}else return document[formName];
	}, 
	
	fSub : function(formName){
		document[formName].submit();
	}, 
	
	fDef : function(formName){
		document[formName].reset();
	}, 
	
	E : function(clauses){
		retElements = new Array();
		elemCount=0;
		if(clauses){
			if(clauses['tag']){
				currents = document.getElementsByTagName(clauses['tag']);
				delete clauses['tag'];
			}else currents = document.getElementsByTagName('*');
			for(var current in currents)
				if((currents[current]) && (currents[current].getAttribute)){
					goover = true;
					for(var tagtype in clauses){
						if(currents[current].getAttribute(tagtype) != clauses[tagtype])
							goover = false;
					}
					if(goover)
						retElements[elemCount++]=currents[current];
			}
		}else retElements = document.getElementsByTagName('*');
		return retElements;
	}, 
	
	onError:function(error){
		EL.message(error);
	}, 
	
	getBrowserSpeed : function(){
		var xc = 0;
		var now = alarm = new Date();
		while(alarm.getTime() - now.getTime() <= 1){
			xc++;
			alarm = new Date();
		}
		return xc;
	}, 
	
	getBrowserObjSpeed : function(){
		var xc = 0;
		var now = alarm = new Date();
		xTMP = document.createElement('div');
		xTMP.a({'style' : 'width:100px; height:100px; opacity:.02; filter:alpha(opacity=2); overflow:hidden; position:relative; top:0px; left:0px; '});
		document.body.appendChild(xTMP);
		while(alarm.getTime() - now.getTime() <= 1){
			bTMP = document.createElement('div');
			bTMP.a({'style' : 'top:' + EL.rand(0, 100) + 'px; left:' + EL.rand(0, 100) + 'px; width:' + EL.rand(0, 100) + 'px; height:' + EL.rand(0, 100) + 'px; border:2px solid #aaaaaa; background-color:#aaaaaa; '});
			bTMP.v('The quick brown fox jumps over the lazy dog');
			xTMP.appendChild(bTMP);
			xc++;
			alarm = new Date();
		}
		document.body.removeChild(xTMP);
		return xc;
	}, 
	
	connectDocuments : function(){
		cntiframe=EL.E({'tag' : 'iframe'});
		for(i = 0; i<cntiframe.length; i++){
			try{
				if(childEL = cntiframe[i].contentWindow['EL']){
					if(EL.appendChild && childEL.bringToParent){
						childEL.parentEL = EL;
						childEL.parent = window;
						if(cntiframe[i].name){
							this.childs[cntiframe[i].name] = childEL;
							this.iFrames[cntiframe[i].name] = cntiframe[i].contentWindow;
						}
						if(cntiframe[i].id){
							this.childs[cntiframe[i].id] = childEL;
							this.iFrames[cntiframe[i].id] = cntiframe[i].contentWindow;
						}
					}
				}
			}catch(e){}
		}
	}, 
	
	hrefGetByID : function(){
		var res = new Array();
		for(i = 0; i < arguments.length; i++)
			res[i] = escape(arguments[i]) + '=' + escape(EL.$(arguments[i]).value);
		return res.join('&');
	}, 
	
	confirm : function(question, executable){
		if(confirm(question)){
			executable();
		}
	}, 
	
	voteBar : function(e, progressObj, progressStyle, isVertical){
		progressObj.s(progressStyle);
		if(isVertical){
			progressObj.s({height : e.layerY + 'px'});
		}else{
			progressObj.s({width : e.layerX + 'px'});
		}
	}, 
	
	loadHashedPage : function(){
		if(((EL.hashNoListenIfPre == '') || ((EL.hashNoListenIfPre != '') && (EL.hashNoListenIfPre != EL.savedHash.substring(0, EL.hashNoListenIfPre.length)))) && (EL.savedHash != '')){
//			EL.$(EL.hashDest).aReq(EL.hashDefAddress.replace('%ADDRESS%', EL.savedHash));
			if(typeof(pageTracker) !== 'undefined'){
				pageTracker._trackPageview(EL.savedHash);
			}
			if(typeof EL.aHashSendPost == 'object'){
				EL.$(EL.hashDest).aReq(EL.savedHash, EL.aHashSendPost, 'POST');
			}else{
				EL.$(EL.hashDest).aReq(EL.savedHash);
			}
			EL.closeWindow();
		}
	}, 
	
	reloadCurrentPageOrHash : function(){
//		alert('alma, ' + EL.hashAddressing + ', ' + EL.savedHash);
//		alert(EL.savedHash + ', ' + EL.hashDest + ', ' + location.hash);
		if((EL.hashAddressing) && (EL.hashDest != '')){
			if(EL.savedHash != ''){
				EL.loadHashedPage();
			}else{
				location.href = location.href;
			}
		}
	}, 
	
	setHash : function(hashstring){
		document.location.hash=(hashstring.substring(0, 1) == '#') ? hashstring : '#' + hashstring;
	}, 
	
	aReqProc : function(responseText, destinationID, destFunction){
		retNStrings = responseText.split("<script type='text/javascript' rel='EL'>");
		document.getElementById(destinationID).innerHTML = retNStrings[0];
		for(i = 1; i < retNStrings.length; i++){
			iRetNStrings = retNStrings[i].split("</script>");
			eval(iRetNStrings[0]);
			document.getElementById(destinationID).innerHTML += iRetNStrings[1];
		}
		if(typeof destFunction == 'function'){
			destFunction(responseText);
		}
		EL.replaceSelect();
		EL.replaceRadio();
		EL.replaceCheck();
		EL.replaceUpload();
		EL._replaceAHrefToHash();
	}, 
	
	includeJS : function(JSsrc){
		var head= document.getElementsByTagName('head')[0];
		var script= document.createElement('script');
		script.type= 'text/javascript';
		script.src= JSsrc;
		head.appendChild(script);
	}, 
	
	includeAJS : function(JSsrc){
		try {
			jsxmlhttp = new XMLHttpRequest();
			var jssuccess = true;
		}catch(e){
			var XMLHTTP_IDS = new Array('MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP');
			var jssuccess = false;
			for(var i=0;i < XMLHTTP_IDS.length && !success; i++){
				try{
					jsxmlhttp = new ActiveXObject(XMLHTTP_IDS[i]);
					jssuccess = true;
				}catch(e){}
			}
			if(!jssuccess){
				this.onError('Unable to create XMLHttpRequest.');
			}
		}
		if(jssuccess){
			jsxmlhttp.open('GET', JSsrc, false);
			jsxmlhttp.send(null);
			alert(jsxmlhttp.responseText);
		}else return false;
	}, 
	
	returnAJS : function(JSsrc, async, destFunction){
		if(typeof async == 'undefined'){
			async = false;
		}
		try {
			jsxmlhttp = new XMLHttpRequest();
			var jssuccess = true;
		}catch(e){
			var XMLHTTP_IDS = new Array('MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP');
			var jssuccess = false;
			for(var i=0;i < XMLHTTP_IDS.length && !success; i++){
				try{
					jsxmlhttp = new ActiveXObject(XMLHTTP_IDS[i]);
					jssuccess = true;
				}catch(e){}
			}
			if(!jssuccess){
				this.onError('Unable to create XMLHttpRequest.');
			}
		}
		if(jssuccess){
			if(async){
				jsxmlhttp.onreadystatechange = function(){
					switch(this.readyState){
						case 4:
							if(this.status == 200)
								destFunction(this.responseText);
					}
				}
			}
			jsxmlhttp.open('GET', JSsrc, async);
			jsxmlhttp.send(null);
			if(! async)
				return jsxmlhttp.responseText;
		}else return false;
	}, 
	
	aReq : function(url, destination, form, destFunction){
		mxx = EL.rand(1000, 9999);
		if(typeof xmlhttp == 'undefined')
			xmlhttp = new Array();
		try {
			xmlhttp[mxx] = new XMLHttpRequest();
			var success = true;
		}catch(e){
			var XMLHTTP_IDS = new Array('MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP');
			var success = false;
			for(var i=0;i < XMLHTTP_IDS.length && !success; i++){
				try{
					xmlhttp[mxx] = new ActiveXObject(XMLHTTP_IDS[i]);
					success = true;
				}catch(e){}
			}
			if(!success){
				this.onError('Unable to create XMLHttpRequest.');
			}
		}
		if(success){
			if(destination){
				this.aDest = destination;
			}
			if(destFunction){
				this.aDestFunction = destFunction;
			}
			if(form){
				var xParam = this.getquerystring(form);
				if(this.aReqType == 'GET'){
					url += (xParam.length > 0)?'?' + xParam:'';
				}
			}
			if((EL.aWhileLoading) && (EL.aLoaderSameDest))
				EL.$(((EL.hashLoading) ? EL.hashDest : EL.aDest)).innerHTML = EL.aWhileLoading.innerHTML;
			if(EL.hashLoading){
				xmlhttp[mxx].onreadystatechange = function(){
					switch(this.readyState){
						case 2:
							this.aHashOnSend;
							break;
						case 4:
							this.aHashOnLoad;
							if(this.status == 200){
								EL.aReqProc(this.responseText, EL.hashDest, this.aDestFunction);
							}else{
								this.onError('HTTP Error Making Request: ' + '[' + xmlhttp.status + ']' + xmlhttp.statusText);
							}
							EL.hashLoading = false;
							EL.aReqType = EL.savedaReqType;
							EL.aDestFunction = false;
							break;
					}
				}
			}else{
				xmlhttp[mxx].onreadystatechange = function(){
					switch(this.readyState){
						case 2:
							this.aOnSend;
							break;
						case 4:
							this.aOnLoad;
							if(this.status == 200){
								EL.aReqProc(this.responseText, EL.aDest, this.aDestFunction);
							}else{
								this.onError('HTTP Error Making Request: ' + '[' + xmlhttp.status + ']' + xmlhttp.statusText);
							}
							EL.aDestFunction = false;
							break;
					}
				}
			}
//			alert(this.aReqType + ', ' + url + ', ' + this.aIsAsync);
			xmlhttp[mxx].open(this.aReqType, url, this.aIsAsync);
			if((form) && (aReqType == 'POST')){
				var xParam = this.getquerystring(form);
				xmlhttp[mxx].setRequestHeader("Content-type", "application/x-www-form-urlencoded");
				xmlhttp[mxx].setRequestHeader("Content-length", xParam.length);
				xmlhttp[mxx].setRequestHeader("Connection", "close");
				xmlhttp[mxx].send(xParam);
			}else{
				xmlhttp[mxx].send(null);
			}
			if(!this.aIsAsync){
				return xmlhttp[mxx].responseText;
			}
		}
	}, 
	
	aReqRaw : function(url, form, destFunction){
		
		reloadFormVar = false;
		if(typeof form == 'object'){
			if(typeof form['reqType'] == 'string'){
				reqType = form['reqType'];
				reloadFormVar = true;
			}
			if(typeof form['destFunction'] == 'function'){
				destFunction = form['destFunction'];
				reloadFormVar = true;
			}
			if((typeof form['form'] == 'object') || (typeof form['form'] == 'string')){
				xform = form['form'];
				reloadFormVar = true;
			}
			if(typeof form['async'] == 'boolean'){
				this.aOptions.aIsAsync = form['async'];
				reloadFormVar = true;
			}
			if(typeof form['silentLoad'] == 'boolean'){
				this.aOptions.silentLoad = form['silentLoad'];
				reloadFormVar = true;
			}
		}
		if(reloadFormVar){
			form = false;
			if((typeof xform == 'object') || (typeof xform == 'string'))
				form = xform;
		}
	}, 
	
	_array2urlquery : function(pObj, pPre){
		toRet = [];
		for(pi in pObj)
			toRet[toRet.length] = (typeof pObj[pi] == 'object') ? this._array2urlquery(pObj, pPre + '[' + pi + ']') : toRet[toRet.length] = pPre + pi + '=' + pObj[pi];
		return toRet.join('&');
	}, 
	
	array2urlquery : function(pObj){
		toRet = (typeof pObj == 'object') ? this._array2urlquery(pObj, '') : '';
		return toRet;
	}, 
	
	getquerystring : function(formname){
		var form = document.forms[formname];
		var qstr = "";
		
		function GetElemValue(name, value){
			qstr += (qstr.length > 0 ? "&" : "") + escape(name).replace(/\+/g, "%2B") + "=" + escape(value ? value : "").replace(/\+/g, "%2B");
		}
		
		var elemArray = form.elements;
		for (var i = 0; i < elemArray.length; i++){
			var element = elemArray[i];
			var elemType = element.type.toUpperCase();
			var elemName = element.name;
			if (elemName){
				if(elemType == "TEXT" || elemType == "TEXTAREA" || elemType == "PASSWORD" || elemType == "BUTTON" || elemType == "RESET" || elemType == "SUBMIT" || elemType == "FILE" || elemType == "IMAGE" || elemType == "HIDDEN")
					GetElemValue(elemName, element.value);
				else if(elemType == "CHECKBOX" && element.checked)
					GetElemValue(elemName, element.value ? element.value : "On");
				else if(elemType == "RADIO" && element.checked)
					GetElemValue(elemName, element.value);
				else if(elemType.indexOf("SELECT") != -1)
					for(var j = 0; j < element.options.length; j++){
						var option = element.options[j];
						if(option.selected)
							GetElemValue(elemName, option.value ? option.value : option.text);
					}
			}
		}
		return qstr;
	}, 
	
	base64_encode : function(input){
		var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
		var output = "";
		var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
		var i = 0;
		input = this.utf8_encode(input);
		while (i < input.length){
			chr1 = input.charCodeAt(i++);
			chr2 = input.charCodeAt(i++);
			chr3 = input.charCodeAt(i++);
			enc1 = chr1 >> 2;
			enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
			enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
			enc4 = chr3 & 63;
			if (isNaN(chr2)){
				enc3 = enc4 = 64;
			}else if (isNaN(chr3)){
				enc4 = 64;
			}
			output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
		}
		return output;
	}, 
	
	base64_decode : function (input){
		var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
		var output = "";
		var chr1, chr2, chr3;
		var enc1, enc2, enc3, enc4;
		var i = 0;
		input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
		while (i < input.length) {
			enc1 = _keyStr.indexOf(input.charAt(i++));
			enc2 = _keyStr.indexOf(input.charAt(i++));
			enc3 = _keyStr.indexOf(input.charAt(i++));
			enc4 = _keyStr.indexOf(input.charAt(i++));
			chr1 = (enc1 << 2) | (enc2 >> 4);
			chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
			chr3 = ((enc3 & 3) << 6) | enc4;
			output = output + String.fromCharCode(chr1);
			if (enc3 != 64){
				output = output + String.fromCharCode(chr2);
			}
			if (enc4 != 64){
				output = output + String.fromCharCode(chr3);
			}
		}
		output = this.utf8_decode(output);
		return output;
	},

	utf8_encode : function (string){
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";
		for (var n = 0; n < string.length; n++) {
			var c = string.charCodeAt(n);
			if (c < 128){
				utftext += String.fromCharCode(c);
			}else if((c > 127) && (c < 2048)){
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}else{
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}
		}
		return utftext;
	},

	utf8_decode : function (utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;
		while ( i < utftext.length ) {
			c = utftext.charCodeAt(i);
			if (c < 128){
				string += String.fromCharCode(c);
				i++;
			}else if((c > 191) && (c < 224)){
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}else{
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}
		}
		return string;
	}, 	
	
	initSVGto : function(obj, width, height){
		if(! obj)
			return false;
		
		sWidth = (width) ? width : obj.w();
		sHeight = (height) ? height : obj.h(); 
		ELSVG = document.createElement('iframe');
		ELSVG.setAttribute('width', width);
		ELSVG.setAttribute('height', height); 
		ELSVG.setAttribute('marginWidth', '0');
		ELSVG.setAttribute('marginHeight', '0');
		ELSVG.setAttribute('frameborder', '0');
		ELSVG.setAttribute('allowtransparency', 'true');
		ELSVG.src='http://work.refe.ro/sitemirror/EasyLayer/svg-frame.xhtml';
/*		ELSVG.src = 'data:application/xhtml+xml;base64,' + 
			'PGh0bWwgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGh0bWwiPg0KPGhlYWQ+DQoJPHN0' + 
			'eWxlIHR5cGU9InRleHQvY3NzIj4NCglodG1sLCBib2R5CXtvdmVyZmxvdzpoaWRkZW47IHBhZGRp' + 
			'bmc6MHB4OyBtYXJnaW46MHB4OyB3aWR0aDoxMDAlOyBoZWlnaHQ6MTAwJTsgfQ0KCTwvc3R5bGU+' + 
			'DQoJPHRpdGxlPkVhc3lMYXllciBTVkc8L3RpdGxlPg0KPC9oZWFkPg0KPGJvZHk+DQo8c2NyaXB0' + 
			'IHR5cGU9InRleHQvamF2YXNjcmlwdCI+DQo8IVtDREFUQVsNCnZhciBzdmducyA9ICJodHRwOi8v' + 
			'd3d3LnczLm9yZy8yMDAwL3N2ZyI7DQpmdW5jdGlvbiBpbml0aWFsaXplKGV2dCl7DQoJaWYgKCB3' + 
			'aW5kb3cuc3ZnRG9jdW1lbnQgPT0gbnVsbCApIHN2Z0RvY3VtZW50ID0gZXZ0LnRhcmdldC5vd25l' + 
			'ckRvY3VtZW50Ow0KfQ0KZnVuY3Rpb24gZHJhd09iamVjdChvVHlwZSwgb1BhcmFtcywgb1BhcmVu' + 
			'dCl7DQoJaWYoKG9UeXBlKSAmJiAob1BhcmFtcykgJiYgKHR5cGVvZiBvUGFyYW1zID09ICJvYmpl' + 
			'Y3QiKSl7DQoJCW9QYXJlbnQgPSAob1BhcmVudCkgPyBvUGFyZW50IDogIlNWR09iamVjdCI7DQoJ' + 
			'CXRtcCA9IHN2Z0RvY3VtZW50LmNyZWF0ZUVsZW1lbnROUyhzdmducywgb1R5cGUpOyANCgkJbWFr' + 
			'ZVRleHQgPSBmYWxzZTsNCgkJZm9yKG9LZXkgaW4gb1BhcmFtcyl7DQoJCQlpZihvS2V5ID09ICdz' + 
			'ZXREYXRhJyl7DQoJCQkJTXNnID0gZG9jdW1lbnQuY3JlYXRlVGV4dE5vZGUob1BhcmFtc1tvS2V5' + 
			'XSk7DQoJCQkJdG1wLmFwcGVuZENoaWxkKE1zZyk7DQoJCQkJDQovLwkJCQl0bXAuZGF0YSA9IG9Q' + 
			'YXJhbXNbb0tleV07DQoJCQkJDQoJCQkJbWFrZVRleHQgPSBvUGFyYW1zW29LZXldOw0KCQkJCQ0K' + 
			'Ly8JCQkJYWxlcnQob1BhcmFtc1tvS2V5XSk7DQoJCQl9ZWxzZXsNCgkJCQl0bXAuc2V0QXR0cmli' + 
			'dXRlTlMobnVsbCwgb0tleSwgb1BhcmFtc1tvS2V5XSk7IA0KCQkJfQ0KCQl9DQoJCWRvY3VtZW50' + 
			'LmdldEVsZW1lbnRCeUlkKG9QYXJlbnQpLmFwcGVuZENoaWxkKHRtcCk7DQoJCWlmKG1ha2VUZXh0' + 
			'KXsNCi8vCQkJdG1wLm5vZGVWYWx1ZSA9IG1ha2VUZXh0Ow0KLy8JCQl0ZXh0VG1wID0gc3ZnRG9j' + 
			'dW1lbnQuY3JlYXRlVGV4dE5vZGUobWFrZVRleHQpOw0KLy8JCQl0bXAuYXBwZW5kQ2hpbGQodGV4' + 
			'dFRtcCk7DQoJCQlhbGVydCh0bXAubm9kZVZhbHVlKTsNCgkJfQ0KCX0NCn0NCl1dPg0KPC9zY3Jp' + 
			'cHQ+DQo8c3ZnIGlkPSJTVkdPYmplY3QiIG9ubG9hZD0iaW5pdGlhbGl6ZShldnQpOyAiIHdpZHRo' + 
			'PSIxMDAlIiBoZWlnaHQ9IjEwMCUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+' + 
			'DQoJPGNpcmNsZSBmaWxsPSJyZ2IoMjUwLCAxNjAsIDIwKSIgY3g9IjEwMCIgY3k9IjUwIiByPSI4' + 
			'MCIgLz4NCjwvc3ZnPg0KPC9ib2R5Pg0KPC9odG1sPg0K';*/
		obj.parentNode.replaceChild(ELSVG, obj);
		this.assignSVG(ELSVG);
		return ELSVG;
	}, 
	
	SVGfont : {
		face				: 'Arial', 
		bold				: false, 
		italic				: false, 
		underline			: false, 
		overline			: false, 
		lineThrough			: false, 
		blink 				: false, 
		size				: '12pt', 
		variant			: 'normal', 
		stretch			: 'normal', 
		kerning			: 'auto', 
		letterSpacing		: 'normal', 
		wordSpacing		: 'normal', 
		baseLine			: 'baseline', 
		baseLineAlign		: 'auto', 
		baseLineDominant	: 'auto', 
		textAnchor			: 'start', 
		direction			: 'ltr', 
		angle				: 0, 
		orientationVertical	: 'auto', 
		orientationHorizontal	: 0, 
		writingMode		: 'lr-tb', 
		fill				: '#000000', 
		stroke			: '#000000', 
		strokeWeight		: 0
	}, 
	
	setFontStyle : function(fStyle){
		fFinal = 'font-family:' + fStyle.face + '; ';
		fFinal += (fStyle.bold) ? 'font-weight:bold; ' : '';
		fFinal += (fStyle.italic) ? 'font-style:italic; ' : '';
		fFinal += 'font-variant:' + fStyle.variant + '; ';
		fFinal += 'font-size:' + fStyle.size + '; ';
		fFinal += 'font-stretch:' + fStyle.stretch + '; ';
		fFinal += 'kerning:' + fStyle.kerning + '; ';
		fFinal += 'letter-spacing:' + fStyle.letterSpacing + '; ';
		fFinal += 'word-spacing:' + fStyle.wordSpacing + '; ';
		if(fStyle.underline || fStyle.overline || fStyle.lineThrough || fStyle.blink){
			fFinal += 'text-decoration:';
			fFinal += (fStyle.underline) ? ' underline' : '';
			fFinal += (fStyle.overline) ? ' overline' : '';
			fFinal += (fStyle.lineThrough) ? ' line-through' : '';
			fFinal += (fStyle.blink) ? ' blink' : '';
		}
		fFinal += 'baseline-shift:' + fStyle.baseLine + '; ';
		fFinal += 'alignment-baseline:' + fStyle.baseLineAlign + '; ';
		fFinal += 'dominant-baseline: ' + fStyle.baseLineDominant + '; ';
		fFinal += 'text-anchor:' + fStyle.textAnchor + '; ';
		fFinal += 'direction:' + fStyle.direction + '; ';
		fFinal += 'angle:' + fStyle.angle + '; ';
		fFinal += 'glyph-orientation-vertical:' + fStyle.orientationVertical + '; ';
		fFinal += 'glyph-orientation-horizontal:' + fStyle.orientationHorizontal + '; ';
		fFinal += 'writing-mode:' + fStyle.writingMode + '; ';
		fFinal += 'fill:' + fStyle.fill + '; ';
		fFinal += 'stroke:' + fStyle.stroke + '; ';
		fFinal += 'stroke-width:' + fStyle.strokeWeight + '; ';
		return fFinal;
	}, 
	
	assignSVG : function(obj){
		obj.SVG = {
			fillStyle 		: 'black', 
			globalAlpha 	: 1.0, 
			globalCompositeOperation : '', 
			lineCap 		: '', 
			lineJoin 		: '', 
			lineWidth 		: '0', 
			miterLimit 		: '', 
			shadowBlur 	: '', 
			shadowColor 	: '', 
			shadowOffsetX 	: '', 
			shadowOffsetY 	: '', 
			strokeStyle 	: 'black', 
			_path		: '', 
			_polyline		: '', 
			_polygon		: '', 
			
			$ : function(id){
				if(! id)
					return false;
				return obj.iDoc().document.getElementById(id);
			}, 
			
			$rem : function(id){
				if(! id)
					return false;
				if(obj.iDoc().document.getElementById(id)){
					obj.iDoc().document.getElementById(id).parentNode.removeChild(obj.iDoc().document.getElementById(id));
				}else{
					return false;
				}
			}, 
			
			_ : function(name, order){
				if(! name)
					return false;
				order = (order) ? order : 0;
				return obj.iDoc().document.getElementsByName(name)[order];
			}, 
			
			_rem : function(name, order){
				if(! name)
					return false;
				order = (order) ? order : 0;
				if(obj.iDoc().document.getElementsByName(name)[order]){
					obj.iDoc().document.getElementsByName(name)[order].parentNode.removeChild(obj.iDoc().document.getElementsByName(name)[order]);
				}else{
					return false;
				}
			}, 
			
			T : function(tagName, order){
				if(! tagName)
					return false;
				order = (order) ? order : 0;
				return obj.iDoc().document.getElementsByTagName(tagName)[order];
			}, 
			
			Trem : function(tagName, order){
				if(! tagName)
					return false;
				order = (order) ? order : 0;
				if(obj.iDoc().document.getElementsByTagName(tagName)[order]){
					obj.iDoc().document.getElementsByTagName(tagName)[order].parentNode.removeChild(obj.iDoc().document.getElementsByTagName(tagName)[order]);
				}else{
					return false;
				}
			}, 
			
			group : function(id, events, toGroup){
				if(! id)
					return false;
				sParams = (events) ? events : {};
				sParams.id = id;
				obj.iDoc().drawObject('g', sParams, toGroup);
				return this;
			}, 
			
			moveTo : function(x, y){
				this._path += 'M ' + x.toString() + ' ' + y.toString() + ' ';
				return this;
			}, 
			
			lineTo : function(x, y){
				this._path += 'L ' + x.toString() + ' ' + y.toString() + ' ';
				return this;
			}, 
			
			bezierCurveTo : function(x1, y1, x2, y2, x, y){
				this._path += 'C ' + x1 + ' ' + y1 + ' ' + x2 + ' ' + y2 + ' ' + x + ' ' + y + ' ';
				return this;
			}, 
			
			smoothCurveTo : function(x2, y2, x, y){
				this._path += 'S ' + x2 + ' ' + y2 + ' ' + x + ' ' + y + ' ';
				return this;
			}, 
			
			quadraticCurveTo : function(x1, y1, x, y){
				this._path += 'Q ' + x1 + ' ' + y1 + ' ' + x + ' ' + y + ' ';
				return this;
			}, 
			
			smoothQuadraticCurveTo : function(x, y){
				this._path += 'Q ' + x + ' ' + y + ' ';
				return this;
			}, 
			
			ellipticalArc : function(posX, posY, radX, radY, xAxisRotation, largeArcFlag, sweepFlag, endX, endY){
				this._path += 'M ' + posX + ' ' + posY + ' A ' + radX + ' ' + radY + ' ' + xAxisRotation + ' ' + largeArcFlag + ' ' + sweepFlag + ' ' + endX + ' ' + endY + ' ';
				return this;
			}, 
			
			strokePath : function(id, events, sStroke, sStrokeWidth, toGroup){
				this._path += 'z';
				sParams = (events) ? events : {};
				sParams.d = this._path;
				sParams.stroke = sStroke ? sStroke : this.strokeStyle;
				sParams['stroke-width'] = sStrokeWidth ? sStrokeWidth : this.lineWidth;
				if(id){sParams.id = id};
				obj.iDoc().drawObject('path', sParams, toGroup);
				this._path = '';
				return this;
			}, 
			
			fillPath : function(id, events, sFill, toGroup){
				this._path += 'z';
				sParams = (events) ? events : {};
				sParams.d = this._path;
				sParams.fill = sFill ? sFill : this.fillStyle;
				if(id){sParams.id = id};
				obj.iDoc().drawObject('path', sParams, toGroup);
				this._path = '';
				return this;
			}, 
			
			drawPath : function(id, events, sFill, sStroke, sStrokeWidth, toGroup){
				this._path += 'z';
				sParams = (events) ? events : {};
				sParams.d = this._path;
				sParams.fill = sFill ? sFill : this.fillStyle;
				sParams.stroke = sStroke ? sStroke : this.strokeStyle;
				sParams['stroke-width'] = sStrokeWidth ? sStrokeWidth : this.lineWidth;
				if(id){sParams.id = id};
				obj.iDoc().drawObject('path', sParams, toGroup);
				this._path = '';
				return this;
			}, 
			
			strokeRect : function(x, y, width, height, radX, radY, id, events, sStroke, sStrokeWidth, toGroup){
				if(!x || !y || !width || !height)
					return false;
				sParams = (events) ? events : {};
				sParams.x = x;
				sParams.y = y;
				sParams.width = width;
				sParams.height = height;
				sParams.rx = radX;
				sParams.ry = radY;
				sParams.stroke = sStroke ? sStroke : this.strokeStyle;
				sParams['stroke-width'] = sStrokeWidth ? sStrokeWidth : this.lineWidth;
				if(id){sParams.id = id};
				obj.iDoc().drawObject('rect', sParams, toGroup);
				return this;
			}, 
			
			fillRect : function(x, y, width, height, radX, radY, id, events, sFill, toGroup){
				if(!x || !y || !width || !height)
					return false;
				sParams = (events) ? events : {};
				sParams.x = x;
				sParams.y = y;
				sParams.width = width;
				sParams.height = height;
				sParams.rx = radX;
				sParams.ry = radY;
				sParams.fill = sFill ? sFill : this.fillStyle;
				if(id){sParams.id = id};
				obj.iDoc().drawObject('rect', sParams, toGroup);
				return this;
			}, 
			
			drawRect : function(x, y, width, height, radX, radY, id, events, sFill, sStroke, sStrokeWidth, toGroup){
				if(!x || !y || !width || !height)
					return false;
				sParams = (events) ? events : {};
				sParams.x = x;
				sParams.y = y;
				sParams.width = width;
				sParams.height = height;
				sParams.rx = radX;
				sParams.ry = radY;
				sParams.fill = sFill ? sFill : this.fillStyle;
				sParams.stroke = sStroke ? sStroke : this.strokeStyle;
				sParams['stroke-width'] = sStrokeWidth ? sStrokeWidth : this.lineWidth;
				if(id){sParams.id = id};
				obj.iDoc().drawObject('rect', sParams, toGroup);
				return this;
			}, 
			
			strokeCircle : function(x, y, r, id, events, sStroke, sStrokeWidth, toGroup){
				if(!x || !y || !r)
					return false;
				sParams = (events) ? events : {};
				sParams.cx = x;
				sParams.cy = y;
				sParams.r = r;
				sParams.stroke = sStroke ? sStroke : this.strokeStyle;
				sParams['stroke-width'] = sStrokeWidth ? sStrokeWidth : this.lineWidth;
				if(id){sParams.id = id};
				obj.iDoc().drawObject('circle', sParams, toGroup);
				return this;
			}, 
			
			fillCircle : function(x, y, r, id, events, sFill, toGroup){
				if(!x || !y || !r)
					return false;
				sParams = (events) ? events : {};
				sParams.cx = x;
				sParams.cy = y;
				sParams.r = r;
				sParams.fill = sFill ? sFill : this.fillStyle;
				if(id){sParams.id = id};
				obj.iDoc().drawObject('circle', sParams, toGroup);
				return this;
			}, 
			
			drawCircle : function(x, y, r, id, events, sFill, sStroke, sStrokeWidth, toGroup){
				if(!x || !y || !r)
					return false;
				sParams = (events) ? events : {};
				sParams.cx = x;
				sParams.cy = y;
				sParams.r = r;
				sParams.fill = sFill ? sFill : this.fillStyle;
				sParams.stroke = sStroke ? sStroke : this.strokeStyle;
				sParams['stroke-width'] = sStrokeWidth ? sStrokeWidth : this.lineWidth;
				if(id){sParams.id = id};
				obj.iDoc().drawObject('circle', sParams, toGroup);
				return this;
			}, 
			
			strokeEllipse : function(x, y, radX, radY, id, events, sStroke, sStrokeWidth, toGroup){
				if(!x || !y || !radX || !radY)
					return false;
				sParams = (events) ? events : {};
				sParams.cx = x;
				sParams.cy = y;
				sParams.rx = radX;
				sParams.ry = radY;
				sParams.stroke = sStroke ? sStroke : this.strokeStyle;
				sParams['stroke-width'] = sStrokeWidth ? sStrokeWidth : this.lineWidth;
				if(id){sParams.id = id};
				obj.iDoc().drawObject('ellipse', sParams, toGroup);
				return this;
			}, 
			
			fillEllipse : function(x, y, radX, radY, id, events, sFill, toGroup){
				if(!x || !y || !radX || !radY)
					return false;
				sParams = (events) ? events : {};
				sParams.cx = x;
				sParams.cy = y;
				sParams.rx = radX;
				sParams.ry = radY;
				sParams.fill = sFill ? sFill : this.fillStyle;
				if(id){sParams.id = id};
				obj.iDoc().drawObject('ellipse', sParams, toGroup);
				return this;
			}, 
			
			drawEllipse : function(x, y, radX, radY, id, events, sFill, sStroke, sStrokeWidth, toGroup){
				if(!x || !y || !radX || !radY)
					return false;
				sParams = (events) ? events : {};
				sParams.cx = x;
				sParams.cy = y;
				sParams.rx = radX;
				sParams.ry = radY;
				sParams.fill = sFill ? sFill : this.fillStyle;
				sParams.stroke = sStroke ? sStroke : this.strokeStyle;
				sParams['stroke-width'] = sStrokeWidth ? sStrokeWidth : this.lineWidth;
				if(id){sParams.id = id};
				obj.iDoc().drawObject('ellipse', sParams, toGroup);
				return this;
			}, 
			
			line : function(x1, y1, x2, y2, id, events, sStroke, sStrokeWidth, toGroup){
				if(!x || !y || !radX || !radY)
					return false;
				sParams = (events) ? events : {};
				sParams.x1 = x1;
				sParams.y1 = y1;
				sParams.x2 = x2;
				sParams.y2 = y2;
				sParams.stroke = sStroke ? sStroke : this.strokeStyle;
				sParams['stroke-width'] = sStrokeWidth ? sStrokeWidth : this.lineWidth;
				if(id){sParams.id = id};
				obj.iDoc().drawObject('line', sParams, toGroup);
				return this;
			}, 
			
			movePolylineTo : function(x, y){
				this._polyline = x + ', ' + y;
				return this;
			}, 
			
			linePolylineTo : function(x, y){
				this._polyline += ' ' + x + ', ' + y;
				return this;
			}, 
			
			strokePolyline : function(id, events, sStroke, sStrokeWidth, toGroup){
				sParams = (events) ? events : {};
				sParams.points = this._polyline;
				sParams.stroke = sStroke ? sStroke : this.strokeStyle;
				sParams['stroke-width'] = sStrokeWidth ? sStrokeWidth : this.lineWidth;
				if(id){sParams.id = id};
				obj.iDoc().drawObject('polyline', sParams, toGroup);
				return this;
			}, 
			
			movePolygonTo : function(x, y){
				this._polygon = x + ', ' + y;
				return this;
			}, 
			
			linePolygonTo : function(x, y){
				this._polygon += ' ' + x + ', ' + y;
				return this;
			}, 
			
			strokePolygon : function(id, events, sStroke, sStrokeWidth, toGroup){
				sParams = (events) ? events : {};
				sParams.points = this._polygon;
				sParams.stroke = sStroke ? sStroke : this.strokeStyle;
				sParams['stroke-width'] = sStrokeWidth ? sStrokeWidth : this.lineWidth;
				if(id){sParams.id = id};
				obj.iDoc().drawObject('polyline', sParams, toGroup);
				return this;
			}, 
			
			fillPolygon : function(id, events, sFill){
				sParams = (events) ? events : {};
				sParams.points = this._polygon;
				sParams.fill = sFill ? sFill : this.fillStyle;
				if(id){sParams.id = id};
				obj.iDoc().drawObject('polyline', sParams, toGroup);
				return this;
			}, 
			
			drawPolygon : function(id, events, sFill, sStroke, sStrokeWidth, toGroup){
				sParams = (events) ? events : {};
				sParams.points = this._polygon;
				sParams.fill = sFill ? sFill : this.fillStyle;
				sParams.stroke = sStroke ? sStroke : this.strokeStyle;
				sParams['stroke-width'] = sStrokeWidth ? sStrokeWidth : this.lineWidth;
				if(id){sParams.id = id};
				obj.iDoc().drawObject('polyline', sParams, toGroup);
				return this;
			}, 
			
			span : function(text, fStyle, toGroup, x, y, dx, dy, rotate, textLength, lengthAdjust, id, events){
				fStyle = EL.setFontStyle(fStyle);
				sParams = (events) ? events : {};
				if(x){sParams.x = x;}
				if(y){sParams.y = y;}
				if(dx){sParams.dx = dx;}
				if(dy){sParams.dy = dy;}
				if(rotate){sParams.rotate = rotate;}
				if(textLength){sParams.textLength = textLength;}
				if(lengthAdjust){sParams.lengthAdjust = lengthAdjust;}
				sParams.setData = text;
				sParams.style = fStyle;
				if(id){sParams.id = id};
				obj.iDoc().drawObject('tspan', sParams, toGroup);
				return this;
			}, 
			
			text : function(x, y, id, events, toGroup){
				if(! id)
					return false;
				sParams = (events) ? events : {};
				sParams.x = x;
				sParams.y = y;
				sParams.id = id;
				obj.iDoc().drawObject('text', sParams, toGroup);
				return this;
			}, 
			
			textToPath : function(text, startOffset, method, spacing, destinationID, fStyle, id, events, toGroup){
				if(!id || destinationID)
					return false;
				sParams = (events) ? events : {};
				sParams.startOffset = startOffset;
				sParams.method = method;
				sParams.spacing = spacing;
				sParams['xlink:href'] = '#' + destinationID;
				sParams.id = id;
				sParams.innerTEXT = text;
				sParams.style = fStyle;
				obj.iDoc().drawObject('textPath', sParams, toGroup);
				return this;
			}
		};
		
	}, 
	
	canvas4IEInit : function(){
		if((this.ieCanvasInit) && (this.browser['IE']) && (! document.createElement('canvas').getContext)){
			document.namespaces.add('elvml', 'urn:schemas-microsoft-com:vml', '#default#VML');
			document.namespaces.add('elvmlo', 'urn:schemas-microsoft-com:office:office', '#default#VML');
			ELVML = document.createElement('object');
			ELVML.id = 'VMLRender';
			ELVML.codebase = 'vgx.dll';
			ELVML.classid = 'CLSID:10072CEC-8CC1-11D1-986E-00A0C955B42E';
			document.body.appendChild(ELVML);
			if (! document.styleSheets['Canvas4IE']){
				var ss = document.createStyleSheet();
				ss.owningElement.id = 'Canvas4IE';
				ss.cssText = 'canvas {display:inline-block; overflow:hidden; text-align:left; width:300px; height:150px} elvml\\:*{behavior:url(#default#VML)} elvmlo\\:*{behavior:url(#default#VML)}';
			}
			canv = this.E({'tag' : 'canvas'});
			for(var canvKey in canv){
				var icanv = canv[canvKey];
				nd = document.createElement('canvas');
				nd.getContext = function(){
					return new Canvas4IE(this);
				};
				nd.id = icanv.id;
				if(icanv.attributes.width && icanv.attributes.width.specified)
					nd.style.width  = icanv.attributes.width.nodeValue + 'px';
				if(icanv.attributes.height && icanv.attributes.height.specified)
					nd.style.height = icanv.attributes.height.nodeValue + 'px';
				nd.style.position = 'relative';
				nd.style.overflow = 'hidden';
				icanv.parentNode.replaceChild(nd, icanv);
			}
		}
	}, 
	
	addStaticFunction : function(funcName, func){
		delete EL.staticFunctions[funcName];
		delete EL.staticFunctionArgs[funcName];
		EL.staticFunctions[funcName] = func;
		EL.staticFunctionArgs[funcName] = new Array();
		for(i=2; i<arguments.length; i++)
			EL.staticFunctionArgs[funcName][(i - 2)] = arguments[i];
	}, 
	
	deleteStaticFunction : function(funcName){
		delete EL.staticFunctions[funcName];
		delete EL.staticFunctionArgs[funcName];
	}, 
	
	addDynamicFunction : function(funcName, func){
		delete EL.dynamicFunctions[funcName];
		delete EL.dynamicFunctionArgs[funcName];
		EL.dynamicFunctions[funcName] = func;
		EL.dynamicFunctionArgs[funcName] = new Array();
		for(i=2; i<arguments.length; i++)
			EL.dynamicFunctionArgs[funcName][(i - 2)] = arguments[i];
	}, 
	
	deleteDynamicFunction : function(funcName){
		delete EL.dynamicFunctions[funcName];
		delete EL.dynamicFunctionArgs[funcName];
	}, 
	
	css : function(theClass, element, value){
		var xrules = (document.all) ? 'rules' : 'cssRules';
		for (var XK = 0; XK < document.styleSheets.length; XK++){
			for (var XB = 0; XB < document.styleSheets[XK][xrules].length; XB++){
				if (document.styleSheets[XK][xrules][XB].selectorText == theClass){
					if(element){
						if(this.isArray(element)){
							for(var keyelement in element)
								document.styleSheets[XK][xrules][XB].style[keyelement] = element[keyelement];
						}else if(value){
							document.styleSheets[XK][xrules][XB].style[element] = value;
						}else{
							return(document.styleSheets[XK][xrules][XB].style[element]);
						}
					}else{
						return document.styleSheets[XK][xrules][XB].style;
					}
				}
			}
		}
	}, 
	
	cookies : function(name, value, days, path, domain){
		if(value){
			if (days) {
				var date = new Date();
				date.setTime(date.getTime()+(days * 24 * 60 * 60 * 1000));
				var expires = "; expires="+date.toGMTString();
			}
			else var expires = "";
			if(! path)
				var path = '/';
			document.cookie = name+"="+value+expires+"; path=" + path + ((domain) ? '; domain=' + domain : '');
		}else{
			var nameX = name + "=";
			var ca = document.cookie.split(';');
			for(var i=0; i<ca.length; i++){
				var c = ca[i];
				while(c.charAt(0)==' ')
					c = c.substring(1, c.length);
				if(c.indexOf(nameX) == 0)
					return c.substring(nameX.length, c.length);
			}
			return null;
		}
	}, 
	
	unsetCookie : function(name){
		this.cookies(name, "", -1);
	}, 
	
	addShortcutKey : function(fnCode, keyCode, isControl, isAlt, isShift){
		EL.keysArray[keyCode + ((isControl) ? '-c' : '') + ((isAlt) ? '-a' : '') + ((isShift) ? '-s' : '')] = fnCode;
	}, 
	
	deleteShortcutKey : function(fnCode, keyCode, isControl, isAlt, isShift){
		if(EL.keysArray[keyCode + ((isControl) ? '-c' : '') + ((isAlt) ? '-a' : '') + ((isShift) ? '-s' : '')])
			delete EL.keysArray[keyCode + ((isControl) ? '-c' : '') + ((isAlt) ? '-a' : '') + ((isShift) ? '-s' : '')];
	}, 
	
	message : function(text){
		if((! this.$('EasyLayerStatus')) && (this.messageShow))
			this.T('body').add('div', {'id' : 'EasyLayerStatus', 'style' : {'display' : 'none', 'cursor' : 'default'}});
		if(text){
			this.messageI = 1;
			this.$('EasyLayerStatus').v(text).a({'style' : this.defaultStyles.message}).s({'marginLeft' : parseInt(0 - (EL.$('EasyLayerStatus').w() / 2)) + 'px'});
		}else{
			this.messageI = 0;
			this.$('EasyLayerStatus').s({'display'	: 'none'});
		}
	}, 
	
	_scrollPageUp : function(container, content, step){
		step = (step) ? step : 3;
		container = (typeof container == 'object') ? container : EL.$(container);
		content = (typeof content == 'object') ? content : EL.$(content);
		newPos = parseInt(content.style.top) + step;
		newPos = (newPos > 0) ? 0 : newPos;
		content.s({top : newPos + 'px'});
	}, 
	
	scrollPageUp : function(container, content, step, clObject){
		EL._scrollPageUp(container, content, step);
		if(clObject){
			EL.xVar1 = setInterval(function(){ EL._scrollPageUp(container, content, step); }, 20);
			clObject.events('mouseup', function(){clearInterval(EL.xVar1); });
		}
	}, 
	
	_scrollPageDown : function(container, content, step){
		step = (step) ? step : 3;
		container = (typeof container == 'object') ? container : EL.$(container);
		content = (typeof content == 'object') ? content : EL.$(content);
		if(container.h() < content.h()){
			newPos = parseInt(content.style.top) - step;
			newPos = ((container.h() + Math.abs(newPos)) > content.h()) ? (0 - (content.h() - container.h())) : newPos;
			content.s({top : newPos + 'px'});
		}
	}, 
	
	scrollPageDown : function(container, content, step, clObject){
		EL._scrollPageDown(container, content, step);
		if(clObject){
			EL.xVar1 = setInterval(function(){ EL._scrollPageDown(container, content, step); }, 20);
			clObject.events('mouseup', function(){clearInterval(EL.xVar1); });
		}
	}, 
	
	tabs : function(contID, tabLayer, defTab, customStyle){
		cont = this.$(contID);
		if(defTab)
			defTab = this.$(defTab);
		this.$(tabLayer).ELprops = {
			selectedIndex : 0
		}
		if(customStyle){
			savedStyle = this.defaultStyles.tab;
			this.defaultStyles.tab = customStyle;
		}
		tabCount=0;
		this.$(tabLayer).v('');
		for(i=0; i<cont.childNodes.length; i++)
			if((cont.childNodes[i].tagName) && (cont.childNodes[i].id != tabLayer) && (cont.childNodes[i].getAttribute('rel'))){
				actTab = cont.childNodes[i];
				if(! defTab)
					defTab = actTab;
				if(defTab != actTab){
					actTab.s({'display' : 'none'});
				}else{
					this.$(tabLayer).ELprops.selectedIndex = tabCount;
				}
				rID = '_EL_TAB_' + contID + tabCount;
				this.$(tabLayer).add('div', {'id' : rID});
				this.$(rID).ELprops = {
					def 		: this.defaultStyles.tab.def, 
					unSelected	: {
						def		: this.defaultStyles.tab.unSelected.def, 
						hover	: this.defaultStyles.tab.unSelected.hover
					}, 
					selected		: {
						def		: this.defaultStyles.tab.selected.def, 
						hover	: this.defaultStyles.tab.selected.hover
					}, 
					tabRel	: contID, 
					tabIndex	: tabCount, 
					tabLayer	: tabLayer, 
					tabSelected	: (defTab == actTab), 
					tabContent	: actTab, 
					parentID	: tabLayer
				};
				this.$(rID).a({'style' : this.defaultStyles.tab.def + ((defTab == actTab) ? this.defaultStyles.tab.selected.def : this.defaultStyles.tab.unSelected.def)}).v(actTab.getAttribute('rel'));
				this.$(rID).events('mouseover', function(){
					this.a({'style' : this.ELprops.def + ((this.ELprops.tabSelected) ? this.ELprops.selected.def + this.ELprops.selected.hover : this.ELprops.unSelected.def + this.ELprops.unSelected.hover)});
				});
				this.$(rID).events('mouseout', function(){
					this.a({'style' : this.ELprops.def + ((this.ELprops.tabSelected) ? this.ELprops.selected.def : this.ELprops.unSelected.def)});
				});
				this.$(rID).events('click', function(){
					EL.$('_EL_TAB_' + this.ELprops.tabRel + EL.$(this.ELprops.tabLayer).ELprops.selectedIndex).a({'style' : this.ELprops.def + this.ELprops.unSelected.def});
					EL.$('_EL_TAB_' + this.ELprops.tabRel + EL.$(this.ELprops.tabLayer).ELprops.selectedIndex).ELprops.tabSelected = false;
					EL.$('_EL_TAB_' + this.ELprops.tabRel + EL.$(this.ELprops.tabLayer).ELprops.selectedIndex).ELprops.tabContent.s({'display' : 'none'});
					EL.$(this.ELprops.tabLayer).ELprops.selectedIndex = this.ELprops.tabIndex;
					EL.$('_EL_TAB_' + this.ELprops.tabRel + EL.$(this.ELprops.tabLayer).ELprops.selectedIndex).a({'style' : this.ELprops.def + this.ELprops.selected.def});
					EL.$('_EL_TAB_' + this.ELprops.tabRel + EL.$(this.ELprops.tabLayer).ELprops.selectedIndex).ELprops.tabSelected = true;
					EL.$('_EL_TAB_' + this.ELprops.tabRel + EL.$(this.ELprops.tabLayer).ELprops.selectedIndex).ELprops.tabContent.s({'display' : 'block'});
				});
				tabCount++;
		}
		if(customStyle)
			this.defaultStyles.tab = savedStyle;
	}, 
	
	sleep : function(xtime){
		xtime = xtime * 1000;
		var sleeping = true;
		var now = new Date();
		var alarm;
		var startingMSeconds = now.getTime();
		while(sleeping){
			alarm = new Date();
			alarmMSeconds = alarm.getTime();
			if(alarmMSeconds - startingMSeconds > xtime)
				sleeping = false;
		}        
	}, 
	
	rand : function(minval, maxval){
		if(! minval)
			minval = 1;
		if(! maxval){
			maxval = minval;
			minval = 0;
		}
		interval = maxval - minval + 1;
		return Math.floor(Math.random() * interval) + minval;
	}, 
	
	elementFade : function(elmnt, chs, way, from, to, unit, actual, fadeArray){
		if(way){
			if(way != elmnt.style['el' + chs + 'Way'])
				elmnt.style['el' + chs + 'Way'] = way;
		}else{
			way = elmnt.style['el' + chs + 'Way'];
		}
		if(((EL.isNumeric(from)) || (EL.isArray(from))) && (elmnt.style['el' + chs + 'From'] != from)){
			elmnt.style['el' + chs + 'From'] = from;
		}
		if(((EL.isNumeric(to)) || (EL.isArray(to))) && (elmnt.style['el' + chs + 'To'] != to)){
			elmnt.style['el' + chs + 'To'] = to;
		}
		if((unit) && (elmnt.style['el' + chs + 'Unit'] != unit)){
			elmnt.style['el' + chs + 'Unit'] = unit;
		}
		if((EL.isNumeric(actual)) && (elmnt.style['el' + chs + 'Actual'] != actual)){
			elmnt.style['el' + chs + 'Actual'] = actual;
		}
		if((fadeArray) && (elmnt.style['el' + chs + 'FadeArray'] != fadeArray)){
			elmnt.style['el' + chs + 'FadeArray'] = fadeArray;
		}
		xUID='_elFade' + EL.rand(1, 99999);
		
		clearTimeout(elmnt.style['el' + chs + 'Timer']);
		
		if((elmnt.style['el' + chs + 'Actual'] >= 0) && (elmnt.style['el' + chs + 'Actual'] < elmnt.style['el' + chs + 'FadeArray'].length)){
			window[xUID] = elmnt;
			if(EL.isArray(elmnt.style['el' + chs + 'From'])){
				CalcColor = 'rgb(' + 
					parseInt(EL.scaleRange(0, 1, elmnt.style['el' + chs + 'FadeArray'][elmnt.style['el' + chs + 'Actual']], elmnt.style['el' + chs + 'From']['r'], elmnt.style['el' + chs + 'To']['r'])) + ', ' + 
					parseInt(EL.scaleRange(0, 1, elmnt.style['el' + chs + 'FadeArray'][elmnt.style['el' + chs + 'Actual']], elmnt.style['el' + chs + 'From']['g'], elmnt.style['el' + chs + 'To']['g'])) + ', ' + 
					parseInt(EL.scaleRange(0, 1, elmnt.style['el' + chs + 'FadeArray'][elmnt.style['el' + chs + 'Actual']], elmnt.style['el' + chs + 'From']['b'], elmnt.style['el' + chs + 'To']['b'])) + ')';
				elmnt.style[chs] = CalcColor;
			}else{
				elmnt.style[chs] = EL.scaleRange(0, 1, elmnt.style['el' + chs + 'FadeArray'][elmnt.style['el' + chs + 'Actual']], elmnt.style['el' + chs + 'From'], elmnt.style['el' + chs + 'To']) + elmnt.style['el' + chs + 'Unit'];
			}
			elmnt.style['el' + chs + 'Actual'] += (way == 'up') ? +1 : ((way == 'down') ? -1 : 0);
			elmnt.style['el' + chs + 'Actual'] = (elmnt.style['el' + chs + 'Actual'] < 0) ? 0 : elmnt.style['el' + chs + 'Actual'];
			elmnt.style['el' + chs + 'Actual'] = (elmnt.style['el' + chs + 'Actual'] >= elmnt.style['el' + chs + 'FadeArray'].length) ? (elmnt.style['el' + chs + 'FadeArray'].length - 1) : elmnt.style['el' + chs + 'Actual'];
			elmnt.style['el' + chs + 'Timer']=setTimeout('window["' + xUID + '"].fade' + chs.ucFirst() + '()', EL.refreshTimeInMiliSec);
		}else{
			clearTimeout(elmnt.style['el' + chs + 'Timer']);
		}
		
	}, 
	
	fade : function(element, action, curval){
		if(! curval)
			curval = 0;
		if((element.rgworking == 'countup') || (element.rgworking == 'countdown')){
			doAction = false;
			for(var stin in action){
				saction = action[stin]['fade'];
				if(! action[stin]['unit'])
					action[stin]['unit'] = '';
				if(EL.isNumeric(saction[curval])){
					element[stin] = EL.scaleRange(0, 1, saction[curval], action[stin]['from'], action[stin]['to']) + action[stin]['unit'];
					doAction = true;
				}
			}
			if(doAction){
				curval += (element.rgworking == 'countup') ? +1 : -1;
				xvar='fade' + EL.rand(1, 999999);
				EL.addDynamicFunction(xvar, function(rxvar, xelement, xaction, xcurval){
					EL.fade(xelement, xaction, xcurval);
				}, element, action, curval);
			}else{
				element.rgworking='';
			}
		}else if(element.rgworking == 'finnish'){
			for(var stin in action){
				if(! action[stin]['unit'])
					action[stin]['unit'] = '';
				element[stin] = action[stin]['to'] + action[stin]['unit'];
			}
			element[styleTag] = endVal + styleUnit;
			element.rgworking='';
		}else if(element.rgworking == 'suspend'){
			setTimeout(function(){EL.fade(element, action, curval)}, EL.refreshTimeInMiliSec);
		}
	}, 
	
	toFade : function(fadeType){
		if(fadeType == _LINEAR_FADE){
			ret = new Array();
			for(i=0; i<arguments[1]; i++)	
				ret[i]=this.scaleRange(0, (arguments[1] - 1), i, 0, 1);
			return ret;
		}else if(fadeType == _SINUS_FADE){
			ret = new Array();
			pret = new Array();
			startDegrees = (arguments[2]) ? arguments[2] : 0;
			endDegrees = (arguments[3]) ? arguments[3] : 90;
			sMin = 2;
			sMax = -2;
			for(i=0; i<arguments[1]; i++){
				degree = Math.sin(this.scaleRange(0, (arguments[1] - 1), i, startDegrees, endDegrees) * Math.PI / 180);
				sMin=Math.min(degree, sMin);
				sMax=Math.max(degree, sMax);
				pret[i]=degree;
			}
			for(i=0; i<arguments[1]; i++)
				ret[i]=this.scaleRange(sMin, sMax, pret[i], 0, 1);
			return ret;
		}else if(fadeType == _CUSTOM_FADE){
			ret = new Array();
			pret = new Array();
			sMin = 9999999999;
			sMax = -9999999999;
			for(i=0; i<(arguments.length - 1); i++){
				sMin = Math.min(sMin, arguments[i - 1]);
				sMax = Math.max(sMax, arguments[i - 1]);
				pret[i] = arguments[i - 1];
			}
			for(i=0; i< pret.length; i++)
				ret[i]=this.scaleRange(sMin, sMax, pret[i], 0, 1);
			return ret;
		}else if(fadeType == _RANDOM_FADE){
			ret = new Array();
			fCount = (arguments[1]) ? arguments[1] : 200;
			fTolerance = ((arguments[2]) ? arguments[2] : 25) / 1000;
			xInit = 0;
			for(i=0; i<fCount; i++){
				xCurr=this.scaleRange(0, (fCount - 1), i, 0, 1);
				do{
					xNr = (Math.random() / 0.5);
				}while(Math.abs(xInit - xNr) > fTolerance);
				ret[i] = xInit = xNr;
			}
			return ret;
		}
	}, 
	
	fadeSet : function(fadeArray, count, min, max, xID){
		try{
			if(EL.isNumeric(fadeArray[count])){
				window[xID]['fade'] = 1;
				ret = EL.scaleRange(0, 1, fadeArray[count], min, max);
			}else ret = max;
		}catch(e){ret = min}
		return ret;
	}, 
	
	imager : function(xID, content, count, deep){
		cc = window[xID]['cc'];
		gr = window[xID]['gr'];
		if(! deep)
			deep = 0;
		if((deep == 0) && (! content.noClear)){
			cc.clearRect(0, 0, EL.$(xID).w(), EL.$(xID).h());
		}
		for(var command in content){
			pr = content[command];
			if(command == 'group'){
				cc.save();
				EL.imager(xID, pr, count, (deep + 1));
				cc.restore();
			}else if(command == 'save'){
				cc.save();
			}else if(command == 'restore'){
				cc.restore();
			}else if(command == 'clear'){
				cc.clearRect(0, 0, EL.$(xID).w(), EL.$(xID).h());
			}else if(command.substring(0, 4) == 'line'){
				if(pr.join)
					cc.lineJoin = pr.join;
				cc.beginPath();
				cc.moveTo(EL.fadeSet(pr[0].xFade, count, pr[0].x, pr[0].xTo, xID), EL.fadeSet(pr[0].yFade, count, pr[0].y, pr[0].yTo, xID));
				xi = 1;
				while(pr[xi]){
					if(EL.isNumber(pr[xi].x1)){
						cc.bezierCurveTo(
							EL.fadeSet(pr[xi].x1Fade, count, pr[xi].x1, pr[xi].x1To, xID), 
							EL.fadeSet(pr[xi].y1Fade, count, pr[xi].y1, pr[xi].y1To, xID), 
							EL.fadeSet(pr[xi].x2Fade, count, pr[xi].x2, pr[xi].x2To, xID), 
							EL.fadeSet(pr[xi].y2Fade, count, pr[xi].y2, pr[xi].y2To, xID), 
							EL.fadeSet(pr[xi].xFade, count, pr[xi].x, pr[xi].xTo, xID), 
							EL.fadeSet(pr[xi].yFade, count, pr[xi].y, pr[xi].yTo, xID)
						);
					}else{
						cc.lineTo(EL.fadeSet(pr[xi].xFade, count, pr[xi].x, pr[xi].xTo, xID), EL.fadeSet(pr[xi].yFade, count, pr[xi].y, pr[xi].yTo, xID));
					}
					xi++;
				}
				if(pr.closePath)
					cc.closePath();
				if(pr.fillLine)
					cc.fill();
				if(pr.strokeLine)
					cc.stroke();
			}else if(command == 'fill'){
				if(pr.r && pr.g && pr.b && pr.a){
					pr.r = parseInt(EL.fadeSet(pr.rFade, count, pr.r, pr.rTo, xID));
					pr.g = parseInt(EL.fadeSet(pr.gFade, count, pr.g, pr.gTo, xID));
					pr.b = parseInt(EL.fadeSet(pr.bFade, count, pr.b, pr.bTo, xID));
					pr.a = EL.fadeSet(pr.aFade, count, pr.a, pr.aTo, xID);
					cc.fillStyle = 'rgba(' + pr.r + ', ' + pr.g + ', ' + pr.b + ', ' + pr.a + ')';
				}
				cc.fill();
			}else if(command == 'stroke'){
				if(pr.r && pr.g && pr.b && pr.a){
					pr.r = parseInt(EL.fadeSet(pr.rFade, count, pr.r, pr.rTo, xID));
					pr.g = parseInt(EL.fadeSet(pr.gFade, count, pr.g, pr.gTo, xID));
					pr.b = parseInt(EL.fadeSet(pr.bFade, count, pr.b, pr.bTo, xID));
					pr.a = EL.fadeSet(pr.aFade, count, pr.a, pr.aTo, xID);
					cc.strokeStyle = 'rgba(' + pr.r + ', ' + pr.g + ', ' + pr.b + ', ' + pr.a + ')';
				}
				if(pr.weight)
					cc.lineWidth = EL.fadeSet(pr.weightFade, count, pr.weight, pr.weightTo, xID);
				cc.stroke();
			}else if(command == 'opacity'){
				cc.globalAlpha = EL.fadeSet(pr.Fade, count, pr.opacity, pr.opacityTo, xID);
			}else if(command == 'rectangle'){
				if(pr.behindFill){
					if(pr.stroke){
						if(pr.stroke.r && pr.stroke.g && pr.stroke.b && pr.stroke.a){
							pr.stroke.r = parseInt(EL.fadeSet(pr.stroke.rFade, count, pr.stroke.r, pr.stroke.rTo, xID));
							pr.stroke.g = parseInt(EL.fadeSet(pr.stroke.gFade, count, pr.stroke.g, pr.stroke.gTo, xID));
							pr.stroke.b = parseInt(EL.fadeSet(pr.stroke.bFade, count, pr.stroke.b, pr.stroke.bTo, xID));
							pr.stroke.a = EL.fadeSet(pr.stroke.aFade, count, pr.stroke.a, pr.stroke.aTo, xID);
							cc.strokeStyle = 'rgba(' + pr.stroke.r + ', ' + pr.stroke.g + ', ' + pr.stroke.b + ', ' + pr.stroke.a + ')';
						}
						if(pr.stroke.weight)
							cc.lineWidth(EL.fadeSet(pr.stroke.weightFade, count, pr.stroke.weight, pr.stroke.weightTo, xID));
						cc.strokeRect(
							EL.fadeSet(pr.xFade, count, pr.x, pr.xTo, xID), 
							EL.fadeSet(pr.yFade, count, pr.y, pr.yTo, xID), 
							EL.fadeSet(pr.wFade, count, pr.w, pr.wTo, xID), 
							EL.fadeSet(pr.hFade, count, pr.h, pr.hTo, xID)
						);
					}
					if(pr.fill){
						if(pr.fill.r && pr.fill.g && pr.fill.b && pr.fill.a){
							pr.fill.r = parseInt(EL.fadeSet(pr.fill.rFade, count, pr.fill.r, pr.fill.rTo, xID));
							pr.fill.g = parseInt(EL.fadeSet(pr.fill.gFade, count, pr.fill.g, pr.fill.gTo, xID));
							pr.fill.b = parseInt(EL.fadeSet(pr.fill.bFade, count, pr.fill.b, pr.fill.bTo, xID));
							pr.fill.a = EL.fadeSet(pr.fill.aFade, count, pr.fill.a, pr.fill.aTo, xID);
							cc.fillStyle = 'rgba(' + pr.fill.r + ', ' + pr.fill.g + ', ' + pr.fill.b + ', ' + pr.fill.a + ')';
						}
						cc.fillRect(
							EL.fadeSet(pr.xFade, count, pr.x, pr.xTo, xID), 
							EL.fadeSet(pr.yFade, count, pr.y, pr.yTo, xID), 
							EL.fadeSet(pr.wFade, count, pr.w, pr.wTo, xID), 
							EL.fadeSet(pr.hFade, count, pr.h, pr.hTo, xID)
						);
					}
				}else{
					if(pr.fill){
						if(pr.fill.r && pr.fill.g && pr.fill.b && pr.fill.a){
							pr.fill.r = parseInt(EL.fadeSet(pr.fill.rFade, count, pr.fill.r, pr.fill.rTo, xID));
							pr.fill.g = parseInt(EL.fadeSet(pr.fill.gFade, count, pr.fill.g, pr.fill.gTo, xID));
							pr.fill.b = parseInt(EL.fadeSet(pr.fill.bFade, count, pr.fill.b, pr.fill.bTo, xID));
							pr.fill.a = EL.fadeSet(pr.fill.aFade, count, pr.fill.a, pr.fill.aTo, xID);
							cc.fillStyle = 'rgba(' + pr.fill.r + ', ' + pr.fill.g + ', ' + pr.fill.b + ', ' + pr.fill.a + ')';
						}
						cc.fillRect(
							EL.fadeSet(pr.xFade, count, pr.x, pr.xTo, xID), 
							EL.fadeSet(pr.yFade, count, pr.y, pr.yTo, xID), 
							EL.fadeSet(pr.wFade, count, pr.w, pr.wTo, xID), 
							EL.fadeSet(pr.hFade, count, pr.h, pr.hTo, xID)
						);
					}
					if(pr.stroke){
						if(pr.stroke.r && pr.stroke.g && pr.stroke.b && pr.stroke.a){
							pr.stroke.r = parseInt(EL.fadeSet(pr.stroke.rFade, count, pr.stroke.r, pr.stroke.rTo, xID));
							pr.stroke.g = parseInt(EL.fadeSet(pr.stroke.gFade, count, pr.stroke.g, pr.stroke.gTo, xID));
							pr.stroke.b = parseInt(EL.fadeSet(pr.stroke.bFade, count, pr.stroke.b, pr.stroke.bTo, xID));
							pr.stroke.a = EL.fadeSet(pr.stroke.aFade, count, pr.stroke.a, pr.stroke.aTo, xID);
							cc.strokeStyle = 'rgba(' + pr.stroke.r + ', ' + pr.stroke.g + ', ' + pr.stroke.b + ', ' + pr.stroke.a + ')';
						}
						if(pr.stroke.weight)
							cc.lineWidth(EL.fadeSet(pr.stroke.weightFade, count, pr.stroke.weight, pr.stroke.weightTo, xID));
						cc.strokeRect(
							EL.fadeSet(pr.xFade, count, pr.x, pr.xTo, xID), 
							EL.fadeSet(pr.yFade, count, pr.y, pr.yTo, xID), 
							EL.fadeSet(pr.wFade, count, pr.w, pr.wTo, xID), 
							EL.fadeSet(pr.hFade, count, pr.h, pr.hTo, xID)
						);
					}
				}
			}else if(command == 'shadow'){
				if(pr.shadow.x)
					cc.shadowOffsetX = EL.fadeSet(pr.shadow.xFade, count, pr.shadow.x, pr.shadow.xTo, xID);
				if(pr.shadow.y)
					cc.shadowOffsetY = EL.fadeSet(pr.shadow.yFade, count, pr.shadow.y, pr.shadow.yTo, xID);
				if(pr.shadow.blur)
					cc.shadowBlur = EL.fadeSet(pr.shadow.blurFade, count, pr.shadow.blur, pr.shadow.blurTo, xID);
				if(pr.shadow.r && pr.shadow.g && pr.shadow.b && pr.shadow.a){
					pr.shadow.r = parseInt(EL.fadeSet(pr.shadow.rFade, count, pr.shadow.r, pr.shadow.rTo, xID));
					pr.shadow.g = parseInt(EL.fadeSet(pr.shadow.gFade, count, pr.shadow.g, pr.shadow.gTo, xID));
					pr.shadow.b = parseInt(EL.fadeSet(pr.shadow.bFade, count, pr.shadow.b, pr.shadow.bTo, xID));
					pr.shadow.a = EL.fadeSet(pr.shadow.aFade, count, pr.shadow.a, pr.shadow.aTo, xID);
					cc.shadowColor = 'rgba(' + pr.shadow.r + ', ' + pr.shadow.g + ', ' + pr.shadow.b + ', ' + pr.shadow.a + ')';
				}
			}else if(command == 'grandient' && pr.colors){
				canGo = false;
				if(pr.style == 'linear' && pr.sx && pr.sy && pr.dx && pr.dy){
					pr.sx = EL.fadeSet(pr.sxFade, count, pr.sx, pr.sxTo, xID);
					pr.sy = EL.fadeSet(pr.syFade, count, pr.sy, pr.syTo, xID);
					pr.dx = EL.fadeSet(pr.dxFade, count, pr.dx, pr.dxTo, xID);
					pr.dy = EL.fadeSet(pr.dyFade, count, pr.dy, pr.dyTo, xID);
					gr[gr.length] = cc.createLinearGradient(pr.sx, pr.sy, pr.dx, pr.dy);
					canGo = true;
				}else if(pr.style == 'radial' && pr.sx && pr.sy && pr.sr && pr.dx && pr.dy && pr.dr){
					pr.sx = EL.fadeSet(pr.sxFade, count, pr.sx, pr.sxTo, xID);
					pr.sy = EL.fadeSet(pr.syFade, count, pr.sy, pr.syTo, xID);
					pr.sr = EL.fadeSet(pr.srFade, count, pr.sr, pr.srTo, xID);
					pr.dx = EL.fadeSet(pr.dxFade, count, pr.dx, pr.dxTo, xID);
					pr.dy = EL.fadeSet(pr.dyFade, count, pr.dy, pr.dyTo, xID);
					pr.dr = EL.fadeSet(pr.drFade, count, pr.dr, pr.drTo, xID);
					gr[gr.length] = cc.createRadialGradient(pr.sx, pr.sy, pr.sr, pr.dx, pr.dy, pr.dr);
					canGo = true;
				}
				if(canGo){
					for(clKey in pr.colors){
						clrs = pr.colors[clKey];
						if(clrs.r && clrs.g && clrs.b){
							clrs.r = parseInt(EL.fadeSet(clrs.rFade, count, clrs.r, clrs.rTo, xID));
							clrs.g = parseInt(EL.fadeSet(clrs.gFade, count, clrs.g, clrs.gTo, xID));
							clrs.b = parseInt(EL.fadeSet(clrs.bFade, count, clrs.b, clrs.bTo, xID));
							color = '#' + EL.toClHex(clrs.r) + EL.toClHex(clrs.g) + EL.toClHex(clrs.b);
						}
						if(color && clrs.pos){
							gr[(gr.length - 1)].addColorStop(clrs.pos, color);
							delete color;
						}
					}
				}
			}else if(command == 'convertpixels'){
				pr.x = EL.fadeSet(pr.xFade, count, pr.x, pr.xTo, xID);
				pr.y = EL.fadeSet(pr.yFade, count, pr.y, pr.yTo, yID);
				pr.w = EL.fadeSet(pr.wFade, count, pr.w, pr.wTo, wID);
				pr.h = EL.fadeSet(pr.hFade, count, pr.h, pr.hTo, hID);
				var imgd = cc.getImageData(pr.x, pr.y, pr.w, pr.h);
				var pix = imgd.data;
				for(var i = 0, n = pix.length; i < n; i += 4){
					if(pr.r)
						eval('pix[i] = ' + pr.r.replace('r', 'pix[i]').replace('R', 'pix[i]') + ';');
					if(pr.g)
						eval('pix[i + 1] = ' + pr.r.replace('g', 'pix[i + 1]').replace('G', 'pix[i + 1]') + ';');
					if(pr.b)
						eval('pix[i + 2] = ' + pr.r.replace('b', 'pix[i + 2]').replace('B', 'pix[i + 2]') + ';');
					if(pr.a)
						eval('pix[i + 3] = ' + pr.r.replace('a', 'pix[i + 3]').replace('A', 'pix[i + 3]') + ';');
				}
				cc.putImageData(imgd, pr.x, pr.y);
			}else if(command == 'clip'){
				cc.clip();
			}else if(command == 'transform'){
				if(pr.rotate){
					pr.rotate = EL.fadeSet(pr.rotateFade, count, pr.rotate, pr.rotateTo, xID);
					cc.rotate(pr.rotate * Math.PI / 180);
				}
				if(pr.translate){
					pr.translate.x = EL.fadeSet(pr.translate.xFade, count, pr.translate.x, pr.translate.xTo, xID);
					pr.translate.y = EL.fadeSet(pr.translate.yFade, count, pr.translate.y, pr.translate.yTo, yID);
					cc.translate(pr.translate.x, pr.translate.y);
				}
				if(pr.invert && pr.invert.x && pr.invert.y && pr.invert.w && pr.invert.h){
					pr.invert.x = EL.fadeSet(pr.invert.xFade, count, pr.invert.x, pr.invert.xTo, xID);
					pr.invert.y = EL.fadeSet(pr.invert.yFade, count, pr.invert.y, pr.invert.yTo, yID);
					pr.invert.w = EL.fadeSet(pr.invert.wFade, count, pr.invert.w, pr.invert.wTo, wID);
					pr.invert.h = EL.fadeSet(pr.invert.hFade, count, pr.invert.h, pr.invert.hTo, hID);
					var imgd = cc.getImageData(pr.invert.x, pr.invert.y, pr.invert.w, pr.invert.h);
					var pix = imgd.data;
					for(var i = 0, n = pix.length; i < n; i += 4){
						pix[i] 	= 255 - pix[i];
						pix[i+1]	= 255 - pix[i+1];
						pix[i+2]	= 255 - pix[i+2];
					}
					cc.putImageData(imgd, pr.invert.x, pr.invert.y);
				}
			}else if(command == 'image'){
				if(pr.img && pr.x && pr.y && !pr.w){
					pr.x = EL.fadeSet(pr.xFade, count, pr.x, pr.xTo, xID);
					pr.y = EL.fadeSet(pr.yFade, count, pr.y, pr.yTo, yID);
					cc.drawImage(pr.img, pr.x, pr.y);
				}else if(pr.img && pr.x && pr.y && pr.w && pr.h && !pr.dx){
					pr.x = EL.fadeSet(pr.xFade, count, pr.x, pr.xTo, xID);
					pr.y = EL.fadeSet(pr.yFade, count, pr.y, pr.yTo, yID);
					pr.w = EL.fadeSet(pr.wFade, count, pr.w, pr.wTo, wID);
					pr.h = EL.fadeSet(pr.hFade, count, pr.h, pr.hTo, hID);
					cc.drawImage(pr.img, pr.x, pr.y, pr.w, pr.h);
				}else if(pr.img && pr.x && pr.y && pr.w && pr.h && pr.dx && pr.dy && pr.dw && pr.dh){
					pr.x = EL.fadeSet(pr.xFade, count, pr.x, pr.xTo, xID);
					pr.y = EL.fadeSet(pr.yFade, count, pr.y, pr.yTo, yID);
					pr.w = EL.fadeSet(pr.wFade, count, pr.w, pr.wTo, wID);
					pr.h = EL.fadeSet(pr.hFade, count, pr.h, pr.hTo, hID);
					pr.dx = EL.fadeSet(pr.dxFade, count, pr.dx, pr.dxTo, xID);
					pr.dy = EL.fadeSet(pr.dyFade, count, pr.dy, pr.dyTo, yID);
					pr.dw = EL.fadeSet(pr.dwFade, count, pr.dw, pr.dwTo, wID);
					pr.dh = EL.fadeSet(pr.dhFade, count, pr.dh, pr.dhTo, hID);
					cc.drawImage(pr.img, pr.x, pr.y, pr.w, pr.h, pr.dx, pr.dy, pr.dw, pr.dh);
				}
			}
		}
		if((window[xID]['fade'] == 1) && (deep == 0)){
			count++;
			EL.addDynamicFunction(xID, function(rxvar, xID, content, count){
				EL.imager(xID, content, count);
			}, xID, content, count);
			window[xID]['fade'] = 0;
		}
	}, 
	
	textEffect : function(obj, method, interval, inc, writeChar, fullText, count, cantAppend){
		switch(method){
			case 0:
				if(! cantAppend)
					cantAppend = false;
				startString = fullText.substring(0, count);
				addedString = fullText.substring(count, count + inc);
				if(addedString.indexOf('<') >= 0)
					cantAppend = true;
				if(addedString.indexOf('>') >= 0)
					cantAppend = false;
				count+=inc;
				obj.innerHTML = startString + addedString + ((count < fullText.length) ? writeChar : '');
				if(count <= fullText.length){
					if(cantAppend){
						EL.textEffect(obj, method, interval, inc, writeChar, fullText, count, cantAppend);
					}else{
						setTimeout(function(){EL.textEffect(obj, method, interval, inc, writeChar, fullText, count, false); }, interval);
					}
				}
				break;
		}
	}, 
	
	toClHex : function(number){
		if(number == null)
			return "00";
		number = parseInt(number); 
		if(number == 0 || EL.isNaN(number))
			return "00";
		number=Math.max(0, number); 
		number=Math.min(number, 255); 
		number=Math.round(number);
		return "0123456789ABCDEF".charAt((number - number % 16) / 16) + "0123456789ABCDEF".charAt(number % 16);
	}, 
	
	bgImgCenter : function(imgSrc){
		this.T('body').add('div', {'id' : '_EL_BG_IMAGE_C', 'style' : {'width' : '100%', 'height' : '100%', 'position' : 'fixed', 'top' : '0px', 'left' : '0px', 'zIndex' : '-1', 'overflow' : 'hidden'}}).add('img', {'src' : imgSrc, 'id' : '_EL_BG_IMAGE', 'style' : {'position' : 'absolute', 'top' : '0px', 'left' : '0px', 'zIndex' : '-1'}});
		this.$('_EL_BG_IMAGE_C').appendChild(this.$('_EL_BG_IMAGE'));
		this.$('_EL_BG_IMAGE').events('load', function(){EL.bgImgAlign(); });
		w.events('resize', function(){EL.bgImgAlign(); });
	}, 
	
	bgImgAlign : function(){
		var _iW 	= EL.$('_EL_BG_IMAGE_C').w();
		var _iH 	= EL.$('_EL_BG_IMAGE_C').h();
		EL.$('_EL_BG_IMAGE').s({'width' : _iW + 'px', 'height' : ''});
		var _BGTopPos = parseInt((_iH - EL.$('_EL_BG_IMAGE').h()) / 2);
		if(_BGTopPos <= 0)
			EL.$('_EL_BG_IMAGE').s({'top' : _BGTopPos + 'px', 'left' : '0px'});
		else
			EL.$('_EL_BG_IMAGE').s({'height' : _iH + 'px', 'width' : '', 'top' : '0px'}).s({'left' : parseInt((_iW - EL.$('_EL_BG_IMAGE').w()) / 2) + 'px'});
	}, 
	
	pageLoaded : function(loadElement, count){
		count -= 10;
		if(count > 0){
			loadElement.s({'opacity' : count / 100});
			setTimeout(function(){EL.pageLoaded(loadElement, count); }, EL.refreshTimeInMiliSec);
		}else{
			loadElement.s({'display' : 'none'});
		}
	}, 
	
	pageUnloaded : function(unloadElement, count){
		count += 25; 
		if(count < 100){
			unloadElement.s({'display' : 'block', 'opacity' : count / 100});
			setTimeout(function(){EL.pageLoaded(loadElement, count); }, EL.refreshTimeInMiliSec);
		}
	}, 
	
	loadUnload : function(loadElement, unloadElement){
		if((loadElement) && (loadelmnt = EL.$(loadElement))){
			loadelmnt.s({'position' : 'fixed', 'top' : '0px', 'left' : '0px', 'width' : '100%', 'height' : '100%', 'zIndex' : '10000'});
			window.events('load', function(){
				setTimeout(function(){EL.pageLoaded(loadelmnt, 100); }, EL.refreshTimeInMiliSec);
			});
		}
		if((unloadElement) && (unloadelmnt = EL.$(unloadElement))){
			unloadelmnt.s({'position' : 'fixed', 'top' : '0px', 'left' : '0px', 'width' : '100%', 'height' : '100%', 'zIndex' : '10000', 'display' : 'none'});
			window.events('unload', function(){
				setTimeout(function(){EL.pageUnloaded(unloadelmnt, 0); }, EL.refreshTimeInMiliSec);
			});
		}
	}, 
	
	setChildsToO : function(childs){
		for(chkey in childs){
			try{
				if(childs[chkey]){
					if((childs[chkey].id) && (childs[chkey].id != '')){
						window['o'][childs[chkey].id] = childs[chkey];
					}
					if((childs[chkey].name) && (childs[chkey].name != '')){
						window['o'][childs[chkey].name] = childs[chkey];
					}
					if(childs[chkey].childNodes.length != 0){
						EL.setChildsToO(childs[chkey].childNodes);
					}
				}
			}catch(err){}
		}
	}, 
	
	newVibra : function(objName){
		this.vibra[objName] = {
			name			: objName, 
			structReorganize	: true, 
			maxKey			: 240, 
			currentKey		: 0, 
			isLoaded			: false, 
			autoPlay			: true, 
			imgCount			: 0, 
			imgLoadedCount	: 0, 
			isPlaying			: false, 
			traceTo			: '', 
			currentKeyNrTo		: '', 
			startAt			: false, 
			obj				: new Array(), 
			keys				: new Array(), 
			
			imgLoaded : function(self){
				self.imgLoadedCount++;
				if(self.imgCount == self.imgLoadedCount){
					self.isLoaded = true;
				}
				if(self.isLoaded && self.autoPlay){
					self.play();
				}
			}, 
			
			setChilds : function(childs){
				for(chkey in childs)
					if((childs[chkey]) && (childs[chkey].tagName) && (childs[chkey].id != contid)){
						child = childs[chkey];
						try{
							if((! child.a('rel')) || (child.a('rel').strToUpper() != '_EL_UNCHANGED')){
								child.s({'position' : 'absolute', 'top' : '0px', 'left' : '0px', 'width' : '1px', 'height' : '1px'});
								if(child.tagName == 'IMG'){
									this.imgCount++;
									var self = this;
									child.events('load', function(){
										EL.vibra[self.name].imgLoaded(EL.vibra[self.name]);
									});
								}
								if(child.a('name'))
									this.obj[child.a('name')] = child;
								if(child.a('id'))
									this.obj[child.a('id')] = child;
								if(child.childNodes.length != 0)
									this.setChilds(child.childNodes);
							}
						}catch(e){}
					}
			}, 
			
			init : function(){
				contName = this.name;
				cont=EL.$(contName);
				childs=cont.childNodes;
				contid = cont.id + EL.rand(100, 999) + '_EL';
				if(this.structReorganize){
					cont.add('div', {'id' : contid, 'style' : {'overflow' : 'hidden', 'width' : '100%', 'height' : '100%', 'position' : 'relative', 'top' : '0px', 'left' : '0px'}});
					for(chkey in childs)
						if((childs[chkey]) && (childs[chkey].tagName) && (childs[chkey].id != contid))
							EL.$(contid).appendChild(childs[chkey]);
					cont.appendChild(EL.$(contid));
					childs=EL.$(contid).childNodes;
				}
				this.setChilds(childs);
				if(this.imgCount == 0){
					this.isLoaded = true;
					if(this.isLoaded && this.autoPlay){
						this.play();
					}
				}
				this.prevMaxKey=this.maxKey;
				if(EL.$(this.currentKeyNrTo)){
					this._KeysWriteTo = EL.$(this.currentKeyNrTo);
					this._WriteKeys = true;
				}else{
					this._WriteKeys = false;
				}
				EL.addStaticFunction(this.name, function(getName){
					EL.vibra[getName].goVibra();
				});
			}, 
			
			playAt : function(second, minute, hour){
				var c = new Date();
				year = c.getFullYear();
				month = c.getMonth(); 
				day = c.getDay();
				hour = (hour) ? hour : c.getHours();
				minute = (minute) ? minute : c.getMinutes();
				second = (second) ? second : c.getSeconds();
				milisecond = 0;
				var sd = new Date(year, month, day, hour, minute, second, milisecond);
				this.startAt = sd.getTime(); //?
			}, 
			
			goKey : function(keyNr){
				this.currentKey = keyNr;
			}, 
			
			play : function(){
				this.isPlaying = true;
			}, 
			
			stop : function(){
				this.isPlaying = false;
			}, 
			
			reset : function(){
				this.currentKey = 0;
			}, 
			
			next : function(count){
				if(! count)
					count = 1;
				this.currentKey += count;
				if(this.currentKey > this.maxKey)
					this.currentKey -= this.MaxKey;
			}, 
			
			prev : function(count){
				if(! count)
					count = 1;
				this.currentKey -= count;
				if(this.currentKey < 0)
					this.currentKey = Math.abs(this.currentKey);
			}, 
			
			trace : function(message){
				if(EL.$(this.traceTo))
					EL.$(this.traceTo).v(message);
			}, 
			
			goVibra : function(){
				if(this.startAt){
					cd = new Date();
					if(cd.getTime() > startAt){
						this.startAt = false;
						this.isPlaying = true;
					}
				}
				if(this.isPlaying){
					if(this._WriteKeys)
						this._KeysWriteTo.v(this.currentKey);
					
					if(this.keys[this.currentKey])
						this.keys[this.currentKey](this.currentKey, this.obj);
					
					this.currentKey++;
					if(this.currentKey > this.maxKey){
						this.currentKey=0;
					}
				}
			}
		};
		this.vibra[objName]['k'] = this.vibra[objName]['keys'];
	}, 
	
	scaleRange : function(smin, smax, scur, dmin, dmax){
		return (dmax-dmin)*((scur-smin)/(smax-smin))+dmin;
	}, 
	
	isElement : function(object){
		return object && object.nodeType == 1;
	},
	
	isArray : function(object){
		return object != null && typeof object == "object";
	},
	
	isObject : function(object) {
		return (object && typeof object == 'object') || this.isFunction(object);
	}, 
	
	isHash : function(object){
		return object instanceof Hash;
	},
	
	isFunction : function(object){
		return typeof object == "function";
	},
	
	isString : function(object){
		return typeof object == "string";
	},
	
	isNumber : function(object){
		return typeof object == "number";
	},
	
	isUndefined : function(object){
		return typeof object == "undefined";
	}, 
	
	isNaN : function(object){
		return typeof object == "NaN";
	}, 
	
	isNumeric : function(value){
		return (parseInt(value) + ' ') != 'NaN ';
	}, 
	
	docLoad : function(func){
		window.events('load', func);
	}, 
	
	docScrollTop : function(){
		iebody=(document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body
		return document.all ? iebody.scrollTop : pageYOffset;
	}, 
	
	docScrollLeft : function(){
		iebody=(document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body
		return document.all ? iebody.scrollLeft : pageXOffset;
	}
}

var EL = new EasyLayer();

xVibra = function(name){
	window[name] = new EL.xVibra(name);
	window[name]['keys'] = window[name]['k'] = new Array();
	window[name]['obj'] = new Array();
}

EL.xVibra = function(name){
	this.name = name;
}

EL.xVibra.prototype = {
	maxKey			: 240, 
	structReorganize	: true, 
	currentKey		: 0, 
	isLoaded			: false, 
	autoPlay			: true, 
	imgCount			: 0, 
	imgLoadedCount	: 0, 
	isPlaying			: false, 
	traceTo			: '', 
	currentKeyNrTo		: '', 
	startAt			: false, 
	
	imgLoaded : function(self){
		self.imgLoadedCount++;
		if(self.imgCount == self.imgLoadedCount){
			self.isLoaded = true;
		}
		if(self.isLoaded && self.autoPlay){
			self.play();
		}
	}, 
	
	setChilds : function(childs){
		for(chkey in childs)
			if((childs[chkey]) && (childs[chkey].tagName) && (childs[chkey].id != contid)){
				try{
					if((! child.a('rel')) || (child.a('rel').strToUpper() != '_EL_UNCHANGED')){
						child = childs[chkey];
						child.s({'position' : 'absolute', 'top' : '0px', 'left' : '0px', 'width' : '1px', 'height' : '1px'});
						if(child.tagName == 'IMG'){
							this.imgCount++;
							var self = this;
							child.events('load', function(){
								window[self.name].imgLoaded(window[self.name]);
							});
						}
						if(child.a('name'))
							this.obj[child.a('name')] = child;
						if(child.a('id'))
							this.obj[child.a('id')] = child;
						if(child.childNodes.length != 0)
							this.setChilds(child.childNodes);
					}
				}catch(e){}
			}
	}, 
	
	init : function(){
		cont=EL.$(this.name);
		childs=cont.childNodes;
		contid = cont.id + EL.rand(100, 999) + '_EL';
		if(this.structReorganize){
			cont.add('div', {'id' : contid, 'style' : {'overflow' : 'hidden', 'width' : '100%', 'height' : '100%', 'position' : 'relative', 'top' : '0px', 'left' : '0px'}});
			for(chkey in childs)
				if((childs[chkey]) && (childs[chkey].tagName) && (childs[chkey].id != contid))
					EL.$(contid).appendChild(childs[chkey]);
			cont.appendChild(EL.$(contid));
			childs=EL.$(contid).childNodes;
		}
		this.setChilds(childs);
		this.prevMaxKey=this.maxKey;
		if(EL.$(this.currentKeyNrTo)){
			this._KeysWriteTo = EL.$(this.currentKeyNrTo);
			this._WriteKeys = true;
		}else{
			this._WriteKeys = false;
		}
		EL.addStaticFunction(this.name, function(getName){
			window[getName].goVibra();
		});
	}, 
	
	playAt : function(second, minute, hour){
		var c = new Date();
		year = c.getFullYear();
		month = c.getMonth(); 
		day = c.getDay();
		hour = (hour) ? hour : c.getHours();
		minute = (minute) ? minute : c.getMinutes();
		second = (second) ? second : c.getSeconds();
		milisecond = 0;
		var sd = new Date(year, month, day, hour, minute, second, milisecond);
		this.startAt = sd.getTime();
	}, 
	
	goKey : function(keyNr){
		this.currentKey = keyNr;
	}, 
	
	play : function(){
		this.isPlaying = true;
	}, 
	
	stop : function(){
		this.isPlaying = false;
	}, 
	
	reset : function(){
		this.currentKey = 0;
	}, 
	
	next : function(count){
		if(! count)
			count = 1;
		this.currentKey += count;
		if(this.currentKey > this.maxKey)
			this.currentKey -= this.MaxKey;
	}, 
	
	prev : function(count){
		if(! count)
			count = 1;
		this.currentKey -= count;
		if(this.currentKey < 0)
			this.currentKey = Math.abs(this.currentKey);
	}, 
	
	trace : function(message){
		if(EL.$(this.traceTo))
			EL.$(this.traceTo).v(message);
	}, 
	
	goVibra : function(){
		if(this.startAt){
			cd = new Date();
			if(cd.getTime() > startAt){
				this.startAt = false;
				this.isPlaying = true;
			}
		}
		if(this.isPlaying){
			if(this._WriteKeys)
				this._KeysWriteTo.v(this.currentKey);
			
			if(this.keys[this.currentKey])
				this.keys[this.currentKey](this.currentKey, this.obj);
			
			this.currentKey++;
			if(this.currentKey > this.maxKey){
				this.currentKey=0;
			}
		}
	}
}

function Canvas4IE(canvObj){
	this.fillStyle = 'black';
	this.globalAlpha = 1.0;
	this.globalCompositeOperation = '';
	this.lineCap = '';
	this.lineJoin = '';
	this.lineWidth = '0';
	this.miterLimit = '';
	this.shadowBlur = '';
	this.shadowColor = '';
	this.shadowOffsetX = '';
	this.shadowOffsetY = '';
	this.strokeStyle = 'black';
	this.cavObject = canvObj;
	this._path = '';
	this._stateStack = new Array();
	this._colorStop = new Array();
	this._offsetX = 0;
	this._offsetY = 0;
	this._rotation = 0;
}

Canvas4IE.prototype = {
	save : function(){
		var o = new Object();
		this._copyState(this, o);
		this._stateStack.push(o);
	}, 
	
	restore : function(){
		var n = this._stateStack.length - 1;
		if (n < 0) { return; }
		var o = this._stateStack[n];
		this._copyState(o, this);
		this._stateStack.splice(n, 1);
	}, 
	
	_copyState : function(oFrom, oTo){
		oTo.fillStyle		= oFrom.fillStyle;
		oTo.lineCap		= oFrom.lineCap;
		oTo.lineJoin		= oFrom.lineJoin;
		oTo.lineWidth		= oFrom.lineWidth;
		oTo.miterLimit		= oFrom.miterLimit;
		oTo.shadowBlur		= oFrom.shadowBlur;
		oTo.shadowColor	= oFrom.shadowColor;
		oTo.shadowOffsetX	= oFrom.shadowOffsetX;
		oTo.shadowOffsetY	= oFrom.shadowOffsetY;
		oTo._offsetX		= oFrom._offsetX;
		oTo._offsetY		= oFrom._offsetY;
		oTo._rotation		= oFrom._rotation;
	}, 
	
	rotate : function(r){
		var MAX = Math.PI * 2;
		this._rotation += r;
		while(this._rotation > MAX)
			this._rotation = MAX - this._rotation; 
	}, 
	
	scale : function(){
		
	},
	
	translate : function(x, y){
		this._offsetX += x;
		this._offsetY += y;
	}, 
	
	bezierCurveTo : function(cp1x, cp1y, cp2x, cp2y, x, y){
		if (this._path)
			this._path += ' ';
		this._path += 'qb' + cp1x + ',' + cp1y + ',' + cp2x + ',' + cp2y + ',' + x + ',' + y;
	}, 
	
	clip : function(){
		if(!this._path)
			return;
			
		this._path += ' xe';
		var o = this.cavObject.ownerDocument.createElement('elvmlo:clippath');
		o['elvmlo:elvml'] = this._path;
		this.cavObject.appendChild(o);
	}, 
	
	beginPath : function(){
		this._path = '';
	}, 
	
	closePath : function(){
		if (this._path)
			this._path += ' ';
		this._path += 'x';
	}, 
	
	lineTo : function(x, y){
		if (this._path)
			this._path += ' ';
		this._path += 'l' + parseInt(x) + ',' + parseInt(y);
	}, 
	
	moveTo : function(x, y){
		if (this._path)
			this._path += ' ';
		this._path += 'm' + parseInt(x) + ',' + parseInt(y);
	}, 
	
	stroke : function(){
		if(! this._path)
			return;
		
		this._path += ' e';
		var o = this.cavObject.ownerDocument.createElement('elvml:shape');
		o.fillColor = 'none';
		o.filled = false;
		o.strokeColor = this.strokeStyle;
		o.stroked = true;
		o.weight = this.lineWidth;
		o.coordsize = this.cavObject.offsetWidth + ',' + element.offsetHeight;
		o.style.position = 'absolute';
		o.style.left = this._offsetX;
		o.style.top = this._offsetY;
		o.style.width = this.cavObject.offsetWidth;
		o.style.height = this.cavObject.offsetHeight;
		o.path = this._path;
		var s = this.cavObject.ownerDocument.createElement('elvml:stroke');
		s.opacity = this.globalAlpha;
		o.appendChild(s);
		if(this._rotation){
			var r = this.cavObject.ownerDocument.createElement('elvml:group');
			r.style.position = 'absolute';
			r.style.left = 0;
			r.style.top = 0;
			r.style.width = this.cavObject.offsetWidth;
			r.style.height = this.cavObject.offsetHeight;
			r.coordsize = o.coordsize;
			r.style.rotation = Math.round((this._rotation * 180) / Math.PI);
			r.style.rotationCenter = '0,0';
			r.appendChild(o);
			this.cavObject.appendChild(r);
			var cosa = Math.cos(this._rotation);
			var sina = Math.sin(this._rotation);
			var cx = this.cavObject.offsetWidth / 2;
			var cy = this.cavObject.offsetHeight / 2;
			var x = ( cx*(1-cosa) + cy*sina);
			var y = (-cx*sina     + cy*(1-cosa));
			r.style.left = x * -1;
			r.style.top = y * -1;
		}else this.cavObject.appendChild(o);
	}, 
	
	fill : function(){
		if(!this._path)
			return;
			
		this._path += ' e';
		var o = this.cavObject.ownerDocument.createElement('elvml:shape');
		o.fillColor = this.fillStyle;
		o.strokeColor = this.strokeStyle;
		o.stroked = false;
		o.weight = this.lineWidth;
		o.coordsize = this.cavObject.offsetWidth + ',' + this.cavObject.offsetHeight;
		o.style.position = 'absolute';
		o.style.left = this._offsetX;
		o.style.top = this._offsetY;
		o.style.width = this.cavObject.offsetWidth;
		o.style.height = this.cavObject.offsetHeight;
		o.path = this._path;
		var f = this.cavObject.ownerDocument.createElement('elvml:fill');
		f.opacity = this.globalAlpha;
		o.appendChild(f);
		if (this._rotation) {
			var r = this.cavObject.ownerDocument.createElement('elvml:group');
			r.style.position = 'absolute';
			r.style.left = 0;
			r.style.top = 0;
			r.style.width = this.cavObject.offsetWidth;
			r.style.height = this.cavObject.offsetHeight;
			r.coordsize = o.coordsize;
			r.style.rotation = Math.round((this._rotation * 180) / Math.PI);
			r.style.rotationCenter = '0,0';
			r.appendChild(o);
			this.cavObject.appendChild(r);
			var cosa = Math.cos(this._rotation);
			var sina = Math.sin(this._rotation);
			var cx = (element.offsetWidth) / 2;
			var cy = (element.offsetHeight) / 2;
			var x = ( cx*(1-cosa) + cy*sina);
			var y = (-cx*sina     + cy*(1-cosa));
			r.style.left = x * -1;
			r.style.top = y * -1;
		}else this.cavObject.appendChild(o);
	}, 
	
	quadraticCurveTo : function(cpx, cpy, x, y){
		if(this._path)
			this._path += ' ';
		this._path += 'qb' + cpx + ',' + cpy + ',' + x + ',' + y;
	}, 
	
	arc : function(x, y, radius, startAngle, endAngle, clockwise){
		if(this._path)
			this._path += ' ';
		
		var xi = parseFloat(x);
		var yi = parseFloat(y);
		var x1 = xi - radius;
		var y1 = yi - radius;
		var x2 = xi + radius;
		var y2 = yi + radius;
		var x3 = Math.round(xi + (Math.cos(startAngle) * radius));
		var y3 = Math.round(yi + (Math.sin(startAngle) * radius));
		var x4 = Math.round(xi + (Math.cos(endAngle) * radius));
		var y4 = Math.round(yi + (Math.sin(endAngle) * radius));
		this._path += 'ar' + x1 + ',' + y1 + ',' + x2 + ',' + y2 + ',' + x3 + ',' + y3 + ',' + x4 + ',' + y4;
	}, 
	
	rect : function(x, y, w, h){
		var x2 = Math.round(x + w);
		var y2 = Math.round(y + h);
		var x1 = Math.round(x);
		var y1 = Math.round(y);
		this._path += 'm' + x1 + ',' + y1 + ' l' + x2 + ',' + y1 + ' l' + x2 + ',' + y2 + ' l' + x1 + ',' + y2 + ' x';
	}, 
	
	strokeRect : function(x, y, w, h){
		var o = this.cavObject.ownerDocument.createElement('elvml:rect');
		o.fillColor = 'none';
		o.filled = false;
		o.strokeColor = this.strokeStyle;
		o.stroked = true;
		o.weight = this.lineWidth;
		o.style.position = 'absolute';
		o.style.left = this._offsetX + x;
		o.style.top = this._offsetY + y;
		o.style.width = w;
		o.style.height = h;
		var s = this.cavObject.ownerDocument.createElement('elvml:fill');
		s.opacity = this.globalAlpha;
		o.appendChild(s);
		this.cavObject.appendChild(o);
	}, 
	
	clearRect : function(x, y, w, h){
		
	}, 
	
	fillRect : function(x, y, w, h){
		var o = this.cavObject.ownerDocument.createElement('elvml:rect');
//		o.a({fillColor : this.fillStyle, filled : true, stroked : false, weight : 0, style : {position : 'absolute', left : this._offsetX + x, top : this._offsetY + y, width : w, height : h, antialias : 'false'}});
		o.fillColor = this.fillStyle;
		o.filled = true;
		o.stroked = false;
		o.weight = 0;
		o.style.position = 'absolute';
		o.style.left = this._offsetX + x;
		o.style.top = this._offsetY + y;
		o.style.width = w;
		o.style.height = h;
		o.style.antialias = 'false';
		var f = this.cavObject.ownerDocument.createElement('elvml:fill');
		f.opacity = this.globalAlpha;
		o.appendChild(f);
		this.cavObject.appendChild(o);
	}, 
	
	addColorStop : function(copPos, color){
		
	}, 
	
	createLinearGradient : function(){
		
	}, 
	
	createPattern : function(){
		
	}, 
	
	createRadialGradient : function(){
		
	}, 
	
	drawImage : function(image, x, y, w, h, dx, dy, dw, dh){
		var o = this.cavObject.ownerDocument.createElement('elvml:image');
//		o.a({fillColor : this.fillStyle, filled : true, stroked : false, weight : 0, style : {position : 'absolute', left : this._offsetX + x, top : this._offsetY + y, width : w, height : h, antialias : 'false'}});
		o.src = image.src;
		o.fillColor = this.fillStyle;
		o.filled = true;
		o.strokeColor = this.strokeStyle;
		o.stroked = true;
		o.weight = this.lineWidth;
		o.style.position = 'absolute';
		o.style.left = this._offsetX + x;
		o.style.top = this._offsetY + y;
		if(w)	o.style.width = w;
		if(h)	o.style.height = h;
		if(dx)	o.cropleft = dx;
		if(dy)	o.croptop = dy;
		if(dw)	o.cropright = w - dw;
		if(dh)	o.cropbottom = h - dh;
		var f = this.cavObject.ownerDocument.createElement('elvml:fill');
		f.opacity = this.globalAlpha;
		o.appendChild(f);
		this.cavObject.appendChild(o);
	}, 
	
	drawImageFromRect : function(){
		
	}
}

if ( !window.Element ) {
	Element = function() {};
}

window['_LINEAR_FADE'] = 0;
window['_SINUS_FADE'] = 1;
window['_CUSTOM_FADE'] = 2;
window['_RANDOM_FADE'] = 3;

window['_CHAR_BY_CHAR'] = 0;

Element.prototype.add = document.add = function(prtype, params, insPos){
	var nd = document.createElement(prtype);
	if(params){
		if(EL.isArray(params))
			if(params['style']){
				nd.s(params['style']);
				delete params['style'];
			}
			nd.a(params);
	}
	if(! insPos){
		this.appendChild(nd);
	}else if(insPos == 'before'){
		this.parentNode.insertBefore(nd, this);
	}else if(insPos == 'after'){
		this.parentNode.insertBefore(nd, this.nextSibling);
	}else if(insPos.tagName){
		this.parentNode.insertBefore(nd, insPos.previousSibling);
	}
	if(nd.a('id'))
		window['o'][nd.a('id')]=nd;
	if(nd.a('name'))
		window['o'][nd.a('name')]=nd;
	return nd;
};


Element.prototype.addSWF = function(SWFMovie, params){
	if(! SWFMovie)
		return false;
	if(! EL.AdobeFlash)
		return false;
	
	var ndObj = document.createElement('object');
	var ndEmb = document.createElement('embed');
	ndEmb.a({'src' : SWFMovie});
	if(params['width']){
		ndObj.a({'width' : params['width']});
		ndEmb.a({'width' : params['width']});
		delete params['width'];
	}
	if(params['height']){
		ndObj.a({'height' : params['height']});
		ndEmb.a({'height' : params['height']});
		delete params['height'];
	}
	ndObj.add('param', {'name' : 'movie', 'value' : SWFMovie});
	for(var paramKey in params)
		ndObj.add('param', {'name' : paramKey, 'value' : params[paramKey]});
	ndEmb.a(params);
	this.appendChild(ndObj);
	ndObj.appendChild(ndEmb);
	if(ndObj.a('id'))
		window['o'][ndObj.a('id')]=nd;
	if(ndObj.a('name'))
		window['o'][ndObj.a('name')]=nd;
	if(ndEmb.a('id'))
		window['o'][ndEmb.a('id')]=nd;
	if(ndEmb.a('name'))
		window['o'][ndEmb.a('name')]=nd;
}; 

Element.prototype.next = function(){
	var n = this;
	do n = n.nextSibling;
	while (n && n.nodeType != 1);
	return n;
};

Element.prototype.prev = function(){
	var p = this;
	do p = p.previousSibling;
	while (p && p.nodeType != 1);
	return p;
};

Element.prototype.a = function(prvalue){
	if(EL.isArray(prvalue)){
		for(var prkey in prvalue){
			if((this.tagName.toUpperCase() == 'DIV') && (prkey.toUpperCase() == 'VALUE')){
				this.v(prvalue[prkey]);
			}else{
				this.setAttribute(prkey, prvalue[prkey]);
			}
		}
		return this;
	}else{
		return this.getAttribute(prvalue);
	}
};

Element.prototype.rem = function(){
	this.parentNode.removeChild(this);
};

Element.prototype.v = function(text, style){
	if(EL.isString(text)){
		thisType = this.tagName.toUpperCase();
		if((thisType == 'INPUT') || (thisType == 'TEXTAREA') || (thisType == 'SELECT')){
			this.value=text;
		}else{
			this.innerHTML=text;
		}
		if(style){
			this.s(style);
		}
		return this;
	}else{
		thisType = this.tagName.toUpperCase();
		return ((thisType == 'INPUT') || (thisType == 'TEXTAREA')) ? this.value : this.innerHTML;
	}
};

Element.prototype.s = function(styles){
	if(EL.isString(styles)) {
		expr=styles.split(":");
		var styles = new Array();
		styles[expr[0]]=expr[1];
	}
	thisType = this.tagName.toUpperCase();
	for(var property in styles){
		if(property.indexOf('borderRadius') >= 0){
			this.style[property] = styles[property];
			this.style['Moz' + property.ucFirst()] = styles[property];
			if(property.length > 12){
				this.style['webkitBorder' + property.substr(12).replace('left', 'Left').replace('right', 'Right').replace('top', 'Top').replace('bottom', 'Bottom').ucFirst() + 'Radius'] = styles[property];
			}else{
				this.style['webkit' + property.ucFirst()] = styles[property];
			}
			this.style['KHTML' + property.ucFirst()] = styles[property];
		}else if(property == 'boxShadow'){
			this.style[property] = styles[property];
			this.style['Moz' + property.ucFirst()] = styles[property];
			this.style['webkit' + property.ucFirst()] = styles[property];
			msfilter=styles[property].split(' ');
			this.style['filter'] = 'progid:DXImageTransform.Microsoft.dropshadow(OffX=' + msfilter[0] + ', OffY=' + msfilter[1] + ', Color=' + msfilter[3] + ')';
		}else if(property == 'transform'){
			if(EL.isString(styles[property])){
				this.style[property] = styles[property];
				this.style['Moz' + property.ucFirst()] = styles[property];
				this.style['webkit' + property.ucFirst()] = styles[property];
			}else{
				sProp = styles[property];
				for(var trProp in sProp){
					this.style['transform'] += trProp + '(' + sProp[trProp] + ') ';
					this.style['MozTransform'] += trProp + '(' + sProp[trProp] + ') ';
					this.style['webkitTransform'] += trProp + '(' + sProp[trProp] + ') ';
				}
			}
		}else if((thisType == 'CANVAS') && ((property == 'width') || (property == 'height'))){
			this.setAttribute(property, styles[property]);
		}else{
			if((property == 'opacity') && (EL.browser.IE)){
				this.style['filter'] = 'alpha(opacity=' + parseInt(parseFloat(('00' + styles[property]) * 100)) + ')';
			}else  this.style[property] = styles[property];
		}
	}
	return this;
};

Element.prototype.getStyle = function(property){
	if(this.currentStyle)
		var y = this.currentStyle[property];
	else if(window.getComputedStyle)
		var y = document.defaultView.getComputedStyle(this, null).getPropertyValue(property);
	return y;
};

Element.prototype.fadeTop = function(way, from, to, unit, actual, fadeArray){
	EL.elementFade(this, 'top', way, from, to, unit, actual, fadeArray);
	return this;
}

Element.prototype.fadeLeft = function(way, from, to, unit, actual, fadeArray){
	EL.elementFade(this, 'left', way, from, to, unit, actual, fadeArray);
	return this;
}

Element.prototype.fadeWidth = function(way, from, to, unit, actual, fadeArray){
	EL.elementFade(this, 'width', way, from, to, unit, actual, fadeArray);
	return this;
}

Element.prototype.fadeHeight = function(way, from, to, unit, actual, fadeArray){
	EL.elementFade(this, 'height', way, from, to, unit, actual, fadeArray);
	return this;
}

Element.prototype.fadePadding = function(way, from, to, unit, actual, fadeArray){
	EL.elementFade(this, 'padding', way, from, to, unit, actual, fadeArray);
	return this;
}

Element.prototype.fadePaddingTop = function(way, from, to, unit, actual, fadeArray){
	EL.elementFade(this, 'paddingTop', way, from, to, unit, actual, fadeArray);
	return this;
}

Element.prototype.fadePaddingLeft = function(way, from, to, unit, actual, fadeArray){
	EL.elementFade(this, 'paddingLeft', way, from, to, unit, actual, fadeArray);
	return this;
}

Element.prototype.fadePaddingRight = function(way, from, to, unit, actual, fadeArray){
	EL.elementFade(this, 'paddingRight', way, from, to, unit, actual, fadeArray);
	return this;
}

Element.prototype.fadePaddingBottom = function(way, from, to, unit, actual, fadeArray){
	EL.elementFade(this, 'paddingBottom', way, from, to, unit, actual, fadeArray);
	return this;
}

Element.prototype.fadeMargin = function(way, from, to, unit, actual, fadeArray){
	EL.elementFade(this, 'margin', way, from, to, unit, actual, fadeArray);
	return this;
}

Element.prototype.fadeMarginTop = function(way, from, to, unit, actual, fadeArray){
	EL.elementFade(this, 'marginTop', way, from, to, unit, actual, fadeArray);
	return this;
}

Element.prototype.fadeMarginLeft = function(way, from, to, unit, actual, fadeArray){
	EL.elementFade(this, 'marginLeft', way, from, to, unit, actual, fadeArray);
	return this;
}

Element.prototype.fadeMarginRight = function(way, from, to, unit, actual, fadeArray){
	EL.elementFade(this, 'marginRight', way, from, to, unit, actual, fadeArray);
	return this;
}

Element.prototype.fadeMarginBottom = function(way, from, to, unit, actual, fadeArray){
	EL.elementFade(this, 'marginBottom', way, from, to, unit, actual, fadeArray);
	return this;
}

Element.prototype.fadeBorderWidth = function(way, from, to, unit, actual, fadeArray){
	EL.elementFade(this, 'borderWidth', way, from, to, unit, actual, fadeArray);
	return this;
}

Element.prototype.fadeColor = function(way, from, to, unit, actual, fadeArray){
	EL.elementFade(this, 'color', way, from, to, unit, actual, fadeArray);
	return this;
}

Element.prototype.fadeBackgroundColor = function(way, from, to, unit, actual, fadeArray){
	EL.elementFade(this, 'backgroundColor', way, from, to, unit, actual, fadeArray);
	return this;
}

Element.prototype.fadeBorderColor = function(way, from, to, unit, actual, fadeArray){
	EL.elementFade(this, 'borderColor', way, from, to, unit, actual, fadeArray);
	return this;
}

Element.prototype.fadeFontSize = function(way, from, to, unit, actual, fadeArray){
	EL.elementFade(this, 'fontSize', way, from, to, unit, actual, fadeArray);
	return this;
}

Element.prototype.fade = function(action){
	this.style.rgworking = 'countup';
	EL.fade(this.style, action);
	return this;
};

Element.prototype.stopFade = function(){
	this.style.rgworking = '';
	return this;
}

Element.prototype.mirrorFade = function(action){
	if(this.style.rgworking == 'countup'){
		this.style.rgworking = 'countdown';
	}
	if(this.style.rgworking != 'countdown'){
		this.style.rgworking = 'countup';
	}
	EL.fade(this.style, action);
	return this;
};

Element.prototype.endFade = function(){
	if(this.style.rgworking != '')
		this.style.rgworking = 'finnish';
	return this;
};

Element.prototype.suspendFade = function(){
	if(this.style.rgworking != '')
		this.style.rgworking = 'suspend';
	return this;
};

Element.prototype.imager = function(content){
	if(this.tagName.toUpperCase() == 'CANVAS'){
		if(! this.id)
			this.id = 'EL' + EL.rand(1000, 9999);
		xID = this.id;
		window[xID] = new Array();
		window[xID]['cc'] = this.getContext('2d');
		window[xID]['fade'] = 0;
		window[xID]['gr'] = new Array();
		EL.imager(xID, content, 0);
	}
	return this;
};

Element.prototype.textEffect = function(method, interval, inc, writeChar){
	if(! inc)
		inc = 1;
	EL.textEffect(this, method, interval, inc, writeChar, this.innerHTML, 0);
	return this;
};

Element.prototype.w = function(width){
	if(width){
		this.s({'width' : width});
	}else{
		return this.offsetWidth;
	}
};

Element.prototype.h = function(height){
	if(height){
		this.s({'height' : height});
	}else{
		return this.offsetHeight;
	}
};

Element.prototype.t = function(top){
	if(top){
		this.s({'top' : top});
	}else{
		return this.offsetTop;
	}
};

Element.prototype.l = function(left){
	if(left){
		this.s({'left' : left});
	}else{
		return this.offsetLeft;
	}
};

Element.prototype.absTop = function(){
	y = this.offsetTop;
	parent = this;
	while (parent.offsetParent){
		parent = parent.offsetParent;
		y += parent.offsetTop ;
	}
	return y;
}

Element.prototype.absLeft = function(){
	x = this.offsetLeft;
	parent = this;
	while (parent.offsetParent){
		parent = parent.offsetParent;
		x += parent.offsetLeft;
	}
	return x;
}

Element.prototype.none = function(){
	this.style.display = 'none';
	return this;
};
	
Element.prototype.block = function(){
	this.style.display = 'block';
	return this;
};

Element.prototype.inline = function(){
	this.style.display = 'inline';
	return this;
};

Element.prototype.hidden = function(){
	this.style.visibility = 'hidden';
	return this;
};

Element.prototype.visible = function(){
	this.style.visibility = 'visible';
	return this;
};

Element.prototype.display = function(){
	return this.style.display;
};

Element.prototype.showed = function(){
	return this.style.display != 'none' && this.style.visibility != 'hidden';
};

Element.prototype.visibility = function(){
	return this.style.visibility;
};

Element.prototype.upload = function(fields, executeBeforeSubmit){
	if(fields){
		canGo=true;
		setFocus=false;
		for(var field in fields)
			if(this[field]){
				if(this[field].ELStyle)
					this[field].a({'style' : this[field].ELStyle});
				if(((fields[field] == 'number') && (! EL.isNumeric(this[field].value))) || ((fields[field] == '') && (this[field].value.trim() == '')) || (((fields[field] != '') && (this[field].value != this[fields[field]].value)) || (this[field].value.trim() == ''))){
					if(! this[field].ELStyle)
						this[field].ELStyle = this[field].a('style');
					if(! setFocus){
						this[field].focus();
						setFocus=true;
					}
					this[field].a({'style' : this[field].ELStyle + EL.submitErrorStyle});
					canGo=false;
			}
		}
		if(canGo){
			if(executeBeforeSubmit)
				executeBeforeSubmit();
			this.submit();
		}
	}else this.submit();
};

Element.prototype.events = window.events = document.events = function(eAction, eFunction){
	if(EL.browser.IE)
		this.attachEvent('on' + eAction, eFunction);
	else
		this.addEventListener(eAction, eFunction, false);
	return this;
};

Element.prototype.iDoc = function(){
	thisType = this.tagName.toUpperCase();
	if(thisType == 'IFRAME'){
		return ((this.contentWindow) ? this.contentWindow : (this.contentDocument.document) ? this.contentDocument.document : this.contentDocument);
	}else{
		return this;
	}
};

Element.prototype.opacityFade = function(step, toValue){
	
}

Element.prototype.aReq = function(url, form, reqType, destFunction){
	if(typeof this.aOptions == 'undefined'){
		this.aOptions = {
			xmlhttp		: false, 
			aIsAsync		: true, 
			aReqType		: 'GET', 
			functions		: false, 
			silentLoad 	: false
		};
		try {
			this.aOptions.xmlhttp = new XMLHttpRequest();
			var success = true;
		}catch(e){
			var XMLHTTP_IDS = new Array('MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP');
			var success = false;
			for(var i=0;i < XMLHTTP_IDS.length && !success; i++){
				try{
					this.aOptions.xmlhttp = new ActiveXObject(XMLHTTP_IDS[i]);
					success = true;
				}catch(e){}
			}
			if(!success){
				this.onError('Unable to create XMLHttpRequest.');
			}
		}
		if(success){
			this.aOptions.xmlhttp.destinationObject = this;
		}
	}
	if(this.aOptions.xmlhttp != false){
		reloadFormVar = false;
		if(typeof form == 'object'){
			if(typeof form['reqType'] == 'string'){
				reqType = form['reqType'];
				reloadFormVar = true;
			}
			if(typeof form['destFunction'] == 'function'){
				destFunction = form['destFunction'];
				reloadFormVar = true;
			}
			if((typeof form['form'] == 'object') || (typeof form['form'] == 'string')){
				xform = form['form'];
				reloadFormVar = true;
			}
			if(typeof form['async'] == 'boolean'){
				this.aOptions.aIsAsync = form['async'];
				reloadFormVar = true;
			}
			if(typeof form['silentLoad'] == 'boolean'){
				this.aOptions.silentLoad = form['silentLoad'];
				reloadFormVar = true;
			}
		}
		if(reloadFormVar){
			form = false;
			if((typeof xform == 'object') || (typeof xform == 'string'))
				form = xform;
		}
		
		if((EL.aWhileLoading) && (! this.aOptions.silentLoad)){
			if(EL.aLoaderSameDest){
				this.innerHTML = EL.aWhileLoading.innerHTML;
			}else{
				EL.aWhileLoading.s({'display' : 'block'});
			}
		}
		if(reqType)
			this.aOptions.aReqType = reqType;
		if(destFunction)
			this.aOptions.functions = destFunction;
		if((form) && (this.aOptions.aReqType == 'GET')){
			var xParam = (typeof form == 'object') ? EL.array2urlquery(form) : EL.getquerystring(form);
			url += (xParam.length > 0) ? '?' + xParam : '';
		}
		this.aOptions.xmlhttp.onreadystatechange = function(){
			switch(this.readyState){
				case 2:
					this.aOnSend;
					break;
				case 4:
					if((! EL.aLoaderSameDest) && (! this.destinationObject.aOptions.silentLoad))
						setTimeout(function(){EL.aWhileLoading.s({'display' : 'none'}); }, 1000);
					this.aOnLoad;
					if(this.status == 200){
						xRetNStrings = this.responseText;
						
						retTitle = xRetNStrings.split("<title>");
						if(retTitle.length > 1){
							xRetTitle = retTitle[1].split("</title>");
							document.title = xRetTitle[0];
						}
						
						retNStrings = xRetNStrings.split("<script type='text/javascript' rel='EL'>");
						this.destinationObject.innerHTML = retNStrings[0];
						for(i = 1; i < retNStrings.length; i++){
							iRetNStrings = retNStrings[i].split("</script>");
							eval(iRetNStrings[0]);
							this.destinationObject.innerHTML += iRetNStrings[1];
						}
						if(typeof this.destinationObject.aOptions.functions == 'function'){
							this.destinationObject.aOptions.functions();
						}
						EL.replaceSelect();
						EL.replaceRadio();
						EL.replaceCheck();
						EL.replaceUpload();
						EL._replaceAHrefToHash();
					}else{
//						this.onError('HTTP Error Making Request: ' + '[' + this.status + ']' + this.statusText);
//						alert('HTTP Error Making Request: ' + '[' + this.status + ']' + this.statusText);
					}
					this.destinationObject.aOptions.functions = false;
					break;
			}
		}
		this.aOptions.xmlhttp.open(this.aOptions.aReqType, url, this.aOptions.aIsAsync);
		if((form) && (this.aOptions.aReqType == 'POST')){
			var xParam = (typeof form == 'object') ? EL.array2urlquery(form) : EL.getquerystring(form);
			this.aOptions.xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			this.aOptions.xmlhttp.setRequestHeader("Content-length", xParam.length);
			this.aOptions.xmlhttp.setRequestHeader("Connection", "close");
			this.aOptions.xmlhttp.send(xParam);
		}else{
			this.aOptions.xmlhttp.send(null);
		}
		if(!this.aOptions.aIsAsync){
			return this.aOptions.xmlhttp.responseText;
		}
	}
};

Element.prototype.mOver = function(func){
	this.events('mouseover', func);
}

Element.prototype.mOut = function(func){
	this.events('mouseout', func);
}

Element.prototype.mClick = function(func){
	this.events('click', func);
}

Element.prototype.unSelectable = function(){
	this.unselectable = 'on';
	this.contenteditable = 'false';
	this.style.userSelect = 'none';
	this.style.MozUserSelect = 'none';
	this.style.MozUserEdit = 'none';
	this.style.KhtmlUserSelect = 'none';
}

String.prototype.ucFirst = function(){
	firstLetter = this.substr(0, 1);
	return firstLetter.toUpperCase() + this.substr(1);
}; 

String.prototype.ucWords = function(){
	words = this.split(' ');
	for(var ord in words)
		words[ord]=words[ord].ucFirst();
	return words.join(' ');
};

String.prototype.strToInt = function(){
	return EL.isNaN(v = parseInt(this)) ? 0 : v;
};

String.prototype.strToFloat = function(){
	return EL.isNaN(v = parseFloat(this)) ? 0 : v;
};

String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
};

String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
};

String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
};

EL.init();
window.events('load', function(){EL.load(); });

}

if((EL.hashToPageOnLoad) && (EL.savedHash.length > 0))
	location.href = EL.savedHash;

window.events('hashchange', function(){
	if((EL.hashAddressing) && (EL.hashDest != '')){
		currentHash = document.location.hash.substring(1, document.location.hash.length);
		currentHash = (currentHash != '') ? currentHash : document.location.href;
		if(currentHash != EL.savedHash){
			EL.savedHash = currentHash;
			EL.loadHashedPage();
		}
	}
});


