var sanomaPopup;

function OpenWindow(wUrl,wName,wOptions) {
	sanomaPopup = window.open(wUrl, wName, wOptions);
	//history.back();
}

function getStyleObject(objectId) {
	if(document.getElementById && document.getElementById(objectId)) {
		return document.getElementById(objectId).style;
	} else if (document.all && document.all(objectId)) {
		return document.all(objectId).style;
	} else if (document.layers && document.layers[objectId]) {
		return document.layers[objectId];
	} else {
		return false;
	}
}

function changeObjectVisibility(objectId, newVisibility) {
	var styleObject = getStyleObject(objectId);
	if(styleObject) {
		styleObject.display = newVisibility;
		return true;
	} else {
		alert("Er is een fout opgetreden. Uw browser ondersteund deze functie niet. Download een nieuwe versie!");
		return false;
	}
}

function getObjectById(objectId){
	if(document.getElementById && document.getElementById(objectId)) {
		return document.getElementById(objectId);
	} else if (document.all && document.all(objectId)) {
		return document.all(objectId);
	} else if (document.layers && document.layers[objectId]) {
		return document.layers[objectId];
	} else {
		return false;
	}
}

function hideIfHrefIsEmpty(id) {alert("blah");
	var elem = document.getElementById(id);
	if(elem.href == "") elem.parentNode.style.display = "none";
}

//Some general function to handle different kind of webbrowsers.
function getObjectById(objectId){
	if(document.getElementById && document.getElementById(objectId)) {
	return document.getElementById(objectId);
	} else if (document.all && document.all(objectId)) {
	return document.all(objectId);
	} else if (document.layers && document.layers[objectId]) {
	return document.layers[objectId];
	} else {
	return false;
	}
}

function PlaceholderIsEmpty(str)
{
	if( str == "" || str == "&nbsp;" )
		return true;
	else
		return false;
}

function PopupKleurplaatImage()
{
var openWindow;
	if (!openWindow || openWindow.closed) 
	{
		openWindow = window.open('','','toolbar=yes,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=1,left=10,top=10'); 
		if (!openWindow.opener) 
			openWindow.opener = window;
	} 
	else 
	{	openWindow.focus();
	}

	openWindow.document.open();
	openWindow.document.write('<HTML><HEAD><TITLE>Kleurplaat</TITLE>');
	openWindow.document.write('<script language="javascript" src="/disneyboekenclub/Includes/Js/General.js" type="text/javascript"></script>');
	openWindow.document.write('</HEAD>');
	
	openWindow.document.write('<body><img id="kleurplaat" src="' + this.attributes.item("big").value + '">');
	openWindow.document.write('<script language="javascript">');
	openWindow.document.write('window.onload = ResizeWindow;');
	openWindow.document.write('</script>');
	openWindow.document.write('</body></HTML>');
	openWindow.document.close();
	
	
}

function ResizeWindow()
{
	window.resizeTo(document.getElementById("kleurplaat").width + 40, document.body.scrollHeight + 80);
}


function pagePrint(id) 
{

	var openWindow;
	var printDiv;
	
	printDiv = document.getElementById(id);	
	
	if (!openWindow || openWindow.closed) 
	{
		openWindow = window.open('','','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,noresize,resizable=0,width=750,height=500,left=10,top=10'); 
		if (!openWindow.opener) 
			openWindow.opener = window;
	} 
	else 
	{	openWindow.focus();
	}
	
	openWindow.document.open();
	openWindow.document.write('<HTML><HEAD>');
	openWindow.document.write('<LINK href="/disneyboekenclub/Includes/Css/print.css" type="text/css" rel="stylesheet">');
	openWindow.document.write('</HEAD>');
	
	openWindow.document.write('<body>');
	openWindow.document.write(printDiv.innerHTML);
	openWindow.document.write('</body></HTML>');
	openWindow.document.close();
	
	openWindow.print();
	

}

var kleurplaatWindow;

function openPrintWindow() {
	document.currentKleurplaat = this.attributes["big"].value;
	kleurplaatWindow = window.open("/disneyboekenclub/includes/html/printkleurplaat.htm", "", "left=0,top=0,width=100, height=100, toolbars=no, status=no");
}

document.getKleurplaat = function() {
	var kpwBody = kleurplaatWindow.document.body;
	kpwBody.innerHTML = '<img src="'+document.currentKleurplaat+'" border="0" alt="" />'
}

disableLoginValidators = function() {
	var arrNewValidators = new Array();
	var arrIndexCounter = 0;
	if (typeof(Page_ClientValidate) != "undefined") {
	
		for(var i=0; i<Page_Validators.length; i++) {
			var val = Page_Validators[i];
			var valName = val.id.toString();
			
			if(!valName.match(/^RechterBol.*EmailRequiredFieldValidator/) &&
				!valName.match(/^RechterBol.*EmailRegularExpressionValidator/) &&
				!valName.match(/^RechterBol.*PasswordRequiredFieldValidator/) &&
				!valName.match(/^RechterBol.*PasswordRegularExpressionValidator/)) {
				arrNewValidators[arrIndexCounter++] = Page_Validators[i];
			}
		}
		
		Page_Validators = arrNewValidators;
	}
}

function openSpelletje(spelletjeUrl) {
	document.spelletjeUrl = spelletjeUrl;
	window.open("/disneyboekenclub/includes/html/spelletje.htm", "", "width=600,height=450,toolbars=no,history=no,status=no");
}

function URLencode(sStr) {
    return escape(sStr).
             replace(/\+/g, '%2B').
                replace(/\"/g,'%22').
                   replace(/\'/g, '%27').
                     replace(/\//g,'%2F');
  }