// Functions for User Interaction & Interface
//Last modified: 27 nov 2007

//show login box
function showlogin() {
	showLayer('loginform');
	hideLayer('loginbutton');
}
//quick search default text
//var searcFieldDefault = "Tìm kiếm";
function searchFieldFocus(tf, df) {
	if (tf.value == df) {
		tf.value = "";
	}
}
function searchFieldBlur(tf, df) {
	if (tf.value == "" || tf.value == null) {
		tf.value = df;
	}
}
// simple tab switch
function showLayer (layerid) {
	if (document.getElementById) {
		document.getElementById(layerid).style.display = "block";
	}
}
function hideLayer (layerid) {
	if (document.getElementById) {
		document.getElementById(layerid).style.display = "none";
	}
}
function flipModule(show,hide) {
	if (document.getElementById) {
		document.getElementById(hide).style.display = "none";
		document.getElementById(show).style.display = "block";
	}
}
function switchTab(show,hide) {
	if (document.getElementById) {
		document.getElementById(hide).className  = "taboff";
		document.getElementById(show).className  = "tabon";
	}
}
function showModule(module) {
    $("#exchangerate").hide();
    $("#interestrate").hide();
    $("#chargebox").hide();
    $("#" + module).show();
}
function showTab(tab) {
    $("#extab").attr("class", "taboff");
    $("#irtab").attr("class", "taboff");
    $("#chtab").attr("class", "taboff");
    $("#" + tab).attr("class", "tabon");
}
//bookmark current url
function addFavourite()
{
var bookmarktitle='Vietcombank';
var bookmarkurl = location.href;
if (document.all)
{
//For IE
window.external.AddFavorite(bookmarkurl,bookmarktitle);
}
else if(window.sidebar)
{
//For Firefox
window.sidebar.addPanel(bookmarktitle,bookmarkurl,"")
}
}
//Link target
// BEGIN Configuration
	// The following URLs are considered "on-site", and will be ignored
	// Consider adding both your main URL and the no-ww URL
	var url_1 = "http://www.vcb.com.vn";
	var url_2 = "http://vcb.com.vn";

	// Default link-target preference. What should be default for new users?
	// Value true opens in _blank by default, false opens in _top by default
	var open_blank_default = false;
// END Configuration
// Configure Link Targets
function setTargets() {
	var link, l = 0;
	if (openBlank == true) {
		while (link = document.links[l++]) {
			// Open in _blank, except all links starting with...
			if (link.href.indexOf(url_1) == -1 && link.href.indexOf(url_2) == -1 && link.href.indexOf('javascript') == -1) link.target = '_blank'; 
		}
	} else {
		while (link = document.links[l++]) {
			// Open in _top, except all links starting with...
			if (link.href.indexOf(url_1) == -1 && link.href.indexOf(url_2) == -1 && link.href.indexOf('javascript') == -1) link.target = '_top'; 
		}
	}
}