if (!window.blogblog)
	blogblog = {};

blogblog.Page = function() 
{
}

function BlogData(Data)
{
		var SL = document.getElementById("BlogControl");
SL.content.findName("LoadIt").Stop();
SL.content.findName("Page").children.clear();
			var currentTopMargin = 0;
			var i;
			for (i=0;i<5;i++)
			{
				var LastXAML = '<Canvas Canvas.Top="' + (7+currentTopMargin) + '" x:Name="LastCanvas' + i + '" xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">';
				LastXAML += '<Rectangle Width="180" Height="24.888" Fill="#FF03446f" Stroke="#FF000000" RadiusX="10.148" RadiusY="10.148" Canvas.Top="-4.426" x:Name="LastRec' + i + '" RenderTransformOrigin="0,0">';
				LastXAML += '<Rectangle.RenderTransform>';
				LastXAML += '<TransformGroup>';
				LastXAML += '<ScaleTransform ScaleX="1" ScaleY="1"/>';
				LastXAML += '<SkewTransform AngleX="0" AngleY="0"/>';
				LastXAML += '<RotateTransform Angle="0"/>';
				LastXAML += '<TranslateTransform X="0" Y="0"/>';
				LastXAML += '</TransformGroup>';
				LastXAML += '</Rectangle.RenderTransform>';
				LastXAML += '</Rectangle>';
				LastXAML += '<Rectangle Fill="#FF0d8da7" Width="179.537" Height="23.962" RadiusX="10.148" RadiusY="10.148" Canvas.Left="0.463" Canvas.Top="-3.5" x:Name="LastGlow' + i + '">';
				LastXAML += '<Rectangle.OpacityMask>';
				LastXAML += '<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">';
				LastXAML += '<GradientStop Color="#FF000000" Offset="0"/>';
				LastXAML += '<GradientStop Color="#00FFFFFF" Offset="1"/>';
				LastXAML += '</LinearGradientBrush>';
				LastXAML += '</Rectangle.OpacityMask>';
				LastXAML += '</Rectangle>';
				LastXAML += '<TextBlock x:Name="Last' + i + '" Width="164" Canvas.Left="8" FontSize="10" TextWrapping="Wrap"><Run Foreground="#FFFFFFFF" Text="' + EscapeChar(Data[i].PostName) + '"/></TextBlock>';
				LastXAML += '<Rectangle Tag="' + Data[i].URL + '" Cursor="Hand" MouseLeftButtonDown="GoGoBlog" MouseLeave="MouseGoneBlog" MouseEnter="MouseCameBlog" Width="180" Height="24.888" Fill="#00F5F5F5" Stroke="#00000000" RadiusX="10.148" RadiusY="10.148" Canvas.Top="-4.426" x:Name="LastHov' + i + '" RenderTransformOrigin="0,0">';
				LastXAML += '<Rectangle.RenderTransform>';
				LastXAML += '<TransformGroup>';
				LastXAML += '<ScaleTransform ScaleX="1" ScaleY="1"/>';
				LastXAML += '<SkewTransform AngleX="0" AngleY="0"/>';
				LastXAML += '<RotateTransform Angle="0"/>';
				LastXAML += '<TranslateTransform X="0" Y="0"/>';
				LastXAML += '</TransformGroup>';
				LastXAML += '</Rectangle.RenderTransform>';
				LastXAML += '</Rectangle>';
				LastXAML += '</Canvas>';

				var Last = SL.content.createFromXaml(LastXAML);
				
				SL.content.findName("Page").children.add(Last);
				
				SL.content.findName("LastRec" + i).Height = SL.content.findName("Last" + i).actualHeight + 8;
				SL.content.findName("LastHov" + i).Height = SL.content.findName("LastRec" + i).Height ;
				SL.content.findName("LastGlow" + i).Height = (SL.content.findName("Last" + i).actualHeight + 8)/2;
				currentTopMargin += SL.content.findName("LastRec" + i).Height -1;
				SL.style.height = (currentTopMargin + 3) + "px";
				document.getElementById("BlogControlHost").style.height = (currentTopMargin + 3) + "px";
				SL.content.findName("Page").Height = currentTopMargin + 10;
					
					var HoverXAML =  '<Storyboard x:Name="LastHov' + i + 'Came" xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">';
					HoverXAML +=  '<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="LastGlow' + i + '" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">';
					HoverXAML +=  '<SplineColorKeyFrame KeyTime="00:00:00" Value="#FF0d8da7"/>';
					HoverXAML +=  '<SplineColorKeyFrame KeyTime="00:00:00.5000000" Value="#FF01eaff"/>';
					HoverXAML +=  '</ColorAnimationUsingKeyFrames>';
					HoverXAML +=  '</Storyboard>';
					var HoverAnim = SL.content.createFromXaml(HoverXAML);
					SL.content.findName("Page").resources.add(HoverAnim);
					
					var GoneXAML =  '<Storyboard x:Name="LastHov' + i + 'Gone" xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">';
					GoneXAML +=  '<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="LastGlow' + i + '" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">';
					GoneXAML +=  '<SplineColorKeyFrame KeyTime="00:00:00" Value="#FF01eaff"/>';
					GoneXAML +=  '<SplineColorKeyFrame KeyTime="00:00:00.5000000" Value="#FF0d8da7"/>';
					GoneXAML +=  '</ColorAnimationUsingKeyFrames>';
					GoneXAML +=  '</Storyboard>';
					var GoneAnim = SL.content.createFromXaml(GoneXAML);
					SL.content.findName("Page").resources.add(GoneAnim);
									
				};
}

blogblog.Page.prototype =
{
	handleLoad: function(control, userContext, rootElement) 
	{
		var SL = document.getElementById("BlogControl");
		SL.content.findName("LoadIt").Begin();
	}
}
function MouseGoneBlog(sender)
{
	sender.findName(sender.Name + "Gone").Begin();
}
function MouseCameBlog(sender)
{
	sender.findName(sender.Name + "Came").Begin();
}
function GoGoBlog(sender)
{
	document.location.href=sender.Tag;
}

function EscapeChar(strInput)
{
  strInput=strInput.replace(/&/g,"&");  
  strInput=strInput.replace(/</g,"<");	
  strInput=strInput.replace(/>/g,">");	
  strInput=strInput.replace(/"/g,"");	
  strInput=strInput.replace(/'/g,"&apos;");	
  
  return(strInput);
}