var mainNavigation = { 'news' : 0,'about_us' : 1,'our_works':2, 'partnership':3 };




function check_form(f){
	$.post("/message.ajax.php",{ ct_contact : f.ct_contact.value, ct_cont : f.ct_cont.value },function(d){
		f.ct_contact.value = f.ct_cont.value = '';
		$('div#completed').fadeIn('normal').delay(3000).fadeOut('slow');
	});
	return false;
}


jQuery.fn.extend({
	anchorLink: function() {
		this.click(function(){
			$('body, html').animate({scrollTop: 0}, 500 );
			return false;
		});
	}
});


$(function(){
	$('div#footer > div > a').anchorLink();
	$('ul#news_list > li > a[target=]').fancyZoom();
	$('img.img').parent('a').fancyZoom();
	$('ul#navigation > li > a').click(function(){
		$(this).blur();
		var tar = $(this).attr('href').replace('#','');
		mainCurrentNum = mainNavigation[tar];
		var beMargin = (mainCurrentNum * 660)*-1;
		jQuery('div#cont > div').animate({
			marginLeft: beMargin
		},400);
		setTimeout(function(){
			var a = $('#'+tar).height();
			if(a < 300) a = 300;
			$('div#cont').height(a);
		},400);
		$('ul#navigation > li > a[class]').removeClass('current');
		$(this).addClass('current');
		return false;
	});
	var b = $('#news').height();
	if(b<300) b = 300;
	$('div#cont').height(b);
	$('input[type=text]').focus(function(){
		$(this).select();
	});
	$('h1').click(function(){
		//document.body.scrollTop = 0;
		//$('ul#navigation > li > a:first').trigger('click');
		location.href='/';
	});
	$('select#sel_lang').change(function(){
		location.replace('change_language.action.php?to='+$(this).val());
	});
	

});

