function do_linked_emailz(obj) {
	for (i=0; i<obj.content2_temp.options.length; i++) {
		if (obj.content2_temp.options[i].value) {
			obj.content2.value+=obj.content2_temp.options[i].value+'|';
		}
	}
}



function do_linked_images(obj) {
	for (i=0; i<obj.linked_images_temp.options.length; i++) {
		if (obj.linked_images_temp.options[i].value) {
			obj.linked_images.value+=obj.linked_images_temp.options[i].value+'|';
		}
	}
}



function createHTMLTable(obj, cols, rows) {
		// táblázat összerakó
		var data;
		data = '<!-- táblázat kezd -->\n<br><br>\n<table align=\'center\' border=\'0\' cellspacing=\'1\' cellpadding=\'2\' width=\'95%\' bgcolor=\''+obj.table_color.value+'\'>\n\n<!-- fejléc kezd -->\n<tr bgcolor=\''+obj.header_color.value+'\'>\n<td colspan=\''+cols+'\' valign=\'top\' align=\'center\' style=\'font-weight: bold;\'>'+obj.header.value+'</td>\n</tr>\n<!-- fejléc vége -->\n\n<!-- sorok kezd -->\n';
		for (var i=0; i<rows; i++) {
			data += '<tr bgcolor=\''+obj.row_color.value+'\'>\n<!-- cellák kezd -->\n';
			for (var j=0; j<cols; j++) {
				data += '<td class=\'6\' valign=\'top\'>'+eval('obj.cell_'+i+'_'+j+'.value')+'</td>\n';
			}
			data  += '<!-- cellák cége -->\n</tr>\n\n';
		}
		data += '<!-- sorok vége -->\n\n<!-- forrás kezd -->\n<tr bgcolor=\''+obj.source_color.value+'\'>\n<td colspan=\''+cols+'\' valign=\'top\' style=\'font-size: 9px;\'>'+obj.source.value+'</td>\n</tr>\n<!-- forrás cége -->\n\n</table>\n<br>\n<!-- táblázat vége -->\n';
		return data;
}



function check_email(obj) {
		if (obj.value.indexOf('.')==-1 || obj.value.indexOf('@')==-1) { alert('Érvényes e-mail címet meg kell adni!'); return 0; } 
		return 1;
}



function check_regdata(obj) {
		if (obj.username.value.length<4) { alert('A felhasználói név legalább 4 karakter hosszú legyen!'); return 0; } 
		if (obj.password.value.length<6) { alert('A jelszó legalább 6 karakter hosszú legyen!'); return 0; } 
		if (obj.password.value!=obj.password2.value) { alert('A megadott két jelszó nem egyezik!'); return 0; } 
		if (!check_email(obj.email)) { return 0; }
		if (obj.nev.value.length<1) { alert('A teljes nevet kötelező megadni!'); return 0; } 
		return 1;
}



function emailFix(a) {
		a.href=a.href.replace(/SSPPAAMM./g, ""); return true;
}



function emailStat(a,b) {
		if (b) { 
			window.status=a.href.replace(/SSPPAAMM./g, ""); 
		}
		else { 
			window.status=""; 
		}
}



function getCheckedValue(obj) {
		if (obj[0].checked) { return 0; }
		if (obj[1].checked) { return 1; }
		if (obj[2].checked) { return 2; }
}



function doLinkedObjects(obj) {
		if (obj.author_pic) {
			for (i=0; i<obj.author_pic_temp.options.length; i++) {
				if (obj.author_pic_temp.options[i].value) {
					obj.author_pic.value+=obj.author_pic_temp.options[i].value+'|';
				}
			}
		}
		if (obj.linked_files) {
			for (i=0; i<obj.linked_files_temp.options.length; i++) {
				if (obj.linked_files_temp.options[i].value) {
					obj.linked_files.value+=obj.linked_files_temp.options[i].value+'|';
				}
			}
		}
		if (obj.linked_links) {
			for (i=0; i<obj.linked_links_temp.options.length; i++) {
				if (obj.linked_links_temp.options[i].value) {
					obj.linked_links.value+=obj.linked_links_temp.options[i].text+'*|*'+obj.linked_links_temp.options[i].value+'|*|';
				}
			}
		}
		if (obj.linked_galery) {
			for (i=0; i<obj.linked_galery_temp.options.length; i++) {
				if (obj.linked_galery_temp.options[i].value) {
					obj.linked_galery.value=obj.linked_galery_temp.options[i].value;
				}
			}
		}
		if (obj.select_menukep) {
			for (i=0; i<obj.select_menukep_temp.options.length; i++) {
				if (obj.select_menukep_temp.options[i].value) {
					obj.select_menukep.value+=obj.select_menukep_temp.options[i].value+'|';
				}
			}
		}
		if (obj.select_munkatarskep) {
			for (i=0; i<obj.select_munkatarskep_temp.options.length; i++) {
				if (obj.select_munkatarskep_temp.options[i].value) {
					obj.select_munkatarskep.value+=obj.select_munkatarskep_temp.options[i].value+'|';
				}
			}
		}
}



function SelectAllVariable(obj, variable) {
		for (var i=0; i<obj.elements.length; i++) {
			var element = obj.elements[i];
			if (element.name == variable) {
				element.checked = !element.checked;
			}
		}
}



function SelectAll(obj) {
		for (var i=0; i<obj.elements.length; i++) {
			var element = obj.elements[i];
			if (element.name != "SelAll") {
				element.checked = !element.checked;
			}
		}
}



function addOption(selectName, insertText, insertValue) { // Add <option value="insertValue">insertText at the end of selectName
		var i,j=0;
		for (i=0; i<selectName.options.length; i++) {
			if (selectName.options[i].value) j++;
		}
		selectName.options.length=j; selectName.options[j]=new Option(insertText,insertValue);
		i=j+1;
		selectName.options.length=i; selectName.options[i]=new Option('                                                                                              ','');
}



function delOption(selectName) { // Removes selected <option> from selectName and sort the rest of the list
		if (selectName.options.selectedIndex<0 || !selectName.options[selectName.options.selectedIndex].value) return;
		var i,j=0;
		ary = new Array();
		for (i=0; i<selectName.options.length; i++) {
			if (selectName.options.selectedIndex!=i) { ary[j] = new Array(selectName.options[i].text, selectName.options[i].value); j++; }
		}
		selectName.options.length=0;
		for (i=0; i<ary.length; i++) {
			selectName.options[i]=new Option(ary[i][0],ary[i][1]);
		}
}



function insertValue(obj, data) {
		// Function ripped from phpMyAdmin, thanks!
		
		// eval('document.'+formname+'.'+field+'.value+=data');
		
		// explorer
		if (document.selection) {
			obj.focus();
			sel = document.selection.createRange();
			sel.text = data;
			obj.focus();
		}
		// mozilla/netscape/firebird
		else if (obj.selectionStart || obj.selectionStart == "0") {
			var startPos = obj.selectionStart;
			var endPos = obj.selectionEnd;
			var chaineData = obj.value;
			obj.value = chaineData.substring(0, startPos) + data + chaineData.substring(endPos, chaineData.length);
		} 
		else {
			obj.value += data;
		}
}



function setPointer(theRow, theAction, theDefaultColor, thePointerColor, theMarkColor) {
		// Function ripped from phpMyAdmin, thanks!
	
	    var theCells = null;
	
	    // 1. Pointer and mark feature are disabled or the browser can't get the
	    //    row -> exits
	    if ((thePointerColor == '' && theMarkColor == '')
	        || typeof(theRow.style) == 'undefined') {
	        return false;
	    }
	
	    // 2. Gets the current row and exits if the browser can't get it
	    if (typeof(document.getElementsByTagName) != 'undefined') {
	        theCells = theRow.getElementsByTagName('td');
	    }
	    else if (typeof(theRow.cells) != 'undefined') {
	        theCells = theRow.cells;
	    }
	    else {
	        return false;
	    }
	
	    // 3. Gets the current color...
	    var rowCellsCnt  = theCells.length;
	    var domDetect    = null;
	    var currentColor = null;
	    var newColor     = null;
	    // 3.1 ... with DOM compatible browsers except Opera that does not return
	    //         valid values with \"getAttribute\"
	    if (typeof(window.opera) == 'undefined'
	        && typeof(theCells[0].getAttribute) != 'undefined') {
	        currentColor = theCells[0].getAttribute('bgcolor');
	        domDetect    = true;
	    }
	    // 3.2 ... with other browsers
	    else {
	        currentColor = theCells[0].style.backgroundColor;
	        domDetect    = false;
	    }
		// 3.3 ... ha megsem lenne jo egyik sem...
		if (!currentColor) { 
			currentColor = theCells[0].style.backgroundColor; 
		} // end 3
	
	    // 4. Defines the new color
	    // 4.1 Current color is the default one
	    if (currentColor == ''
	        || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
	        if (theAction == 'over' && thePointerColor != '') {
	            newColor = thePointerColor;
	        }
	        else if (theAction == 'click' && theMarkColor != '') {
	            newColor = theMarkColor;
	        }
	    }
	    // 4.1.2 Current color is the pointer one
	    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()) {
	        if (theAction == 'out') {
	            newColor = theDefaultColor;
	        }
	        else if (theAction == 'click' && theMarkColor != '') {
	            newColor = theMarkColor;
	        }
	    }
	    // 4.1.3 Current color is the marker one
	    else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
	        if (theAction == 'click') {
	            newColor = (thePointerColor != '')
	                     ? thePointerColor
	                     : theDefaultColor;
	        }
	    } // end 4
	
	    // 5. Sets the new color...
	    if (newColor) {
	        var c = null;
	        // 5.1 ... with DOM compatible browsers except Opera
	        if (domDetect) {
	            for (c = 0; c < rowCellsCnt; c++) {
	                theCells[c].setAttribute('bgcolor', newColor, 0);
	            } // end for
	        }
	        // 5.2 ... with other browsers
	        else {
	            for (c = 0; c < rowCellsCnt; c++) {
	                theCells[c].style.backgroundColor = newColor;
	            }
	        }
	    } // end 5
	
	    return true;
} // end of the 'setPointer()' function



function newwin (link,name,settings) {
	x = window.open (link,name,settings);
}

