
function setSpecialText() 
{		
	var window_height   = document.body.clientHeight;
	var txt_right       = document.getElementById('verticaltext');    	
	var ie_version      = parseFloat(navigator.appVersion.split('MSIE')[1]);
	
	if (txt_right != null) {
    	var word_right      = txt_right.innerHTML;
    	var word_length     = (word_right.length * 65);
    	
    	if (window_height < 650) {
    	    if (word_right.length <= 6) {
    	        var new_height = 980;
    	    } else if (word_right.length <= 8) {
    	        var new_height = 760;
    	    } else if (word_right.length <= 10) {
    	        var new_height = 640;
    	    } else {
    	        var new_height = 510;
    	    }    	    
    	} else if (window_height > 650 && window_height < 835) {
    	    var diff = (window_height - 650);
    	    var perc = (diff / 170)
    	    
    	    if (word_right.length <= 6) {
    	        var new_height = 950 + (perc * 300);
    	    } else if (word_right.length <= 8) {
    	        var new_height = 730 + (perc * 280);
    	    } else if (word_right.length <= 10) {
    	        var new_height = 610 + (perc * 240);
    	    } else {
    	        var new_height = 480 + (perc * 190);
    	    }
    	} else {
    	    if (word_right.length <= 6) {
    	        var new_height = 1180;
    	    } else if (word_right.length <= 8) {
    	        var new_height = 1040;
    	    } else if (word_right.length <= 10) {
    	        var new_height = 880;
    	    } else {
    	        var new_height = 700;
    	    }
    	}    	
    	if (ie_version == 7) {
			txt_right.style.fontSize = (new_height-100) + "%";
		} else {
			txt_right.style.fontSize = new_height + "%";
		}
    }   
}

function fullscreenBG()
{
    var body_frame = document.getElementById('big_bg');
    
    if (body_frame != null) {        
        if (body_frame.currentStyle.backgroundImage != undefined) {
            var bg_image    = body_frame.currentStyle.backgroundImage;        
        
            var begin       = bg_image.indexOf("\"");
            bg_image        = bg_image.substr((begin+1), bg_image.length);
            var end         = bg_image.indexOf("\"");
            bg_image        = bg_image.substr(0, end);

            if (bg_image != "") {
                body_frame.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+bg_image+"',  sizingMethod='scale')";
            }
        }
    }   
}

function displayFrame(active_frm) 
{
    var frm = $('content').childNodes;
    
    if ($(active_frm)) {
        for(i = 0; i < frm.length; i++) {
            if (frm[i].id == active_frm) {
                frm[i].style.display = "block";
            } else {
                frm[i].style.display = "none";
            }
        }
    }
}

function setFrame(str_filename, iframe_name)
{
	
	if (typeof str_filename == 'string' && iframe_name != "") {
	    displayFrame(iframe_name);
	} 
	/*
	else {	
    	if (typeof str_filename != 'string') {
    	    var str_filename = 'catalogus.html';
    	}
    	
    	var url     = str_filename;
    	var pars    = '';
    	
        var myAjax  = new Ajax.Updater( {success: 'content_div'}, url, { method: 'get', parameters: pars, onFailure: reportError });  
        
        //getSubHTML();
        
        rounded();
        Behaviour.apply();
    }*/
}    
/*function getSubHTML(str_filename)
{
	if (str_filename == Object || str_filename == undefined) {
	    var str_filename = 'algemeen.html';   
	}
	
	var url     = str_filename;
	var pars    = '';
	
    var myAjax  = new Ajax.Updater( {success: 'link_frame'}, url, { method: 'get', parameters: pars, onFailure: reportError });    
}*/
function reportError(request)
{
	//alert('Sorry. There was an error.');
}
function showAladin() 
{
    window.open('http://aladin.bibliotheek.nl','aladin','width=1016px,height=590px,status=yes,toolbar=yes,location=yes,titlebar=yes,resizable=yes,menubar=yes,top=0,left=0');
}
function showCatalogus() 
{
    //window.open('http://www.kb.nl','test','width=1016px,height=590px,status=yes,toolbar=yes,location=yes,titlebar=yes,resizable=yes,menubar=yes,top=0,left=0');
}
function showHomepage() 
{
    window.open('http://www.bibliotheekhilversum.nl/','homepage','width=1016px,height=590px,status=yes,toolbar=yes,location=yes,titlebar=yes,resizable=yes,menubar=yes,top=0,left=0');
}

Event.observe(window, 'load',   setSpecialText, false);
Event.observe(window, 'load',   setFrame,       false);
Event.observe(window, 'load',   fullscreenBG,   false);

Event.observe(window, 'resize', setSpecialText, false);
