function ajx_file_del( prj, lng, url, elid ) {
	
	$( "#" + elid ).remove(  );
	
	url	= str_replace( '/', '&de%', url );
	
	str		= 'prj=' + prj + '/plg=service/ctrl=CService/act=file_del/url=' + url + '/lng=' + lng;
	
	get_body( 'empty', str, 0 );
}

function ajx_field_del( link, elid ) {
	
	$( "#" + elid ).remove(  );
	
	get_body( 'empty', link, 0 );
}

function ajx_unic_lst( prj, tbl, name, name_lng, val, id, lng, elbox, elid ) {
	
	if ( val ) {
		
		str		= 'prj=' + prj + '/plg=service/ctrl=CService/act=unic_lst/link=' + id + '/tbl=' + tbl + '/name=' + name + '/name_lng=' + name_lng + '/lng=' + lng + '/val=' + val + '/elbox=' + elbox + '/elid=' + elid;
		
		get_body( 'empty', str, 0 );
	}
}

function ajx_unic_complex( prj, psid, tbl1, tbl2, name1, name2, name_lng, val, id, lng, elbox, elid ) {
	
	if ( val ) {
		
		str		= 'prj=' + prj + '/psid=' + psid + '/plg=service/ctrl=CService/act=unic_complex/link=' + id + '/tbl1=' + tbl1 + '/tbl2=' + tbl2 + '/name1=' + name1 + '/name2=' + name2 + '/name_lng=' + name_lng + '/lng=' + lng + '/val=' + val + '/elbox=' + elbox + '/elid=' + elid;
		
		get_body( 'empty', str, 0 );
	}
}

function ajx_unic_lng( prj, tbl, name, val, id, lng, elbox, elid ) {
	
	if ( val ) {
		
		str		= 'prj=' + prj + '/plg=service/ctrl=CService/act=unic_lng/link=' + id + '/tbl=' + tbl + '/name=' + name + '/lng=' + lng;
		
		get_body( elid, str, 0 );
	}
}

function ajx_edit_lst( prj, tbl, name, id, width, lng ) {
	
	elid	= 'ajx_' + name + '_' + id;
	
	str		= 'prj=' + prj + '/plg=service/ctrl=CService/act=box_lst/link=' + id + '/tbl=' + tbl + '/name=' + name + '/width=' + width + '/lng=' + lng;
	get_body( elid, str, 0 );
}

function ajx_edit_lng( prj, tbl, name, id, width, lng ) {
	
	elid	= 'ajx_' + name + '_' + id;
	
	str		= 'prj=' + prj + '/plg=service/ctrl=CService/act=box_lng/link=' + id + '/tbl=' + tbl + '/name=' + name + '/width=' + width + '/lng=' + lng;
	get_body( elid, str, 0 );
}

function ajx_save_lst( prj, tbl, name, val, id, lng ) {
	
	elid	= 'ajx_' + name + '_' + id;
	
	str		= 'prj=' + prj + '/plg=service/ctrl=CService/act=save_lst/link=' + id + '/tbl=' + tbl + '/name=' + name + '/val=' + val + '/lng=' + lng;
	get_body( elid, str, 0 );
}

function ajx_save_lng( prj, tbl, name, val, id, lng ) {
	
	elid	= 'ajx_' + name + '_' + id;
	
	str		= 'prj=' + prj + '/plg=service/ctrl=CService/act=save_lng/link=' + id + '/tbl=' + tbl + '/name=' + name + '/val=' + val + '/lng=' + lng;
	get_body( elid, str, 0 );
}

function act_target( t_link, tid ) {
	
	if ( tid ) {
		
		t_link	= t_link + '/' +tid;
	}
	
	ind	= t_link.indexOf( 'del' );
	
	if ( -1 == ind ) {
		
		document.location.href = t_link;
	}
	else {
		
		warn_del_gen(  );
		form_del_conf( 'warn_info', t_link );
	}
}

function ajx_target( t_link, tid ) {
	
	title	= get_title(  );
	
	if ( tid ) {
		
		t_link	= t_link + '/link=' +tid;
	}
	
	mgr	= 	'';
	mgr+=	'bid=item_show / bar_box=body / bar_type=warn_info / bar_title=' + title + ' / bar_movable=yes / bar_max=yes / bar_resizable=no / ';
	mgr+=	'bar_but_close=yes / bar_but_min=yes / bar_cls_but_close=warn_info_close / bar_cls_but_min=warn_info_min / bar_cls_but_max=warn_info_max / ';
	mgr+=	'bar_cls_box=warn_info_ajx_box / bar_cls_header=warn_info_header / bar_cls_header_left=warn_info_header_left / bar_cls_header_right=warn_info_header_right / bar_cls_title=warn_info_title / bar_cls_body=warn_info_ajx_body / bar_cls_cont=warn_info_ajx_cont / bar_cls_footer=warn_info_footer / ';
	
	if ( !document.getElementById( 'item_show' ) ) {
		
		barCart	= new bar_mgr( mgr );
		barCart.create_bar(  );
	}
	
	get_body( 'item_show_cont', t_link );
}

function warn_del_gen(  ) {
	
	title	= get_title(  );
	
	mgr	= 	'';
	mgr+=	'bid=warn_info / bar_box=body / bar_type=warn_info / bar_title=' + title + ' / bar_movable=yes / bar_max=yes / bar_resizable=no / ';
	mgr+=	'bar_but_close=yes / bar_but_min=yes / bar_cls_but_close=warn_info_close / bar_cls_but_min=warn_info_min / bar_cls_but_max=warn_info_max / ';
	mgr+=	'bar_cls_box=warn_info_box / bar_cls_header=warn_info_header / bar_cls_title=warn_info_title / bar_cls_body=warn_info_body / bar_cls_cont=warn_info_cont / bar_cls_footer=warn_info_footer / ';
	
	if ( !document.getElementById( 'cart_add' ) ) {
		
		barCart	= new bar_mgr( mgr );
		barCart.create_bar(  );
	}
}

function get_title(  ) {
	
	if ( document.getElementById( 'page_title' ) ) {
		
		title	= document.getElementById( 'page_title' ).innerHTML;
	}
	else {
		
		title	= 'warn';
	}
	
	return title;
}

function form_del_conf( id, t_link ) {
	
	str = '';
	str+= '<table width="400" cellpadding="0" cellspacing="0" border="0" >';
	str+= 	'<tr style="height:40px;" valign="bottom">';
	str+= 		'<td colspan="4" class="text_gray" style="text-align:center;">';
	str+= 			'Are you sure, you want to remove this item ? ';
	str+= 		'</td>';
	str+=	'</tr>';
	str+=	'<tr style="height:80px;" valign="bottom">';
	str+=		'<td width="87">&nbsp;</td>';
	str+=		'<td width="93"><div class="but_main" onclick=\'bar_close( "' + id + '" );\'>Cancel</div></td>';
	str+=		'<td width="40"></td>';
	str+=		'<td width="180"><div class="but_main" onclick=\'bar_close( "' + id + '" ); del_target( "'+t_link+'" );\'>OK</div></td>';
	str+=	'</tr>';
	
	elid	= id + '_cont';
	
	if ( document.getElementById( elid ) ) {
		
		document.getElementById( elid ).innerHTML	= str;
	}
}

function del_target( t_link ) {
	
	document.location.href = t_link;
}

function tab_on( this_el, id, cl_pref ) {
	
	elid		= 'tab_' + id;
	cl_over		= cl_pref + '_over';
	cl_out		= cl_pref + '_out';
	cl_press	= cl_pref + '_press';
	
	cl_old		= this_el.className;
	
	if ( cl_press != cl_old ) {
		
		$( '.box_main_item > .box_int' ).animate( {opacity : "hide"}, cgg.curt_hide_speed - 1 );
		
		$( '.box_tab > .' + cl_press ).addClass( cl_out );
		$( '.box_tab > .' + cl_press ).removeClass( cl_press );
		this_el.className	= cl_press;
		
		setTimeout( 'tab_show( "' + elid + '" )', cgg.curt_hide_speed*1.2 );
	}
}

function tab_over( this_el, id, cl_pref ) {
	
	elid		= 'tab_' + id;
	cl_over		= cl_pref + '_over';
	cl_press	= cl_pref + '_press';
	
	cl_old	= this_el.className;
	
	if ( cl_press != cl_old ) {
		
		this_el.className	= cl_over;
	}
}

function tab_out( this_el, id, cl_pref ) {
	
	elid		= 'tab_' + id;
	cl_out		= cl_pref + '_out';
	cl_press	= cl_pref + '_press';
	
	cl_old	= this_el.className;
	
	if ( cl_press != cl_old ) {
		
		this_el.className	= cl_out;
	}
}

function tab_show( elid ) {
	
	$( "#" + elid ).animate( {opacity : "show"}, cgg.curt_show_speed - 1 );
}

function panel_target_click( el_id ) {
	
	$( '#box_tar > div' ).css( {display:'none'} );
	
	document.getElementById( 'target_' + el_id ).style.display	= 'block';	
}

function img_prev_swap( elid, cls ) {
	
	if ( document.getElementById( elid ) ) {
		
		document.getElementById( elid ).className	= cls;
	}
}

function filter_plg_click( link, plg ) {
	
	document.location.href	= link + '/' + plg;
}
