﻿//Print Page
var gAutoPrint = true; // Flag for whether or not to automatically call the print function
function printSpecial()
{
	if (document.getElementById != null)
	{
		var html = '<HTML>\n<HEAD>\n';
		if (document.getElementsByTagName != null)
		{
			var headTags = document.getElementsByTagName("head");
			if (headTags.length > 0)
				html += headTags[0].innerHTML;
		}
		html += '\n</HE' + 'AD>\n<BODY bgcolor=\"#FFFFFF\" style=\"width:775px;padding:5px;font-family:tahoma\">\n';
		html += '<div>\n'
		//html += '<img src=\"/images/global/viettri.net.vn.jpg\" style=\"margin-bottom:20px\">\n'

		var containerElem = document.getElementById("container");
		if (containerElem != null)
		{
				html += containerElem.innerHTML;
		}
		else
		{
			alert("Could not find the container section in the HTML");
			return;
		}
		html += '</div>\n'
		html += '\n</BO' + 'DY>\n</HT' + 'ML>';
		var printWin = window.open("","printSpecial");
		printWin.document.open();
		printWin.document.write(html);
		printWin.document.close();
		if (gAutoPrint)
			printWin.print();
	}
	else
	{
		alert("Sorry, the print ready feature is only available in modern browsers.");
	}
}

//Bookmark page
	function AddBookmark()
	{
		if((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function") ) {
			window.sidebar.addPanel( document.title, location.href,  "" );
		} else if( document.all ) {
			if(navigator.appName.indexOf('Microsoft') >= 0 ) {
				window.external.AddFavorite( location.href, document.title );
			} else if (navigator.appName && navigator.appName.indexOf("Netscape")>=0 ) {
				document.alert( "To bookmark press Ctrl-D in browser" );
			}
		} else if( window.opera && window.print ) {
			return true;
		}	
	}


