function updateInfo(cat, upd) {
	var inf = {};
	var valid = 1;
	try {
		if (typeof(upd) == "string") inf = $.evalJSON(upd);
		else inf = upd;
	} catch (e) { valid = 0; }
	if (valid) {
		for (var i in inf) {
			info[cat][i] = inf[i];
		}
		saveInfo(cat);
		return upd.length;
	}
}

function saveInfo(cat) {
	$.ajax({
		"url"      : "/",
		"type"     : "POST",
		"data"     : { "action" : "save_info", "key" : key, "category" : cat, "info" : $.toJSON(info[cat]) },
		"success"  : function() {
						if (checkingStatus == 0) {
							checkingStatus++;
							checkStatus();
						}
					 },
		"error"    : function() {
						connAttempts--;
						if (connAttempts <= 0) alert("Connection error while saving info.");
						else setTimeout(function() { saveInfo(cat); }, 500);
					 }
	});
}

function checkStatus() {
	$.ajax({
		"url"      : "/",
		"type"     : "GET",
		"dataType" : "json",
		"data"     : { "action" : "get_status", "key" : key, "rnd" : Math.random(), "cycles" : waitResults, "nw" : noWait.join(",") },
		"success"  : function(data) {
						if (typeof(data.status) == "string") {
							setProgress(data.progress, data.details);
							if (data.status == "Completed" && result == 0) {
								result = 1;
								$.get("/?action=get_report&key=" + key + "&rnd=" + Math.random(), function(data) {
									setProgress(100, data.details);
									$(".content-inner").fadeTo(125, 0, function() {
										$(".content-inner").remove();
										$("#report").html(data);
										setTimeout(function() {
											$(".scroll-div").bind('mousewheel', function(e, d) {  
												if (d > 0 && $(this).scrollTop() == 0)  
													e.preventDefault(); 
												else  
													if (d < 0 &&  $(this).scrollTop() == $(this).get(0).scrollHeight - $(this).innerHeight())  
														e.preventDefault()  
											});
											$('table.info-table').each(function() {
												$(this).find('tr.data').filter(':even').addClass('even');
												$(this).find('tr.data').filter(':odd').addClass('odd');
											})
											$(".fbox").fancybox({'width':'80%','height':'80%','autoScale':false,
																 'transitionIn':'none','transitionOut':'none',
																 'type':'iframe','hideOnOverlayClick':false});
											$("#ec-div").remove();
											setTimeout(function() {
												$(".likebox").load("/?action=get_share");
												$(".extra160").load("/?action=get_extra160");
											}, 200);
										}, 500);
									});
								});
							} else if (data.status == "Waiting") {
								waitResults--;
								if (waitResults <= 0) alert("No result.");
								else setTimeout("checkStatus()", 500);
							}
						} else {
							connAttempts--;
							if (connAttempts <= 0) alert("Connection error while getting status.");
							else setTimeout("checkStatus()", 500);
						}
					 },
		"error"    : function() {
						connAttempts--;
						if (connAttempts <= 0) alert("Connection error while getting status.");
						else setTimeout("checkStatus()", 500);
					 }
	});
}

function setProgress(pr, dt) {
	if (typeof(dt) == "object") {
		for (var i = 0; i < dt.length; i++) {
			if ($.inArray(dt[i], progressDetails) == -1) {
				progressDetails.push(dt[i]);
				if ($.inArray(dt[i], noWait) >= 0) $("#" + dt[i] + "-name").css("text-decoration", "line-through");
				else $("#" + dt[i] + "-name").css("color", "#3b3933");
			}
		}
	}
	if (pr > progress) {
		progress = pr;
		$("#progress-bar").progressbar({ value: progress });
	}
}

function gatherInfo1() {
	if (typeof(navigator.platform) != "undefined") {
		navPlatform = navigator.platform.toLowerCase();
	}
	
	// navigator

	var fl = false;
	info["js"]["navigator_objects"] = new Array();	
	for (var i in navigator) {
		try {
			var v = {"name" : i, "value" : "" + navigator[i], "type" : typeof(navigator[i])};
			if (v.type == "string" && v.value.indexOf(">") >= 0) v.value = "[html]";
			if (v.type == "function") v.value = "[" + v.type + "]";
			info["js"]["navigator_objects"].push(v);
		} catch(e) {}
	}
	if (navigator.plugins) {
		info["js"]["navigator_plugins"] = new Array();
		for (var i = 0; i < navigator.plugins.length; i++) {
			var p = navigator.plugins[i];
			if (p.name == "Shockwave Flash") fl = true;
			info["js"]["navigator_plugins"].push({"name" : p.name, "description" : p.description, "version" : parseInt(p.version), "filename" : p.filename});
		}
	}
	if (navigator.mimeTypes && navigator.mimeTypes.length) {
		info["js"]["mime_types"] = new Array();
		for (var i = 0; i < navigator.mimeTypes.length; i++) {
			var m = navigator.mimeTypes[i];
			if (m.type == "application/x-shockwave-flash" || m.suffixes == "swf") fl = 1;
			info["js"]["mime_types"].push({ "type" : m.type, "description" : m.description, "suffixes" : m.suffixes }); 
		}
	}
	if (!is_ie && !fl) noWait.push("fl");

	// Java Version

	try {
		info["js"]["java_version"] = java.lang.System.getProperty("java.version");
		info["js"]["java_vm_version"] = java.lang.System.getProperty("java.vm.version");
	} catch(e) {}
	info["js"]["jre_versions"] = deployJava.getJREs();
	if ((!info["js"]["jre_versions"][0] && !info["js"]["java_version"]) || navPlatform.indexOf("mac") > -1) noWait.push("jv");
}

function gatherInfo2() {
	// Adobe Acrobat

	var o = createObject("AcroPDF.PDF.1");
	if (typeof(o) == "object") {
		var vs = o.GetVersions().split(',');
		var v = 0;
		try {
			v = parseFloat((vs[1].split('='))[1]);
		} catch (e) {
			v = 0;
		}
		info["js"]["acrobat_reader"] = { "installed" : 1, "version" : v };
	}

	// Ajax Support
	
	var r;
	var r_type;
	try {
		r = new XMLHttpRequest();
		r_type = "XMLHttpRequest";
	} catch (e) {
		try {
   			r = new ActiveXObject("Msxml2.XMLHTTP");
   			r_type = "ActiveX Msxml2.XMLHTTP";
  		} catch (e) {
   			try {
    			r = new ActiveXObject("Microsoft.XMLHTTP");
    			r_type = "ActiveX Microsoft.XMLHTTP";
   			} catch (e) {}
  		}
 	}
	if (typeof(r) == "object") {
  		info["js"]["xmlhttprequest_support"] = 1;
  		info["js"]["xmlhttprequest_type"] = r_type;
 	}
	var s;
	try {
		s = new XMLSerializer();
	} catch (e) {}
	if (s) info["js"]["xmlserializer_support"] = 1;
	var x;
	var x_type;
	try {
		new ActiveXObject("Microsoft.XMLDOM");
		x = 1;
		x_type = "ActiveX Microsoft.XMLDOM";
	} catch (e) {
		try {
			var parser = new DOMParser();
			x = 1;
			x_type = "DOMParser";
		} catch (e) {}
	}
	if (x) {
		info["js"]["xml_parser_support"] = 1;
		if (x_type) info["js"]["xml_parser_type"] = x_type;
	}
	
	// IE Components

	if (is_ie) {
		var cl = new Array(
			["AOL ART Image Format", "{47F67D00-9E55-11D1-BAEF-00C04FC2D130}"],
			["Address Book", "{7790769C-0471-11D2-AF11-00C04FA35D02}"],
			["Arabic Text Display", "{76C19B38-F0C8-11CF-87CC-0020AFEECF20}"],
			["Chinese (Simplified) Text Display", "{76C19B34-F0C8-11CF-87CC-0020AFEECF20}"],
			["Chinese (Traditional) Text Display", "{76C19B33-F0C8-11CF-87CC-0020AFEECF20}"],
			["DirectAnimation Java Classes", "{4F216970-C90C-11D1-B5C7-0000F8051515}"],
			["DirectAnimation", "{283807B5-2C60-11D0-A31D-00AA00B92C03}"],
			["DirectShow", "{44BBA848-CC51-11CF-AAFA-00AA00B6015C}"],
			["Dynamic HTML Data Binding for Java", "{4F216970-C90C-11D1-B5C7-0000F8051515}"],
			["Dynamic HTML Data Binding", "{9381D8F2-0288-11D0-9501-00AA00B911A5}"],
			["Hebrew Text Display", "{76C19B36-F0C8-11CF-87CC-0020AFEECF20}"],
			["Internet Connection Wizard", "{5A8D6EE0-3E18-11D0-821E-444553540000}"],
			["Internet Explorer Web Browser", "{89820200-ECBD-11CF-8B85-00AA005B4383}"],
			["Internet Explorer Browsing Enhancements", "{630B1DA0-B465-11D1-9948-00C04F98BBC9}"],
			["Internet Explorer Classes for Java", "{08B0E5C0-4FCB-11CF-AAA5-00401C608555}"],
			["Internet Explorer Help Engine", "{DE5AED00-A4BF-11D1-9948-00C04F98BBC9}"],
			["Internet Explorer Help", "{45EA75A0-A269-11D1-B5BF-0000F8051515}"],
			["Japanese Text Display", "{76C19B30-F0C8-11CF-87CC-0020AFEECF20}"],
			["Korean Text Display", "{76C19B31-F0C8-11CF-87CC-0020AFEECF20}"],
			["Language Auto-Selection", "{76C19B50-F0C8-11CF-87CC-0020AFEECF20}"],
			["Macromedia Flash", "{D27CDB6E-AE6D-11CF-96B8-444553540000}"],
			["Macromedia Shockwave Director", "{2A202491-F00D-11CF-87CC-0020AFEECF20}"],
			["Microsoft virtual machine", "{08B0E5C0-4FCB-11CF-AAA5-00401C608500}"],
			["NetMeeting NT", "{44BBA842-CC51-11CF-AAFA-00AA00B6015B}"],
			["Offline Browsing Pack", "{3AF36230-A269-11D1-B5BF-0000F8051515}"],
			["Outlook Express", "{44BBA840-CC51-11CF-AAFA-00AA00B6015C}"],
			["Pan-European Text Display", "{76C19B32-F0C8-11CF-87CC-0020AFEECF20}"],
			["Task Scheduler", "{CC2A9BA0-3BDD-11D0-821E-444553540000}"],
			["Thai Text Display", "{76C19B35-F0C8-11CF-87CC-0020AFEECF20}"],
			["Uniscribe", "{3BF42070-B3B1-11D1-B5C5-0000F8051515}"],
			["VRML 2.0 Viewer", "{90A7533D-88FE-11D0-9DBE-0000C0411FC3}"],
			["Vector Graphics Rendering (VML)", "{10072CEC-8CC1-11D1-986E-00A0C955B42F}"],
			["Vietnamese Text Display", "{76C19B37-F0C8-11CF-87CC-0020AFEECF20}"],
			["Visual Basic Scripting", "{4F645220-306D-11D2-995D-00C04F98BBC9}"],
			["Wallet", "{1CDEE860-E95B-11CF-B1B0-00AA00BBAD66}"],
			["Web Folders", "{73FA19D0-2D75-11D2-995D-00C04F98BBC9}"],
			["Windows Desktop Update NT", "{89820200-ECBD-11CF-8B85-00AA005B4340}"],
			["Windows Media Player RealNetwork", "{23064720-C4F8-11D1-994D-00C04F98BBC9}"],
			["Windows Media Player", "{22D6F312-B0F6-11D0-94AB-0080C74C7E95}"]
		);
		info["js"]["ie_components"] = new Array();
		for (var i = 0; i < cl.length; i++) {
			var cc = checkComp(cl[i][0],cl[i][1]);
			if (cc.installed) info["js"]["ie_components"].push(cc);
		}
	}

	// Date and Time

	var n = new Date();
	if (typeof(n) == "object") info["js"]["datetime_today"] = n;
	if (typeof(n.toGMTString) == "function") info["js"]["datetime_today_gmt"] = n.toGMTString();
	if (typeof(n.toLocaleString) == "function") info["js"]["datetime_today_local"] = n.toLocaleString();
	if (typeof(n.getTimezoneOffset) == "function") info["js"]["datetime_timezone_offset"] = n.getTimezoneOffset();
	if (typeof(Date.parse(n)) == "number") info["js"]["datetime_miliseconds_since_1970"] = Date.parse(n);

	// Document Object

	if (typeof(document.defaultCharset) == "string") info["js"]["document_defaultcharset"] = document.defaultCharset;
	if (typeof(document.implementation) != "undefined") {
		info["js"]["document_features"] = "";
		var f = new Array("HTML","XML","Views","StyleSheets","CSS","CSS2","Events","UIEvents",
                          "MouseEvents","MutationEvents","HTMLEvents","Traversal","Range");
		var v = new Array(null,"1.0","2.0","3.0","4.0");
		info["js"]["document_features"] = new Array();
		for (var i = 0; i < f.length; i++) {
			for (var j = 0; j < v.length; j++) {
				if (document.implementation.hasFeature(f[i], v[j]))
					info["js"]["document_features"].push(v[j] ? f[i] + " " + v[j] : f[i]);
			}
		}s
	}
	
	// JavaScript Version

	var b;
	if (is_ie)
		try {
			b = ScriptEngineMajorVersion() + "." + ScriptEngineMinorVersion() + "." + ScriptEngineBuildVersion();
		} catch(e) {}
	if (b) info["js"]["javascript_build"] = b;
	info["js"]["javascript_version"] = jsver;

	// PSM

	if (typeof(crypto) != "undefined" && typeof(crypto.version) == "string") info["js"]["psm"] = crypto.version;

	// Screen
	// <div id="inch" style="width: 1in; height: 1in; position: absolute">&nbsp;</div>
	
	info["js"]["wdpi"] = document.getElementById("inch").offsetWidth;
	info["js"]["hdpi"] = document.getElementById("inch").offsetHeight;
 	info["js"]["screen_objects"] = new Array();
	for (var i in screen) {
		try{
			info["js"]["screen_objects"].push({"name" : i, "value" : "" + screen[i], "type" : typeof(screen[i])});
		} catch(e) {}
	}
 
	// silverlight

// 	var vs = new Array("1.0", "2.0", "3.0", "4.0", "5.0", "6.0", "7.0");
// 	for (var i = vs.length - 1; i > 0; i--) {
// 		try{
// 			if (Silverlight.isInstalled(vs[i])) {
// 				info["js"]["silverlight"] = vs[i];
// 				break;
// 			}
// 		} catch(e) {}
// 	}

	// Other

	var cl = new Array(
		["sun_java", "JavaSoft.JavaBeansBridge.1"], ["microsoft_agent_ver_1", "Agent.Control.1"],
		["microsoft_agent_ver_2", "Agent.Control.2"], ["microsoft_animation_control", "ComCtl2.Animation.1"],
		["ipix", "IPIX.ActiveXCtrl.5"], ["metastream", "AxMetaStream.MetaStreamCtl.1"],
		["citrix", "Wfica.WficaCtl.1"], ["citrix", "Citrix.ICAClient"],
		["autodesk_mapguide", "Autodesk.MGMap.1"], ["microsoft_office_tools", "Outc.TC.1"],
		["microsoft_office_update", "OPUCatalog.OPUCatalog.1"], ["microsoft_windows_update", "IUCtl.Update.1"],
		["rp_realplayer", "RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)"], ["rp_realvideo", "RealVideo.RealVideo(tm) ActiveX Control (32-bit)"],
		["svg_viewer", "Adobe.SVGCtl"]
  	);
	for (var i = 0; i < cl.length; i++) {
		var cc = canCreate(cl[i][1]);
		if (cc) info["js"][cl[i][0]] = cc;
	}
	var o = createObject("SWCtl.SWCtl");
	if (typeof(o) == "object") info["js"]["shockwave"] = o.ShockwaveVersion("");
	var o = createObject("ShockwaveFlash.ShockwaveFlash");
	if (typeof(o) == "object") info["js"]["shockwave_flash"] = o.GetVariable("$version");
	if (is_ie && !info["js"]["shockwave"] && !info["js"]["shockwave_flash"]) noWait.push('fl');
	var o = createObject("rmocx.RealPlayer G2 Control");
	if (typeof(o) == "object") {
		info["js"]["rp_realplayer"] = 1;
		info["js"]["rp_realplayerg2"] = 1;
		info["js"]["rp_realplayerplus"] = o.GetIsPlus();
		var n = o.GetVersionInfo();
		if (n) info["js"]["rp_realplayer"] = n;
	}
	var o = createObject("IERPCtl.IERPCtl.1");
	if (typeof(o) == "object") {
		info["js"]["rp_realone"] = 1;
		info["js"]["rp_realone"] = o.RealPlayerVersion();
		var c = o.InstalledComponents();
		info["js"]["rp_realvideo"] = o.ComponentVersion("RV:6.0");
	}
	var o = createObject("QuickTimeCheckObject.QuickTimeCheck.1");
	if (typeof(o) == "object" && o.IsQuickTimeAvailable(0)) info["js"]["rp_realplayerplus"] = hex(o.QuickTimeVersion);
	var o = createObject("Alttiff.AlternaTIFF ActiveX.1");
	if (typeof(o) == "object") info["js"]["alternatiff"] = o.GetVersion();	
	var o = createObject("Autodesk.MGMap.1");
	if (typeof(o) == "object") {
		info["js"]["autodesk_mapguide"] = o.version();
		try {
			info["js"]["autodesk_mapguide"] += " " + o.ViewerType() + " " + o.ApiVersion();
		} catch(e) {}
	}
	if (canCreate("Msxml2.DOMDocument.4.0")) info["js"]["msxml"] = "4.0";
	else if (canCreate("Msxml2.DOMDocument.3.0")) info["js"]["msxml"] = "3.0";
	else if (canCreate("Msxml2.DOMDocument.2.6")) info["js"]["msxml"] = "2.6";
	else if (canCreate("Msxml2.DOMDocument")) info["js"]["msxml"] = "2.0";
	else if (canCreate("Microsoft.XMLDOM")) info["js"]["msxml"] = "1.0";
	var o = createObject("Messenger.MsgrObject");
	if (typeof(o) == "object") info["js"]["microsoft_messenger"] = o.LocalState();
	var o = createObject("SealedMedia.UnsealerPlugin.1");
	if (typeof(o) == "object") info["js"]["dotencrypt"] = o.majorVersion() + "." + o.minorVersion() + "." + o.revisionNumber() + "." + o.buildNumber();
	var o = createObject("Cycore.Cult3D");
	if (typeof(o) == "object") info["js"]["cult3d"] = o.Version();
	if (typeof(v_vbscript) != "undefined") info["js"]["vbscript"] = v_vbscript;

	info["js"]["fonts"] = getFonts();

	info["js"]["visited"] = checkVisited();
}

function checkComp(cname, cid) {
	var c = { "name" : cname, "id" : cid, "installed" : 0 };
	if (typeof(sibody) != "undefined" && typeof(sibody.id) != "undefined" && typeof(sibody.getComponentVersion) != "undefined"
		&& sibody.isComponentInstalled(cid, "ComponentID")) {
		c.installed = 1;
		var v = sibody.getComponentVersion(cid, "ComponentID");
		if (v) c.version = v;
	}
	return c;
}

function createObject(name) {
	var o;
	if (is_ie)
		try {
			o = new ActiveXObject(name);
		} catch(e) {}
	else
		try {
			o = new GeckoActiveXObject(name);
		} catch(e) {}
	return typeof(o) == "object" ? o : 0;
}

function canCreate(name) {
	var o = createObject(name);
	return typeof(o) == "object" ? 1 : 0;
}

var cfniw = 0;
var cftb = null;
var cfid = 0;
var jflist = new Array(
	"Adobe Caslon Pro", "Adobe Garamond", "Adobe Garamond Pro", "Agency FB", "Aharoni", "Algerian", "American Typewriter",
	"Andale Mono", "Andalus", "Angsana New", "AngsanaUPC", "Apple Chancery", "Arabic Transparent", "Arabic Typesetting",
	"Archer", "Arial", "Arial Baltic", "Arial Black", "Arial CE", "Arial CYR", "Arial Greek", "Arial Narrow", "Arial Rounded MT Bold",
	"Arial TUR", "Arial Unicode MS", "Arno Pro", "Avenir", "Ayuthaya", "Bandy", "Bank Gothic", "Baskerville Old Face", "Batang",
	"BatangChe", "Bauer Bodoni", "Bauhaus 93", "Bell Mt", "Bell MT", "Bembo", "Berlin Sans FB", "Bernard MT Condensed", "Big Caslon",
	"Blackadder ITC", "Blairmditc Tt", "Bodoni MT", "Book Antiqua", "Bookman Old Style", "Bookshelf Symbol 7", "Bradley Hand ITC",
	"Britannic Bold", "Broadway", "Browallia New", "BrowalliaUPC", "Brush Script MT", "Calibri", "Californian FB", "Calisto MT",
	"Cambria", "Candara", "Castellar", "Centaur", "Century", "Century Gothic", "Century Schoolbook", "Chalkboard", "Chiller",
	"Clarendon", "Cochin", "Colonna MT", "Comic Sans", "Comic Sans MS", "Consolas", "Constantia", "Cooper Black", "Copperplate Gothic",
	"Corbel", "Cordia New", "CordiaUPC", "Courier", "Courier New", "Courier New Baltic", "Courier New CE", "Courier New CYR",
	"Courier New Greek", "Courier New TUR", "Curlz MT", "DaunPenh", "David", "Delicious", "DFKai-SB", "Didot", "DilleniaUPC",
	"Din", "DokChampa", "Dotum", "DotumChe", "Edwardian Script ITC", "Elephant", "Engravers MT", "Eras Bold ITC", "Estrangelo Edessa",
	"EucrosiaUPC", "Euphemia", "Eurostile", "FangSong", "Felix Titling", "Fontin", "Footlight MT Light", "Forte", "Franklin Gothic",
	"FrankRuehl", "FreesiaUPC", "Freestyle Script", "French Script MT", "Fruitger", "Futura", "Gabriola", "Garamond", "Gautami",
	"Geneva", "Georgia", "Gigi", "Gill Sans", "Gisha", "Gotham", "Goudy Old Style", "Goudy Stout", "Gulim", "GulimChe", "Gungsuh",
	"GungsuhChe", "Haettenschweiler", "Harlow Solid Italic", "Harrington", "Helv", "Helvetica", "Helvetica Neue", "High Tower Text",
	"Hoefler Text", "Impact", "Imprint MT Shadow", "Inconsolata", "Informal Roman", "Interstate", "IrisUPC", "Iskoola Pota",
	"JasmineUPC", "Jazz Let", "Jenson", "Jokerman", "Juice ITC", "KaiTi", "Kalinga", "Kartika", "KodchiangUPC", "Kristen ITC",
	"Krungthep", "Kunstler Script", "Latha", "Leelawadee", "Levenim MT", "Liberation Mono", "Liberation Sans", "Liberation Sans Narrow",
	"Liberation Serif", "LilyUPC", "Lucida Bright", "Lucida Calligraphy", "Lucida Console", "Lucida Fax", "Lucida Grande",
	"Lucida Handwriting", "Lucida Sans", "Lucida Sans Typewriter", "Lucida Sans Unicode", "Magneto", "Maiandra GD", "Malgun Gothic",
	"Mangal", "Marker Felt", "Marlett", "Matura MT Script Capitals", "Meiryo", "Meiryo UI", "Microsoft Himalaya", "Microsoft JhengHei",
	"Microsoft Sans Serif", "Microsoft Uighur", "Microsoft YaHei", "Microsoft Yi Baiti", "MingLiU", "MingLiU_HKSCS", "Minion",
	"Minion Pro", "Miriam", "Mistral", "Modern No. 20", "Monaco", "Mongolian Baiti", "Mono", "Monospace", "Monotype Corsiva",
	"MoolBoran", "Mrs Eaves", "MS Gothic", "MS Mincho", "MS Outlook", "MS PGothic", "MS PMincho", "MS Reference Sans Serif",
	"MS Reference Specialty", "MS UI Gothic", "MT Extra", "Museo", "MV Boli", "Myriad", "Myriad Pro", "Nadeem", "Narkisim",
	"Nevis", "News Gothic", "Niagara Engraved", "Niagara Solid", "NSimSun", "Nyala", "OCR A Extended", "Old English Text MT",
	"Onyx", "Optima", "Osaka", "Palace Script MT", "Palatino", "Palatino Linotype", "Papyrus", "Parchment", "Perpetua",
	"Perpetua Titling MT", "Petitabold", "Plantagenet Cherokee", "Playbill", "PMingLiU", "Poor Richard", "Princetown Let",
	"Pristina", "Raavi", "Rage Italic", "Ravie", "Rockwell", "Rod", "Santa Fe Let", "Savoye Let", "Script", "Scriptina",
	"Script MT Bold", "Segoe Print", "Segoe Script", "Segoe UI", "Showcard Gothic", "Shruti", "Silkscreen", "SimHei",
	"Simplified Arabic", "SimSun", "Sketch Rockwell", "Skia", "Snap ITC", "Snell Roundhand", "Stencil", "Styllo", "Sylfaen",
	"Symbol", "Synchro Let", "System", "Tahoma", "Tempus Sans ITC", "Times", "Times New Roman", "Times New Roman Baltic",
	"Times New Roman CE", "Times New Roman CYR", "Times New Roman Greek", "Times New Roman TUR", "Traditional Arabic",
	"Trajan", "Trajan Pro", "Trebuchet MS", "Tunga", "Tw Cen MT", "Univers", "Verdana", "Viner Hand ITC", "Vivaldi",
	"Vladimir Script", "Vrinda", "Webdings", "Whitney", "Wide Latin", "Wingdings", "Wingdings 2", "Wingdings 3", "Zapfino"
);

function checkFont(font) {
	var ts = "qwertyuiopasdfghjklzxcvbnm1234567890";
	var tf = "Arial Black";	
	
	if (!$('#fontInstalledTest').length) {
		$('head').append('<style> #fontInstalledTest, #fontTestBed { position: absolute; left: -9999px; top: 0; visibility: hidden; } #fontInstalledTest { font-size: 25px!important; font-family: "' + tf + '";}</style>');
		$('body').append('<div id="fontTestBed"></div>').append('<span id="fontInstalledTest" class="fonttest">' + ts + '</span>');
		cftb = $('#fontTestBed');
		cfniw = $('#fontInstalledTest').width();
	}
	
	cfid++;
	var style = '<style id="fonttestStyle"> #fonttest' + cfid + ' { font-size: 25px!important; font-family: "' + font + '", "' + tf + '"; } </style>';
	$('head').find('#fonttestStyle').remove().end().append(style);
	cftb.empty().append('<span id="fonttest' + cfid + '" class="fonttest">' + ts + '</span>');
	var w = cftb.find('span').width();

	return (w != cfniw);
}

function getFonts() {
	var jf = new Array();
	for (var i = 0; i < jflist.length; i++) {
		if (checkFont(jflist[i])) jf.push(jflist[i]);
	}
	return jf;
}

function checkVisited() {
	var sites = {
		"aliveproxy.com": ["http://www.aliveproxy.com/"],
		"anonymouse.org": ["http://www.anonymouse.org/"],
		"awmproxy.com": ["http://www.awmproxy.com/", "http://awmproxy.com/freeproxy.php"],
		"azproxies.com": ["http://www.azproxies.com/"],
		"cgiproxylist.com": ["http://www.cgiproxylist.com/"],
		"cool-proxy.ru": ["http://cool-proxy.ru/"],
		"digitalcybersoft.com": ["http://www.digitalcybersoft.com/ProxyList/", "http://www.digitalcybersoft.com/ProxyList/fresh-proxy-list.shtml"],
		"fastproxynetwork.com": ["http://www.fastproxynetwork.com/"],
		"forums.webproxytalk.com": ["http://forums.webproxytalk.com/"],
		"free-proxy-list.info": ["http://www.free-proxy-list.info/"],
		"freeproxies.org": ["http://www.freeproxies.org/"],
		"freeproxy.ca": ["http://www.freeproxy.ca/"],
		"freeproxy.ru": ["http://www.freeproxy.ru/", "http://www.checker.freeproxy.ru/checker/", "http://www.freeproxy.ru/ru/free_proxy/"],
		"freeproxyinc.com": ["http://www.freeproxyinc.com/"],
		"freeproxylists.com": ["http://www.freeproxylists.com/"],
		"freeproxyserver.net": ["http://www.freeproxyserver.net/"],
		"freeproxysite.com": ["http://www.freeproxysite.com/"],
		"freeproxysites.biz": ["http://www.freeproxysites.biz/"],
		"freeproxysites.us": ["http://www.freeproxysites.us/"],
		"hideme.ru": ["http://hideme.ru/"],
		"hidemyass.com": ["http://www.hidemyass.com/", "http://forum.hidemyass.com/"],
		"my-proxy.com": ["http://www.my-proxy.com/", "http://forum.my-proxy.com/", "http://proxies.my-proxy.com/"],
		"newipnow.com": ["http://www.newipnow.com/"],
		"proxeasy.com": ["http://www.proxeasy.com/"],
		"proxies.us": ["http://www.proxies.us/"],
		"proxify.co.uk": ["http://www.proxify.co.uk/"],
		"proxify.com": ["http://www.proxify.com/"],
		"proxy-list.org": ["http://www.proxy-list.org/en/index.php","http://www.proxy-list.org/"],
		"proxy.org": ["http://www.proxy.org/", "http://www.proxy.org/cgi_proxies.shtml", "http://www.proxy.org/forum/index.html"],
		"proxy4free.com": ["http://www.proxy4free.com/"],
		"proxyblind.org": ["http://www.proxyblind.org/proxyblind-forum/","http://www.proxyblind.org/"],
		"proxylist.sakura.ne.jp": ["http://proxylist.sakura.ne.jp/"],
		"proxyserverfinder.com": ["http://www.proxyserverfinder.com/"],
		"publicproxyservers.com": ["http://www.publicproxyservers.com/"],
		"russianproxy.ru": ["http://russianproxy.ru/", "http://russianproxy.ru/proxy_list_http_fastest"],
		"samair.ru": ["http://www.samair.ru/proxy/"],
		"spys.ru": ["http://www.spys.ru/", "http://www.spys.ru/en/"],
		"sslunblock.com": ["http://www.sslunblock.com/"],
		"tools.rosinstrument.com": ["http://tools.rosinstrument.com/proxy/"],
		"totalnetprivacy.com": ["http://www.totalnetprivacy.com/"],
		"webevader.org": ["http://webevader.org/"],
		"xroxy.com": ["http://www.xroxy.com/", "http://www.xroxy.com/proxylist.htm"],
		"youhide.com": ["http://www.youhide.com/"],
	};
	var visited = {};
	function getStyle(el, scopeDoc,styleProp) {
		if (el.currentStyle) var y = el.currentStyle[styleProp];
		else if (window.getComputedStyle) var y = scopeDoc.defaultView.getComputedStyle(el,null).getPropertyValue(styleProp);
		return y;
	}
	function remove( el ) {
		el.parentNode.removeChild( el );
	}
	function createIframe() {
		var iframe = document.createElement("iframe");
		iframe.style.position = "absolute";
		iframe.style.visibility = "hidden";
		document.body.appendChild(iframe);
		if(iframe.contentDocument) iframe.doc = iframe.contentDocument;
		else if(iframe.contentWindow) iframe.doc = iframe.contentWindow.document;
		iframe.doc.open();
		iframe.doc.write('<style>');
		iframe.doc.write("a{color: #000000; display:none;}");		
		iframe.doc.write("a:visited {color: #FF0000; display:inline;}");		
		iframe.doc.write('</style>');
		iframe.doc.close();
		return iframe;
	}	
	var iframe = createIframe();
	function embedLinkInIframe( href, text ) {
		var a = iframe.doc.createElement("a");
		a.href = href;
		a.innerHTML = site;
		iframe.doc.body.appendChild( a );
	}
	for( var site in sites ) {
		var urls = sites[site];
		for( var i=0; i<urls.length; i++ ) {
			embedLinkInIframe( urls[i], site );
			if( urls[i].match(/www\./) ){
				var sansWWW = urls[i].replace(/www\./, "");
				embedLinkInIframe( sansWWW, site );
			} else {
				var httpLen = urls[i].indexOf("//") + 2;
				var withWWW = urls[i].substring(0, httpLen ) + "www." + urls[i].substring( httpLen );
				embedLinkInIframe( withWWW, site );
			}
		}
	}
	var links = iframe.doc.body.childNodes;
	for( var i=0; i<links.length; i++) {
		var displayValue = getStyle(links[i], iframe.doc, "display");
		if (displayValue != "none"){
			visited[ links[i].innerHTML ] = true;
		}
	}
	remove( iframe );
	var usedSites = [];
	for( var site in visited ){
		usedSites.push( site );
	}
	return usedSites;
}

