﻿if (!window.Spark) Spark=new Object(); window.Spark.__namespace=true;
if (!window.Spark.DateTime) Spark.DateTime=new Object();
Spark.DateTime.parse=function(DateValue,Format)
{
	try
	{
		var YearValue=0;
		var MonthValue=0;
		var DayValue=0;
		var Year=new RegExp(/y{2,4}/g).exec(Format);
		if (Year.index==undefined) Year=Year[0];
		var Month=new RegExp(/M{2}/g).exec(Format);
		if (Month.index==undefined) Month=Month[0];
		var Day=new RegExp(/d{2}/g).exec(Format);
		if (Day.index==undefined) Day=Day[0];
		Year=DateValue.substr(Year.index,(Year.lastIndex?Year.lastIndex-Year.index:Year[0].length));
		if (Year.length==2)
			Year=new Date().getYear().toString().substr(0,2)+Year;
		YearValue=parseInt(Year);
		Month=DateValue.substr(Month.index,(Month.lastIndex?Month.lastIndex-Month.index:Month[0].length));
		if (Month.charAt(0)=='0')
			Month=Month.substr(1);
		MonthValue=parseInt(Month);
		Day=DateValue.substr(Day.index,(Day.lastIndex?Day.lastIndex-Day.index:Day[0].length));
		if (Day.charAt(0)=='0')
			Day=Day.substr(1);
		DayValue=parseInt(Day);
	}
	catch (exception)
	{
	}
	if ((YearValue!=0)&&(MonthValue!=0)&&(DayValue!=0)&&(DayValue<=32-new Date(YearValue,MonthValue,32).getDate()))
		return new Date(YearValue,--MonthValue,DayValue);
	else
		return null;
}

if (!window.Spark.Web) Spark.Web=new Object(); window.Spark.Web.__namespace=true;
if (!window.Spark.Web.HttpRequest) Spark.Web.HttpRequest=new Object();
Spark.Web.HttpRequest.IsSecuredPage=(window.location.protocol.indexOf("https")!=-1?true:false);
Spark.Web.HttpRequest.Protocol=(Spark.Web.HttpRequest.IsSecuredPage==true?"https://":"http://");
if (!window.Spark.Animation) window.Spark.Animation=new Object();

Spark.Animation.NullTransformation=function(Value) {
	return Value;
}

Spark.Animation.LinearEaseOut=
Spark.Animation.LinearEaseIn=
Spark.Animation.LinearEaseInOut=function(t,b,c,d) {
	return c*t/d+b;
}

Spark.Animation.QuadEaseIn=function(t,b,c,d) {
	return c*(t/=d)*t+b;
}

Spark.Animation.QuadEaseOut=function(t,b,c,d) {
	return -c*(t/=d)*(t-2)+b;
}

Spark.Animation.QuadEaseInOut=function(t,b,c,d) {
	if ((t/=d/2)<1) return c/2*t*t+b;
	return -c/2*((--t)*(t-2)-1)+b;
}

Spark.Animation.CubicEaseIn=function(t,b,c,d) {
	var Result=c*(t/=d)*t*t+b;
	return Result;
}

Spark.Animation.CubicEaseOut=function(t,b,c,d) {
	var Result=c*((t=t/d-1)*t*t+1)+b;
	return Result;
}

Spark.Animation.CubicEaseInOut=function(t,b,c,d) {
	if ((t/=d/2)<1) return c/2*t*t*t+b;
	return c/2*((t-=2)*t*t+2)+b;
}

Spark.Animation.QuarticEaseIn=function(t,b,c,d) {
	return c*(t/=d)*t*t*t+b;
}

Spark.Animation.QuarticEaseOut=function(t,b,c,d) {
	return -c*((t=t/d-1)*t*t*t-1)+b;
}

Spark.Animation.QuarticEaseInOut=function(t,b,c,d) {
	if ((t/=d/2)<1) return c/2*t*t*t*t+b;
	return -c/2*((t-=2)*t*t*t-2)+b;
}

Spark.Animation.QuinticEaseIn=function(t,b,c,d) {
	return c*(t/=d)*t*t*t*t+b;
}

Spark.Animation.QuinticEaseOut=function(t,b,c,d) {
	return c*((t=t/d-1)*t*t*t*t+1)+b;
}

Spark.Animation.QuinticEaseInOut=function(t,b,c,d) {
	if ((t/=d/2)<1) return c/2*t*t*t*t*t+b;
	return c/2*((t-=2)*t*t*t*t+2)+b;
}

Spark.Animation.SinEaseIn=function(t,b,c,d) {
	return -c*Math.cos(t/d*(Math.PI/2))+c+b;
}

Spark.Animation.SinEaseOut=function(t,b,c,d) {
	return c*Math.sin(t/d*(Math.PI/2))+b;
}

Spark.Animation.SinEaseInOut=function(t,b,c,d) {
	return -c/2*(Math.cos(Math.PI*t/d)-1)+b;
}

Spark.Animation.ExpEaseIn=function(t,b,c,d) {
	return (t==0?b:c)*Math.pow(2,10*(t/d-1))+b;
}

Spark.Animation.ExpEaseOut=function(t,b,c,d) {
	return (t==d?b+c:c)*(-Math.pow(2,-10*t/d)+1)+b;
}

Spark.Animation.ExpEaseInOut=function(t,b,c,d) {
	if (t==0) return b;
	if (t==d) return b+c;
	if ((t/=d/2)<1) return c/2*Math.pow(2,10*(t-1))+b;
	return c/2*(-Math.pow(2,-10*--t)+2)+b;
}

Spark.Animation.CircularEaseIn=function(t,b,c,d) {
	return -c*(Math.sqrt(1-(t/=d)*t)-1)+b;
}

Spark.Animation.CircularEaseOut=function(t,b,c,d) {
	return c*Math.sqrt(1-(t=t/d-1)*t)+b;
}

Spark.Animation.CircularEaseInOutCirc=function(t,b,c,d) {
	if ((t/=d/2)<1) return -c/2*(Math.sqrt(1-t*t)-1)+b;
	return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b;
}

Spark.Animation.Animate=function(ID,Property,Type,Direction,Format,Interval,InitialValue,StopValue,Steps,OnCompleted,Transformation)
{
	if ((window.document.readyState==undefined)||(window.document.readyState==false)) return;
	var Element=document.getElementById(ID);
	var PropertyPath=Property.split('.');
	if (!Element.animatedProperties)
		Element.animatedProperties=new Object();
	var PropertyValue=Element[PropertyPath[0]];
	for (var Index=1; Index<PropertyPath.length-1; Index++)
		PropertyValue=PropertyValue[PropertyPath[Index]];
	if (InitialValue!=undefined)
	{
		if ((Transformation==undefined)||(Transformation==null))
			Transformation=Spark.Animation.NullTransformation;
		Element.animatedProperties[Property.replace(".","_")]=new Object();
		Element.animatedProperties[Property.replace(".","_")].animationParameters=new Object();
		Element.animatedProperties[Property.replace(".","_")].animationParameters.t=0;
		Element.animatedProperties[Property.replace(".","_")].animationParameters.b=InitialValue;
		Element.animatedProperties[Property.replace(".","_")].animationParameters.c=StopValue;
		Element.animatedProperties[Property.replace(".","_")].animationParameters.b=InitialValue;
		Element.animatedProperties[Property.replace(".","_")].animationParameters.c=StopValue;
		Element.animatedProperties[Property.replace(".","_")].animationParameters.d=Steps;
		Element.animatedProperties[Property.replace(".","_")].animationParameters.i=Interval;
		Element.animatedProperties[Property.replace(".","_")].animationParameters.transformation=Transformation;
		Element.animatedProperties[Property.replace(".","_")].animationParameters.oncompleted=OnCompleted;
	}
	if (Element.animatedProperties[Property.replace(".","_")]!=null)
	{
		if (Element.animatedProperties[Property.replace(".","_")].animationParameters.t<=
			Element.animatedProperties[Property.replace(".","_")].animationParameters.d)
		{
			try
			{
				PropertyValue[PropertyPath[PropertyPath.length-1]]=Format.replace("{0}",
					(Direction=='Out'?Element.animatedProperties[Property.replace(".","_")].animationParameters.c:0)+
					(Direction=='Out'?-1:1)*Element.animatedProperties[Property.replace(".","_")].animationParameters.transformation(
						Spark.Animation[Type+'Ease'+Direction](
						Element.animatedProperties[Property.replace(".","_")].animationParameters.t,
						Element.animatedProperties[Property.replace(".","_")].animationParameters.b,
						Element.animatedProperties[Property.replace(".","_")].animationParameters.c,
						Element.animatedProperties[Property.replace(".","_")].animationParameters.d)));
			}
			catch (Exception)
			{
			}
			if (Spark.Animation.debug)
				window.status=Format.replace("{0}",
					(Direction=='Out'?Element.animatedProperties[Property.replace(".","_")].animationParameters.c:0)+
					(Direction=='Out'?-1:1)*Element.animatedProperties[Property.replace(".","_")].animationParameters.transformation(
						Spark.Animation[Type+'Ease'+Direction](
						Element.animatedProperties[Property.replace(".","_")].animationParameters.t,
						Element.animatedProperties[Property.replace(".","_")].animationParameters.b,
						Element.animatedProperties[Property.replace(".","_")].animationParameters.c,
						Element.animatedProperties[Property.replace(".","_")].animationParameters.d)));
			Element.animatedProperties[Property.replace(".","_")].animationParameters.t+=1;
			setTimeout("Spark.Animation.Animate(\""+ID+"\",\""+Property+"\",'"+Type+"','"+Direction+"','"+Format+"',"+Interval+")",Interval);
		}
		else
		{
			var OnCompleted=Element.animatedProperties[Property.replace(".","_")].animationParameters.oncompleted;
			Element.animatedProperties[Property.replace(".","_")]=null;
			delete Element.animatedProperties[Property.replace(".","_")];
			if ((OnCompleted!=undefined)&&(OnCompleted!=null))
				OnCompleted({target:Element});
		}
	}
}

if (!window.Spark.Web.HttpRequest.Browser) Spark.Web.HttpRequest.Browser=new Object();
if (!window.Spark.Web.HttpRequest.Browser.Style) Spark.Web.HttpRequest.Browser.Style=new Object();
window.onload_old=null;
Spark.Web.HttpRequest.Browser.OnLoad=function(evt)
{
	window.document.readyState=true;
	if (window.onload_old!=null)
	{
	    window.finalOnLoad=window.onload_old;
	    window.onload_old=null;
		window.finalOnLoad(evt);
	}
}

if (!window.document.readyState)
{
	window.document.readyState=false;
	if ((window.onload!=null)&&(window.onload!=Spark.Web.HttpRequest.Browser.OnLoad))
		window.onload_old=window.onload;
	window.onload=Spark.Web.HttpRequest.Browser.OnLoad;
}

Spark.Web.HttpRequest.Browser.isIE=new Boolean(navigator.userAgent.toLowerCase().indexOf("msie")+1);
Spark.Web.HttpRequest.Browser.isFireFox=new Boolean(navigator.userAgent.toLowerCase().indexOf("firefox")+1);
Spark.Web.HttpRequest.Browser.isSafari=new Boolean(navigator.userAgent.toLowerCase().indexOf("safari")+1);
Spark.Web.HttpRequest.Browser.isOpera=new Boolean(navigator.userAgent.toLowerCase().indexOf("opera")+1);
Spark.Web.HttpRequest.Browser.isNetscape=new Boolean(Boolean(navigator.userAgent.toLowerCase().indexOf("compatible")+1)&(this.isIE|this.isSafari|this.isOpera|this.isKonqueror));
Spark.Web.HttpRequest.Browser.isKonqueror=new Boolean(navigator.userAgent.toLowerCase().indexOf("konqueror")+1);
Spark.Web.HttpRequest.Browser.isChrome=new Boolean(navigator.userAgent.toLowerCase().indexOf("chrome")+1);
Spark.Web.HttpRequest.Browser.isUnknown=new Boolean(!Boolean(Spark.Web.HttpRequest.Browser.isIE|Spark.Web.HttpRequest.Browser.isSafari|Spark.Web.HttpRequest.Browser.isOpera|Spark.Web.HttpRequest.Browser.isNetscape|Spark.Web.HttpRequest.Browser.isKonqueror|Spark.Web.HttpRequest.Browser.isChrome));
Spark.Web.HttpRequest.Browser.version=new Number(navigator.appVersion.charAt(navigator.appVersion.search(".")-1));

Spark.Web.HttpRequest.Browser.MatchToLower=function()
{
	return (arguments[arguments.length-6]!=null?arguments[arguments.length-6].substr(0,1)+arguments[arguments.length-5].toLowerCase()+arguments[arguments.length-6].substr(1+arguments[arguments.length-5].length):arguments[arguments.length-4].substr(0,2)+arguments[arguments.length-3].toLowerCase()+arguments[arguments.length-4].substr(2+arguments[arguments.length-3].length));
}

Spark.Web.HttpRequest.Browser.HTML2XHTML=function(Input)
{
	var Regex,Matches;
	Regex=new RegExp("(<([a-z]+)[^>]*>)|(</([a-z]+)>)","gi");
	Input=Input.replace(Regex,Spark.Web.HttpRequest.Browser.MatchToLower);
	Regex=new RegExp("<[a-z]+\\s[^>]+>","gi");
	Matches=Regex.exec(Input);
	if (Matches!=null)
	{
		while (Matches!=null)
		{
			Input=Input.substring(0,Matches.index)+Spark.Web.HttpRequest.Browser.AddAttributeQuotes(Matches[0])+Input.substring(Matches.index+Matches[0].length,Input.length);
			Matches=Regex.exec(Input);
		}
	}
	Regex=new RegExp("<(br|img[^>]+)>","gi");
	Matches=Regex.exec(Input);
	if (Matches!=null)
	{
		while(Matches!=null)
		{
			if (Input.charAt(Matches.index+Matches[1].length)!="/")
			{
				Input=Input.substring(0,Matches.index+Matches[1].length+1)+" /"+Input.substring(Matches.index+Matches[1].length+1,Input.length);
			}
			else if(Input.charAt(Matches.index+Matches[1].length-1)!=" ")
			{
				Input=Input.substring(0,Matches.index+Matches[1].length)+" "+Input.substring(Matches.index+m[1].length,Input.length);
			}
			Matches=Regex.exec(Input);
		}
	}
	return Input;
}

Spark.Web.HttpRequest.Browser.AddAttributeQuotes=function(Input)
{
	var Regex=/(\s[a-z0-9_]+=)([^"'\s>]+)/gi;
	Matches=Regex.exec(Input);
	if (Matches!=null)
	{
		while ((Matches!=null)&&(RegExp.$2)&&(RegExp.$2!=null)&&(RegExp.$2!=""))
		{
			Input=Input.substring(0,Matches.index+Matches[1].length)+"\""+Matches[2]+"\""+
				Input.substring(Matches.index+Matches[1].length+Matches[2].length);
			Matches=Regex.exec(Input);
		}
	}
	return Input.replace(/\s{2,}/gi," ");
}

if (Spark.Web.HttpRequest.Browser.isIE==false)
{
	Spark.Web.HttpRequest.Browser.Style.table=new String("table");
	Spark.Web.HttpRequest.Browser.Style.tableCell=new String("table-cell");
	Spark.Web.HttpRequest.Browser.Style.tableRow=new String("table-row");
	if (!document.body.contains)
		HTMLElement.prototype.contains=function(element) {
			if (element==this) return true;
			if (element==null) return false;
			return this.contains(element.parentNode);
		};
	if (!document.body.innerText)
		HTMLElement.prototype.__defineSetter__("innerText",function(Text) {
			this.innerHTML=Text.replace(/\&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"<br>");
		});
	if (!document.body.outerHTML)
		HTMLElement.prototype.__defineGetter__("outerHTML", function() {
			var emptyTags={
				"IMG":true,
				"BR":true,
				"INPUT":true,
				"META":true,
				"LINK":true,
				"PARAM":true,
				"HR":true};
			var Attributes=this.attributes;
			var Output="<"+this.tagName;
			for (var Index=0;Index<Attributes.length;Index++)
				Output+=" "+Attributes[Index].name+"=\""+Attributes[Index].value+"\"";
			if (emptyTags[this.tagName]) return Output+">";
			return Output+">"+this.innerHTML+"</"+this.tagName+">";
		});
}
else if (Spark.Web.HttpRequest.Browser.version<8)
{
	Spark.Web.HttpRequest.Browser.Style.table=new String("block");
	Spark.Web.HttpRequest.Browser.Style.tableCell=new String("block");
	Spark.Web.HttpRequest.Browser.Style.tableRow=new String("block");
}

Spark.Web.HttpRequest.Browser.isFlash=new Number(0);
if ((navigator.plugins) && (navigator.plugins.length))
{
	if (navigator.plugins["Shockwave Flash"])
	{
		Spark.Web.HttpRequest.Browser.isFlash=1;
		if (navigator.plugins["Shockwave Flash"].description)
			Spark.Web.HttpRequest.Browser.isFlash=parseInt(navigator.plugins["Shockwave Flash"].description.match(/(\d+)\.\d+/)[1].toString());
	}
	if (navigator.plugins["Shockwave Flash 2.0"])
		Spark.Web.HttpRequest.Browser.isFlash=2
}
else if ((navigator.mimeTypes) && (navigator.mimeTypes.length))
{
	if ((navigator.mimeTypes['application/x-shockwave-flash']) && (navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin))
		Spark.Web.HttpRequest.Browser.isFlash=1;
}
else
{
	for(var Index=9;Index>=0;Index--)
	{
		try
		{
			var Flash=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+Index);
			Spark.Web.HttpRequest.Browser.isFlash=Index;
		}
		catch(e)
		{
		}
	}
}

Spark.Web.HttpRequest.Browser.findPositionX=function(element)
{
	var Position=0;
	if (element.offsetParent)
	{
		Position=element.offsetLeft;
		while (element=element.offsetParent)
			Position+=element.offsetLeft;
	}
	return Position;
}

Spark.Web.HttpRequest.Browser.findPositionY=function(element)
{
	var Position=0;
	if (element.offsetParent)
	{
		Position=element.offsetTop;
		while (element=element.offsetParent)
			Position+=element.offsetTop;
	}
	return Position;
}

Spark.Web.HttpRequest.Browser.hoverElements=new Array();

if (!window.Spark.Web.HttpCookie) Spark.Web.HttpCookie=new Object();
Spark.Web.HttpCookie.Create=function(Name,Value,Days)
{
	var Expires=""
	if (Days)
	{
		var CookieDate=new Date();
		CookieDate.setTime(CookieDate.getTime()+(Days*24*60*60*1000));
		var Expires="; expires="+CookieDate.toGMTString();
	}
	document.cookie=Name+"="+Value+Expires+"; path=/";
}

Spark.Web.HttpCookie.Read=function(Name)
{
	var NameEQ=Name+"=";
	var Cookies=document.cookie.split(';');
	for (var Index=0;Index<Cookies.length;Index++)
	{
		var Cookie=Cookies[Index];
		while (Cookie.charAt(0)==' ') Cookie=Cookie.substring(1,Cookie.length);
		if (Cookie.indexOf(NameEQ)==0) return Cookie.substring(NameEQ.length,Cookie.length);
	}
	return null;
}

Spark.Web.HttpCookie.Delete=function(Name)
{
	Spark.Web.HttpCookie.CreateCookie(Name,"",-1);
}

Spark.Web.HttpRequest.BuildFlash=function(Url,Width,Height,WMode,Scalling,FlashVars,BackgroundColor)
{
	if ((Scalling==undefined)||(Scalling==null))
		Scalling="default";
	if (FlashVars==undefined)
		FlashVars=null;
	if ((BackgroundColor==undefined)||(BackgroundColor==null))
		BackgroundColor="#000000";
	var Result="<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\""+Spark.Web.HttpRequest.Protocol+"download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" "+
		"width=\""+Width+"\" height=\""+Height+"\" id=\"flashmov\"><param name=\"allowScriptAccess\" value=\"always\" />"+
		"<param name=\"movie\" value=\""+Url.replace("&amp;","&")+"\" /><param name=\"scale\" value=\""+Scalling+"\" />"+
		"<param name=\"wmode\" value=\""+((WMode!=undefined)&&(WMode!=null)&&(WMode!="")?WMode:"opaque")+"\" /><param name=\"quality\" value=\"high\" /><param name=\"allowfullscreen\" value=\"true\" />"+
		"<param name=\"bgcolor\" value=\""+BackgroundColor+"\" />"+(FlashVars!=null?"<param name=\"flashvars\" value=\""+FlashVars+"\" />":"")+
		"<embed src=\""+Url+"\" allowScriptAccess=\"always\" quality=\"high\" pluginspage=\""+Spark.Web.HttpRequest.Protocol+"www.macromedia.com/go/getflashplayer\" "+
		"type=\"application/x-shockwave-flash\" scale=\""+Scalling+"\" width=\""+Width+"\" height=\""+Height+"\" wmode=\""+
		((WMode!=undefined)&&(WMode!=null)&&(WMode!="")?WMode:"opaque")+"\" name=\"flashmov\" "+
		(FlashVars!=null?"flashvars=\""+FlashVars+"\" ":"")+"></embed></object>";
	return Result;
}

Spark.Web.HttpRequest.InsertFlash=function(Url,Width,Height,WMode,Scalling,FlashVars,BackgroundColor,Id)
{
	if ((Spark.Web.HttpRequest.Browser.isFireFox==true)&&(Id!=undefined))
	{
		Id=document.getElementById(Id);
		if (Id!=null)
		try
		{
			Id.innerHTML=Spark.Web.HttpRequest.BuildFlash(Url,Width,Height,WMode,Scalling,FlashVars,BackgroundColor);
		}
		catch (exception)
		{
			document.write(Spark.Web.HttpRequest.BuildFlash(Url,Width,Height,WMode,Scalling,FlashVars,BackgroundColor));
		}
	}
	else
		document.write(Spark.Web.HttpRequest.BuildFlash(Url,Width,Height,WMode,Scalling,FlashVars,BackgroundColor));
}