function parsequery(){
    var arg_pairs = new Object();
    arg_pairs.names = new Array();
    arg_pairs.values = new Array();
    var query = location.search.substring(1);
    if(query == ""){ return 0; }
    var pairs = query.split("\&");
    for(var i = 0; i < pairs.length; i++){
        var pos = pairs[i].indexOf('=');
        if(pos == -1){ continue; }
        var arg_name = pairs[i].substring(0,pos);
        var arg_value = pairs[i].substring(pos+1);
        arg_pairs.names[i] = arg_name;
        arg_pairs.values[i] = arg_value;
    }
    return arg_pairs;
}
function getqueryparam(arg_pairs, paramname){
    if(arg_pairs == null || arg_pairs.names == null){ return null; }

    for(var i = 0; i < arg_pairs.names.length; i++){
        if(arg_pairs.names[i] == paramname){ return arg_pairs.values[i]; }
    }

    return null;
}
function parsecookie(){
	var cookie_pairs = new Object();
	cookie_pairs.names = new Array();
	cookie_pairs.values = new Array();
	var cookie = document.cookie;
	if(cookie == "") { return null; }
	var pairs = cookie.split(";");
	for(var i = 0; i < pairs.length; i++){
		var pos = pairs[i].indexOf('=');
		if(pos == -1){ continue; }
		var cookie_name = pairs[i].substring(0,pos);
		var cookie_value = pairs[i].substring(pos+1);
		cookie_pairs.names[i] = cookie_name;
		cookie_pairs.values[i] = cookie_value;
	}
	return cookie_pairs;
}
function getcookieparam(cookie_pairs, name){
	if(cookie_pairs == null){ return null; }
	exp = new RegExp(name);
	for(var i = 0; i < cookie_pairs.names.length; i++){
		var result = exp.exec(cookie_pairs.names[i]);
		if(result == name) { return cookie_pairs.values[i]; }
	}
}
function openlink(url, external){
    if(external){
        var asynclog = null;
        if(window.XMLHttpRequest){ asynclog = new XMLHttpRequest(); }
        else if(window.ActiveXObject){ asynclog = new ActiveXObject("Microsoft.XMLHTTP"); }

        asynclog.open('POST', '/cgi-bin/asynclog.pl', true);
        asynclog.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        asynclog.send('link=' + escape(url));
        window.open(url, '_new');
    }else{
        location.href = url;
    }

    return;
}
function resizerows(){
    for(var i = 0; true; i++){
        var row = document.getElementById('section' + i);
        if(row == null){ break; }
        var height = row.clientHeight;
        height = (height < 40) ? 40 : height;
        document.getElementById('section' + i).style.height = height + 'px';
        document.getElementById('sectiontitle' + i).style.height = height + 'px';
        if(navigator.appName == 'Microsoft Internet Explorer'){
            document.getElementById('sectionbody' + i).style.height = height + 'px';
        }else{
            document.getElementById('sectionbody' + i).style.height = (height - 2) + 'px';
        }
    }

    return;
}

/*
function storestylepref(){
    var fontpref = getfontsize();
    var stylepref = getstyleid();
    var pref = stylepref + "," + fontpref;

    var date = new Date();
    date.setTime(date.getTime() + (30*24*60*60*1000));
    var expires = "expires="+date.toGMTString();
    document.cookie = "pt_pref=" + pref + ";" + expires;
    return;
}
function loadstylepref(){
    var pref = getcookieparam(parsecookie(), "pt_pref");
    if(pref){
        var prefs = pref.split(",");
        togglestyle(prefs[0], null, 0);
        togglefontsize(prefs[1], 0);
        resizesectioncontrols();
    }else{ resizesectioncontrols(); }
    return;
}

lastvisit,filter*/
