function TNCom_getDocumentSize(val)
{
	var xScroll,yScroll,value;
	
	if(window.innerHeight&&window.scrollMaxY)
	{
		xScroll=window.innerWidth+window.scrollMaxX;
		yScroll=window.innerHeight+window.scrollMaxY;
	}
	else if(document.body.scrollHeight>document.body.offsetHeight)
	{
		xScroll=document.body.scrollWidth;
		yScroll=document.body.scrollHeight;
	}
	else{
		xScroll=document.body.offsetWidth;
		yScroll=document.body.offsetHeight;
	}
	
	var windowWidth,windowHeight;
	
	if(self.innerHeight)
	{
		if(document.documentElement.clientWidth){
			windowWidth=document.documentElement.clientWidth;
		}
		else{
			windowWidth=self.innerWidth;
		}
		windowHeight=self.innerHeight;
	}
	else if(document.documentElement&&document.documentElement.clientHeight)
	{
		windowWidth=document.documentElement.clientWidth;
		windowHeight=document.documentElement.clientHeight;
	}
	else if(document.body)
	{
		windowWidth=document.body.clientWidth;
		windowHeight=document.body.clientHeight;
	}
	
	if(yScroll<windowHeight){
		pageHeight=windowHeight;
	}
	else{
		pageHeight=yScroll
	}
	
	if(xScroll<windowWidth){
		pageWidth=xScroll
	}
	else{
		pageWidth=windowWidth
	}
	
	arrayPageSize=new Array(pageWidth,pageHeight,windowWidth,windowHeight)	
	return arrayPageSize[val]
}// end function

function jb_active_tab(obj){
		var curentTab=obj.id;
		var curentContent=curentTab.replace("tab","cont");

		curentContent_1=curentTab.replace("tab","cont");
		var tabs=$('#' + curentTab).parent().children();
		var contents=$('#' + curentContent).parent().children();

		$(tabs).each( function(){								
				$(this).attr('class','');
		});		
		
		$(contents).each( function(){								
				$(this).hide();
		});	
		
		$('#' + curentTab).addClass('active');
		//$('#' + curentContent).fadeIn('show');	
		$('#' + curentContent).show();	
		var pos =0;
		
		switch (curentTab){
			case "tab1":
				pos='left top';
				break;
			case "tab2":
				pos='left center';
				break;
			case "tab3":
				pos='left bottom';
				break;
			case "tab7":
				pos='left top';
				break;
			case "tab8":
				pos='left center';
				break;
			case "tab9":
				pos='left bottom';
				break;	
			}
			
		$('#'+curentTab).parent().css({'backgroundPosition':pos});

}
function jb_active_tab_btin(obj){
		var curentTab=obj.id;
		var curentContent=curentTab.replace("tab","cont");

		curentContent_1=curentTab.replace("tab","cont");
		var tabs=$('#' + curentTab).parent().children();
		var contents=$('#' + curentContent).parent().children();

		$(tabs).each( function(){								
				$(this).attr('class','');
		});		
		
		$(contents).each( function(){								
				$(this).hide();
		});	
		
		$('#' + curentTab).addClass('active');
		$('#' + curentContent).fadeIn('slow');	
		var pos =0;
		
		switch (curentTab){
			case "tab3":
				pos='left top';
				break;
			case "tab4":
				pos='left center';
				break;
			case "tab5":
				pos='left bottom';
				break;
			}
		$('#'+curentTab).parent().css({'backgroundPosition':pos});

}

/*
* 
* Type:     Function use Jquery
* Name:     
* Date:     Feb 11, 2009
* Update: 	
* @author   Tri Do <tridn@von-inc.com >
*/
var g_itemID;
function delitem(){
	$('.delthis').click(function(){
		var itemDisplay=$(this).parent().parent().children('.displaynow').length;
		var itemID=$(this).parent().attr('id');
		var bID="b"+itemID.substring(4,itemID.length);
		$('#'+bID).parent().show();
		$(this).parent().removeClass('displaynow');
		if(itemDisplay<2) $(this).parent().parent().hide();
		return false;
	});
}
function edititem(){
	
	$('.editthis').click(function(){
		g_itemID=$(this).parent().attr('id');
		
		
		document.getElementById('contlist').innerHTML = "";
		switch(g_itemID)
		{
			case "itemmajor":
				ajax_loadIndustry();
				break;
			case "itemlocal":
				ajax_loadLocation();
				break;
			case "itemsalary":
			// Ngan lai
				ajax_loadSalary();
				break;
			case "itemexperience":
				// Ngan lai
				ajax_loadExperience();
				break;
			case "itemlevel":
				ajax_loadLevel();
				break;
			case "itemkind":
			// Ngan lai
				ajax_loadWorkingType();
				break;
		}
		
		if(g_itemID=='itemkey'){
			$("#listmajor").addClass('type2');
			$('.txteditkey').val($('#'+g_itemID).children('.data').text());
		}
		else{
			//$("#listmajor").attr('class','');
			//var h=($("#contlist li").length*14+10)<190?($("#contlist li").length*14+10):188;
			//$('#contlist').css('height',h);
		}
		
		$("#listmajor").css("top",$(this).parent().offset().top);
		var boxw=$("#listmajor").width()+8;
		$("#listmajor").css("left",$(this).parent().offset().left-boxw);
		$("#listmajor").slideDown();
		return false;
	});
	$('.btncontinue').click(function(){						 
		$('#'+g_itemID).children('.data').text($('.txteditkey').val());
		closeboxfilter();
	});
	
	$('#closeicon').click(function(){
		closeboxfilter();
	});
}
function closeboxfilter()
{
	$("#listmajor").slideUp("slow",function(){
		$("#listmajor").attr('class','');										
	});
	return false;
}
function getListValue(obj)
{
	$('#'+g_itemID).children('.data').text($(obj).text());
	closeboxfilter();
	return false;
}
function changeSearchKey(obj){
	var pID=$(obj).parent().parent().attr("id");
	var itemID="item"+pID.substring(1,pID.length);
	$('#'+itemID).children('.data').text($(obj).text());
	$('#'+itemID).parent().show();
	$('#'+itemID).addClass('displaynow');
	$('#'+pID).parent().hide();
	return false;
}
function changeKeyWord(val){
	$('#itemkey').children('.data').text(val);
	$('#itemkey').parent().show();
	$('#itemkey').addClass('displaynow');
	return false;
}
jQuery(document).ready(function(){
	delitem();
	edititem();
});