function fixBottom() {
	var objTemp = document.getElementById('footer');
	var value = document.documentElement.scrollTop+document.documentElement.clientHeight-objTemp.offsetHeight-(parseInt(objTemp.currentStyle.marginTop,10)||0)-(parseInt(objTemp.currentStyle.marginBottom,10)||0);
	objTemp.style.top = value;
}
function viewGnbsub(layerId){
	if (document.getElementById('business')) {
		var sublayer_length = 4;
		var divId = "subLayer2";
	} else {
		var sublayer_length = 5;
		var divId = "subLayer";
	}
	for(var i=1;i<=sublayer_length;i++){
		if(layerId==divId+i) {
			if(layerId != "none") document.getElementById(divId+i).style.display = "block";
		} else {
			document.getElementById(divId+i).style.display = "none";
		}
	}
}

function brightcovePlayerStart(code) {
    customPlayer.onClickClose = brightcovePlayerClose;
    eval(code);
}


function brightcovePlayerClose() {
    document.getElementById("flashcontent").rollingStart();
}


jQuery(document).ready(function () {
	if ( (/MSIE 6\.0/).test(navigator.userAgent) && !(/MSIE 7\.0/).test(navigator.userAgent) ) {
		DD_belatedPNG.fix(".FixPng");		
		/*jQuery(window).scroll( fixBottom );
		jQuery(window).resize( fixBottom );*/
	}
	$("#listMenu > li").mouseover(function() {
		var layerIdarg = $(this).find("div").attr("id");
		viewGnbsub(layerIdarg);
	});
	$("#listMenu > li").mouseout(function() {
		viewGnbsub("none");
	});
	$("#listMenu > li > div").mouseout(function() {
		viewGnbsub("none");
	});


// Embed the Flash
var ran = Math.random(1000);
var flashvars = { xmlpath: "/config.xml?nocahe="+ran };
var params = { wmode: "opaque", allowScriptAccess: "always" };
var attributes = {};
swfobject.embedSWF("/Images/bg_main.swf", "flashcontent", "100%", "100%", "9.0.0", "/Js/expressInstall.swf", flashvars, params, attributes);
// Set the Flash's minimum size
swffit.fit("flashcontent", 1020, 768);

//	var height = $(window).height();
/*
	var flashvars = {};
	var ran = Math.random(1000);
    
	embedFlash ({
	    url: "Images/bg_main.swf",
		width: "100%", 
		height: "100%",
		flashPlayerID: "flashcontent",
		flashVersion: "9",
		wmode: 'transparent',
        allowScriptAccess:"always",
        flashvars: 'xmlpath=config.xml?nocache=' + ran
	});
	
*/
	$('.SearchField input').bind('keypress', function(e) {
        if(e.keyCode==13){
				var text = $('.SearchField input').val();
				url='search.php?val='+text;
               $(location).attr('href',url);
			   return false;
        }
	});
	
});

/* ========================== MY ================================ */
function myPop(strURL){
	var strlink = 'pop.php?url='+strURL;
	adWindow = window.open(strlink, "img", "height=550,width=800,scrollbars=yes,left=50,top=50,menubar=no,location=no,resizable=yes,toolbar=no");
		adWindow.focus();
}

function showCotent(id) {
    $('.wr_nd').attr('style', 'display:none;');
    $('.chua_hinh_dv').attr('style', 'display:none;');
    $('.wr_danhmuc_left li').removeClass('active');
    $("#content_" + id).attr('style', 'position: absolute; z-index: 10; display:block;');
    $("#cImage_" + id).attr('style', 'position: absolute; z-index: 9; display:block;');
    $("#content_" + id).addClass('current');
    $("#menu_" + id).addClass('active');
}

function showCotentSer(id) {
    $("#js_detail").attr('style', 'display:none;');
    $('.wr_nd').attr('style', 'display:none;');
    $('.chua_hinh_dv').attr('style', 'display:none;');
    $('.wr_danhmuc_left li').removeClass('active');
    $("#content_" + id).attr('style', 'position: absolute; z-index: 10; display:block;');
    $("#cImage_" + id).attr('style', 'position: absolute; z-index: 9; display:block;');
    $("#content_" + id).addClass('current');
    $("#menu_" + id).addClass('active');
}


