
// init loader
var loader = new Loader();
loader.setScriptPath("/static/js/");
loader.addFile("protoaculous.js");
loader.addFile("animator.js");
loader.addFile("swfobject.js");
loader.addFile("slidebox.js");
loader.addFile("lightbox.js");
loader.addFile("rightbox.js");
loader.addFile("onLoad.js");
loader.addClass("at.elements.textreplace.image");

//loader.load();
loader.loadProxy("http://www.summercard.info/extensions/getCompressed/loader.php");

function onDocumentLoad ()
{	
	// replace text to images
	var imageReplacer = new at.elements.headlines.image("http://www.summercard.info/static/cache/headlines/");
	
	var h1Handler = {
		font: 'din1451m.ttf',
		width: '575',
		height: '',
		color: '669933',
		size: '17',
		positionx: '',
		positiony: '',
		replaceElement: {
			tagName: "h1",
			className: "h1"
		}
	};
	
	if(template == "content")
	{
		if(season == "winter")
		{
			var h1Winter = h1Handler;
			h1Winter.color = '006eb4';
			
			imageReplacer.add({
				elements: $$("h1"),
				options: h1Winter
			});	
		}
		else
		{
			imageReplacer.add({
				elements: $$("h1"),
				options: h1Handler
			});	
		}
	}
		
	if(template == "portal")
	{
		if(season == "winter")
		{
			var h1PortalWinter = h1Handler;
			h1PortalWinter.width = '390';
			h1PortalWinter.color = 'ffffff';
			
			imageReplacer.add({
				elements: $$("h1"),
				options: h1PortalWinter
			});	
		}
		else
		{
			var h1PortalSummer = h1Handler;
			h1PortalSummer.width = '390';
			h1PortalSummer.color = 'ffffff';
	
			imageReplacer.add({
				elements: $$("h1"),
				options: h1PortalSummer
			});	
		}
		
		imageReplacer.add({
			elements: $$("#mainPortal h2"),
			options: {
				font: 'din1451m.ttf',
				width: '180',
				height: '',
				color: '505E69',
				size: '10',
				positionx: '',
				positiony: '',
				replaceElement: {
					tagName: "span",
					className: "h2"
				},
				modifyValue : function (value)
				{
					return value.toUpperCase();
				}
			}
		});
		
		imageReplacer.add({
			elements: $$("#navigationPortal span"),
			options: {
				font: 'din1451m.ttf',
				width: '',
				height: '18',
				color: 'ffffff',
				size: '9.4',
				positionx: '',
				positiony: '12',
				replaceElement: {
					tagName: "span",
					className: "nav"
				},
				modifyValue : function (value)
				{
					return value.toUpperCase();
				}
			}
		});	
		
		imageReplacer.add({
			elements: $$("#rightbox h2"),
			options: {
				font: 'din1451m.ttf',
				width: '180',
				height: '20',
				color: 'ffffff',
				size: '10',
				positionx: '',
				positiony: '',
				replaceElement: {
					tagName: "h2",
					className: "white"
				},
				modifyValue : function (value)
				{
					return value.toUpperCase();
				}
			}
		});
		
		imageReplacer.add({
			elements: $$("em"),
			options: {
				font: 'din1451m.ttf',
				width: '40',
				height: '19',
				color: 'ffffff',
				size: '16',
				positionx: '',
				positiony: '',
				replaceElement: {
					tagName: "h2",
					className: "maps"
				},
				modifyValue : function (value)
				{
					return value.toUpperCase();
				}
			}
		});	
	}
	
	if(template == "content")
	{
		imageReplacer.add({
			elements: $$("#main .right h2"),
			options: {
				font: 'din1451m.ttf',
				width: '180',
				height: '',
				color: '505e69',
				size: '10',
				positionx: '',
				positiony: '',
				replaceElement: {
					tagName: "span",
					className: "h2"
				},
				modifyValue : function (value)
				{
					return value.toUpperCase();
				}
			}
		});
		
		if(season == "winter")
		{
			imageReplacer.add({
				elements: $$("h2 .img"),
				options: {
					font: 'din1451m.ttf',
					width: '180',
					height: '',
					color: '006eb4',
					size: '10',
					positionx: '',
					positiony: '',
					replaceElement: {
						tagName: "h2",
						className: "h2"
					},
					modifyValue : function (value)
					{
						return value.toUpperCase();
					}
				}
			});
		}
		
		if(season == "summer")
		{
			imageReplacer.add({
				elements: $$("h2 .img"),
				options: {
					font: 'din1451m.ttf',
					width: '180',
					height: '',
					color: '669933',
					size: '10',
					positionx: '',
					positiony: '',
					replaceElement: {
						tagName: "h2",
						className: "h2"
					},
					modifyValue : function (value)
					{
						return value.toUpperCase();
					}
				}
			});
		}
		
		imageReplacer.add({
			elements: $$("#rightbox h2"),
			options: {
				font: 'din1451m.ttf',
				width: '180',
				height: '20',
				color: 'ffffff',
				size: '10',
				positionx: '',
				positiony: '',
				replaceElement: {
					tagName: "h2",
					className: "white"
				},
				modifyValue : function (value)
				{
					return value.toUpperCase();
				}
			}
		});
		
		imageReplacer.add({
			elements: $$("h2 .maps"),
			options: {
				font: 'din1451m.ttf',
				width: '700',
				height: '',
				color: '669933',
				size: '10',
				positionx: '',
				positiony: '',
				replaceElement: {
					tagName: "h2",
					className: "maps"
				},
				modifyValue : function (value)
				{
					return value.toUpperCase();
				}
			}
		});	
		
		imageReplacer.add({
			elements: $$("#main .menu h2"),
			options: {
				font: 'din1451m.ttf',
				width: '160',
				height: '20',
				color: '505e69',
				size: '10',
				positionx: '',
				positiony: '',
				replaceElement: {
					tagName: "h2",
					className: "grey"
				},
				modifyValue : function (value)
				{
					return value.toUpperCase();
				}
			}
		});
		
		imageReplacer.add({
			elements: $$("em"),
			options: {
				font: 'din1451m.ttf',
				width: '40',
				height: '19',
				color: '505e69',
				size: '16',
				positionx: '',
				positiony: '',
				replaceElement: {
					tagName: "h2",
					className: "maps"
				},
				modifyValue : function (value)
				{
					return value.toUpperCase();
				}
			}
		});	
		
		imageReplacer.add({
			elements: $$("#navigation span"),
			options: {
				font: 'din1451m.ttf',
				width: '',
				height: '18',
				color: '505e69',
				size: '9.4',
				positionx: '',
				positiony: '12',
				replaceElement: {
					tagName: "span",
					className: "nav"
				},
				modifyValue : function (value)
				{
					return value.toUpperCase();
				}
			}
		});	
	}
	
	imageReplacer.start();
	initLightbox();
}


window.onload = onDocumentLoad;




