
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                                            //
// JavaScript written by Brandon C. Adams for MorseBest Innovation & Microsoft Corp.                                                          //
// For questions call me @ 435.229.8264                                                                                                       //
// Last Updated: 9-13-07                                                                                                                      //
//                                                                                                                                            //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

var xmlDoc;
if (window.ActiveXObject) {
	xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
} else {
	xmlDoc=document.implementation.createDocument("","",null);
}
var xmlObj;
var completeSender = false;
var rollOnCanvas = false;
var xamlAdd = "";
var doDragVol = false;
var doDragTime = false;
var vidTimelineID = 0;
var typeFaceDownloader;
var currentPlayingVid = 0;
var CCOn = false;
var vidToStart = -1;
var totalValidXMLNodes = 0;
var loadVidDownloadID;
var startedFirstVid = 0;
if (!window.SQLServer2008Demo) {
	window.SQLServer2008Demo = {};
}
SQLServer2008Demo.Page = function() {
}
SQLServer2008Demo.Page.prototype = {
	handleLoad: function(control, userContext, rootElement) {
		this.control = control;
		silverlightControl = this.control;
		silverlightControl.content.findName("LoadingCanvas").visibility = "Visible";
		silverlightControl.content.findName("ShellCanvas").visibility = "Collapsed"
		silverlightControl.content.findName("LoadingAnimation").begin();
		this.control.content.onResize = onResized;
		loadXML('playlist.xml');
	}
}
loadXML = function(xmlFile) {
  if (window.ActiveXObject) {
  	xmlDoc.onreadystatechange = verifyXMLIE;
  	xmlDoc.async = "false";
  	xmlDoc.load(xmlFile);
  } else {
  	xmlDoc.onload = verifyXMLFF;
  	xmlDoc.load(xmlFile);
	}
}
verifyXMLIE = function() {
 if (xmlDoc.readyState == 4){
  	xmlObj = xmlDoc.documentElement;
  	createMainNav();
		typeSetup();
 }
}
verifyXMLFF = function() {
	xmlObj = xmlDoc.documentElement;
	createMainNav();
	typeSetup();
}
onResized = function(sender, eventArgs) {
	this.control = sender.getHost();
	var w = document.body.clientWidth;
	var h = document.body.clientHeight;
	this.control.content.findName("Page").Width = w;
	this.control.content.findName("Page").Height = h;
	this.control.content.findName("DemoBackground").Width = w;
	this.control.content.findName("DemoBackground").Height = h;
	this.control.content.findName("DemoCanvas")["Canvas.Left"] = Math.round((w-960)/2);
	this.control.content.findName("DemoCanvas")["Canvas.Top"] = Math.round((h-520)/2);
}
onRollOverURL = function(sender, mouseEventArgs) {
	sender.textDecorations = "Underline";
	sender.foreground = "#FF000000";
}
onRollOutURL = function(sender, mouseEventArgs) {
	sender.textDecorations = "None";
	sender.foreground = "#FF777777";
}
onRollOverPlayerControlsButton = function(sender, mouseEventArgs) {
	if(completeSender != false){
		completeSender.children.remove(xamlAdd);
	}
	rollOnCanvas = false;
	this.control = sender.getHost();
	if(rollOnCanvas == false)
	{
		var xamlString = '<Rectangle xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="30" Height="30" RadiusX="3" RadiusY="3" Fill="#E5FF5800" Opacity="1E-06" x:Name="RollObject"/>';
	  xamlAdd = this.control.content.createFromXaml(xamlString);
	  sender.children.insert(0,xamlAdd);
	  rollOnCanvas = true;
	}
	sender.findName("ButtonObjectRollOver").begin();
}
onRollOutPlayerControlsButton = function(sender, mouseEventArgs) {
	if(rollOnCanvas == true)
	{
		completeSender = sender;
		sender.findName("ButtonObjectRollOut").begin();
	}
}
clickEvents = function(sender, mouseEventArgs) {
	if (sender.name == "MSLink") {
		open("http://www.microsoft.com","_blank");
	} else if (sender.name == "ButtonPlay") {
		vidPause();
	} else if (sender.name == "ButtonPause") {
		vidPlay();
	} else if (sender.name == "ButtonMute") {
		if(sender.findName("VidWindow").IsMuted == false) {
			sender.findName("VidWindow").IsMuted = "True";
			sender.findName("MusicLoop").IsMuted = "True";
			sender.findName("IconMute").visibility = "Visible";
			sender.findName("IconUnmute").visibility = "Collapsed";
		} else {
			sender.findName("VidWindow").IsMuted = "False";
			sender.findName("MusicLoop").IsMuted = "False";
			sender.findName("IconMute").visibility = "Collapsed";
			sender.findName("IconUnmute").visibility = "Visible";
		}
	} else if (sender.name == "ButtonNext") {
		nextVid();
	} else if (sender.name == "ButtonPrev") {
		prevVid();
	} else if (sender.name == "ButtonCC") {
		if(CCOn == false) {
			CCOn = true;
			silverlightControl.content.findName("CCShow").begin();
		} else {
			CCOn = false;
			silverlightControl.content.findName("CCHide").begin();
		}
	} else if (sender.name == "VolumeSliderCanvas") {
		doDragVol = false;
	} else if (sender.name == "TimelineSliderCanvas") {
		doDragTime = false;
	} else if (sender.name == "ellipse") {
		setVolumeManual(-.10);
	} else if (sender.name == "ellipse1") {
		setVolumeManual(.10);
	} else if (sender.name == "EndURL1") {
		open("http://go.microsoft.com/?linkid=7299570","_blank");
	} else if (sender.name == "EndURL2") {
		open("http://go.microsoft.com/?linkid=7299571","_blank");
	} else if (sender.name == "EndURL3") {
		open("http://go.microsoft.com/?linkid=7299572","_blank");
	}  
}
setVolumeManual = function (v) {
	var currentV = silverlightControl.content.findName("VidWindow").Volume;
	if (v>0) {
		if (currentV<1) {
			currentV += v;
		} else {
			currentV = 1;
		}
		if (currentV>1) {
			currentV = 1;
		}
	} else {
		if (currentV>0) {
			currentV += v;
		} else {
			currentV = 0;
		}
		if (currentV<0) {
			currentV = 0;
		}
	}
	silverlightControl.content.findName("VidWindow").Volume = currentV;
	silverlightControl.content.findName("MusicLoop").Volume = (currentV)/3;			
	var posSet = ((silverlightControl.content.findName("VolumeSliderCanvas").width*currentV)/1);
	silverlightControl.content.findName("VolumeSlider").Width = posSet-1;
	silverlightControl.content.findName("VolumeSliderGlow").Width = posSet+1;
	silverlightControl.content.findName("VolumeSliderGripper")["Canvas.Left"] = (silverlightControl.content.findName("VolumeSliderCanvas")["Canvas.Left"]+silverlightControl.content.findName("VolumeSlider").width)-silverlightControl.content.findName("VolumeSliderGripper").width;
	if (silverlightControl.content.findName("VolumeSliderGripper")["Canvas.Left"]< 31) {
		silverlightControl.content.findName("VolumeSliderGripper")["Canvas.Left"] = 31;
	}
};
dragEvents = function(sender, mouseEventArgs) {
	if(sender.name == "VolumeSliderCanvas" && doDragVol == true) {
		var coordinate = mouseEventArgs.getPosition(sender).x;
		silverlightControl.content.findName("VolumeSlider").Width = coordinate;
		silverlightControl.content.findName("VolumeSliderGlow").Width = coordinate+6;
		var v = Math.round((silverlightControl.content.findName("VolumeSlider").Width*100)/silverlightControl.content.findName("VolumeSliderCanvas").Width);
		silverlightControl.content.findName("VidWindow").Volume = v/100;
		silverlightControl.content.findName("MusicLoop").Volume = (v/100)/3;
		silverlightControl.content.findName("VolumeSliderGripper")["Canvas.Left"] = coordinate+31;
	} else if(sender.name == "TimelineSliderCanvas" && doDragTime == true) {
		var coordinate = mouseEventArgs.getPosition(sender).x;		
		var d = silverlightControl.content.findName("VidWindow").naturalDuration.seconds;
		var w = silverlightControl.content.findName("TimelineSliderCanvas").width;
		if(d != 0){
			silverlightControl.content.findName("TimelineSlider")["Canvas.Left"] = coordinate+10;
			silverlightControl.content.findName("TimelineSliderFollow").width = coordinate+1;
			silverlightControl.content.findName("TimelineSliderFollowGlow").width = coordinate+7;
			var seconds = ((d*coordinate)/w);
			var pos = silverlightControl.content.findName("VidWindow").position;
			pos.seconds = seconds;
			silverlightControl.content.findName("VidWindow").position = pos;
		}
	}
}
outEvents = function(sender, mouseEventArts){
	if(sender.name == "VolumeSliderCanvas") {
		doDragVol = false;
	} else if(sender.name == "TimelineSliderCanvas"){
		doDragTime = false;
	}
}
pressEvents = function(sender, mouseEventArgs) {
	if(sender.name == "VolumeSliderCanvas") {
		doDragVol = true;
	} else if(sender.name == "TimelineSliderCanvas"){
		doDragTime = true;
	}
}
setFont = function(textElement, fontFamily, txt, align) {
    var txtBlock = silverlightControl.content.findName(textElement);
    txtBlock["Canvas.Top"] = txtBlock["Canvas.Top"]+2;
    txtBlock.text = txt;
    if (align == "right") {
    	var w = txtBlock.actualWidth;
    	txtBlock["Canvas.Left"] = txtBlock["Canvas.Left"]+(txtBlock.width-w);
    } else if (align == "center") {
    	var w = txtBlock.actualWidth;
    	txtBlock["Canvas.Left"] = txtBlock["Canvas.Left"]+((txtBlock.width-w)/2);
    }
}
startVid = function(vid){
	silverlightControl.content.findName("EndURLs").visibility = "Collapsed";
	currentPlayingVid = parseInt(vid);
	for(var r=0; r<xmlObj.childNodes.length; r++){
		if (xmlObj.childNodes[r].nodeType == 1) {
			silverlightControl.content.findName("ButtonCanvas"+r).Opacity = "0.00001";
			silverlightControl.content.findName("buttonText"+r).foreground = "#FF777777";
		}
	}
	silverlightControl.content.findName("ButtonCanvas"+currentPlayingVid).Opacity = "1";
	silverlightControl.content.findName("buttonText"+currentPlayingVid).foreground = "#FFFFFFFF";
	silverlightControl.content.findName("VidWindow").Source = xmlObj.childNodes[currentPlayingVid].getAttribute("src");
	startedFirstVid = 1;
	loadVid();
}
loadVid = function(){
	silverlightControl.content.findName("VidWindow").visibility = "Collapsed";
	silverlightControl.content.findName("VidDownloadProgress").visibility = "Visible";
	vidPlay();
}
loadVidDownload = function(){
	if(silverlightControl.content.findName("VidWindow").BufferingProgress == 1){
		silverlightControl.content.findName("VidWindow").visibility = "Visible";
		silverlightControl.content.findName("VidDownloadProgress").visibility = "Collapsed";
		vidPlay();
	} else {
		silverlightControl.content.findName("VidWindow").visibility = "Collapsed";
		silverlightControl.content.findName("VidDownloadProgress").visibility = "Visible";
	}
}
prevVid = function(){
	if(currentPlayingVid != 0) {
		var x = currentPlayingVid;
		do {
			x--;
		} while (xmlObj.childNodes[x].nodeType != 1);
		startVid(x);
	}
}
nextVid = function(){
	if(currentPlayingVid < xmlObj.childNodes.length-1) {
		var x = currentPlayingVid;
		do {
			x++;
		} while (xmlObj.childNodes[x].nodeType != 1);
		startVid(x);
	}
}
vidEnd = function(){
	if(startedFirstVid == 1){
		if(currentPlayingVid == xmlObj.childNodes.length-1) {
			silverlightControl.content.findName("EndURLs").visibility = "Visible";
		} else {
			nextVid();
		}
	}
}
vidPlay = function(){
	if(xamlAdd != "") {
		silverlightControl.content.findName("ButtonPause").children.remove(xamlAdd);
	}
	silverlightControl.content.findName("VidWindow").play();
	silverlightControl.content.findName("IconPlay").visibility = "Collapsed";
	silverlightControl.content.findName("IconPause").visibility = "Visible";
	silverlightControl.content.findName("ButtonPlay").visibility = "Visible";
	silverlightControl.content.findName("ButtonPause").visibility = "Collapsed";
	
}
vidPause = function(){
	if(xamlAdd != "") {
		silverlightControl.content.findName("ButtonPlay").children.remove(xamlAdd);
	}
	silverlightControl.content.findName("VidWindow").pause();
	silverlightControl.content.findName("IconPlay").visibility = "Visible";
	silverlightControl.content.findName("IconPause").visibility = "Collapsed";
	silverlightControl.content.findName("ButtonPlay").visibility = "Collapsed";
	silverlightControl.content.findName("ButtonPause").visibility = "Visible";
}
vidTimeline = function(){
	if(doDragTime == false){	
		var p = silverlightControl.content.findName("VidWindow").position.seconds;
		var d = silverlightControl.content.findName("VidWindow").naturalDuration.seconds;
		var w = silverlightControl.content.findName("TimelineSliderCanvas").width-silverlightControl.content.findName("TimelineSlider").width;
		if(d != 0 && p < d){
			silverlightControl.content.findName("TimelineSlider")["Canvas.Left"] = ((p*w)/d)+10;
			silverlightControl.content.findName("TimelineSliderFollow").width = ((p*w)/d)+1;
			silverlightControl.content.findName("TimelineSliderFollowGlow").width = ((p*w)/d)+7;
		}
		for (var t=0; t<xmlObj.childNodes[currentPlayingVid].childNodes.length; t++) {		
			if (xmlObj.childNodes[currentPlayingVid].childNodes[t].nodeType == 1) {
				var syncStart = xmlObj.childNodes[currentPlayingVid].childNodes[t].getAttribute("start");
				if(syncStart <= p){
					var passTxt = xmlObj.childNodes[currentPlayingVid].childNodes[t].firstChild.nodeValue;
					silverlightControl.content.findName("CCText").Text = passTxt;
					var w = silverlightControl.content.findName("CCText").actualWidth;
		  		silverlightControl.content.findName("CCText")["Canvas.Left"] = ((silverlightControl.content.findName("CCText").width-w)/2);
				}
			}		
		}
	}
}
createMainNav = function(){
	for(var x=0; x<xmlObj.childNodes.length; x++){
		if (xmlObj.childNodes[x].nodeType == 1) {
			totalValidXMLNodes++;	
		}
	}
	var marginWidth = 4;
	var totalWidth = silverlightControl.content.findName("MainNav").width;
	var itemWidth = Math.round((totalWidth-((totalValidXMLNodes+1)*marginWidth))/totalValidXMLNodes);
	var difWidth = totalWidth-(((totalValidXMLNodes+1)*marginWidth)+(itemWidth*totalValidXMLNodes));
	var canvasX = marginWidth;
	for(var x=0; x<xmlObj.childNodes.length; x++){
		if (xmlObj.childNodes[x].nodeType == 1) {
			if (vidToStart == -1) {
				vidToStart = x;
			}
			if (x == (totalValidXMLNodes-1)) {
				var w = itemWidth+difWidth;
			} else {
				var w = itemWidth;
			}
			var xamlButton = '<Canvas xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Name="buttonMainNav'+x+'" Width="'+w+'" Height="20" Canvas.Left="'+canvasX+'" Canvas.Top="2" Cursor="Hand" MouseEnter="buttonRollOver'+x+'" MouseLeave="buttonRollOut'+x+'" MouseLeftButtonUp="buttonPress'+x+'"><Canvas x:Name="ButtonCanvas'+x+'" Width="'+w+'" Height="20" Opacity="0.00001"><Rectangle Width="'+w+'" Height="20" RadiusX="2" RadiusY="2" x:Name="buttonRect0-'+x+'"><Rectangle.Fill><LinearGradientBrush EndPoint="0.5,0" StartPoint="0.5,1"><GradientStop Color="#FFFF3300" Offset="0"/><GradientStop Color="#FFCF2A00" Offset="1"/></LinearGradientBrush></Rectangle.Fill></Rectangle><Rectangle Width="'+(w-4)+'" Height="16" RadiusX="2" RadiusY="2" Stroke="#FFFF5600" Canvas.Left="2" Canvas.Top="2" x:Name="buttonRect1-'+x+'"/><Canvas Width="'+w+'" Height="10"><Canvas.Clip><RectangleGeometry Rect="0, 0, '+w+', 10"/></Canvas.Clip><Rectangle Width="'+w+'" Height="20"><Rectangle.Fill><LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"><GradientStop Color="#66FFFFFF" Offset="0"/><GradientStop Color="#4CFFFFFF" Offset="1"/></LinearGradientBrush></Rectangle.Fill></Rectangle><Rectangle Width="'+(w-4)+'" Height="16" RadiusX="2" RadiusY="2" Stroke="#FFFFFFC8" Canvas.Left="2" Canvas.Top="2" x:Name="buttonRect2-'+x+'"/></Canvas></Canvas><TextBlock x:Name="buttonText'+x+'" Width="'+w+'" Height="12" Canvas.Top="3" FontFamily="Arial" FontSize="10" Foreground="#FF777777" Text=" " TextWrapping="Wrap" IsHitTestVisible="False"/></Canvas>';
			var xamlButtonAdd = silverlightControl.content.createFromXaml(xamlButton);
			silverlightControl.content.findName("MainNav").children.insert(0,xamlButtonAdd);
			canvasX += w;
			if (x != (totalValidXMLNodes-1)) {
				var xamlDivider = '<Canvas Width="2" Height="22" Canvas.Left="'+(canvasX+1)+'" Canvas.Top="1"><Rectangle Width="1" Height="22"><Rectangle.Fill><LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"><GradientStop Color="#FFC1C1C1" Offset="0"/><GradientStop Color="#FFFFFFFF" Offset="1"/></LinearGradientBrush></Rectangle.Fill></Rectangle><Rectangle Width="1" Height="22" Fill="#FFFFFFFF" Canvas.Left="1"/></Canvas>';
				var xamlDividerAdd = silverlightControl.content.createFromXaml(xamlDivider);
				silverlightControl.content.findName("MainNav").children.insert(0,xamlDividerAdd);
				canvasX += marginWidth;
			}
			this["buttonPress"+x] = function(sender){
				var senderName = sender.name;
				var buttonID = senderName.replace(/buttonMainNav/,"");
				startVid(buttonID);
			}
			this["buttonRollOver"+x] = function(sender){
				var buttonID = sender.name.replace(/buttonMainNav/,"");
				var txtNameID = "buttonText"+buttonID;
				var storyboardNameID = "ButtonCanvasRollOver"+buttonID;
				if(currentPlayingVid != buttonID){
					silverlightControl.content.findName(txtNameID).foreground = "#FFFFFFFF";
					silverlightControl.content.findName(storyboardNameID).begin();
				}
			}
			this["buttonRollOut"+x] = function(sender){
				var buttonID = sender.name.replace(/buttonMainNav/,"");
				var nameID = "buttonText"+buttonID;
				var storyboardNameID = "ButtonCanvasRollOut"+buttonID;
				if(currentPlayingVid != buttonID){
					silverlightControl.content.findName(nameID).foreground = "#FF777777";
					silverlightControl.content.findName(storyboardNameID).begin();
				}
			}
			var xamlButtonStoryBoardsIn  = '<Storyboard xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Name="ButtonCanvasRollOver'+x+'"><DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ButtonCanvas'+x+'" Storyboard.TargetProperty="(UIElement.Opacity)"><SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.00001"/><SplineDoubleKeyFrame KeyTime="00:00:00.00001" Value="1"/></DoubleAnimationUsingKeyFrames><ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="buttonRect0-'+x+'" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)"><SplineColorKeyFrame KeyTime="00:00:00" Value="#FFFFFFFF"/><SplineColorKeyFrame KeyTime="00:00:00.4000000" Value="#FFFF3300"/></ColorAnimationUsingKeyFrames><ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="buttonRect0-'+x+'" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)"><SplineColorKeyFrame KeyTime="00:00:00" Value="#FFFFFFFF"/><SplineColorKeyFrame KeyTime="00:00:00.4000000" Value="#FFCF2A00"/></ColorAnimationUsingKeyFrames><ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="buttonRect1-'+x+'" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)"><SplineColorKeyFrame KeyTime="00:00:00" Value="#FFFFFFFF"/><SplineColorKeyFrame KeyTime="00:00:00.4000000" Value="#FF9E9E9E"/><SplineColorKeyFrame KeyTime="00:00:01" Value="#FFFF5600"/></ColorAnimationUsingKeyFrames><ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="buttonRect2-'+x+'" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)"><SplineColorKeyFrame KeyTime="00:00:00" Value="#FFFFFFFF"/><SplineColorKeyFrame KeyTime="00:00:00.4000000" Value="#FFFFFFFF"/><SplineColorKeyFrame KeyTime="00:00:01" Value="#FFFFFFC8"/></ColorAnimationUsingKeyFrames></Storyboard>';
			var xamlButtonStoryboardsInAdd = silverlightControl.content.createFromXaml(xamlButtonStoryBoardsIn);
			silverlightControl.content.findName("Page").resources.add(xamlButtonStoryboardsInAdd);		
			var xamlButtonStoryBoardsOut = '<Storyboard xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Name="ButtonCanvasRollOut'+x+'"><DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ButtonCanvas'+x+'" Storyboard.TargetProperty="(UIElement.Opacity)"><SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/><SplineDoubleKeyFrame KeyTime="00:00:01" Value="0.00001"/></DoubleAnimationUsingKeyFrames></Storyboard>';
			var xamlButtonStoryBoardsOutAdd = silverlightControl.content.createFromXaml(xamlButtonStoryBoardsOut);
			silverlightControl.content.findName("Page").resources.add(xamlButtonStoryBoardsOutAdd);
		}
	}
}
typeSetup = function(sender, eventArgs) {
  setFont("MSLink", "Arial", "Microsoft.com", "left");
  setFont("Copyright", "Arial", "© 2007 Microsoft Corporation. All Rights Reserved.", "right");
  setFont("CCText", "Arial", " ", "center");
  for(var x=0; x<xmlObj.childNodes.length; x++){
  	if (xmlObj.childNodes[x].nodeType == 1) {
			var buttonName = xmlObj.childNodes[x].getAttribute("name").toUpperCase();
			setFont("buttonText"+x, "Arial", buttonName, "center");
		}
	}
	startSilverlight();
}
startSilverlight = function(){
	setVolumeManual(.10);
	silverlightControl.content.findName("LoadingCanvas").visibility = "Collapsed";
	silverlightControl.content.findName("ShellCanvas").visibility = "Visible"
	silverlightControl.content.findName("ShellAnimation").begin();
}
silverlightReady = function(){
	startVid(vidToStart);
	clearInterval(vidTimelineID);
	vidTimelineID = setInterval(vidTimeline, 1);
	silverlightControl.content.findName("VidDownloadingAnimation").begin();
}
musicLoopRepeat = function(sender, args){
	var pos = sender.position;
	pos.seconds = 0;
	sender.position = pos;
	sender.play();
}
retry = function (sender, args)
{
   	var pos = sender.position;
	sender.Source = xmlObj.childNodes[currentPlayingVid].getAttribute("src");
	sender.position = pos;
}
