/*******************************************************************
 * soopa-rollovers.js
 * 7/28/2001
 * www.youngpup.net
 *
 * easiest rollovers on earth, baby!
 * see www.youngpup.net for documentation.
 *******************************************************************/

function ReadMyCookie(cookieName) {
	var theCookie=""+document.cookie;
	var ind=theCookie.indexOf(cookieName);
	if (ind==-1 || cookieName=="") return "";
	var ind1=theCookie.indexOf(';',ind);
	if (ind1==-1) ind1=theCookie.length;
	return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}

function SetMyCookie(cookieName,cookieValue,nDays) {
	var today = new Date();
	var expire = new Date();
	if (nDays==null || nDays==0) nDays=1;
	expire.setTime(today.getTime() + 3600000*24*nDays);
	document.cookie = cookieName+"="+escape(cookieValue)
		+ ";expires="+expire.toGMTString() + '; domain=bruist.test;';
}

function makeArray() {
	for (i = 0; i<makeArray.arguments.length; i++)
		this[i + 1] = makeArray.arguments[i];
}

function getDate()
{
var months = new makeArray('January','February','Maart','April','Mei', 'Juni','July','Augustus','September','October','November','December');
var days = new makeArray('Maandag','Dinsdag','Woensdag','Donderdag','Vrijdag', 'Zaterdag','Zondag');
var date = new Date();
var dayOfWeek = date.getDay();
var day = date.getDate();
var month = date.getMonth() + 1;
var yy = date.getYear();
var year = (yy < 1000) ? yy + 1900 : yy;

return days[dayOfWeek] + " " + day + " " + months[month] + " " + year;
}

/* zoom functies, alleen voor IE */
function zoom(image)
{

	if(ele = document.getElementById('content')) {
		if(ele.style.zoom != '150%') {
			ele.style.zoom = '150%'; 
			image.src = 'templates/bruistportal/images/schalen_aktief.gif';
			image.hsrc = 'templates/bruistportal/images/schalen_aktief_on.gif';
			SetMyCookie('scale', '150', 1);
		} else {
			ele.style.zoom = '100%';
			SetMyCookie('scale', '100', 1);

		}
	}
}

function showZoomButtons()
{
	var agent = navigator.userAgent.toLowerCase() ;
	if(agent.indexOf("msie") != -1 && !window.opera) {
		
		Items = new Array() ;
		Zoomers = document.getElementById('home');
		Schalen = document.createElement('div') ;
		Schalen.className = 'schalen';
				
		// zet zoom
		scale = ReadMyCookie('scale');
		
		if(scale == '150') {
			document.getElementById('content').style.zoom = '150%';
		}

		image = new Image();
		if(document.getElementById('content').style.zoom == '150%') {
			image.src = 'templates/bruistportal/images/schalen_aktief.gif';
			image.hsrc = 'templates/bruistportal/images/schalen_aktief_on.gif';
		} else {
			image.src = 'templates/bruistportal/images/schalen.gif';
			image.hsrc = 'templates/bruistportal/images/schalen_on.gif';
		}
		image.attachEvent('onclick', function(){zoom(this)});
		
		//Schalen.appendChild(image);
		Schalen.insertBefore(image, null);
		document.body.insertBefore(Schalen, null)
		Zoomers.appendChild(Schalen) ;
	} else {
		try {
			home = document.getElementById('home');
			dateElement = document.createElement('span');
			dateElement.className = 'datum';
			dateElement.style.zIndex ='40';
			dateElement.innerHTML = getDate();
			home.appendChild(dateElement);
		} catch(e) {

			/* doe niets */

		}
	}
}

/* extra moet ook onLoad ^^^^^^ */

function soopaSetup() {

	
	/* heeft niks te maken met soopa */
	showZoomButtons();
	/* eind heeft niks te maken met soopa, maar moet ook Onload */

	var img, sh, sn, sd
	for (var i = 0; (img = document.images[i]); i++) {
		if (img.getAttribute) {

			sn = img.getAttribute("src");
			sh = img.getAttribute("hsrc");
			sd = img.getAttribute("dsrc");

			if (sn != "" && sn != null) {
				img.n = new Image();
				img.n.src = img.src;
			
				if (sh != "" && sh != null) {
					img.h = new Image();
					img.h.src = sh;
					img.onmouseover = soopaSwapOn
					img.onmouseout  = soopaSwapOff
				}

				if (sd != "" && sd != null) {
					img.d = new Image();
					img.d.src = sd;
					img.onmousedown = soopaSwapDown
				}
			}
		}
	}
}

function soopaSwapOn() {
	this.src = this.h.src;
}

function soopaSwapOff() {
	this.src  = this.n.src;
}

function soopaSwapDown() {
	this.src  = this.d.src;
	this.temp = typeof(document.onmouseup) != 'undefined' && typeof(document.onmouseup) != 'unknown' ? document.onmouseup : "";
	soopaSwapUp.img = this;
	document.onmouseup = soopaSwapUp;
}

function soopaSwapUp() {
	var ths = soopaSwapUp.img;
	ths.src = ths.n.src;
	if (ths.temp) document.onmouseup = ths.temp;
}

function submitPoll(itemForm){
	
	getObj(itemForm).submit();
	
}

