PageSourceSearch

https://www.migvan.org.il/htm-webaxy/javascript/dragMigvan.js

js migvan.org.il collected 2026-10-02 23:00:14 UTC 53,286 bytes, 1,484 lines download raw bytes

1var myWidth,myHeight,myScroll,myScrollWidth,myScrollHeight;
2
3function getSize() {
4				
5				// Window Size
6				if (self.innerHeight) { // Everyone but IE
7					myWidth = window.innerWidth;
8					myHeight = window.innerHeight;
9					myScroll = window.pageYOffset;
10				} else if (document.documentElement && document.documentElement.clientHeight) { // IE6 Strict
11					myWidth = document.documentElement.clientWidth;
12					myHeight = document.documentElement.clientHeight;
13					myScroll = document.documentElement.scrollTop;
14				} else if (document.body) { // Other IE, such as IE7
15					myWidth = document.body.clientWidth;
16					myHeight = document.body.clientHeight;
17					myScroll = document.body.scrollTop;
18				}
19				// Page size w/offscreen areas
20			
21				if (window.innerHeight && window.scrollMaxY) {	
22					myScrollWidth = document.body.scrollWidth;
23					myScrollHeight = window.innerHeight + window.scrollMaxY;
24				} else if (document.body.scrollHeight > document.body.offsetHeight) { // All but Explorer Mac
25					myScrollWidth = document.body.scrollWidth;
26					myScrollHeight = document.body.scrollHeight;
27				} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
28					myScrollWidth = document.body.offsetWidth;
29					myScrollHeight = document.body.offsetHeight;
30				}
31				
32			}
33			
34			function close_edit_element() {
35				
36				$("#hideAllDiv").css('display','none');
37				$("#dd-edit_element").css('display','none');
38				document.onkeypress = null;
39				$("#dd-edit_element_tabs").tabs().tabs('select', 0);
40				$("#styleForm").remove();
41				$("#styleFormover").remove();
42					
43			}
44			
45			function deleteItem(id) {
46				
47				var f = document.form1;
48				document.getElementById(id).parentNode.removeChild(document.getElementById(id));
49				if (id.search(/text_free_code/) >= 0) {
50					id1 = id.replace(toolName+'-', '').replace('_field', '').replace(/c(\d+)$/, '');
51					c = RegExp.$1;
52					var index = 0;
53					for (cc = 0 ; cc < c ; cc++) {
54						tempPartID = id.replace(/-text_free_codec\d+/, '-text_free_codec'+cc);
55						if (document.getElementById(tempPartID)) {
56							index++;
57							//alert(tempPartID+':'+document.getElementById(tempPartID));
58						}
59					}
60					if (f[id1+'-box'].length) {
61						f[id1+'-box'][index].parentNode.removeChild(f[id1+'-box'][index]);
62					}
63					else {
64						f[id1+'-box'].value = '';
65					}
66				}
67				id = id.replace(/c\d+$/, '');
68				REDIPS.drag.enable_drag(true, id);
69				$("#"+id+'Cell').css('display', '');
70				/*
71				if (id.search(/text_free_code/) >=0) {
72					REDIPS.drag.cloned_id[id]--;
73				}*/
74				try {
75					//REDIPS.drag.init(REDIPS.drag.obj.redips_container.id);
76					REDIPS.drag.init($("#current_drag").val());
77					//alert('here')
78				}	catch (e) {
79					//alert('del:'+e);
80				}
81			}
82			
83			
84			
85			function editItem(tbName, field, img) {
86				
87				try {
88					getSize();
89				arrName1 = tbName+'_form_fields';
90				arrName2 = tbName+'_fields';
91				arrName3 = tbName+'_form_fields_titles';
92				eval("var fields="+arrName1);
93				eval("var fieldsDef="+arrName2);
94				eval("var fieldsTitles="+arrName3);
95				eval("var prop_title="+tbName+"_title");
96				eval("var fieldsTypes="+tbName+"_fields_type");
97				var code = ft = '';
98				var style = 0, style_over = 0;
99				for (i = 0 ; i < fields.length ; i++) {
100					if (field == fields[i]) {
101						//code = '<li>tab: <a href="javascript:show_tab_menu(\''+tbName+'\');">'+prop_title+'</a></li>';
102						title = fieldsTitles[i];
103						defs = fieldsDef[i].split(',');
104						ft = fieldsTypes[i];
105						for (j = 0 ; j < defs.length ; j++) {
106							if (!defs[j]) continue;
107							if (defs[j] == 'style') style = 1;
108							if (defs[j] == 'style_over') style_over = 1;
109							//alert(defs[j]+'\n'+field+'\n');
110							//alert(document.form1[tbName+'-'+field+'-'+defs[j]]);
111							var index = 0;
112							var val;
113							if (field == 'text_free_code') {
114								var parID = img.parentNode.id;
115								parID.search(/-text_free_codec(\d+)/);
116								c = RegExp.$1;
117								for (cc = 0 ; cc < c ; cc++) {
118									tempPartID = parID.replace(/-text_free_codec\d+/, '-text_free_codec'+cc);
119									if (document.getElementById(tempPartID)) {
120										index++;
121										//alert(tempPartID+':'+document.getElementById(tempPartID));
122									}
123								}
124								//alert(index);
125								//alert(tbName+'\n'+field+'\n'+defs[j]);
126								if (document.form1[tbName+'-'+field+'-'+defs[j]].length) val = document.form1[tbName+'-'+field+'-'+defs[j]][index].value;
127								else val = document.form1[tbName+'-'+field+'-'+defs[j]].value;
128							}
129							else val = document.form1[tbName+'-'+field+'-'+defs[j]].value;
130							//val = val.replace(/\'/, '\'');
131							if (defs[j] != 'box') {
132								val = val.replace(/\'/g, '&#39');
133								val = val.replace(/\"/g, '&quot;');
134								val = val.replace(/\r?\n/g, '');
135							}
136							//val = val.replace(/\"/g, '&quot;');
137							val = val.replace(/\"/g, '\\"');
138							val = val.replace(/\r?\n/g, '<NL>');
139							code += eval("get_field_"+defs[j]+"('"+tbName+"','"+field+"', '"+val+"', "+index+")");
140						}
141						break;
142					}
143				}
144				if (field != 'text_free_code') {
145					var def_field_title = '';
146					eval("def_field_title="+ft+"_def_styles_title");
147					eval("def_field="+ft+"_def_styles");
148					var checked = '';
149					if (tbName+'-'+field == def_field) checked = 'checked=true';
150					//alert(checked);
151					code += '<li><input type="checkbox" '+checked+' name="use_def_styles" value="1"> '+use_styles_def_f_fields+' <U><B>'+def_field_title+'</B></U></li>';
152					buttons = '<li>'+gen_update_edit_element+gen_cancel_edit_element+'</li>';
153					buttons = buttons.replace(/%%FORM%%/, tbName).replace(/%%FIELD%%/, field);
154					$("#hideAllDiv").css('display','block');
155					$("#dd-edit_element_style").css('display', (style)?'':'none');
156					$("#dd-edit_element_style_over").css('display', (style_over)?'':'none');
157					$("#dd-edit_element_title").html(title);
158					$("#dd-edit_element_buttons").html(buttons);
159					$("#dd-edit_element").css('display','block');
160					$("#edit_element_general").html(code);
161					
162					$("#dd-edit_element").css('left', (myWidth-$("#dd-edit_element").width())/2);
163					$("#dd-edit_element").css('top', myScroll);
164					$("#hideAllDiv").css('width',myWidth+'px');
165					$("#hideAllDiv").css('height',myScrollHeight+'px');
166				}
167				document.onkeypress = getKey;
168				} catch (e) {
169					//alert(e)
170				}
171
172			}
173			
174			function update_element(tbName, field) {
175				
176				var f = document.form1;
177				arrName1 = tbName+'_form_fields';
178				arrName2 = tbName+'_fields';
179				arrName3 = tbName+'_form_fields_titles';
180				eval("var fields="+arrName1);
181				eval("var fieldsDef="+arrName2);
182				eval("var fieldsTitles="+arrName3);
183				eval("var prop_title="+tbName+"_title");
184				eval("var fieldsTypes="+tbName+"_fields_type");
185				eval("var fieldsMust="+tbName+"_fields_must");
186				eval("var fields2Types="+tbName+"_fields_2type");
187				var codes = new Array();
188				//use_def_styles
189				var ft = '';
190				var i;
191				for (i = 0 ; i < fields.length ; i++) {
192					if (field == fields[i]) {
193						defs = fieldsDef[i].split(',');
194						styleVal = styleOverVal = '';
195						ft = fieldsTypes[i];
196						for (j = 0 ; j < defs.length ; j++) {
197							if (!defs[j]) continue;
198							val = document.form1['general_'+defs[j]].value;
199							id = toolName+'-'+tbName+'_field-'+field+'c0';
200							// text
201							if (fieldsTypes[i] == 'text' || fieldsTypes[i] == 'subtext') {
202								if (defs[j] == 'text' && val != '') codes[1] = val;
203								else if (defs[j] == 'img' && val != '') codes[0] = '<img src="'+val+'" border="0">';
204								else if (defs[j] == 'style') {
205									styleVal = val = document.getElementById('css_code').value;
206									putElemStyle(id, val);
207									if (val != '') {
208										f[tbName+'-'+field+'-style'].value = document.getElementById('css_code').value;
209									}
210								}
211								else if (defs[j] == 'style_over') {
212									val = document.getElementById('css_codeover').value;
213									putElemStyleOver(id, val, styleVal);
214									if (val != '') {
215										f[tbName+'-'+field+'-style_over'].value = document.getElementById('css_codeover').value;
216									}
217								}
218							}
219							else if (fieldsTypes[i] == 'btn') {
220								if (defs[j] == 'text' && val != '') codes[1] = val;
221								else if (defs[j] == 'img' && val != '') codes[0] = '<img src="'+val+'" border="0">';
222								else if (defs[j] == 'style') {
223									styleVal = val = document.getElementById('css_code').value;
224									putElemStyle(id, val);
225									if (val != '') {
226										f[tbName+'-'+field+'-style'].value = document.getElementById('css_code').value;
227									}
228								}
229								else if (defs[j] == 'style_over') {
230									val = document.getElementById('css_codeover').value;
231									putElemStyleOver(id, val, styleVal);
232									if (val != '') {
233										f[tbName+'-'+field+'-style_over'].value = document.getElementById('css_codeover').value;
234									}
235								}
236							}
237							else if (fieldsTypes[i] == 'link' || fieldsTypes[i] == 'innerlink') {
238								if (defs[j] == 'text' && val != '') codes[1] = val;
239								else if (defs[j] == 'img' && val != '') codes[0] = '<img src="'+val+'" border="0">';
240								else if (defs[j] == 'style') {
241									styleVal = val = document.getElementById('css_code').value;
242									putElemStyle(id, val);
243									if (val != '') {
244										f[tbName+'-'+field+'-style'].value = document.getElementById('css_code').value;
245									}
246								}
247								else if (defs[j] == 'style_over') {
248									val = document.getElementById('css_codeover').value;
249									putElemStyleOver(id, val, styleVal);
250									if (val != '') {
251										f[tbName+'-'+field+'-style_over'].value = document.getElementById('css_codeover').value;
252									}
253								}
254							}
255							else if (fieldsTypes[i] == 'input') {
256								var id2update = (fields2Types[i] == 'checkbox')?id:id+' input';
257								if (defs[j] == 'text') {
258									val = val.replace(/\"/g, '&quot;');
259									if (fields2Types[i] == 'checkbox') {codes[0] = '<input type="checkbox" readonly value="1">';codes[2] = val;}
260									else codes[1] = '<input type="text" readonly value="'+val+'">';
261								}
262								else if (defs[j] == 'img' && val != '') {
263									if (fields2Types[i] == 'checkbox') codes[1] = '<img src="'+val+'" border="0">';
264									else codes[0] = '<img src="'+val+'" border="0">';
265								}
266								else if (defs[j] == 'style') {
267									styleVal = val = document.getElementById('css_code').value;
268									putElemStyle(id2update, val);
269									if (val != '') {
270										f[tbName+'-'+field+'-style'].value = document.getElementById('css_code').value;
271									}
272								}
273								else if (defs[j] == 'style_over') {
274									val = document.getElementById('css_codeover').value;
275									putElemStyleOver(id2update, val, styleVal);
276									if (val != '') {
277										f[tbName+'-'+field+'-style_over'].value = document.getElementById('css_codeover').value;
278									}
279								}
280							}
281							else if (fieldsTypes[i] == 'checkbox') {
282								var id2update = (fields2Types[i] == 'checkbox')?id:id+' input';
283								if (defs[j] == 'text') {
284									val = val.replace(/\"/g, '&quot;');
285									if (fields2Types[i] == 'checkbox') {codes[0] = '<input type="checkbox" readonly value="1">';codes[2] = val;}
286									else codes[1] = '<input type="text" readonly value="'+val+'">';
287								}
288								else if (defs[j] == 'img' && val != '') {
289									if (fields2Types[i] == 'checkbox') codes[1] = '<img src="'+val+'" border="0">';
290									else codes[0] = '<img src="'+val+'" border="0">';
291								}
292								else if (defs[j] == 'style') {
293									styleVal = val = document.getElementById('css_code').value;
294									putElemStyle(id2update, val);
295									if (val != '') {
296										f[tbName+'-'+field+'-style'].value = document.getElementById('css_code').value;
297									}
298								}
299								else if (defs[j] == 'style_over') {
300									val = document.getElementById('css_codeover').value;
301									putElemStyleOver(id2update, val, styleVal);
302									if (val != '') {
303										f[tbName+'-'+field+'-style_over'].value = document.getElementById('css_codeover').value;
304									}
305								}
306							}
307							else if (fieldsTypes[i] == 'select') {
308								if (defs[j] == 'text') {
309									codes[0] = val;
310									codes[1] = '<select><option>user 1</option><option>user 2</option></select>';
311								}
312								else if (defs[j] == 'style') {
313									styleVal = val = document.getElementById('css_code').value;
314									putElemStyle(id, val);
315									if (val != '') {
316										f[tbName+'-'+field+'-style'].value = document.getElementById('css_code').value;
317									}
318								}								
319							}
320							document.form1[tbName+'-'+field+'-'+defs[j]].value = val;
321						}
322						break;
323					}
324				} //for
325				code = codes.join(' ');
326				/*if (fieldsTypes[i] == 'link') {
327					code = '<a href="javascript:void(0);">'+code+'</a>';
328				}*/
329				id = toolName+'-'+tbName+'_field-'+field+'c0';
330				//alert(code+'\n'+id);
331				if (code.length == 0) {
332					code = $("#"+id).attr('title');
333					$("#"+id).css('opacity', 0.5);
334				}
335				else {
336					$("#"+id).css('opacity', '');
337				}
338				code += '<div id="'+id+'-editor" class="dd-editor" style="display: none; position: absolute ; left: 2px; top: 0px;"><img style="cursor: pointer;" src="'+htm_webaxy+'/skins/standard/icons/edit.png" border="0" onclick="editItem(\''+tbName+'\', \''+field+'\')">';
339				if (!fieldsMust[i]) code += '<img id="'+id+'-delete" style="cursor: pointer;" src="'+htm_webaxy+'/skins/standard/icons/delete.png" border="0" onclick="deleteItem(\''+id+'\')"></div>';
340				document.getElementById(id).innerHTML = code;
341				try {
342					//closeStyle();
343				} catch (e) {
344					
345				}
346				val = '';
347				val = tbName+"-"+field;
348				//alert('val:'+val+':'+eval(ft+"_def_styles"));				
349				if (f.use_def_styles.checked) {
350					eval(ft+"_def_styles='"+val+"'");
351					//alert(ft+'=\n'+'.'+ft+'{'+styleVal+'}\n.'+ft+':hover {'+styleOverVal+'}');
352					//$("#style-"+ft).html('.'+ft+'{'+styleVal+'}\n.'+ft+':hover {'+styleOverVal+'}');
353					$("#style-"+ft).remove();
354					if (ft == 'input') {
355						putStyleHeader('.'+ft+' input {'+styleVal+'}
355\n.'+ft+' input:hover {'+styleOverVal+'}', 'style-'+ft);
356					}
357					else {
358						putStyleHeader('.'+ft+'{'+styleVal+'}\n.'+ft+':hover {'+styleOverVal+'}', 'style-'+ft);
359					}
360				}
361				else if (val == eval(ft+"_def_styles")) {
362					$("#style-"+ft).remove();
363					eval(ft+"_def_styles=''");
364				}
365				
366				close_edit_element();
367			}
368			
369			function putElemStyle(id, val, donot) {
370				
371				try {
372					if (typeof(donot) == 'undefined') donot = 0;
373					styles = val.split(';');
374					$("#"+id).attr('style', '');
375					//alert(id+'::'+val);
376					var widthExists = 0, textAlignExists = 0;
377					var childsNum;
378					for (s = 0 ; s < styles.length; s++) {
379						if (styles[s]) {
380							//alert($("#"+id).attr('style'))
381							arr = styles[s].split(':');
382							key = arr[0];
383							value = arr[1];
384							key = key.replace(/^\s/, '')
385							//alert(id+'::'+key+'::'+value);
386							if (key == 'width') widthExists = 1;
387							if (key == 'text-align') {
388								var cell = $("#"+id).parent()[0];
389								childsNum = $(".itemEdit", cell).length;
390								textAlignExists = 1;
391							}
392							$("#"+id).css(key, value);
393						}
394					}
395					if (textAlignExists == 1 && widthExists == 0 && childsNum == 1) {
396						$("#"+id).css('width', '100%');
397					}
398					else if (!widthExists) {
399						
400					}
401					
402					if (donot == 0) {
403						$("#"+id).css('border-style', 'dotted');
404						$("#"+id).css('cursor', 'move');
405					}
406				} catch (e) {
407					//alert('putelemStyle:'+id+'\n'+val);
408					//alert(e);
409				}
410				
411			}
412			
413			function putElemStyleOver(id, val, styleVal) {
414			
415				$("#"+id).hover(
416				  function () {
417				    putElemStyle(id, val);
418				  }, 
419				  function () {
420				    putElemStyle(id, styleVal);
421				  }
422				);
423				
424			}
425
426
427			function get_field_text(form, field, val) {
428				
429				var html = '';
430				html = '<li>'+text+'&nbsp;<input type="text" id="general_text" name="general_text" value="'+val+'"></li>';
431				return html;
432				
433			}
434			
435			function get_field_img(form, field, val) {
436				
437				var html = '';
438				var f = document.form1;
439				//f.general_img.value = val;
440				html = '<li>'+image+'&nbsp;'+
441							'<input type="text" id="general_img" name="general_img" value="'+val+'">&nbsp;'+
442							'<a href="javascript:void(0)" onmouseover="showImagePreview(document.form1, \'general_img\', 30, 30);" onmouseout="nd();" onClick="open(\''+cgi_webaxy+'/getfield.pl?act=localimg&localtoo=1&form=form1&field=general_img&'+hidden2+'&eval=opener.setHiddenImg()\',\'img\',\'height=200,width=400,resizable=yes,scrollbars=yes\');return false">'+
443							'<img src="'+htm_webaxy+'/icons/localimg.png" border="0" id="general_bullet_li"></a>&nbsp;'+
444							'<a href="javascript:void(0)" onClick="open(\''+cgi_webaxy+'/files-uploader.pl?returnLink=general_img&saveIn=&rootdir=&'+hidden2+'\',\'img\',\'height=600,width=500,resizable=yes,scrollbars=yes\');return false">'+
445							'<img title="'+uploadFileAndGetLink+'" src="'+htm_webaxy+'/ficons/sndcreate.gif" border="0"></a></li>';
446				return html;
447				
448			}
449			
450			function get_field_style(form, field, val) {
451				
452				var html = '';
453				var f = document.form1;
454				f.general_style.value = val;
455				edit_style('edit_element_style', hidden2, form+'-'+field+'-style', '','', '', '', '' ,'');
456				return html;
457				
458			}
459			
460			function get_field_style_over(form, field, val) {
461				
462				var html = '';
463				var f = document.form1;
464				f.general_style_over.value = val;
465				edit_style('edit_element_style_over', hidden2, form+'-'+field+'-style_over', '','', '', '','over');
466				return html;
467				
468			}
469			
470			function edit_style(id, hidden, field, title, update, noother, fList, suff) {
471	
472				if (!update) update = '';	
473				if (!suff) suff = '';
474				var xmlHttp;
475				try {  // Firefox, Opera 8.0+, Safari  
476					xmlHttp=new XMLHttpRequest(); 
477				}
478				catch (e) {  // Internet Explorer  
479					try {
480						xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
481					}
482					catch (e) {   
483						 try {
484						 	   xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
485						 }
486				   	 catch (e)  {
487				  		   alert("Your browser does not support AJAX!");  
488				   		   return false;
489						}
490					}
491				}
492			  xmlHttp.onreadystatechange=function() {
493			  			if(xmlHttp.readyState==4) {
494			  					var resp = xmlHttp.responseText;
495			  					try 
496			  					{
497			  						$("#"+id).html(resp);
498			  					}
499			  					catch (e)
500			  					{
501			  					}
502			  					
503			  					clickStyle(0,0,"document.form1.elements['"+field+"'].value='%%STYLE%%';"+update,document.form1.elements[field].value,document.getElementById(id), title, suff);	
504			  			}
505			  	}
506			  
507			  xmlHttp.open("GET",cgi_webaxy+"/cssEditor/cssEditor.pl?"+hidden+"&act=line&notitle=1&noUpdateBtn=1&noother="+noother+"&fList="+fList+"&suff="+suff,true);
508			  xmlHttp.send(null);
509			  
510			}
511	
512			function get_field_box(form, field, val, index){
513				
514				val = val.replace(/<NL>/g, "\n");
515				var f = document.form1;
516				//alert(form+'-'+field+'-box');
517				f.box_id.value = form+'-'+field+'-box';
518				f.box_index.value = index;
519				f[toolName+'-flex'].value = val;
520				resetEditors(toolName+'-flex');
521				putSmartBox(toolName+'-flexDiv');
522				
523			}
524			
525			function closeSmartBox(id, save) {
526				
527				var f = document.form1;
528				var divID;
529				var boxID = f.box_id.value;
530				var boxIndex = f.box_index.value;
531				boxID.search(/([^-]+)-([^-]+)-box/);
532				divID = boxID.replace(/([^-]+)-([^-]+)-box/, toolName+'-'+RegExp.$1+'_field-'+RegExp.$2+'c'+boxIndex);
533				if (save) {
534					submitEditors();
535					if (f[boxID].length) {
536						f[boxID][boxIndex].value = f[toolName+'-flex'].value;
537					}
538					else {
539						f[boxID].value = f[toolName+'-flex'].value;
540					}
541					
542					if (f[toolName+'-flex'].value == '') {
543						$("#"+divID).css('opacity', 0.5);
544					}
545					else {
546						$("#"+divID).css('opacity', '');
547					}
548				}
549				($("#"+divID+"-editor").css('display', 'none'));
550				$("#hideAllDiv").css('display','none');
551				$("#"+id).css('display','none');
552				
553			}
554			
555			function putSmartBox(id) {
556	
557				getSize();
558				var hide = document.getElementById('hideAllDiv');
559				var div = document.getElementById(id);
560				$("#hideAllDiv").css('height', myScrollHeight+'px');
561				$("#hideAllDiv").css('display','block');
562				$("#hideAllDiv").css('width', myWidth+'px');
563				$("#"+id).css('display','block');
564				var w = div.clientWidth;
565				var h = div.clientHeight;
566				$("#"+id).css('left', ((myWidth-w)/2)+'px');	
567				Top = ((myScroll+(myHeight-h)/2) < 0)?'0px':(myScroll+(myHeight-h)/2)+'px';	
568				$("#"+id).css('top', Top);	
569				
570			}
571			
572			function init_table_preview(tbName, fieldName, c) {
573				
574				if (!c) c = 0;
575				try {
576					var f = document.form1;
577				arrName1 = tbName+'_form_fields';
578				arrName2 = tbName+'_fields';
579				arrName3 = tbName+'_form_fields_titles';
580				eval("var fields="+arrName1);
581				eval("var fieldsDef="+arrName2);
582				eval("var fieldsTitles="+arrName3);
583				eval("var prop_title="+tbName+"_title");
584				eval("var fieldsTypes="+tbName+"_fields_type");
585				eval("var fieldsMust="+tbName+"_fields_must");
586				eval("var fields2Types="+tbName+"_fields_2type");
587				//alert(tbName+'\n'+fieldsMust);
588				var codes = new Array();
589				for (i = 0 ; i < fields.length ; i++) {
590						field = fields[i];
591						/*
592						if (fieldName == 'text_free_code') {
593							alert(field+'\n'+fieldName);
594						}
595						*/
596						if (fieldName && field != fieldName) continue;
597						id = toolName+'-'+tbName+'_field-'+field+'c'+c;
598						if (!document.getElementById(id)) continue;
599						codes = new Array();
600						defs = fieldsDef[i].split(',');
601						styleVal = '';
602						for (j = 0 ; j < defs.length ; j++) {
603							if (!defs[j]) continue;
604							val = document.form1[tbName+'-'+field+'-'+defs[j]].value;
605							// text
606							if (fieldsTypes[i] == 'text' || fieldsTypes[i] == 'subtext') {
607								if (defs[j] == 'text' && val != '') codes[1] = val;
608								else if (defs[j] == 'img' && val != '') codes[0] = '<img src="'+val+'" border="0">';
609								else if (defs[j] == 'style' && val != '') {
610									styleVal = val;
611									putElemStyle(id, val);						
612								}
613								else if (defs[j] == 'style_over' && val != '') {
614									putElemStyleOver(id, val, styleVal);
615								}
616							}
617							else if (fieldsTypes[i] == 'btn') {
618								if (defs[j] == 'text' && val != '') codes[1] = val;
619								else if (defs[j] == 'img' && val != '') codes[0] = '<img src="'+val+'" border="0">';
620								else if (defs[j] == 'style' && val != '') {
621									styleVal = val;
622									putElemStyle(id, val);						
623								}
624								else if (defs[j] == 'style_over' && val != '') {
625									putElemStyleOver(id, val, styleVal);
626								}
627							}
628							else if (fieldsTypes[i] == 'link' || fieldsTypes[i] == 'innerlink') {
629								if (defs[j] == 'text' && val != '') codes[1] = val;
630								else if (defs[j] == 'img' && val != '') codes[0] = '<img src="'+val+'" border="0">';
631								else if (defs[j] == 'style' && val != '') {
632									styleVal = val;
633									putElemStyle(id, val);						
634								}
635								else if (defs[j] == 'style_over' && val != '') {
636									putElemStyleOver(id, val, styleVal);
637								}
638							}
639							else if (fieldsTypes[i] == 'input') {
640								var id2update = (fields2Types[i] == 'checkbox')?id:id+' input';
641								if (defs[j] == 'text') {
642									if (fields2Types[i] == 'checkbox') {codes[0] = '<input type="checkbox" readonly value="1">';codes[2] = val;}
643									else codes[1] = '<input type="text" readonly value="'+val+'">';
644								}
645								else if (defs[j] == 'img' && val != '') {
646									if (fields2Types[i] == 'checkbox') codes[1] = '<img src="'+val+'" border="0">';
647									else codes[0] = '<img src="'+val+'" border="0">';
648								}
649								else if (defs[j] == 'style' && val != '') {
650									styleVal = val;
651									putElemStyle(id2update, val);
652								}
653								else if (defs[j] == 'style_over' && val != '') {
654									putElemStyleOver(id2update, val, styleVal);
655								}
656							}
657							else if (fieldsTypes[i] == 'checkbox') {
658								var id2update = (fields2Types[i] == 'checkbox')?id:id+' input';
659								if (defs[j] == 'text') {
660									if (fields2Types[i] == 'checkbox') {codes[0] = '<input type="checkbox" readonly value="1">';codes[2] = val;}
661									else codes[1] = '<input type="text" readonly value="'+val+'">';
662								}
663								else if (defs[j] == 'img' && val != '') {
664									if (fields2Types[i] == 'checkbox') codes[1] = '<img src="'+val+'" border="0">';
665									else codes[0] = '<img src="'+val+'" border="0">';
666								}
667								else if (defs[j] == 'style' && val != '') {
668									styleVal = val;
669									putElemStyle(id2update, val);
670								}
671								else if (defs[j] == 'style_over' && val != '') {
672									putElemStyleOver(id2update, val, styleVal);
673								}
674							}
675							else if (fieldsTypes[i] == 'select') {
676								if (defs[j] == 'text') {
677									codes[0] = val;
678									codes[1] = '<select><option>option 1</option><option>option 2</option></select>';
679								}
680								else if (defs[j] == 'style' && val != '') {
681									styleVal = val;
682									putElemStyle(id, val);						
683								}								
684							}
685						}
686					code = codes.join(' ');
687					if (field == 'text_free_code' || fieldName == 'text_free_code') {
688						code = text_free_code;
689					}
690					if (fieldName == 'text_free_code') {
691						
692					}
693					if (code.length == 0) {
694						code = $("#"+id).attr('title');
695						$("#"+id).css('opacity', 0.5);
696					}
697					else {
698						$("#"+id).css('opacity', '');
699					}
700					
701					code += '<div id="'+id+'-editor" class="dd-editor" style="display: none; position: absolute ; left: 2px; top: 0px;"><img style="cursor: pointer;" src="'+htm_webaxy+'/skins/standard/icons/edit.png" border="0" onclick="editItem(\''+tbName+'\', \''+field+'\', this)">';
702					if (!fieldsMust[i]) code += '<img id="'+id+'-delete" style="cursor: pointer;" src="'+htm_webaxy+'/skins/standard/icons/delete.png" border="0" onclick="deleteItem(\''+id+'\')"></div>';
703					
704					document.getElementById(id).innerHTML = code;
705				} //for
706			} catch (e) {
707				//alert(e);
708				//alert(field);
709			}
710				
711			}
712			
713			function getKey(evt) {
714			
715				if (! evt) {
716					theKey = event.keyCode;
717				} else {
718					theKey = evt.keyCode;
719				}
720				
721				if (theKey == 27 || theKey == 11) { // ESC OR Enter
722					close_edit_element();
723					closeSmartBox(toolName+'-flexDiv', 0);
724				}
725				
726			}
727			
728			function addTableColumn(tblID, toolName, tab) {
729				
730				var i = $('tr:first td', $("#"+tblID)).length;
731				//if (typeof(maxTableWidth) != 'undefined' && parseFloat($("#"+toolName+'-'+tab+'Table').css('width'))+150 > maxTableWidth) {
732				var newTBWidth = parseFloat($("#"+toolName+'-'+tab+'Table').css('width'))+150;
733				if (newTBWidth > $("#dd-wrapTable").width()) {
734					$("#dd-wrapTable").width(newTBWidth);
735					//alert(width_exceeds_frame);
736					//return;
737				}
738				var rowIndex = 0;
739				$('#'+tblID+' tr').each(function() {  
740					cls = 'class="'+toolName+'-ddTableCell '+toolName+'-ddTableCell'+i+' '+toolName+'-'+tab+'ddTableCell'+i+' '+toolName+'-ddTableRow'+rowIndex+'"';
741					rowIndex++;
742					var td;
743					if (navigator.appVersion.indexOf("MSIE")!=-1) td = '<td '+cls+'></td>';
744					else td = '<td '+cls+' style="height: 25px;"></td>';
745					$(this).append(td);
746					$("td:last", $(this)).mousedown( function(e) {markCell(e);});
747				})
748				//set marking cell for added cells
749				//alert('#'+tblID+' tr td:last');
750				//$('#'+tblID+' tr td:last').mousedown( function(e) {markCell(e);});
751				
752				$('#'+tblID+'CG').append('<col style="width:150px;"\/>');
753				i = $("#"+toolName+'-'+tab+'CWTable tr:first td').length-2;				
754				$("#"+toolName+'-'+tab+'CWTable').find('tr:first').find('td:eq('+i+')').after('<td class="mark" align="center" style="width: 150px;cursor:pointer;" index="'+(i+1)+'">150px</td>');
755				newWidth = parseFloat($("#"+toolName+'-'+tab+'Table').css('width'))+150;
756				$("#"+toolName+'-'+tab+'Table').css('width', newWidth);
757				$("#"+toolName+'-'+tab+'CWTable tr:first td:last').html(newWidth+'px');
758				$("#"+tab+"_general_style").val(updateStyleWidth($("#"+tab+"_general_style").val(), newWidth));
759				var lastDiv = $("#"+toolName+'-'+tab+'-CR'+i);
760				x = parseFloat(lastDiv.css('left'))-150;
761				//alert('top:'+parseFloat(lastDiv.css('top')));
762				y = parseFloat(lastDiv.css('top'));
763				lastDiv.after('<div style="left: '+x+'px; top: '+y+'px;" class="drag-CR drag-CR-'+tab+'" id="'+toolName+'-'+tab+'-CR'+(i+1)+'"></div>');
764				j = i+1;
765				setColInc(toolName+'-'+tab+'-CR'+j, toolName);
766				
767				positionCellInc(tab);
768												
769			}
770			
771			function removeTableColumn(tblID, toolName, tab){     
772				
773				var del = 1;
774				var mergedCells = new Array();
775				$('#'+tblID+' tr').each(function() {  
776					var tr = $(this);
777					var cells = $('td', tr).length;
778					$('td:last', tr).each(function() {  
779						// if it's a merged cell, check it
780						cell2check = $(this);
781						if ($(this).css('display') == 'none') {
782							for (i = cells - 1 ; i >= 0 ; i--) {
783								cell = $("td:nth("+i+")", tr);
784								if (cell.css('display') != 'none') {
785									cell2check = cell;
786									mergedCells.push(cell2check);
787									break;
788								}
789							}
790						}
791						if (cell2check.html().replace(/\r?\n/g, '')) {
792    					del = 0;
793    				}
794    				else {
795	    				;
796    				}
797    			})
798				}) 
799
800				if (del) {
801					//check if there are empty merged cells in order to descrease colspan
802					for (i = 0 ; i < mergedCells.length ; i++) {
803						if (mergedCells[i].attr('colspan') > 1) mergedCells[i].attr('colspan', mergedCells[i].attr('colspan')-1);	
804					}
805					$('#'+tblID+' tr').each(function() {  
806						var tr = $(this);
807						$('td:last', tr).each(function() {  
808	    				$(this).remove();
809	    			})
810					}) 
811					$('#'+tblID+'CG col:last').remove();
812					 
813					i = $("#"+toolName+'-'+tab+'CWTable tr:first td').length-2;
814					var lastCell = $("#"+toolName+'-'+tab+'CWTable tr:first td:eq('+i+')');
815					var lastDiv = $("#"+toolName+'-'+tab+'-CR'+i);
816					newWidth = parseFloat($("#"+toolName+'-'+tab+'Table').css('width'))-parseFloat(lastCell.css('width'));
817					$("#"+toolName+'-'+tab+'Table').css('width', newWidth);
818					$("#"+toolName+'-'+tab+'CWTable tr:first td:last').html(newWidth+'px');
819					$("#"+tab+"_general_style").val(updateStyleWidth($("#"+tab+"_general_style").val(), newWidth));
820					lastDiv.remove();
821					lastCell.remove();
822				}
823				else alert(column_not_empty);
824				
825			}
826			
827			function removeTableRow(tblID, tab) {
828				
829				jQtable = $('#'+tblID);
830				var del = 1;
831				$('#'+tblID+' tr:last td').each(function() {  
832    			if ($(this).html().replace(/\r?\n/g, '')) {
833    				del = 0;
834    			}
835    			else {
836    				;
837    			}
838				}) 
839
840				if (del) {
841					$('#'+tblID+' tr:last').remove();
842					positionCellInc(tab);
843				}
844				else alert(row_not_empty);
845			}
846			
847			function addTableRow(tblID, toolName, tab){
848				
849				var r;
850				jQtable = $('#'+tblID);
851				jQtable.each(function(){ 
852						var $table = $(this);         // Number of td\'s in the last table row         
853						var n = $('tr:last td', this).length;
854						r = $('tr', this).length;
855						var tds = '<tr class="'+toolName+'-ddTableRow '+toolName+'-ddTableRow'+r+'">';
856						for(var i = 0; i < n; i++){
857							cls = 'class="'+toolName+'-ddTableCell '+toolName+'-ddTableCell'+i+' '+toolName+'-'+tab+'ddTableCell'+i+' '+toolName+'-ddTableRow'+r+'"';
858							if (navigator.appVersion.indexOf("MSIE")!=-1) tds += '<td '+cls+'></td>';
859							else tds += '<td '+cls+' style="height: 25px;"></td>';
860						}         
861						tds += '</tr>';         
862						if($('tbody', this).length > 0){             
863							$('tbody', this).append(tds);         
864						}
865						else {             
866							$(this).append(tds);         
867						}     
868						});
869				//alert("#"+toolName+"-"+tab+"Table ."+toolName+"-ddTableRow"+r+" td");
870				$("#"+toolName+"-"+tab+"Table ."+toolName+"-ddTableRow"+r+" td").mousedown( function(e) {markCell(e);});
871				positionCellInc(tab);
872				 
873			}
874			
875			function initDrag(fName) {
876				
877				// dragged elements can be placed to the empty cells only (disable more than one element in the same table cell)
878				//REDIPS.drag.drop_option = 'single';
879				// set hover color
880				REDIPS.drag.hover_color = '#9BB3DA';
881				// dont ask on delete
882				REDIPS.drag.trash_ask = false;
883				// this function (event handler) is called after element is over
884				REDIPS.drag.myhandler_over = function (e) {					
885					var evt = e || window.event;	// define event (cross browser)
886					if (evt.srcElement) {
887						src = evt.srcElement;
888					}
889					else {
890						src = evt.target;
891					}
892					if (src.tagName != 'DIV') src = src.parentNode;
893					
894					//src.id = src.id.replace(/-editor$/, '');
895					if ($("#current_edit_id").val() && $("#current_edit_id").val() != src.id && $("#current_edit_id").val() != src.id+'-editor' && $("#current_edit_id").val()+'-editor' != src.id) {
896						if (src.id.search('-editor') >= 0) $("#"+src.id).css('display', 'none');
897						else $("#"+src.id+"-editor").css('display', 'none');
898					}
899					
900					$("#"+src.id+"-editor").css('display', 'inline');
901					$("#current_edit_id").val(src.id);
902				}
903				// this function (event handler) is called after element is out
904				REDIPS.drag.myhandler_out = function (e) {
905					var evt = e || window.event;	// define event (cross browser)
906					if (evt.srcElement) {
907						src = evt.srcElement;
908						srcT = evt.relatedTarget;
909					}
910					else {
911						src = evt.target;
912						srcT = evt.relatedTarget;
913					}
914					if (!srcT) return;
915					if (src.tagName != 'DIV') src = src.parentNode;
916					if (srcT.tagName != 'DIV') srcT = srcT.parentNode;
917					if (srcT.id.search('-editor') == -1) {
918						$("#"+src.id+"-editor").css('display', 'none');
919						$(".dd-editor").css('display', 'none');
920					}
921				}
922				// this function (event handler) is called after element is clicked
923				REDIPS.drag.myhandler_clicked = function () {
924					var obj         = REDIPS.drag.obj;						// reference to the dragged OBJect
925					var obj_old     = REDIPS.drag.obj_old;					// reference to the original object
926					//alert(obj.id);
927					var target_cell = REDIPS.drag.target_cell;				// reference to the Target cell
928					//alert(target_cell.id);
929					if (!target_cell) return;
930					var target_row  = REDIPS.drag.target_cell.parentNode;	// reference to the Target row
931					var target_table = target_row.parentNode.parentNode;
932					var source_cell = REDIPS.drag.source_cell;				// reference to the Source cell
933					var source_table = source_cell.parentNode.parentNode.parentNode;				// reference to the Source table
934					
935				}
936				
937				// this function (event handler) is called after element is deleted
938				REDIPS.drag.myhandler_deleted = function () {
939					var obj         = REDIPS.drag.obj;						// reference to the dragged OBJect
940					var obj_old     = REDIPS.drag.obj_old;					// reference to the original object
941					
942					var target_cell = REDIPS.drag.target_cell;				// reference to the Target cell
943					var id = obj.id;
944					id = id.replace(/c\d+$/, '');
945					//alert(id);
946					REDIPS.drag.enable_drag(true, id);
947					$("#"+id+'Cell').css('display', '');
948				}
949				
950				// this function (event handler) is called after element is dropped
951				REDIPS.drag.myhandler_dropped = function () {
952					var obj         = REDIPS.drag.obj;						// reference to the dragged OBJect
953					var obj_old     = REDIPS.drag.obj_old;					// reference to the original object
954					
955					var target_cell = REDIPS.drag.target_cell;				// reference to the Target cell
956					var target_row  = REDIPS.drag.target_cell.parentNode;	// reference to the Target row
957					var target_table = target_row.parentNode.parentNode;
958					var source_cell = REDIPS.drag.source_cell;				// reference to the Source cell
959					var source_table = source_cell.parentNode.parentNode.parentNode;				// reference to the Source table
960					
961					set_text_align_preview(target_cell);
962					set_text_align_preview(source_cell);
963					//if ($("#"+obj.id).attr('class').search(/itemEdit/) == -1) $("#"+obj.id).attr('class', $("#"+obj.id).attr('class')+ ' itemEdit');
964					$("#"+obj.id).addClass('itemEdit');
965					
966					// disable double clone
967					if (source_table.id != target_table.id) {
968						var f = document.form1;
969						obj.id.search(/[^-]+-(.+?)_field-(.+?)c(\d+)/);
970						tbName = RegExp.$1;
971						field = RegExp.$2;
972						c = RegExp.$3;
973						if (obj.id.search(/text_free_code/) == -1) {
974							REDIPS.drag.enable_drag(false, obj_old.id);
975							$("#"+obj_old.id+'Cell').css('display', 'none');
976						}
977						else {
978							elemID = tbName+'-'+field+'-box';
979							$("#form1").append('<input type="hidden" name="'+elemID+'" value="">');
980						}
981						//alert(c+'\\n'+field+'\\n'+tbName);
982						obj.title = obj_old.title;				
983						init_table_preview(tbName, field, c);
984					}
985					
986					var marked_cell = REDIPS.drag.marked_cell;				// reference to the meaning (deny/allow) of marked cells
987					var mark_cname  = REDIPS.drag.mark_cname;				// reference to the name of marked cells
988					var i, obj_new, mark_found, id;							// local variables
989					// if checkbox is checked and original element is "clone" type then clone school subject to the week
990					if (0 && document.getElementById('week').checked === true && obj_old.className.indexOf('clone') > -1) {
991						// loop through table cells
992						for (i = 0; i < target_row.cells.length; i++) {
993							// skip table cell where DIV element is dropped
994							if (target_cell === target_row.cells[i]){
995								continue;
996							}
997							// skip if table cell is not empty
998							if (target_row.cells[i].childNodes.length > 0) {
999								continue;
1000							}
1001							// search for 'mark' class name
1002							mark_found = target_row.cells[i].className.indexOf(mark_cname) > -1 ? true : false;
1003							// if current cell is marked and access type is 'deny' or current cell isnot marked and access type is 'allow'
1004							// then skip this table cell
1005							if ((mark_found === true && marked_cell === 'deny') || (mark_found === false && marked_cell === 'allow')) {
1006								continue;
1007							}
1008							// clone DIV element
1009							obj_new = obj.cloneNode(true);
1010							// set id (first two characters are id of original element)
1011							id = obj.id.substring(0, 2);
1012							// set id for cloned element
1013							obj_new.id = id + 'c' + REDIPS.drag.cloned_id[id];
1014							// set reference to the DIV container 
1015							obj_new.redips_container = obj.redips_container;
1016							// increment cloned_id for cloned element
1017							REDIPS.drag.cloned_id[id] += 1;
1018							// set onmousedown event for cloned object
1019							obj_new.onmousedown = REDIPS.drag.handler_onmousedown;
1020							// append to the table cell
1021							target_row.cells[i].appendChild(obj_new);
1022						}
1023					}
1024					
1025				}
1026				
1027				var f = $("#"+fName);
1028				if ($("#hideAllDiv").length == 0) {
1029					f.append('<div id="hideAllDiv" style="z-index: 1000; background-color: #000000; filter: alpha(opacity=85); opacity: 0.85; display: none; position: absolute; left: 0px; top: 0px; width: 100%; height: 100%"></div>');
1030				}
1031				if ($("#dd-edit_element").length == 0) {
1032					f.append('<div id="dd-edit_element" style="background-color: #FFFFFF; padding: 10px; z-index: 1000; display: none; position: absolute; left: 20px; top: 20px; width: 675px;">'+
1033						'<div id="dd-edit_element_close" style="height: 20px;"><img align="'+un_direction+'" style="cursor: pointer;" src="'+htm_webaxy+'/icons/close.png" border="0" onclick="close_edit_element
1033();"></div>'+
1034						'<div id="dd-edit_element_title"></div>'+
1035						'<div id="dd-edit_element_inner">'+
1036						'	<div id="dd-edit_element_tabs">'+
1037						'		<ul>'+
1038						'       <li id="dd-edit_element_general"><a href="#edit_element_general"><span>'+general+'</span></a></li>'+
1039						'        <li id="dd-edit_element_style"><a href="#edit_element_style"><span>'+design_t+'</span></a></li>'+
1040						'        <li id="dd-edit_element_style_over"><a href="#edit_element_style_over"><span>'+design_over_t+'</span></a></li>'+
1041						'    </ul>'+
1042						'    <div id="edit_element_general">'+
1043						'        '+
1044						'    </div>'+
1045						'    <div id="edit_element_style">'+
1046						'        style'+
1047						'    </div>'+
1048						'    <div id="edit_element_style_over">'+
1049						'        style_over'+
1050						'    </div>'+
1051						'   </div>'+
1052						'</div>'+
1053						'<div id="dd-edit_element_buttons"></div>'+
1054						'</div>');
1055				}
1056	  		$("#dd-edit_element_tabs").tabs();
1057				
1058			}
1059			
1060			
1061			function show_field_def() {
1062				
1063				return;
1064			}
1065	
1066	function changeTab(toolName, tab, dd, dp, first) {
1067		
1068		var cr = $("#"+toolName+'-'+tab+'-CR0');
1069		if (0 && typeof(dp) != 'undefined') {
1070			if (typeof(first) == 'undefined') {
1071				window.setTimeout("changeTab('"+toolName+"', '"+tab+"', '"+dd+"', '"+dp+"', '1')",5000);
1072				//alert(toolName+':'+tab+':'+dd+':'+cr.position().left)
1073				//window.setTimeout("changeTab('"+toolName+"', '"+tab+"', '"+dd+"', '"+dp+"')",5000);
1074				return
1075			}
1076		}
1077		//alert(dp);
1078		//if (typeof(dp) == 'undefined' || dp == 0)
1079		positionCellInc(tab);
1080		if (0 && typeof(dp) != 'undefined') {
1081			//alert('x');
1082			cr.attr('startX', cr.position().left);
1083			cr.attr('endX', parseInt(cr.position().left)+5);
1084			endMoveCol(cr, tab, 0, toolName);
1085			//alert('ds')
1086			cr.attr('startX', cr.position().left);
1087			cr.attr('endX', parseInt(cr.position().left)-5);
1088			endMoveCol(cr, tab, 0, toolName);
1089		}
1090		$("#current_drag").val(dd);
1091		
1092	}		
1093			
1094	function positionCellInc(tab) {
1095	
1096	var c = 0;
1097	var rows = $("#"+toolName+"-"+tab+"Table tr").length;
1098	var TTop = 0;
1099	$("#"+toolName+"-"+tab+"Table tr:first td").each(function() {  
1100  	//alert(c+':'+$(this).position().top);
1101  	// check if this is a merged cells
1102  	var cell = $(this);
1103  	var Top = $(this).position().top;
1104  	//alert(c+':Top:'+Top+':TTop:'+TTop+'\ncls'+cell.attr('className'));
1105  	if ($(this).attr('colspan') > 1 || $(this).css('display') == 'none') {
1106  		var row = 1;
1107  		for (r = 1; r < rows ; r++) {
1108  			tcell = $("#"+toolName+"-"+tab+"Table tr:eq("+r+") td:eq("+c+")");	
1109  			if (tcell.attr('colspan') <= 1) {
1110  				cell = tcell;
1111  				break;
1112  			}
1113  		}
1114  	}
1115  	$("#"+toolName+"-"+tab+"-CR"+c).css('left', cell.position().left);
1116  	if (Top == 0 || TTop > 0) Top = TTop;
1117  	else TTop = Top;
1118  	//alert(c+':Top:'+Top+':TTop:'+TTop);
1119  	$("#"+toolName+"-"+tab+"-CR"+c).css('top', Top);
1120  	c++;
1121	})
1122		
1123}
1124
1125	function moveCol(dragi, tab, c) {
1126		
1127		return;
1128		var counter = 0;
1129		$("#"+toolName+"-"+tab+"TableCG col").each(function() {
1130   		start = parseFloat(dragi.attr('startX'));
1131   		x = parseFloat(dragi.css('left'));
1132   		diff = start - x;
1133   		if (counter == c) {
1134   			newX = $(this).width()+diff;
1135   			$(this).width(newX);
1136   			//dragi.attr('startX', newX); 
1137   		}
1138   		counter++;
1139		})
1140		//alert(dragi.attr('startX')+'::'+tab+':'+c);
1141		
1142	}
1143	
1144	function endMoveCol(dragi, tab, c, toolName) {
1145		
1146		start = parseFloat(dragi.attr('startX'));
1147		end = parseFloat(dragi.attr('endX'));
1148		diff = start - end;
1149		var counter = 0;
1150		newTBWidth = parseFloat($("#"+toolName+"-"+tab+"Table").css('width'))+diff;
1151		//if (typeof(maxTableWidth) != 'undefined' && newTBWidth > maxTableWidth) {
1152		if (newTBWidth > $("#dd-wrapTable").width()) {
1153			//diff = maxTableWidth - parseFloat($("#"+toolName+"-"+tab+"Table").css('width'));
1154			//newTBWidth = maxTableWidth;
1155			$("#dd-wrapTable").width(newTBWidth);
1156		}
1157		
1158		$("#"+toolName+"-"+tab+"TableCG col").each(function() {
1159   		if (counter == c) {
1160   			//curCellWidth = $("."+toolName+"-ddTableCell"+c).width();
1161   			if (navigator.appVersion.indexOf("MSIE")!=-1 || $(this).width() == 0) curCellWidth = parseInt($(this).css('width'));
1162   			else curCellWidth = $(this).width();
1163   			//newX = $(this).width()+diff;
1164   			newX = curCellWidth+diff;
1165   			if (newX < 5) {
1166   				newX = 5;
1167   				//alert(newX+'\n'+curCellWidth+'\n'+diff+'\n'+newTBWidth);
1168   				newTBWidth -= diff;
1169   				diff = -curCellWidth+5;
1170   				//alert(newX+'\n'+curCellWidth+'\n'+diff+'\n'+newTBWidth);
1171   				newTBWidth += diff;
1172   			}
1173   			$(this).width(newX);
1174   			
1175   			newWidth = parseFloat(curCellWidth)+diff;
1176   			//alert('diff:'+diff+', width:'+$(this).width()+', cellwidth:'+curCellWidth+'\n'+$(this).css('width')+'\nnewX:'+newX+'\nnewWidth:'+newWidth);
1177   			$("."+toolName+"-"+tab+"ddTableCell"+c).css('width', newWidth);
1178   			// set upper table #c cell width
1179   			$("#"+toolName+"-"+tab+"CWTable tr:first td:eq("+c+")").css('width', newWidth);
1180   			$("#"+toolName+"-"+tab+"CWTable tr:first td:eq("+c+")").html(newWidth+'px');
1181   		}
1182   		counter++;
1183		})
1184		
1185		$('.drag-CR-'+tab).each(function() {
1186			id = $(this).attr('id');
1187			id.search(/CR(\d+)$/);
1188			num = parseInt(RegExp.$1);
1189			//alert(num+'::'+c);
1190			if (id != toolName+'-'+tab+'-CR'+c && num > c) {
1191				//alert('num:'+num+'\n'+c);
1192				newX = (($(this).css('left') == 'auto')?$(this).position().left:parseFloat($(this).css('left')))-diff;
1193   			//alert($(this).attr('id')+'::'+newX);
1194   			$(this).css('left', newX);
1195			}
1196		})
1197		
1198		// set current main table width preview
1199		$("#"+toolName+"-"+tab+"Table").css('width', newTBWidth);
1200		// set current main table style value width
1201		$("#"+tab+"_general_style").val(updateStyleWidth($("#"+tab+"_general_style").val(), newTBWidth));		
1202		// set upper table (width preview) total width preview
1203		$("#"+toolName+"-"+tab+"CWTable tr:first td:last").html(newTBWidth+'px');
1204		
1205		positionCellInc(tab);
1206		
1207	}
1208	
1209	function updateStyleWidth(style, newWidth) {
1210	
1211		if (style.search(/width\s*:\s*\d+\s*px\s*;/) >= 0) style = style.replace(/width\s*:\s*\d+\s*px\s*;/, 'width:'+newWidth+'px;');
1212		else style += 'width:'+newWidth+'px;';
1213		return style;
1214		
1215	}
1216	
1217	function setColInc(id, toolName) {
1218		
1219		$("#"+id).draggable({ axis: "x", 
1220															start: function(event, ui) {$(this).attr('startX', $(this).css('left'));},
1221															drag: function(event, ui) {$(this).attr('id').search(/(^-)+-(.+)-CR(\d+)/);moveCol($(this), RegExp.$1, RegExp.$2);}, 
1222															stop: function(event, ui) {$(this).attr('endX', $(this).css('left'));$(this).attr('id').search(/[^-]+-(.+)-CR(\d+)/);endMoveCol($(this), RegExp.$1, RegExp.$2, toolName);}
1223
1224														});
1225														
1226	}
1227	
1228	
1229	function markCell(e) {
1230		
1231		var evt = e || window.event;
1232		if (e.which == 1 && e.ctrlKey) {
1233			//alert('markCell: which:'+evt.which+', ctrl:'+e.ctrlKey);
1234			var selectedRow = '';
1235			$( ".ui-selected", $("#"+$("#current_drag").val())).each(function() {
1236				$(this).attr('class').search(/-ddTableRow(\d+)/);
1237				selectedRow = RegExp.$1;
1238				});
1239
1240			var src;
1241			if (evt.srcElement) {
1242				src = evt.srcElement;
1243			}
1244			else {
1245				src = evt.target;
1246			}
1247			while (src.nodeName != 'TD') {
1248				src = src.parentNode;
1249			}
1250			cls = src.className;
1251			cls.search(/-ddTableRow(\d+)/);
1252			currentRow = RegExp.$1;
1253			if (selectedRow != '' && currentRow != selectedRow) return;
1254			if (cls.search(/ui-selected/) >= 0) {
1255				cls = cls.replace(/ui-selected/, '');
1256				src.className = cls;
1257			}
1258			else {
1259				src.className += ' ui-selected';
1260			}				
1261			//$(this).addClass('ui-selected')
1262		}
1263		else if (e.which == 1 ) {
1264			$( ".ui-selected").removeClass('ui-selected')	;
1265		}
1266		
1267	}
1268	
1269	function merge_cells(tblID, toolName, tab){ 
1270		
1271		var selectedRow = '';
1272		var list = $( ".ui-selected", $("#"+$("#current_drag").val()));
1273		var index = 0;
1274		if (list.length < 2) return;
1275		var firstCell;
1276		var joinedData = '';
1277		var colspan = 0;
1278		list.each(function() {
1279			$(this).attr('class').search(/-ddTableRow(\d+)/);
1280			selectedRow = RegExp.$1;
1281			index++;
1282			colspan += ($(this).attr('colspan'))?$(this).attr('colspan'):1;
1283			if (index == 1) {
1284				firstCell = $(this);
1285			}
1286			else {
1287				$(this).css('display', 'none');
1288				$(this).removeClass('ui-selected');
1289				joinedData += $(this).html();
1290				$(this).html('');
1291			}
1292		});
1293		firstCell.html(firstCell.html()+joinedData);
1294		firstCell.attr('colspan', colspan);
1295		REDIPS.drag.init($("#current_drag").val());
1296				
1297	}
1298	
1299	function sep_cells(tblID, toolName, tab){
1300		
1301		var selectedRow = '';
1302		var list = $( ".ui-selected", $("#"+$("#current_drag").val()));
1303		var index = 0;
1304		if (list.length != 1) return;
1305		var firstCell;
1306		list.each(function() {
1307			$(this).attr('class').search(/-ddTableRow(\d+)/);
1308			selectedRow = RegExp.$1;
1309			index++;
1310			if (index == 1) {
1311				$(this).attr('colspan', 1);
1312				firstCell = $(this);
1313			}
1314		});
1315		tr = firstCell.parent();
1316		$('td:not(.ui-selected)', tr).each(function() { 
1317			if ($(this) === firstCell);
1318			else {
1319				//alert($(this));
1320				$(this).css('display', '');
1321			}
1322		})
1323		REDIPS.drag.init($("#current_drag").val());
1324		
1325	}
1326	
1327	function editColWidth(cell) {
1328		
1329		var index = cell.getAttribute('index');
1330		var tbl = cell;
1331		while (tbl.nodeName != 'TABLE') {
1332			tbl = tbl.parentNode;
1333		}
1334		cell = $("#"+tbl.id+" tr:first td:eq("+index+")");
1335		var code = cell.html();
1336		code = code.replace(/^\s+/,'').replace(/\s+$/, '');
1337		if (code.search(/<input/i) >= 0) return;
1338		cell.html('<input type="text" onmouseout="updateColWidth(\''+tbl.id+'\', '+index+')" onblurr="updateColWidth(\''+tbl.id+'\', '+index+')" name="dd-editColWidth" id="dd-editColWidth" origValue="'+code+'" value="'+code+'" size="5">');
1339		return;
1340		var evt = e || window.event;
1341		var src;
1342		if (evt.srcElement) {
1343			src = evt.srcElement;
1344		}
1345		else {
1346			src = evt.target;
1347		}
1348		while (src.nodeName != 'TD') {
1349			src = src.parentNode;
1350		}
1351		//alert(src.innerHTML);
1352		src.innerHTML
1353		return;
1354			
1355	}
1356	
1357	function updateColWidth(tblID, index) {
1358		
1359		cell = $("#"+tblID+" tr:first td:eq("+index+")");
1360		//check if syntax is ok
1361		code = cell.html();
1362		var inpt = $("#dd-editColWidth");
1363		var origValue = inpt.attr('origValue');
1364		Val = inpt.val();
1365		if (code.search(/<input/i) == -1) return;
1366		if (Val.search(/^\d+(|px|%|pt|mm|cm|in)$/i) == -1) {
1367			cell.html(origValue);
1368		}
1369		else {
1370			cell.html(Val);
1371			//return;
1372			diff = parseInt(Val)-parseInt(origValue);
1373			if (diff == 0) return;
1374			//alert('*'+Val+'*\norig:'+origValue+'\n'+diff);
1375			tblID.search(/([^-]+)-(.+)CWTable/);
1376			toolName = RegExp.$1;
1377			tab = RegExp.$2;
1378			c = index;
1379			newTBWidth = parseFloat($("#"+toolName+"-"+tab+"Table").css('width'))+diff;
1380			if (newTBWidth > $("#dd-wrapTable").width()) {
1381				$("#dd-wrapTable").width(newTBWidth);
1382			}
1383			
1384			var counter = 0;
1385			$("#"+toolName+"-"+tab+"TableCG col").each(function() {
1386	   		if (counter == c) {
1387	   			//curCellWidth = $("."+toolName+"-ddTableCell"+c).width();
1388	   			if (navigator.appVersion.indexOf("MSIE")!=-1 || $(this).width() == 0) curCellWidth = parseInt($(this).css('width'));
1389	   			else curCellWidth = $(this).width();
1390	   			//alert('diff:'+diff+', width:'+$(this).width()+', cellwidth:'+curCellWidth);
1391	   			//newX = $(this).width()+diff;
1392	   			newX = curCellWidth+diff;
1393	   			$(this).width(newX);
1394	   			
1395	   			newWidth = parseFloat(curCellWidth)+diff;
1396	   			$("."+toolName+"-"+tab+"ddTableCell"+c).css('width', newWidth);
1397	   			$("#"+toolName+"-"+tab+"CWTable tr:first td:eq("+c+")").css('width', newWidth);
1398	   			$("#"+toolName+"-"+tab+"CWTable tr:first td:eq("+c+")").html(newWidth+'px');
1399	   		}
1400	   		counter++;
1401			})
1402			
1403			$('.drag-CR-'+tab).each(function() {
1404				id = $(this).attr('id');
1405				id.search(/CR(\d+)$/);
1406				num = parseInt(RegExp.$1);
1407				//alert(num+'::'+c);
1408				//if (id != toolName+'-'+tab+'-CR'+c && num > c) {
1409				if (num >= c) {
1410					newX = parseFloat($(this).css('left'))-diff;
1411	   			//alert($(this).attr('id')+'::'+newX);
1412	   			$(this).css('left', newX);
1413				}
1414			})
1415			$("#"+toolName+"-"+tab+"Table").css('width', newTBWidth);
1416			$("#"+toolName+"-"+tab+"CWTable tr:first td:last").html(newTBWidth+'px');
1417			$("#"+tab+"_general_style").val(updateStyleWidth($("#"+tab+"_general_style").val(), newTBWidth));	
1418			
1419			positionCellInc(tab);
1420		}
1421		
1422	}
1423	
1424	function putStyleHeader(rawHTML, ID) {
1425  	
1426		var headEl = null;  // lazy-load
1427		//styles = rawHTML.split(/\n/);
1428		var style = 0, stop = 1;
1429		var newStyleEl = document.createElement('style');
1430		newStyleEl.type = 'text/css';
1431		var styleIE = '';
1432		// add all found style blocks to the HEAD element.
1433    if (!headEl) {  
1434    		headEl = document.getElementsByTagName('head')[0];
1435        if (!headEl) return;
1436    }
1437    var counter = 0;
1438    if (navigator.appVersion.indexOf("MSIE")!=-1) {  
1439       styleIE = rawHTML;
1440    }
1441    else {  
1442       var cssDefinitionsEl = document.createTextNode(rawHTML);
1443       newStyleEl.appendChild(cssDefinitionsEl);
1444    }
1445    if (navigator.appVersion.indexOf("MSIE")!=-1 && styleIE != '') newStyleEl.styleSheet.cssText = styleIE;
1446    newStyleEl.id = ID;
1447    headEl.appendChild(newStyleEl);
1448    
1449	}	
1450	
1451	function set_text_align_preview(cell) {
1452		
1453		var cls = cell.className;
1454		var oldID = cell.id;
1455		cell.id = 'dd-temp';
1456		var existsTextAlign = 0, existsWidth = 0;
1457		var counterChilds = 0;
1458		$("#dd-temp .itemEdit").each(function() {  
1459			if ($(this).css('text-align') != '') existsTextAlign = 1;
1460			counterChilds++;
1461		})
1462		$("#dd-temp .itemEdit").each(function() {  
1463			if ($(this).css('text-align') != '' && existsTextAlign) {
1464				if (counterChilds == 1) $(this).css('width', '100%');
1465				else $(this).css('width', '');
1466			}
1467		})
1468		
1469		cell.id = oldID;
1470		
1471	}
1472	
1473	function getIEVersionNumber() {
1474    
1475    var ua = navigator.userAgent;
1476    var MSIEOffset = ua.indexOf("MSIE ");
1477    
1478    if (MSIEOffset == -1) {
1479        return 0;
1480    } else {
1481        return parseFloat(ua.substring(MSIEOffset + 5, ua.indexOf(";", MSIEOffset)));
1482    }
1483    
1484}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.