﻿function createLogo()
{
	var scene = new logo.Page();
	Silverlight.createObjectEx({
		source: "xaml/Logo.xaml",
		parentElement: document.getElementById("LogoHost"),
		id: "SLLogo",
		properties: {
			width: "236px",
			height: "80px",
			version: "1.0",
       		background:'transparent',
         	isWindowless: 'true'
		},
		events: {
			onLoad: Silverlight.createDelegate(scene, scene.handleLoad),
			onError: function(sender, args) {
				var errorDiv = document.getElementById("errorLocation");
				if (errorDiv != null) {
					var errorText = args.errorType + "- " + args.errorMessage;
							
					if (args.ErrorType == "ParserError") {
						errorText += "<br>File: " + args.xamlFile;
						errorText += ", line " + args.lineNumber;
						errorText += " character " + args.charPosition;
					}
					else if (args.ErrorType == "RuntimeError") {
						errorText += "<br>line " + args.lineNumber;
						errorText += " character " +  args.charPosition;
					}
					errorDiv.innerHTML = errorText;
				}	
			}
		}
	});
}


if (!window.Silverlight) 
	window.Silverlight = {};

Silverlight.createDelegate = function(instance, method) {
	return function() {
		return method.apply(instance, arguments);
	}
}

if (!window.logo)
	window.logo = {};

logo.Page = function() 
{
}

logo.Page.prototype =
{
	handleLoad: function(control, userContext, rootElement) 
	{
		document.getElementById("SLLogo").content.findName("Parlama").Begin();
		LogoParildama();
	}
}
function LogoParlamaBitti()
{
	document.getElementById("SLLogo").content.findName("Parlama").Begin();
}
function LogoMouseEnter()
{
	document.getElementById("SLLogo").content.findName("Parildama").Begin();
}
function LogoParildama()
{
	document.getElementById("SLLogo").content.findName("Parildama").Begin();
	setTimeout("LogoParildama();",Math.round(Math.random()*5000)+5000);
}
