	// --------------------------------------------------
	// Coded by Kirsanov Anton (anton.kirsanov@gmail.com)

	// -------------------------
	// Javascript font detection
	// -------------------------

	// Settings

	var font_string = "abcdefghijklmnopqrstuvwxyz0123456789";
	var font_size = "1000000%";

	function font_installed(fontname)
	{

		default_status = check_font('');
		current_status = check_font(fontname);

		if(default_font(fontname)) return true;

		if(default_status != current_status) return true;
		return false;
	
	}


	function default_font(fontname)
	{

		var df; 

		// IE & Opera

		if(document.body.currentStyle) 
		
			df = document.body.currentStyle.fontFamily;

		// Mozilla & Firefox

		else 

			df = document.defaultView.getComputedStyle(document.body,'').getPropertyValue('font-family'); 


		if(df.substring(0,1) == '"' || df.substring(0,1) == "'") df = df.substring(1, df.length-1);

		if(fontname.toLowerCase() == df.toLowerCase()) return true;
		return false;

	}
	
		
	function check_font(font_name)
	{

		div = document.createElement("div");
		document.body.appendChild(div);

		div.style.visibility = 'hidden';
		div.style.padding = '0px';
		div.style.fontSize = font_size;
		div.style.fontFamily = font_name;

		div.innerHTML = font_string;
		size = div.offsetWidth + "x" + div.offsetHeight;

		document.body.removeChild(div);

		return size;

	}