        //
        // TL's script to populate ad campaign variables
        //


        my_query = document.location.search;
        my_sid = '';
		change_hitslink = 0;

        if (my_query.indexOf('?sid=') != -1) {

                my_sid = my_query.substring(my_query.indexOf('?sid=') + 5);

        }

        else if (my_query.indexOf('&sid=') != -1) {

                my_sid = my_query.substring(my_query.indexOf('&sid=') + 5);

        }

        if(my_sid.indexOf('&') != -1) {

                my_sid = my_sid.substring(0,my_sid.indexOf('&'));
        }

        if(my_sid == '') {

        // if null, see if we set a cookie last time we saw them

		wt_cookie = '';		// initialize

                if(document.cookie.indexOf('fcwt') != -1) {

                        wt_cookie = document.cookie.toString().substring(document.cookie.indexOf('fcwt=') + 5);

                        if(wt_cookie.indexOf(';') != -1) {

                                wt_cookie = wt_cookie.substring(0,wt_cookie.indexOf(';'));
                        }
                }

                if(wt_cookie != '') {

                        my_sid = wt_cookie;
                }
        }

        if(my_sid == '') {

        // then use hostname from document.referrer if it isn't null

                if(document.referrer != '') {

                        my_referrer = document.referrer;

                        if(my_referrer.indexOf('http://') != -1) {my_referrer = my_referrer.substring(7);}

			if(my_referrer.indexOf('https://') != -1) {my_referrer = my_referrer.substring(8);}

                        if(my_referrer.indexOf('/') != -1) {

                                my_referrer = my_referrer.substring(0,my_referrer.indexOf('/'));
                        }

                        my_sid = my_referrer;

			change_hitslink = 1;		// use referrer as campaign ID for all non-explicit campaign traffic
							// lets us define particular referrers as campaigns without having	

							// to configure Hitslink for each one individually
                }
        }


        if(my_sid == '') {

                my_sid = 'unknown'; // catch-all

		change_hitslink = 1;			// essentially replaces 'Non-campaign' with 'unknown'
        }

        else {          // set cookie so if they come back without a sid or referer we can track the initial one

                expiresin30days = new Date(new Date().getTime() + (86400000 * 30)).toGMTString();

                document.cookie = 'fcwt=' + my_sid + '; path=/; domain=.fortunecity.com; expires=' + expiresin30days;
        }

        //
        // end TL's script
        //



        //
        // Hitslink code
        //

        var data,nhp,ntz,rf,sr;

        document.cookie='__support_check=1';

        nhp='http';

        rf=document.referrer;

	if(change_hitslink == 1) {

		sr='?sid=' + my_sid;		// TL hack
	}

	else {

	        sr=document.location.search;	// normal hitslink code
	}


        if(top.document.location==document.referrer
|| (document.referrer == '' && top.document.location != '')) {

                rf=top.document.referrer;

		if(change_hitslink == 1) {

			sr='?sid=' + my_sid;		// TL hack
		}

		else {
	                sr=top.document.location.search;	// normal hitslink code
		}
        }

        ntz=new Date();

        if((location.href.substr(0,6)=='https:') || 
(location.href.substr(0,6)=='HTTPS:')) {

        nhp='https'; 
        }


        var data='&an='+escape(navigator.appName)+ '&ck='+document.cookie.length+
        '&sr='+escape(sr)+
        '&rf='+escape(rf)+
        '&sl='+escape(navigator.systemLanguage)+
        '&av='+escape(navigator.appVersion)+
        '&l='+escape(navigator.language)+
        '&pf='+escape(navigator.platform)+
        '&pg='+escape(location.pathname);


        if(navigator.appVersion.substring(0,1)>'3') {

                data=data+'&cd='+
                screen.colorDepth+
                '&rs='+escape(screen.width+ ' x '+screen.height)+
                '&tz='+ntz.getTimezoneOffset()+
                '&je='+ navigator.javaEnabled();

        }

        //document.write('<img border=0 hspace=0 '+
        //'vspace=0 width=1 height=1 src="'+nhp+'://counter2.hitslink.com/'+
        //'statistics.asp?v=1&s=207&acct=fortunecity'+data+'">');

        //
        // end hitslink code
        //

//document.cookie = 'mysr=' + sr +'; path=/; domain=.fortunecity.com; expires=' + expiresin30days;
