function Set_Cookie( name, value, expires, path, domain, secure ) 
{
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );

/*
if the expires variable is set, make the correct 
expires time, the current script below will set 
it for x number of days, to make it for hours, 
delete * 24, for minutes, delete * 60 * 24
*/
if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );

document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
( ( path ) ? ";path=" + path : "" ) + 
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}

var qsParm = new Array();
function qs() {
        var query = window.location.search.substring(1);
        var parms = query.split('&');
        for (var i=0; i<parms.length; i++) {
                var pos = parms[i].indexOf('=');
                if (pos > 0) {
                        var key = parms[i].substring(0,pos);
                        var val = parms[i].substring(pos+1);
                        qsParm[key] = val;
                }
        }
}
//qsParm['source'] = null;
qs();
if (qsParm['source']) {
	//document.cookie = 'sem='+qsParm['source']+'; expires=Thu, 2 Aug 2008 20:47:11 UTC; path=/';
	Set_Cookie( 'osemq', qsParm['source'], 30, '/', '', '' );
	Set_Cookie( 'sem_query', qsParm['source'], null, '/', '', '' );
} else if (qsParm['ppc']) {
	//document.cookie = 'sem='+qsParm['source']+'; expires=Thu, 2 Aug 2008 20:47:11 UTC; path=/';
	Set_Cookie( 'osemq', qsParm['ppc'], 30, '/', '', '' );
	Set_Cookie( 'sem_query', qsParm['ppc'], null, '/', '', '' );
}