function setHomepage()
{
if (document.all)
{
document.body.style.behavior='url(#default#homepage)';
document.body.setHomePage('http://hamtan.gov.vn');

}
else if (window.sidebar)
{
if(window.netscape)
{
try
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
}
catch(e)
{
alert("this action was aviod by your browser, if you want to enable please enter about:config in your address line,and change the value of signed.applets.codebase_principal_support to true");
}
}
var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
prefs.setCharPref('browser.startup.homepage','http://www.asp.net/130.aspx');
}
}

function CreateBookmarkLink() 
{

	 title = "Webpage Title"; 
	  // Blogger - Replace with <$BlogItemTitle$> 
	  // MovableType - Replace with <$MTEntryTitle$>

	 url = "http://trungdinh.com";
	  // Blogger - Replace with <$BlogItemPermalinkURL$> 
	  // MovableType - Replace with <$MTEntryPermalink$>
	  // WordPress - <?php bloginfo('url'); ?>

		if (window.sidebar) { // Mozilla Firefox Bookmark
			window.sidebar.addPanel(title, url,"");
		} else if( window.external ) { // IE Favorite
			window.external.AddFavorite( url, title); }
		else if(window.opera && window.print) { // Opera Hotlist
			return true; }
}


$(document).ready(function(){	

url = window.location.href;	
	
$('table#Table1 .name a').each(function(){
	href = $(this).attr('href');
	$(this).parent().next().next().wrap('<a href="'+href+'" target="_blank"></a>');	
})
	
// form contact	
	$('#form_contact').submit(function(){
		error = false;
		errors = ' * Bắt buộc';
		invalid = ' *Email không hợp lệ';	
		
		name_contact = $('#name_contact');
		if(name_contact.val())
		{
			name_contact.next().html('');
		}else{
			name_contact.next().html(errors);
			error = true;
		}
		email = $('#email');
		if(email.val())
		{
			email.next().html('');
			if(!/^([a-zA-Z0-9_\.])+\@([a-zA-Z0-9\-])+\.([a-zA-Z0-9]{2,4})(\.[a-zA-Z0-9]{2,4})?$/.test(email.val()))
			{
				email.next().html( invalid );
				error = true;
			}
			else
			{
				email.next().html('');
			}
		}else{
			email.next().html(errors);
			error = true;
		}

		comment = $('#comment');

		if(comment.val())
		{
			comment.next().html('');
		}else{
			comment.next().html(errors);
			error = true;
		}

		if(error) return false;
})
// end form contact

// menu hover

$('.hover_img').mouseover(function(){
	src_path = this.title;	
	if(src_path.indexOf('_active')<2){
		src_path = src_path.split('.');
		src_path = src_path[0]+'_active.'+src_path[1];
		$(this).attr('src',language_path+'images/'+src_path);
	}
}).mouseout(function(){
	src_path = this.title;		
	$(this).attr('src',language_path+'images/'+src_path);	
})

// binh chon
	$('.cursor_hand').click(function(){
		if( $(this).is('.comment')){			
			$('.binhchon:checked').each(function(){
				str = 'content='+$(this).val();
				$.ajax({
				   type: "POST", url: site_url+'trangchu/binhchon', data: str, 
						success: function(msg){
					      if(msg) alert(msg);						  
						}
				});				
			})			
		}
	})	
	
	
	heights = $(document).height();
	widths = $(document).width();
	
	$('#popup_main').height(heights).width(widths).css({opacity:.94}).hide();	
	
	if($.browser.msie)
	{
		widths = (widths/2)-300;
		$('#popup_content').css({'margin-left':50});
	}
	
	
		
	$('#popup_close').css('cursor','pointer').click(function(){
		$('#popup_main').fadeOut('slow');
	})
	
	$('#popup_open').click(function(){
		$('#popup_main').fadeIn('slow');
	})		
	
	
f = document.forms[0];

// for menu search
$('#search_id').click(function(){
	search_value = f.search_value.value;
	if(search_value)
	{
		f.type_form.value = 'search';
		f.submit();
	}	
})		

// for image
$('a[rel="lightbox"]').lightBox({
	'imageLoading':			site_url+'assets/images/lightbox-ico-loading.gif',		// (string) Path and the name of the loading icon
	'imageBtnPrev':			site_url+'assets/images/lightbox-btn-prev.gif',			// (string) Path and the name of the prev button image
	'imageBtnNext':			site_url+'assets/images/lightbox-btn-next.gif',			// (string) Path and the name of the next button image
	'imageBtnClose':		site_url+'assets/images/lightbox-btn-close.gif',		// (string) Path and the name of the close btn
	'imageBlank':			site_url+'assets/images/lightbox-blank.gif'
});

$('table.currency tbody tr td:nth-child(3)').remove();
		
})