var isie = (document.all) ? true : false;
var ie = (document.all) ? true : false;

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
	var arVersion = navigator.appVersion.split("MSIE")
	var version = parseFloat(arVersion[1])
	
	if ((version >= 5.5) && (document.body.filters)) 
	{
		for(var i=0; i<document.images.length; i++)
		{
			var img = document.images[i]
			var imgName = img.src.toUpperCase()
			
			if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
			{
				img.style.display = 'block';
				
				var imgID = (img.id) ? "id='" + img.id + "' " : ""
				var imgClass = (img.className) ? "class='" + img.className + "' " : ""
				var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
				var imgStyle = "display:inline-block;" + img.style.cssText 
				if (img.align == "left") imgStyle = "float:left;" + imgStyle
				if (img.align == "right") imgStyle = "float:right;" + imgStyle
				if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
				var strNewHTML = "<div " + imgID + imgClass + imgTitle
				+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
				+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
				+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></div>" 
				img.outerHTML = strNewHTML
				
				i = i-1
			}
		}
	}
	
	for (var i=0; i<document.images.length; i++)
	{
		var img = document.images[i]
		var imgName = img.src.toUpperCase()
		
		if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
		{
			img.style.display = 'block';
		}
	}
}

function setClassName (object, name)
{
	var names 	= object.className.split(" ");
	var classes = "";
	
	if (names.length > 0 && name == "")
	{
		classes = names[0];
	}
	
	if (name != "")
	{
		classes = names[0] + " " + names[0] + "_active";
	}
	
	object.className = classes;
}

function replaceField(field)
{ 
    var password 	= document.createElement("input"); 
    
    password.type 	= "password"; 
    password.name 	= field.name; 
    password.id		= field.name; 
    
    field.parentNode.replaceChild(password, field); 
}

window.onload = function ()
{
	swap.hide('decrease');
	// png's voor IE6 aanpassen
	//correctPNG();
	
	// swf object schrijven
//	var so = new SWFObject("/video.swf", "video", "388", "269", "8");
//	so.addParam("quality", "high");
//	so.addParam("wmode", "transparent");
//	so.addParam("salign", "t");
//	so.write("flashmovie");
}



function formHandler ()
{
	
}

	formHandler.prototype.Send = function (formname, method, action)
	{
		document.forms[formname].method = method;
		document.forms[formname].action = action;
		document.forms[formname].submit();
	}
	
	var formHandler = new formHandler();

function rect ()
{
	this.elements 		= Array();
	this.clipWidth 		= 493;
	this.clipHeight 	= 316;
	
	this.minClipWidth 	= 493;
	this.minClipHeight 	= 316;
	
	this.maxClipWidth 	= 722;
	this.maxClipHeight 	= 316;
	
	this.step			=  10;
	this.speed			=  10;
	
	this.timer;
}

	rect.prototype.Grow = function (elementid)
	{
		// reference voor recursie goed instellen
		var self = this;
		
		// timer clearen
		clearTimeout (this.timer);
		
		// element aan de collectie toevoegen als deze nog niet bestaat
		if (elementid && !this.elements[elementid])
		{
			this.elements[elementid] = document.getElementById(elementid);
		}
		
		// clip waarde berekenen
		this.clipWidth = this.clipWidth - this.step;
		this.clipWidth = (this.clipWidth > this.maxClipWidth) ? this.maxClipWidth : this.clipWidth;
		
		this.elements[elementid].style.clip = 'rect(0px '+ this.maxClipWidth +'px '+ this.maxClipHeight +'px '+ this.clipWidth +'px)';
		
		if (this.clipWidth > 0)
		{
			this.timer = setTimeout(function(){self.Grow(elementid)}, this.speed);
		}
		else
		{
			this.clipWidth = 0;
		}
	}

	rect.prototype.Sink = function (elementid)
	{
		// reference voor recursie goed instellen
		var self = this;
		
		// timer clearen
		clearTimeout (this.timer);
		
		// element aan de collectie toevoegen als deze nog niet bestaat
		if (elementid && !this.elements[elementid])
		{
			this.elements[elementid] = document.getElementById(elementid);
		}
		
		// clip waarde berekenen
		this.clipWidth = this.clipWidth + this.step;
		
		this.clipWidth = (this.clipWidth > this.minClipWidth) ? this.minClipWidth : this.clipWidth;
		
		this.elements[elementid].style.clip = 'rect(0px '+ this.maxClipWidth +'px '+ this.maxClipHeight +'px '+ this.clipWidth +'px)';
		
		if (this.clipWidth < this.minClipWidth)
		{
			this.timer = setTimeout(function(){self.Sink(elementid)}, this.speed);
		}
	}

function text ()
{
	this.elements 		= Array();
	this.opacity  		= 99;
	this.minOpacity 	=  0;
	this.maxOpacity 	= 99;
	
	this.step			=   5;
	this.speed			=  20;
	
	this.timer;
}

	text.prototype.FadeOut = function (elementid)
	{
		// reference voor recursie goed instellen
		var self = this;
		
		// timer clearen
		clearTimeout (this.timer);
		
		// element aan de collectie toevoegen als deze nog niet bestaat
		if (elementid && !this.elements[elementid])
		{
			this.elements[elementid] = document.getElementById(elementid);
		}
		
		// opacity waarde berekenen
		this.opacity = this.opacity - this.step;
		this.opacity = (this.opacity < this.minOpacity) ? this.minOpacity : this.opacity;
		
		if (ie)
		{
			this.elements[elementid].filters.alpha.opacity = this.opacity;
		}
		else
		{
			this.elements[elementid].style.MozOpacity = this.opacity/100;
			this.elements[elementid].style.KhtmlOpacity = this.opacity/100;
		}
		
		if (this.opacity > this.minOpacity)
		{
			this.timer = setTimeout(function(){self.FadeOut(elementid)}, this.speed);
		}
	}

	text.prototype.FadeIn = function (elementid)
	{
		// reference voor recursie goed instellen
		var self = this;
		
		// timer clearen
		clearTimeout (this.timer);
		
		// element aan de collectie toevoegen als deze nog niet bestaat
		if (elementid && !this.elements[elementid])
		{
			this.elements[elementid] = document.getElementById(elementid);
		}
		
		// opacity waarde berekenen
		this.opacity = this.opacity + this.step;
		this.opacity = (this.opacity > this.maxOpacity) ? this.maxOpacity : this.opacity;
		
		if (ie)
		{
			this.elements[elementid].filters.alpha.opacity = this.opacity;
		}
		else
		{
			this.elements[elementid].style.MozOpacity = this.opacity/100;
			this.elements[elementid].style.KhtmlOpacity = this.opacity/100;
		}
		
		if (this.opacity < this.maxOpacity)
		{
			this.timer = setTimeout(function(){self.FadeIn(elementid)}, this.speed);
		}
	}

function swap ()
{
	
}

	swap.prototype.show = function (id)
	{
		document.getElementById(id).style.display = 'block';
	}
	
	swap.prototype.hide = function (id)
	{
		document.getElementById(id).style.display = 'none';
	}
	
function photo ()
{
	this.active = 'photo_1';
}

	photo.prototype.display = function (elm, id, src)
	{
		document.getElementById(this.active).className = '';
		document.getElementById(id).src = src;
		
		elm.className = 'active';
		
		this.active = elm.id
	}

var rect  = new rect();
var text  = new text();
var swap  = new swap();
var photo = new photo();	
