function getBaseURL() {
    var url = location.href;  // entire url including querystring - also: window.location.href;
    var base = url.substring(0, url.indexOf('/', 14));
		var repBase = base.replace("http://www.", "");
		var upBase = repBase.replace("vacature","Vacature");
		var baseURL = upBase.substr(0, 1).toUpperCase() + upBase.substr(1);
		
    if (baseURL.indexOf('http://localhost') != -1) {
        // Base Url for localhost
        var url = location.href;  // window.location.href;
        var pathname = location.pathname;  // window.location.pathname;
        var index1 = url.indexOf(pathname);
        var index2 = url.indexOf("/", index1 + 1);
        var baseLocalUrl = url.substr(0, index2);

        return baseLocalUrl;
    }
    else {
        // Root Url for domain name
        return baseURL;
    }

}

function printPage() {
	var content	= document.getElementsByClassName("login_module_middle_content")[0];
	var obj		= content.innerHTML; // beware
	var win		= window.open();
	
	self.focus();
	win.document.open();
	win.document.write('<html><head><title>'+getBaseURL()+' Print Pagina</title>');
	win.document.write('<link rel="stylesheet" href="backend/css/printpage.css" type="text/css" charset="utf-8" />');
	win.document.write('<style type="text/css"> .hidefromprint{ display: none !important; } </style>'); // this allows you to hide certain parts of the page from the file that's printed
	win.document.write('</head><body>');
	win.document.writeln(obj);
	win.document.write('</body></html>');
	win.document.close();
	win.print();
}

function printPageBack() {
	
	//var content	= document.getElementsByClassName("linkswrapper")[0];
	var content = document.getElementById("main_middle_content");
	var obj		= content.innerHTML; // beware
	var win		= window.open();
	
	//alert(obj);
	
	self.focus();
	win.document.open();
	win.document.write('<html><head><title>'+getBaseURL()+' Print Pagina</title>');
	win.document.write('<link rel="stylesheet" href="backend/css/printpage.css" type="text/css" charset="utf-8" />');
	win.document.write('<style type="text/css"> .hidefromprint{ display: none !important; } </style>'); // this allows you to hide certain parts of the page from the file that's printed
	win.document.write('</head><body>');
	win.document.writeln(obj);
	win.document.write('</body></html>');
	win.document.close();
	win.print();
}

function printPageCV(gebruikernummer){
	
	var webpage = document.location('admin.php?page=print&type=cv&id='+gebruikernummer);
	var content = document.getElementById("printable");
	
	alert(content);
	win.print();
	
}

/* 
possible fix for landscape mode printing
win.document.write('<style type="text/css">@page{size: landscape;margin: 2cm;}</style>'); 
*/





