function intval( mixed_var, base ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: stensi
    // +   bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // *     example 1: intval('Kevin van Zonneveld');
    // *     returns 1: 0
    // *     example 2: intval(4.2);
    // *     returns 2: 4
    // *     example 3: intval(42, 8);
    // *     returns 3: 42
    // *     example 4: intval('09');
    // *     returns 4: 9
 
    var tmp;
 
    var type = typeof( mixed_var );
 
    if(type == 'boolean'){
        if (mixed_var == true) {
            return 1;
        } else {
            return 0;
        }
    } else if(type == 'string'){
        tmp = parseInt(mixed_var * 1);
        if(isNaN(tmp) || !isFinite(tmp)){
            return 0;
        } else{
            return tmp.toString(base || 10);
        }
    } else if(type == 'number' && isFinite(mixed_var) ){
        return Math.floor(mixed_var);
    } else{
        return 0;
    }
}




// Build an empty URL structure in which we will store
// the individual query values by key.
var objURL = new Object();
 
 
// Use the String::replace method to iterate over each
// name-value pair in the query string. Location.search
// gives us the query string (if it exists).
window.location.search.replace(
new RegExp( "([^?=&]+)(=([^&]*))?", "g" ),
 
// For each matched query string pair, add that
// pair to the URL struct using the pre-equals
// value as the key.
function( $0, $1, $2, $3 ){
objURL[ $1 ] = $3;
}
);

/*

// Loop over the URL values that we collected.
for (var strKey in objURL){
 
// Output the key to the document.
document.write(
"<strong>" + strKey + ":</strong> "
);
 
// Output the value stored at that key.
document.write(
objURL[ strKey ] + "<br />"
);
}
*/


// Now that the most of the document is loaded, we
// can reach into the DOM and set values on specific
// node elements. Let's set the Database node.
var objNode = document.getElementById( "database" );
 
// Check to make sure we have a valid node and that
// our URL does indeed contain the proper variable.
if (objNode && objURL[ "i" ]){
 
// Set the inner HTML to reflect the value of
// the database that was sent in the URL.
objNode.innerHTML = objURL[ "i" ];
 
}
 
 
function scroll(id)
{
var divNode = document.getElementById( id );
var aNode = document.getElementById( "a"+intval(objURL[ "id" ]) );
//alert(divNode.nodeName);
//alert(aNode.nodeName);
if (intval(objURL[ "id" ]) &&  divNode && aNode ) 
{
//alert (aNode.parentElement.offsetLeft);
//divNode.scrollLeft=aNode.parentElement.offsetLeft-286;
var scrl= 0;
//alert("aNode.parentNode.clientWidth="+aNode.parentNode.clientWidth);
//alert("aNode.parentNode.offsetWidth="+aNode.parentNode.offsetWidth);

/*if (aNode.parentNode.clientWidth)
 {scrl=aNode.parentNode.clientWidth;}	
else
{

if (aNode.parentNode.offsetWidth) 
{scrl=aNode.parentNode.offsetWidth;}
}
*/
divNode.scrollLeft=aNode.parentNode.offsetLeft-scrl;
}
}

//window.onload=init();
