function showLoginAjax(prefix, t)
{
	$.getJSON
	(
		HOST + '/lightbox/index-quick-post-job/?callback=?' ,
		{
			'prefix'	: prefix ,
			't'			: t 
		} ,
		function(data)
		{
			if (data.html)
			{
				$.blockUI
				({
					message : data.html ,
					css: 
					{
						border: 'none',
						cursor: 'pointer',
						top:  ($(window).height() - 300)/2 + 'px',
						left: ($(window).width() - 300)/2 + 'px',
						color : 'none'
					}
				});
			}
		}
	);
}

function showboxleft_1(id) {
	if(id >0) {
		$.get(
			HOST_AGENCY + '/ajax/boxleft1?userid=' + id,
			function(html){
				$.blockUI({
					message: html,
					css: {
						color: '#fff', 	
						border: 'none',
						top:  ($(window).height() - 300)/2 + 'px',
						left: ($(window).width() - 300)/2 + 'px',
						cursor: 'pointer'
					}
				});
			}
		);
	}
}

function showboxleft_2(id) {
	if(id >0) {
		$.get(
			HOST_AGENCY + '/ajax/boxleft2?userid=' + id,
			function(html){
				$.blockUI({
					message: html,
					css: {
						color: '#fff', 	
						border: 'none',
						top:  ($(window).height() - 300)/2 + 'px',
						left: ($(window).width() - 300)/2 + 'px',
						cursor: 'pointer'
					}
				});
			}
		);
	}
}

function submitrequest(strItemName) {
	var x=document.getElementsByName(strItemName);
	var p=0;
	for(var i=0; i<x.length; i++) {
		if(x[i].checked) {
			p = p + parseInt(x[i].value);
		}
	}
	if(p<1){
		alert('Bạn chưa chọn ngành!');
		return false; 
	}
	var strUrl 		= HOST_AGENCY + '/ajax/boxleft1?option='+p;
	$.ajax({
			cache	: false,
            async	: false,
            type	: 'GET',
			data	: '',
			url		: strUrl,
			success	: function(response) {				
				return false;
			}
		}); 
	hideBlockUI();
}

function submitrequest2(strItemName, namesender, mailsender ) {
	var x=document.getElementsByName(strItemName);
	var p="";
	for(var i=0; i<x.length; i++) {
		if(x[i].checked) {
			p += x[i].value + ',';
		}
	}
	var name = $("#name").val();
	var mail = $("#email").val();
	var result = (p != '' ? p.substr(0, p.length - 1) : '');	
	if(name==''){
		$("#err_1").show();  
		document.getElementById('name').focus(); 
		return false; 
	}else{
		$("#err_1").hide(); 			 
	}
	if(!ValidateEmail(mail)){
		$("#err_2").show();  
		document.getElementById('email').focus();
		return false;
	}else{
		$("#err_2").hide(); 			 
	}
	if(result == ''){
		alert('Bạn chưa chọn ngành!');
		return false; 
	}
	$.getJSON
		(
			HOST + '/send-gmnmv/?callback=?' ,		
			{
				'fs' : namesender ,  //à fullname sender
				'es' : mailsender ,  //à email sender
				'o'  : result ,//à chuỗi option id (dang id1,id2,id3,id4 )
				'fr' : name ,  //à fullname receiver
				'er' : mail    //à email receiver		
			},		
			function(data)		
			{		
				if (data.result=='1'){
					hideBlockUI(); 									
				}
			}		
		);
	/*var strUrl 		= HOST_AGENCY + '/ajax/boxleft2?cate='+result;	 
	$.ajax({
			cache	: false,
            async	: false,
            type	: 'POST',
			data	: 'name='+name+'&email='+mail,
			url		: strUrl,
			success	: function(response) {				
				return true;
			}
		});*/ 
	///hideBlockUI();
}

function showBlockUI(strId, intTime, intTop, intLeft, intWitdth)
{
	if (intTop || intLeft || intWitdth)
	{
		$.blockUI
		({
		  	message:$('#'+strId),
			css: 
			{ 
				color: '',
				top:  intTop + '%', 
				left: intLeft + '%', 
				border : 'none',
				width: intWitdth + 'px' 
			} 
		});
	}
	else
	{
		$.blockUI
		({
		  	message:$('#'+strId)
		});
	}
	if (intTime)
	{
		setTimeout($.unblockUI, intTime*1000); 
	}
}

function hideBlockUI()
{
	$.unblockUI();
	$('embed').show();
}

function showUIMessage(msg) 
{
	if (msg!='') 
	{	
		$('embed').hide();
		$.blockUI
		({
			message: msg, 
			css: 
			{
				background:'#fffbba', 
				color:'#a90a0e', 
				border:'1px solid #ffc407', 
				showOverlay: false, 
				width:'300px', 
				top: ($(window).height()-200)/2 + 'px', 
				left:($(window).width()-300)/2 + 'px', 
				padding:'10px'
			}, 
			overlayCSS: 
			{	
				opacity:'0'
			}
		});
		//$('.blockOverlay').click(hideBlockUI());
		setTimeout('hideBlockUI()', 3*1000);
	}
}

function showUIWaiting() 
{
	var msg = '<center><img src="img/ajax-loader.gif"/><br/>Đang xử lý, vui lòng chờ...</center>';
	showUIMessage(msg);
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}


function setWaiting(id)
{
	var html = '<img src="images/icons/wait1e.gif" /> ';
	html += '<font style="font-style:italic;">Đang thực hiện tải dữ liệu. Vui lòng chờ trong ít phút...</font>';
	setInnerElementById(id, html);
}

function checkValueElementById(id)
{
	var e = document.getElementById(id);
	if (e && e.value)
	{
		return true;
	}
	if (e) e.focus();
	return false;
}

function checkNumberElementById(id)
{
	var e = document.getElementById(id);
	if (e && e.value && e.value*1>-1)
	{
		return true;
	}
	if (e) e.focus();
	return false;
}

function getValueElementById(id)
{
	var e = document.getElementById(id);
	return e ? e.value : '';
}

function setFocusById(id)
{
	var e = document.getElementById(id);
	if (e){
		e.focus();
	}
}

function setValueElementById(id, value)
{
	var e = document.getElementById(id);
	if (e)
	{
		e.value = '';
		e.value = value;
	}
}

function setInnerElementById(id, html)
{
	var e = document.getElementById(id);
	if (e){
		e.innerHTML = html;
	}
}

function setDisabledById(id, value)
{
	var e = document.getElementById(id);
	if (e){
		e.disabled = value;
	}
}

function in_array(value, arr)
{
	var n = arr.length;
	var i=0;
	for(i=0; i<n; i++)
	{
		if (arr[i]==value)
		{
			return true;
		}
	}
	return false;
}
function array_indexOf(value, arr)
{
	var n = arr.length;
	var i=0;
	for(i=0; i<n; i++)
	{
		if (arr[i]==value)
		{
			return i;
		}
	}
	return -1;
}

function isEmail(id) 
{
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var e = document.getElementById(id);
   if (e && e.value)
   {
		if( reg.test(e.value) )
		{
			return true;
		}
		e.select();
		e.focus();
   }
   return false;
}

function isPhone(id)
{
	var e = document.getElementById(id);
	if (e && e.value)
	{
		var r = e.value.match(/^((\(\+?84\)[\-\.\s]?)|(\+?84[\-\.\s]?)|(0))((\d{3}[\-\.\s]?\d{6})|(\d{2}[\-\.\s]?\d{8}))$/) ;
		if (r){ return true; }
		e.select();
		e.focus();
	}
	return false;
}

function isNumber(id)
{
	var e = document.getElementById(id);
	if (e && e.value)
	{
		if( !isNaN(e.value) )
		{
			return true;
		}
		e.select();
		e.focus();
	}
	return false;
}
/**************************************/
function isCheckAll(idParent, nameChild)
{
	var eParent = document.getElementById(idParent);
	if (eParent)
	{
		eParent.checked=false;
		var arrCheck = getArrCheck(nameChild);
		var bolFlag = 1;
		var n = arrCheck.length;
		for (var i=0; i<n; i++)
		{
			if (!arrCheck[i].checked)
			{
				bolFlag = 0;
				break;
			}
		}
		eParent.checked=bolFlag;
	}
}
function setCheckAll(nameChild, value)
{

	var arrCheck = getArrCheck(nameChild);
	var n = arrCheck.length;
	for (var i=0; i<n; i++)
	{
		arrCheck[i].checked = value;
	}

}
function getArrCheck(strName)
{
	var arrElement = document.getElementsByTagName('input');
	var n = arrElement.length;
	var arrRet = new Array();
	var index =0 ;
	for (var i=0; i<n; i++)
	{
		if (arrElement[i].name==strName)
		{
			arrRet[index++] = arrElement[i];
		}
	}
	return arrRet;
}
function getListCheckedValue(nameChild)
{
	var strRet = "";
	var arrCheck = getArrCheck(nameChild);
	var n = arrCheck.length;
	for (var i=0; i<n; i++)
	{
		if (arrCheck[i].checked && arrCheck[i].disabled==false)
		{
			strRet += strRet ? ","+arrCheck[i].value : arrCheck[i].value;
		}
	}
	return strRet;
}
function setCheckedByValue(nameChild, value)
{
	var arrCheck = getArrCheck(nameChild);
	var n = arrCheck.length;
	for (var i=0; i<n; i++)
	{
		if (arrCheck[i].value==value)
		{
			arrCheck[i].checked=true;
			break;
		}
	}
}
/**************************************/

function openPopupCenter(popupwidth, popupheight, strPath, strName, boolWriteWait, scrollbars) 
{
    var popup_width		= popupwidth;
    var popup_height	= popupheight;
    var screen_width	= window.screen.width;
    var screen_height	= window.screen.height;
    var popup_left		= Math.round((screen_width-popup_width)/2);
    var popup_top		= Math.round((screen_height-popup_height)/2);
	var scroll_bars		= scrollbars ? scrollbars : 0;
	strName = strName.replace(/ /,'');
	window.open(strPath, strName, "status,height="+popup_height+",width="+popup_width+",resizable=yes,left="+popup_left+",top="+popup_top+",scrollbars=yes"+",menubar=0,status=1,fullscreen=0");
}

function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}

function checkLengthContent(id, maxlength)
{
	var content = getValueElementById(id);
	if (content.length<=maxlength){
		return true;
	}
	return false;
}

function subContentByLength(id, maxlength)
{
	var e = document.getElementById(id);
	if (e)
	{
		e.value = e.value.substring(0, maxlength);
	}
}

function setLoading(id)
{
	document.getElementById(id).innerHTML='<div align="center"><img src="images/icons/loading.gif" border="0"/></div>';
}

//Convert no Vn
function setConvertNoVn(strInput)
{
	var arrCharFrom= new Array(
	   "ạ","á","à","ả","ã","Ạ","Á","À","Ả","Ã",
	   "â","ậ","ấ","ầ","ẩ","ẫ","Â","Ậ","Ấ","Ầ","Ẩ","Ẫ",
	   "ă","ặ","ắ","ằ","ẳ","ẫ","Ă","Ắ","Ằ","Ẳ","Ẵ","Ặ",
	   "ê","ẹ","é","è","ẻ","ẽ","Ê","Ẹ","É","È","Ẻ","Ẽ",
	   "ế","ề","ể","ễ","ệ","Ế","Ề","Ể","Ễ","Ệ",
	   "ọ","ộ","ổ","ỗ","ố","ồ","Ọ","Ộ","Ổ","Ỗ","Ố","Ồ","Ô","ô",
	   "ó","ò","ỏ","õ","Ó","Ò","Ỏ","Õ",
	   "ơ","ợ","ớ","ờ","ở","ỡ",
	   "Ơ","Ợ","Ớ","Ờ","Ở","Ỡ",
	   "ụ","ư","ứ","ừ","ử","ữ","ự","Ụ","Ư","Ứ","Ừ","Ử","Ữ","Ự",
	   "ú","ù","ủ","ũ","Ú","Ù","Ủ","Ũ",
	   "ị","í","ì","ỉ","ĩ","Ị","Í","Ì","Ỉ","Ĩ",
	   "ỵ","ý","ỳ","ỷ","ỹ","Ỵ","Ý","Ỳ","Ỷ","Ỹ",
	   "đ","Đ"
	);
		// 0
	var arrCharEndNoVn= new Array(
		"a","a","a","a","a","A","A","A","A","A",
		"a","a","a","a","a","a","A","A","A","A","A","A",
		"a","a","a","a","a","a","A","A","A","A","A","A",
		"e","e","e","e","e","e","E","E","E","E","E","E",
		"e","e","e","e","e","E","E","E","E","E",
		"o","o","o","o","o","o","O","O","O","O","O","O","O","o",
		"o","o","o","o","O","O","O","O",
		"o","o","o","o","o","o",
		"O","O","O","O","O","O",
		"u","u","u","u","u","u","u","U","U","U","U","U","U","U",
		"u","u","u","u","U","U","U","U",
		"i","i","i","i","i","I","I","I","I","I",
		"y","y","y","y","y","Y","Y","Y","Y","Y",
		"d","D"
	);
	
	var n = strInput.length;
	for(i=0; i<n; i++)
	{
		var index = array_indexOf(strInput[i], arrCharFrom);
		if (index>-1)
		{
			var char1 = arrCharFrom[index];
			var char2 = arrCharEndNoVn[index];
			strInput = strInput.replace(char1, char2);
		}
	}
	return strInput;
}
//Convert no Vn

function titleCase(string)
{
	var result = '';
	var nLength = string.length;
	for(i=0; i<nLength; i++)
	{
		var bol = true;
		var c = string[i].toLowerCase();
		if (i==0 || (i>0 && result[i-1]==' ' && result[i]!=' ') )
		{
			c = c.toUpperCase();
		}
		result+=c;
	}
	return result;
}

function getSelText()
{
    var txt = '';
	if (window.getSelection)
    {
        txt = window.getSelection();
	}
    else if (document.getSelection) // FireFox
    {
        txt = document.getSelection();
	}
    else if (document.selection)  // IE 6/7
    {
        txt = document.selection.createRange().text;
	}
    else return;
	return txt;
}

function getValueRadio(idForm, nameRadio)
{
	var e = document.getElementById(idForm);
	if (e)
	{
		var arrInput = e.getElementsByTagName('input');
		var n = arrInput.length;
		for(i=0; i<n; i++)
		{
			if (arrInput[i].type=='radio' && arrInput[i].name==nameRadio && arrInput[i].checked)
			{
				return arrInput[i].value;
			}
		}
	}
	alert('Can not read value.');
}

function getValueCheckbox(id)
{
	var e = document.getElementById(id);
	if (e && e.checked)
	{
		return e.value;
	}
	return '';
}

function setHomepage(url)
{
	if (document.all)
    {
		document.body.style.behavior='url(#default#homepage)';
		document.body.setHomePage(url);
	}
	else if (window.sidebar)
    {
		if(window.netscape)
		{
			try
			{
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
			}
			catch(e)
			{
				var strAlert = "Trình duyệt của bạn hiện tại không cho phép thực hiện chức năng này.";
				strAlert += "\nNếu bạn muốn thực hiện thao tác này, vui lòng thực hiện theo các bước sau:";
				strAlert += "\n1) Mở một tab, hoặc cửa sổ mới bằng trình duyệt hiện tại.";
				strAlert += "\n2) Nhập giá trị [about:config] vào thanh địa chỉ của bạn.";
				strAlert += "\n3) Nhập giá trị [signed.applets.codebase_principal_support] vào công cụ Fillter, sau đó nhấn Show All.";
				strAlert += "\n4) Thay đổi giá trị của dòng dữ liệu tìm thấy được bằng [true].";
				strAlert += "\n\nXin chân thành cảm ơn quý khách. Ban quản trị sinhloi.com";
				alert(strAlert);
			}
		}
		var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
		prefs.setCharPref('browser.startup.homepage',url);
	}
}

function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}
 
function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
 
function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

function expandE(id, value)
{
	if (value=='min')
	{
		$('#'+id).hide('slow');
	}
	else
	{
		$('#'+id).show();
	}
}
//Hong Duc
function refeshCaptcha()
{
	var e = document.getElementById('captcha');
	e.src= e.src+'?a='+ Math.random();
}
function isPhoneNumber(str){
	var alphaExp = /^((\(\+?84\)[\-\.\s]?)|(\+?84[\-\.\s]?)|(0))((\d{3}[\-\.\s]?\d{6})|(\d{2}[\-\.\s]?\d{8}))$/;
	if(str.match(alphaExp)){
		return true;
	}
	return false;
}
function isFullName(strFullName) {	
	// special character
	szInvalid = "`1234567890-=\[];',./~!@#$%^&*()_+|{}:\"<>?";	
	if(!isLegal(strFullName, szInvalid))
	{			
		return false;
	}
	return true;
}
function isCompanyName(strName) {
	// special character
	szInvalid = "`-=\\[];',./~!@#$%^&*()_+|{}:\"<>?";
	if(!isLegal(strName, szInvalid))
	{			
		return false;
	}
	return true;
}
function isEmbed(strEmbed) {
	if(strEmbed.match(/^(<object|OBJECT)*([\s]+.{0,50})+(>)*([\s]+.{0,5000})+(<\/object|OBJECT>)?$/)) {
		return true;
	}
	return false;
}
function isAlphabetAndNumber(str) {
	var alphaExp = /^[a-zA-Z0-9_]+$/;
	if (str.match(alphaExp)){
		return true;
	}
	return false;
}
function isValidImage(strFilename) {
  var ext = (strFilename.substring(strFilename.length-3, strFilename.length)).toLowerCase();
  if( ext != 'jpg' && ext != 'gif' && ext != 'png' && ext != 'jpeg' ) return false;
  return true;
}
function isValidVideo(strFilename) {
  var ext = (strFilename.substring(strFilename.length-3, strFilename.length)).toLowerCase();
  if( ext != 'flv' && ext != 'mp3' && ext != 'wma' && ext != 'wmv' && ext != 'avi' ) return false;
  return true;
}
function checkPointKey(e){
	var keyCode //= (window.event) ? event.keyCode : e.which;   
	if (window.event) keyCode = event.keyCode   
	else keyCode = e.which   
	// Was key that was pressed a numeric character (0-9) or , or <- or -> or backspace (8)?   
	if ( keyCode > 47 && keyCode < 58 || keyCode == 46 || keyCode == 37 || keyCode == 39 || keyCode < 32 ) {
		flagXuLyPoint = true;
		return; // if so, do nothing   else // otherwise, discard character   
	}
	flagXuLyPoint = false;
	if (window.event) //IE       
		window.event.returnValue = null;     
	else //Firefox       
		e.preventDefault(); 
	 
}
function addPoint(node ){
	var str 	= node.value;
	if(!flagXuLyPoint)	return;	
	str =filter(str ,'0123456789');		
	var cont = true;
	while(cont){
		if(str.charAt(0) == '0'){
			str = str.substr(1,str.length);
		}
		else cont = false;
	}
	temp="";
	for(i=str.length-1; i>=0; i--){
		temp=str.charAt(i)+temp;		
		if ( (((i-str.length)%3)==0) && (i!=0)){
			temp= '.' + temp;
		}
	}	
	node.value = temp ;		
}
function removePoint(string){
	if (string.indexOf('.') > 0 ){
		arrString	=	string.split('.');
		strResult	=	arrString.join("");
		return strResult;
	}
	return string;
}
//khong cho nhap nhung ky tu dac biet
function inputMask(input)
{ 
	var index = 0;
	var len = input.value.length;
	mask='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_@.'; 
	while ((index < len) && (len != 0))
	if (mask.indexOf(input.value.charAt(index)) == -1)
	{
	if (index == len-1)
	input.value = input.value.substring(0, len-1);
	else if (index == 0)
	input.value = input.value.substring(1, len);
	else input.value = input.value.substring(0, index)+input.value.substring(index+1, len);
	index = 0;
	len = input.value.length;
	}
	else index++;
}

function ValidateEmail(szEmail)
{
	// chi co 1 ky tu @ o giua, chieu dai username tu 1 den 64 ky tu
	// chieu dai domain tu 1 den 255 ky tu
	if (!szEmail.match(/^[^@]{1,64}@[^@]{1,255}$/))
	{
		return false;
	}

  	// chia 2 phan truoc va sau @
  	szEmailArray = szEmail.split("@");
  	// szEmailArray[0] user, szEmailArray[1] domain

  	// phan username, chieu dai tu max 64 ky tu
  	// valid character la ky tu chu a-zA-Z, ky tu so 0-9 dash _ hyphen - va dot .
  	// neu de trong quote "langxang, at vinacyber dot com dot vn!"@server.com
  	// tach cac phan phan chia boi dot .
  	szLocalArray = szEmailArray[0].split(".");

  	// kiem tra tung phan
  	for(i = 0; i < szLocalArray.length; i ++)
  	{
  		// part 1: neu co dau dash hay hyphen thi khong co o dau va o cuoi
  		// part 2: neu khong do dash hay hyphen thi la A-Za-z0-9 chieu dai tu 1 den 64 ky tu
  		// part 3: neu trong quote, phan trong quote khong chua \" dau quote hay \\ va back slash
		if (!szLocalArray[i].match(/^(([A-Za-z0-9][A-Za-z0-9_-]{0,62}[A-Za-z0-9])|([A-Za-z0-9]{1,64})|(\"[^(\\|\")]{0,62}\"))$/))
		{
      		return false;
    	}
  	}

  	// domain khong phai la IP
  	if (!szEmailArray[1].match(/\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/))
  	{
  		// kiem tra valid domain, tach tung phan domain
    	szDomainArray = szEmailArray[1].split(".");
    	// it nhat co 2 phan cua domain sau @
    	if (szDomainArray.length < 2)
    	{
        	return false;
    	}
/*hungtm sua phan nay
24/11/08*/
		else
		{
			//phan sau dot (.) co kich thuoc < 3
			if(szDomainArray[1].length<2)
				return false;
		}/*end hungtm sua*/
    	// kiem tra tung phan
    	for(i = 0; i < szDomainArray.length; i++)
    	{
    		// maxinum la 64, chua A-Za-z, 0-9, co the chua hyphen -
    		// dau hyphen khong o dau va khong o cuoi, domain case in-sensitive
    		// neu khong co hyphen thi la A-Za-z0-9
			if (!szDomainArray[i].match(/^(([A-Za-z0-9][A-Za-z0-9-]{0,62}[A-Za-z0-9])|([A-Za-z0-9]{0,64}))$/))
			{
        		return false;
      		}
    	}

    	// kiem tra top domain
		// szDomainArray[szDomainArray.length - 1]
  	}
  	return true;
}
function displayDiv(strDiv,intType){
	//type=1 : display= none;
	//type=2 : display= block;
	if(intType==1)
		$('#'+strDiv).css('display','none');
	else
		$('#'+strDiv).css('display','block');
}
function ShowDiv(objId){
	var objName = document.getElementById(objId);
	objName.className='open';
}
function CloseDiv(objId){
	var objName = document.getElementById(objId);
	objName.className='close';
}

//*Thai them **/
function stripTags(str, allowed_tags) {
    str = str.replace(/&nbsp;/g,'');
	str = jQuery.trim(str);	
	var key = '', allowed = false;
    var matches = [];
    var allowed_array = [];
    var allowed_tag = '';
    var i = 0;
    var k = '';
    var html = '';
    var replacer = function(search, replace, str) {
        return str.split(search).join(replace);
    };
    // Build allowes tags associative array
    if (allowed_tags) {
        allowed_array = allowed_tags.match(/([a-zA-Z]+)/gi);
    }
    str += '';
    // Match tags
    matches = str.match(/(<\/?[\S][^>]*>)/gi);
    // Go through all HTML tags
    for (key in matches) {
        if (isNaN(key)) {
            // IE7 Hack
            continue;
        }
        // Save HTML tag
        html = matches[key].toString();
        // Is tag not in allowed list? Remove from str!
        allowed = false;
        // Go through all allowed tags
        for (k in allowed_array) {
            // Init
            allowed_tag = allowed_array[k];
            i = -1;
            if (i != 0) { i = html.toLowerCase().indexOf('<'+allowed_tag+'>');}
            if (i != 0) { i = html.toLowerCase().indexOf('<'+allowed_tag+' ');}
            if (i != 0) { i = html.toLowerCase().indexOf('</'+allowed_tag)   ;}

            // Determine
            if (i == 0) {
                allowed = true;
                break;
            }
        }
        if (!allowed) {
            str = replacer(html, "", str); // Custom replace. No regexing
        }
    }
    return str;
}
$(document).ready(function() {
	if (typeof(_msg)!='undefined' && _msg) { showUIMessage(_msg) };
	if (typeof(_msg)!='undefined' && _err) { alert(_err) };
	if ( $.browser.msie && $.browser.version=='6.0' ) 
	{
		//P7_ExpMenu();
	}
});

loginOpenId = function (url, edit) {
	if (edit == 1) {
		var opener = window.open('https://login.yahoo.com/config/login?logout=1','Yahoo!','toolbar=no,scrollbars=no,location=no,resizable=no,width='+screen.width+',height='+screen.height+"'");
		setTimeout(function () {
			opener.close();
			document.location.href=url;
		}, 2000);
	} else {
		document.location.href=url;
	}
}
