function FadeOutChangeContentFadeIn(division,contentfile,frameheight)
{
    $('#'+division).fadeOut('slow',function()
    {
        $('#'+division).height(frameheight);
        document.getElementById(division).innerHTML= "<iframe id='mainiframe' src='"+contentfile+"'></iframe>";
        $('#'+division).fadeIn('slow', function(){});
    });   
}

$.extend({
  getUrlVars: function(){
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++)
    {
      hash = hashes[i].split('=');
      vars.push(hash[0]);
      vars[hash[0]] = hash[1];
    }
    return vars;
  },
  getUrlVar: function(cfile){
    return $.getUrlVars()[cfile];
  },
  getUrlVar: function(fheight){
    return $.getUrlVars()[fheight];
  }
});

jQuery(document).ready(function(){
    
    
    
    if ($.getUrlVar('cfile')==null) {
        //alert ('cfile is empty');
        $('#contentblockcenter').height('600px');
        if($("body").attr("id")=="mainbody")//standaard
        {
            setTimeout(function(){
            document.getElementById('contentblockcenter').innerHTML = "<iframe id='mainiframe' src='plastic-union-flexible-packaging.html'></iframe>";
            $('#contentblockcenter').fadeIn();},10);
        }
        else if($("body").attr("id")=="mainbodynl") //nederlands
        {
            setTimeout(function(){
            document.getElementById('contentblockcenter').innerHTML = "<iframe id='mainiframe' src='plastic-union-flexible-packaging-nl.html'></iframe>";
            $('#contentblockcenter').fadeIn();},10);
        }
        else if($("body").attr("id")=="mainbodyfr") //francais
        {
            setTimeout(function(){
            document.getElementById('contentblockcenter').innerHTML = "<iframe id='mainiframe' src='plastic-union-flexible-packaging-fr.html'></iframe>";
            $('#contentblockcenter').fadeIn();},10);
        }
        else if($("body").attr("id")=="mainbodyen")//english
        {
            setTimeout(function(){
            document.getElementById('contentblockcenter').innerHTML = "<iframe id='mainiframe' src='plastic-union-flexible-packaging-en.html'></iframe>";
            $('#contentblockcenter').fadeIn();},10);
        }
    } // end if cfile is null
    else {
        //alert('cfile : ' + $.getUrlVar('cfile') + ' - fheight : ' + $.getUrlVar('fheight'));
        FadeOutChangeContentFadeIn('contentblockcenter',$.getUrlVar('cfile') , $.getUrlVar('fheight'));
    }
    
  });








