function inherit(id, inherit, del) {

	var obj = document.getElementById(id);		
	var obj1 = document.getElementById(id+'_1');
	var obj2 = document.getElementById(id+'_2');

	if (del) {
		var obj_del = document.getElementById(id+'_del');	
		obj_del.disabled = ( inherit ? false : true );
	}

	if (inherit) {
		obj1.style.display = 'block';
		obj2.style.display = 'none'; 			
		obj.disabled = true;
	} else {
		obj1.style.display = 'none';
		obj2.style.display = 'block';
		obj.disabled = false;			
	}
		
}

// ---------------------------------------------
function setPropID(prop_id, prop_name, doc_id) {

	var obj_id = document.getElementById('prop_id_'+doc_id);
	var obj_name = document.getElementById('prop_name_'+doc_id);

	obj_id.value = prop_id;
	obj_name.value = prop_name;
}

// ---------------------------------------------
function UpdateCard(doc_id, alias, id) {

	var prop_id = document.getElementById('prop_id_'+doc_id);
	var form = document.getElementById('frmAdminList');

	if ( prop_id.value!='' ) {
		var ClassName = document.getElementById('class_name_'+doc_id);
		form.action = 'main/AdminValue/prop_id='+prop_id.value+'/doc_id='+doc_id+'/class='+ClassName.value ;
	}
	else {
		if (alias!='') {
			form.action+='/name='+alias;
		}
		else {
			form.action+='/id='+id;			
		}
	}
}

// ---------------------------------------------
function TreeGo(str, oCarent) {
	ChangeActiveLine(oCarent);

	var oBaseColl = document.all.tags('BASE'); 
	//alert(oBaseColl[0].href);

	var num1 = str.indexOf('/');
	var sClass = str.substring(0, num1);
	str = str.substring( num1+1 );
	
	num1 = str.indexOf('/');
	var t_id = str.substring(0, num1 );
	
	var parent_id = str.substring( num1+1 );
//	alert('class='+sClass+'   t_id='+t_id+'     parent_id='+parent_id);	

	var ViewType = document.getElementById('ViewType');
	
	if (ViewType.value=='list') {
		parent.mainFrame.location.href = oBaseColl[0].href + sClass+'/adminlist/t_id='+ t_id;		
	}

	if (ViewType.value=='CategCard') {
		parent.mainFrame.location.href = oBaseColl[0].href + 'tree/admincard/id='+ t_id + '/t_id=' + parent_id;		
	}

	if (ViewType.value=='CategList') {
		parent.mainFrame.location.href = oBaseColl[0].href + 'tree/adminlist/t_id='+ t_id;		
	}

	return false;
}

// ---------------------------------------------
function PropertyGo(str, oCarent) {
	var oBaseColl = document.all.tags('BASE'); 

	ChangeActiveLine(oCarent);	
	
	var ViewType = document.getElementById('ViewPropertyType');
	
	if (ViewType.value=='list') {
		parent.mainFrame.location.href = oBaseColl[0].href + 'main/adminproplist/parent_id='+ str;		
	}
	else {
		parent.mainFrame.location.href = oBaseColl[0].href + 'main/adminpropcard/id='+ str;
	}

	return false;
}

// ---------------------------------------------
function ChangeActiveLine(oCarent) {

	var oHideField = document.getElementById('CarentString');
	var sID = oHideField.value;
	if (sID) {
		var oOld = document.getElementById(sID);
	}

	if (oOld) {
		oOld.style.fontWeight = 'normal';
	}

	var oCur = oCarent.parentElement; 
	if (oCur) {
		oCur.style.fontWeight ='bold';
		oHideField.value = oCur.id;
	}
	
}

