// JavaScript Document
var date = new Date();
date.setTime(date.getTime() + (3 * 24 * 60 * 60 * 1000));
	
$(document).ready(function(){
	var max = 450;
	$('.content img').each(function(i){ 
	  if ($(this).width() > max){
		  $(this).width(max).addClass('border');
	  }
	});
//	if($.cookie('cuscsoft.com_bgcolor')){
//		r($.cookie('cuscsoft.com_bgcolor'));
//	}
	$('div').pngFix();
	function opencard(uid) {
		$('#'+uid).slideDown();
	}
//	$('#go').click(function(){
//		var keysearch = $.trim($('#key').val());
//		if(keysearch != '') {
//			$('#ajaxLoading').show();
//			$.post('search.php', {
//			keysearch:keysearch,
//			title:1,
//			intro:1,
//			content:1,
//			id: Math.random()
//			}, function(response){
//				setTimeout("jLoading('ajaxLoading', 'main_content', '"+escape(response)+"')", 0);
//			});
//		}
//	});
//	$('#key').keypress(function(e){
//		if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
//			$("#go").click();
//			return false;
//		}
//	});
});
//function jLoad(url, idHome){
//	var idContent	= 'main_content';
//	/*if(typeof idHome == "undefined"){
//		$('#tabindex').hide();
//	}
//	else{
//		$('#tabindex').show();
//	}*/
//	param			= url.substr(url.indexOf("#")+2);
//	param			= param.split("/");
//	url				= param[0]+'.php?'+param[1]+'='+parseInt(param[2])+'&'+param[3]+'='+parseInt(param[4])+'&'+param[5]+'='+parseInt(param[6]);
//	$('#ajaxLoading').show();
//	$.post(url, {
//	id: Math.random()
//	}, function(response){
//		setTimeout("jLoading('ajaxLoading', '"+idContent+"', '"+escape(response)+"')", 500);
//	});
//	window.scroll(0,0);
//}
/*
function jLoading(idLoading, idContent, response) {
	$('#'+idLoading).hide();
	$('#'+idContent).html(unescape(response));
	$('#'+idContent).fadeIn(500);
	$('label, legend, a, .no-select, .header, #service_right').disableTextSelect();
} //jLoading
function get_url(){
	// neu load trang co kem cac tham so thi load trang theo dung noi dung
	url		= (location.href.lastIndexOf("#")>0)? location.href.substr(location.href.indexOf("#")) : '#/home';
	
	if(url=='#/home')
	{
		jLoad(url, 'home');
	}
	if(url=='#menu_top')
	{
		jLoad('#/products', 'products');
	}
	else if(url=='#')
	{
		jLoad('#/home', 'home');
	}

	else{
		jLoad(url);
	}
}

function customer(id){
	jLoad('#/customer/cat/'+id);
	$('td.header_text').removeClass('selected');
	$('#member_'+id).addClass('selected');
	$.cookie('cuscsoft.com_memberid', id, { path: '/', expires: date });
}
*/
var lck=0;  
function r(hval){  
	if ( lck == 0 ){  
		document.bgColor='#'+hval;
		$.cookie('cuscsoft.com_bgcolor', hval, { path: '/', expires: date });
			$('#sanphamcusc td, .setbgcolor').css('background', '#'+hval);
			setTimeout("$('#colorChangeList').hide();", 200);
	}  
}  
function l(){  
	if (lck == 0){  
		lck = 1;  
	}  
	else{  
		lck = 0;  
	}  
}
/*function jTab(id){
	$('#tab_1, #tab_2').hide();
	$('#member_1, #member_2').removeClass('membergroup_act');
	$('#member_'+id).addClass('membergroup_act');
	$('#tab_'+id).show();
}

function jLoadIntro(url){
	var idContent	= 'tab_service';
	param			= url.substr(url.indexOf("#")+2);
	param			= param.split("/");
	url				= param[0]+'.php?'+param[1]+'='+parseInt(param[2])+'&'+param[3]+'='+parseInt(param[4]);
	$.post(url, {
	id: Math.random()
	}, function(response){
		setTimeout("jLoading('ajaxLoading', '"+idContent+"', '"+escape(response)+"')", 0);
	});
}

function jLoadProducts(url){
	var idContent	= 'products';
	param			= url.substr(url.indexOf("#")+2);
	param			= param.split("/");
	$('#ajaxLoading').show();
	url				= param[0]+'.php?'+param[1]+'='+parseInt(param[2])+'&'+param[3]+'='+parseInt(param[4]);
	$.post(url, {
	id: Math.random()
	}, function(response){
		setTimeout("jLoading('ajaxLoading', '"+idContent+"', '"+escape(response)+"')", 0);
	});
}
*/
function slideimg(id) {
	$('#img-slide').attr('src', 'images/000'+id+'.png');
	$('.item').each(function(){
		$(this).removeClass('active');
	})
	$('#tablink'+id).addClass('active');
}