
function up(elName) {
	var zm = document.getElementsByName(elName)[0].value;
	if(zm < 3) {
		zm++;
	}
	document.getElementsByName(elName)[0].value = zm;
}

function down(elName) {
	var zm = document.getElementsByName(elName)[0].value;
	if(zm > 0) {
		zm--;
	}
	document.getElementsByName(elName)[0].value = zm;
}



function getPos(el,sProp) {
	var iPos = 0;
	while (el!=null) {
		iPos+=el["offset" + sProp];
		el = el.offsetParent;
	}
    return iPos;
}
function overEvent (obj) {
	$(obj).css({border: "1px solid #ddd"});
}
function outEvent (obj) {
	$(obj).css({border: "1px solid #aaa"});
}
function clearDiv (id) {
	$("#ajaxForm").html("");
	$("#row_"+id).removeClass("selected");
}
function ajaxForm(objHtml, tbl, FieldName, wField, wValue, action, type) {
	$.post("index.php",
		{doc: "staff_ajax_server",
		action: "ajaxForm",
		fieldName: FieldName,
		tbl: tbl,
		wField: wField,
		wValue: wValue,
		action_s: action,
		type_id: type},
		function(data){
			$("#ajaxForm").css({position: 'absolute', left: getPos(objHtml,"Left")-150, top: getPos(objHtml,"Top")-200}).html(data);
			$("#row_"+wValue).addClass("selected");
		}
	);
}
function ajaxdFormCreate(objHtml, tbl, FieldName, wField, wValue) {
	$.post("index.php",
		{doc: "staff_ajax_server",
		action: "ajaxdFormCreate",
		fieldName: FieldName,
		tbl: tbl,
		wField: wField,
		wValue: wValue,
		},
		function(data){
			$("#ajaxForm").css({position: 'absolute', left: getPos(objHtml,"Left")-150, top: getPos(objHtml,"Top")-250}).html(data);
			$("#row_"+wValue).addClass("selected");
		}
	);
}
function addBind(id1, id2, bindType, objHtml) {
	
	$.post("index.php",
		{doc: "staff_ajax_server",
		action: "ajaxFormAddBind",
		action2: objHtml.checked,
		action3: objHtml.name,
		methodId: id1,
		country: id2,
		type_id: bindType},
		function(data){
			$("#ajaxForm").css({position: 'absolute', left: getPos(objHtml,"Left")-150, top: getPos(objHtml,"Top")-200}).html(data);
		}
	);
}