    var isNav4, isNav6, isIE4, isIE;
    var newHeight;
    var newWidth;
    var mainHeight = 550;
    var mainWith = 550;
    var debug = true;
/*
 * Browser version snooper; determines your browser
 * (Navigator 4, Navigator 6, or Internet Explorer 4/5)
 */
function setBrowser()
{
    if (navigator.appName.indexOf("Explorer") >= 0)
    {
        isIE = true;
    }
    
    if (navigator.appVersion.charAt(0) == "4")
    {
        if (navigator.appName.indexOf("Explorer") >= 0)
        {
            isIE4 = true;            
        }
        else
        {
            isNav4 = true;
        }
    }
    else if (navigator.appVersion.charAt(0) > "4")
    {
        isNav6 = true;
    }
}
setBrowser();

/*
 *
 * Move a given id.  If additive is true,
 * then move it by xValue dots horizontally and
 * yValue units vertically.  If additive is
 * false, then move it to (xValue, yValue)
 *
 * Note: do not precede the id with a # -- it will be
 * appended when searching the stylesheets
 *
 * Note also: length units are preserved in Navigator 6
 * and Internet Explorer. That is, if left is 2cm and
 * top is 3cm, and you move to (4, 5), the left will
 * become 4cm and the top 5cm.
 *
 */
function generic_move( id, xValue, yValue, additive )
{
    var left = getIdProperty(id, "left");
    var top = getIdProperty(id, "top");
    var leftMatch, topMatch;

    if (isNav4)
    {
        leftMatch = new Array( 0, left, "");
        topMatch = new Array( 0, top, "");
    }
    else if (isNav6 || isIE4 )
    {
        var splitexp = /([-0-9.]+)(\w+)/;
        leftMatch = splitexp.exec( left );
        topMatch = splitexp.exec( top );
        if (leftMatch == null || topMatch == null)
        {
            leftMatch = new Array(0, 0, "px");
            topMatch = new Array(0, 0, "px");
        }
    }
    left = ((additive) ? parseFloat( leftMatch[1] ) : 0) + xValue;
    top = ((additive) ? parseFloat( topMatch[1] ) : 0) + yValue;
    setIdProperty( id, "left", left + leftMatch[2] );
    setIdProperty( id, "top", top + topMatch[2] );
}

/*
 *
 * Move a given id to position (xValue, yValue)
 *
 */
function moveIdTo( id, x, y )
{
    generic_move( id, x, y, false );
}

/*
 *
 * Move a given id to (currentX + xValue, currentY + yValue)
 *
 */
function moveIdBy( id, x, y)
{
    generic_move( id, x, y, true );
}

function getStyleBySelector( selector )
{
   var sheetList = document.styleSheets;
   var ruleList;
   var i, j;

   /* look through stylesheets in reverse order that
      they appear in the document */
   for (i=sheetList.length-1; i >= 0; i--)
   {
       ruleList = sheetList[i].cssRules;
       for (j=0; j<ruleList.length; j++)
       {
           if (ruleList[j].type == CSSRule.STYLE_RULE && 
               ruleList[j].selectorText == selector)
           {
               return ruleList[j].style;
           }   
       }
   }
   return null;
}

/*
 *
 * Given an id and a property (as strings), return
 * the given property of that id.  Navigator 6 will
 * first look for the property in a tag; if not found,
 * it will look through the stylesheet.
 *
 * Note: do not precede the id with a # -- it will be
 * appended when searching the stylesheets
 *
 */
function getIdProperty( id, property )
{
    if (isNav6)
    {
        var styleObject = document.getElementById( id );
        if (styleObject != null)
        {
            styleObject = styleObject.style;
            if (styleObject[property])
            {
                return styleObject[ property ];
            }
        }
       
        styleObject = getStyleBySelector( "#" + id );
        return (styleObject != null) ?
            styleObject[property] :
            null;
    }
    else if (isNav4)
    {
        return document[id][property];
    }
    else
    {
        return document.all[id].style[property];
    }
}

/*
 *
 * Given an id and a property (as strings), set
 * the given property of that id to the value provided.
 *
 * The property is set directly on the tag, not in the
 * stylesheet.
 *
 */
function setIdProperty( id, property, value )
{
    if (isNav6)
    {
        var styleObject = document.getElementById( id );
        if (styleObject != null)
        {
            styleObject = styleObject.style;
            styleObject[ property ] = value;
        }
        
        /*
        styleObject = getStyleBySelector( "#" + id );
        if (styleObject != null)
        {
            styleObject[property] = value;
        }
        */
    }
    else if (isNav4)
    {
        document[id][property] = value;
    }
    else if (isIE4)
    {
         document.all[id].style[property] = value;
    }
}

function switchview()
{   
    //var height;        
    var image = new Image(); 
    var replacestring;
    
    //height = getIdProperty("main", "height").replace("px","");       
    image = document.getElementById("mainpic");
        
    if (image.src.indexOf("&maxw") == -1)
    {
        image.src = image.src + "&maxwidth=" + (mainWidth - 60).toString() + "&maxheight=" + (mainHeight - 40).toString();
        refresh();        
    }
    else
    {
        replacestring = image.src.substring(image.src.indexOf("&maxw"));        
        image.src = image.src.replace(replacestring, "")
        setIdProperty( "main", "height", newHeight - 114);
        setIdProperty( "main", "width", newWidth - 64);   
        moveIdTo("main", 32, 82);  
        
        setIdProperty( "main", "overflow", "auto");  
    }
}

  function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

  function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }

function InitHome()
{
   
    var elem = window.document.getElementById("ft"); 
    var pg = window.document.getElementById("pg"); 
    var x = findPosX(elem);
    var y = findPosY(elem);
    var w;
    
    var xofs = 200;
    var yofs;
    var newoffset;
    var footheight;
    
	try {
	    w = document.getElementById("pg").offsetWidth;
	    yofs = getIdProperty("picpreview", "height");
        yofs = yofs.replace("px", "");
		
		
        newoffset = parseInt(yofs);

        footheight = document.getElementById("ft").offsetHeight;

        $('#picpreview').show();
		
	    //setIdProperty( "picpreview", "display", "block");
	    setIdProperty( "picpreview", "width", (w - xofs - 50) + "px");
	    moveIdTo( "picpreview", x + xofs, y + footheight - yofs - 13);
	}
	catch (e)
	{
	    if (debug) alert(e.message);
	}
}

function InitBeurs(picpreview)
{
    var elem = window.document.getElementById("ft"); 
    var pg = window.document.getElementById("pg"); 
	
    var x = findPosX(elem);
    var y = findPosY(elem);
    var w;
    
    var xofs = 200;
    var yofs;
    var newoffset;
    var footheight;
    
	try
	{
		
	    w = document.getElementById("pg").offsetWidth;
	    yofs = getIdProperty( picpreview, "height");
		
		if (yofs == null) alert("return");
		
        yofs = yofs.replace("px", "");
        newoffset = parseInt(yofs);
        footheight = document.getElementById("ft").offsetHeight;
	    setIdProperty( picpreview, "display", "block");
	    setIdProperty( picpreview, "width", (w - xofs - 50) + "px");
	    moveIdTo( picpreview, x + xofs, y + footheight - yofs - 13);
	}
	catch (e)
	{
	    if (debug) alert(e.message);
	}
}

function ShowPreview(image) {
   
    var img = new Image();
    
    try
    {   
        img.src = "/files/images/home_visuals/" + image;
        
        var mp = document.getElementById("homeimg");
            
        mp.src = img.src;    
    }
    catch (e)
    {
        if (debug) alert(e.message);
    }
}

var i_beurs = 1;

function DoBeursSlide2()
{
    try
    {
        var src = "";
        
        $('homeimg').fade();
        
        if (i_beurs >= 3)
            i_beurs = 1;
        else
            i_beurs++;
        
        src = "/files/images/home_visuals/beurs" + i_beurs + ".jpg";
            
        $("homeimg").src = src;   
        
        $('homeimg').appear();            
    }
    catch (e)
    {
        if (debug) alert(e.message);
    }
    
}
