﻿// JavaScript Document

// Prelaod images

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

// LightBox activator

function ActLight(){
	$(function() {
		$('#mainNavi a').nyroModal();

	});
}
//

//Horizontal Marquee activation
function marqueeActivate(){
	marqueeInit({
		uniqueid: 'mycrawler',
		style: {
			'padding': '0',
			'width': '375px',
			'height': '101px',
			'background-color': '#FFF',
			'z-index': '1'
		},
		inc: 1, //speed - pixel increment for each iteration of this marquee's movement
		mouse: false, //mouseover behavior ('pause' 'cursor driven' or false)
		direction: 'right', // direction 'right' or 'left'
		noAddedSpace: false, // Added Space between marquee elements
	});
}
/* Marquee Options:

uniqueid: 'some_unique_id', 	Required - id for the marquee's container division tag.

style: {
'width': '100%',
'height': '1.6em',
'color': '#fff',
'background-color': '#32f',
'font-family': 'sans-serif',
'margin': '0 auto'
}, 	Style object for this marquee container (use quotes on both sides of the : as shown) (defaults to {'margin': '0 auto'}, which centers a marquee) If no width is specified it will default to 100%, if no height is specified, it will default to the offsetHeight of the marquee contents. Marquees whose specified or default width is greater than their contents will be automatically shrunk to avoid empty spots.

inc: 8, 	Speed/top speed - pixel increment for each iteration of this marquee's movement - If marquee mouse: property is 'cursor driven' this is the top speed. Otherwise, it is the speed of the marquee. (defaults to 2)

addDelay: 20, 	Additional delay between movement iterations (default delay is 30 milliseconds, the number here will be added to that)

mouse: 'cursor driven', 	Mouseover behaviour ('pause' 'cursor driven' or false). (defaults to 'pause') Using false here will make the mouse have no effect on the marquee.

direction: 'right', 	('right' or 'left') Direction of marquee. (defaults to 'left' - easiest for reading text marquees)

noAddedSpace: true, 	(true or false) Should marquee not have an added space at the beginning to ensure that the first and last elements or sentences do not butt up against each other? (defaults to false (a space will be added) - optimal for text marquees and for image marquees with spaces between the images)

stopped: true, 	(true or false) Should marquee start out in stopped mode? Useful for some 'cursor driven' marquees. (defaults to false).
 
  	The 3 parameters below are applicable only in mouse: 'cursor driven' marquees
	
moveatleast: 4, 	Minimum speed for 'cursor driven' marquee when mouse is off of it. If not specified and this is a 'cursor driven' marquee, the marquee will stop when moused out. (defaults to no motion onmouseout)

neutral: 150, 	Size of neutral area for 'cursor driven' marquee. This is size of the area in the center of the marquee where hovering it will stop it. (defaults to 16)

savedirection: true, 	(true, false, or 'reverse') Directional behaviour of 'cursor driven' marquee that has a moveatleast property when moused out. Will it remember it's initial direction (true), continue it's current direction (false), or will it reverse ('reverse') its current direction? (defaults to false)

*/
// Nivo Slider activation
function nivoActivate() {
	/* Conflict solution */ 
	
	$('#GallerySlider').nivoSlider({ 
	pauseTime:5000, pauseOnHover:false, 
			effect:'fold',
			slices:1,
			animSpeed:500,
			directionNav:true,
			directionNavHide:false,
			controlNav:false
	});
}

// Project Loader

function ajax_request_project(projekt) {
	$('#contentViewer').fadeOut('normal');
	setTimeout('loaderimage('+'"'+projekt+'"'+')',250);	
}

function loaderimage(projekt) {
	$('#loaderViewer').html('<div class="placeholder"><img src="img/ajaxLoader.gif" width="64" height="64" /></div>');
	setTimeout('loaderein('+'"'+projekt+'"'+')',250);
}

function loaderein(projekt) {
	$('#loaderViewer').fadeIn('normal');
	setTimeout('ajax_load_project('+'"'+projekt+'"'+')',1000);
}

function ajax_load_project(projekt) {
	$("#contentViewer").load(projekt, function () { 
							 			setTimeout ('loaderaus()',750); 
									}
							);
}

function loaderaus() {
	$('#loaderViewer').fadeOut('normal');
	setTimeout('einblenden()',500);
}

function einblenden() {
	$('#loaderViewer').html('<div class="placeholder">&nbsp;</div>');
	$('#contentViewer').fadeIn('normal');
/*	ActLight(); */
}


/* 
Some Code I didn't use (jQuery slide down effect that only works with hidden layers but not with resize)

$('#content').slideDown('slow', function() {
     this.style.height = 'auto';
});

*/

function emailaddress () {
	document.write('<a href="mailto:');		
	document.write('info');
	document.write('@');
	document.write('dcd');
	document.write('.ie');
	document.write('" class="standart" target="_blank">');
	document.write('info');
	document.write('@');
	document.write('dcd');
	document.write('.ie');
	document.write('</a>');
}

/* Changing background image */

function ChangeBG(newbg) {
	document.getElementById('contentBackImage').src = newbg;
}

function CurrentPage(lkname) {
	document.getElementById('mainMenuItemActive').id = 'mainMenuItemNormal';
//	document.getElementByName(lkname).id = 'mainMenuItemActive';
	document.getElementsByName(lkname).item('id').id = 'mainMenuItemActive';
}

