function getObj(name) {
	if (document.getElementById) {
		this.obj = document.getElementById(name);
		this.style = document.getElementById(name).style;
	} else if (document.all) {
		this.obj = document.all[name];
		this.style = document.all[name].style;
	} else if (document.layers){
		this.obj = document.layers[name];
		this.style = document.layers[name];
	}
}
function set_lm_over(obj) {
	var id = obj.id.replace('a_', '');
	if (id != 'lm_' + curr_page){
		var li = new getObj(id);
		if (li) {
			var add_class = 'selected';
			if (li.obj.className.search(add_class) == -1) {
				li.obj.className += ' ' + add_class;
			} else {
				li.obj.className = li.obj.className.replace(add_class, '');
			}
		}
	}
	return true;
}
function popupWindow(url, width, height) {
	window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=' + width + ',height=' + height + ',screenX=50,screenY=50,top=50,left=50');
	return true;
}
function img_change(part_id) {
	var obj_1 = new getObj('div_' + part_id + '_1');
	var obj_2 = new getObj('div_' + part_id + '_2');
	if (obj_1 && obj_2) {
		var add_class = ' img_2';
		if (obj_1.obj.className.search(add_class) == -1) {
			obj_1.obj.className += add_class;
			obj_2.obj.className = obj_2.obj.className.replace(add_class, '');
		} else {
			obj_2.obj.className += add_class;
			obj_1.obj.className = obj_1.obj.className.replace(add_class, '');
		}
	}
}

function validate_form(c_form, errorstring, fields) {
	var validForm = false;
	if (typeof fields == 'object' && fields.length > 0) {
		var x = c_form.elements;
		var valid_fields = 0;
		for (var j=0;j<fields.length; j++) {
			for (var i=0;i<x.length;i++) {
				if (x[i].name == fields[j]) {
					switch (x[i].type) {
					case 'text':
					case 'textarea':
						if (x[i].value) valid_fields++;
						i = x.length;
						break;
					case 'radio':
					case 'checkbox':
						if (x[i].checked)  valid_fields++
						i = x.length;
						break;
					}
				}
			}
		}
		if (valid_fields >= fields.length) validForm = true;
	} else {
		var x = c_form.elements;
		for (var i=0;i<x.length;i++) {
			switch (x[i].type) {
			case 'text':
			case 'textarea':
				if (x[i].value) {
					validForm = true;
					i = x.length;
				}
				break;
			case 'radio':
			case 'checkbox':
				if (x[i].checked) {
					validForm = true;
					i = x.length;
				}
				break;
			}
		}
	}
	if (!validForm) alert(errorstring);
	return validForm;
}