﻿/// <reference name="MicrosoftAjax.js"/>
var currentVersion = "1.0.21";

function pageLoad()
{
	$telerik.$("a").each(	function(element)
							{
								if (this.href != null)
								{
									if	(
											(this.href.indexOf("fireatlas") < 0)
										&&
											(this.href.indexOf("localhost") < 0)
										&&
											(this.href.indexOf("javascript:") < 0)
										)
									{
										if (this.title != null)
										{
											this.title += " (external link)";
										}
										
										this.target="_tab";
									}
								}
							});

	setTimeout(	testFireAtlasVersion,
				1000);
}

function testFireAtlasVersion()
{
	if ("_fireatlasProxy" in window)
	{
		var version = window._fireatlasProxy.version;
		if (version == null)
		{
			version = "0.unknown";
		}
		
		if (currentVersion > version)
		{
			console.log("FireAtlas detected: version (" + version + ") is outdated, download version " + currentVersion);
		}
		else
		{
			console.log("FireAtlas detected: version (" + version + ") is up-to-date");
		}
	}
}

function buttonSuccessWSClick()
{
	return Sys.Net.WebServiceProxy.invoke(	"WebService.asmx",
											"HelloWorld",
											false);
}
function buttonFailureWSClick()
{
	return Sys.Net.WebServiceProxy.invoke(	"WebService.asmx",
											"MyUndefinedMethod",
											false, 
											null,
											null,
											null,
											null,
											10000);
}
