RIAx = 
{
	Go : function( country, project, location, action, actionname, section )
    {
        this.baseURL = "http://switch.atdmt.com/action/";
        var dr = document.referrer;
      
		this.section = section;
		this.actionname = actionname;
		this.project = project;
		this.country = country;
		this.language = country;
		this.location = location;
		this.action = action;
		this.resolution = screen.width + "x" + screen.height;
		this.url      = encodeURIComponent( dr );
        this.domain   = this.GetDomain( dr );
        this.keywords  = this.GetSearchKeywords( dr );
        this.search   = this.GetSearchResult( dr );   
        this.source   = this.GetQuerystringValue( "source" );
        this.urlDriverVar = this.GetQuerystringValue("driver");
		this.viewURL = this.GetURL("location."+this.location+"/action."+this.action+"/actionname."+this.actionname+"/section."+this.section);
		this.trackingImage( this.viewURL );
	
     },
      // BETA CODE - capture keyword data from search queries
    GetSearchKeywords : function( i )
    {        
        // loop through all m_searchProviders
        for ( var search in this.m_searchProviders )
        {
            // check for a match
            if ( i.indexOf( this.m_searchProviders[ search ].form ) == 0 )
            {                
                // extract keywords
                return this.GetQuerystringValue( this.m_searchProviders[ search ].key, i ).replace( /[+]/g, "," );
            }
        }
        
        // no major search m_searchProviders found, return empty string
        return "";
    },
    
    // BETA CODE - capture keyword data from search queries
    GetSearchResult : function( i )
    {        
        // loop through all m_searchProviders
        for ( var search in this.m_searchProviders )
        {
            // check for a match
            if ( i.indexOf( this.m_searchProviders[ search ].form ) == 0 )
            {                
                // extract keywords
                return search;
            }
        }
        
        // no major search m_searchProviders found, return empty string
        return "";
    },
    
    // extract a domain value from a document referrer string
    GetDomain : function( i )
    {   
        var regex  = "(?:http|https)://(.*?)/";
             
        if ( i && i.length > 0 )
        {
            var matches = i.match( regex );
            
            if ( matches && matches.length > 1 )
            {
                return encodeURIComponent( matches[ 1 ] );
            }
        }
        
        return "";
    },
    
    // gets a querystring value
    GetQuerystringValue : function( s, u )
    {
        s += "=";
        var h  = u ? u : window.location.href,
            ss = h.indexOf( s ),
            a  = "&";
        q = h.indexOf( '?' );
        if ( q > 0 && ss > q )
        {
            sh = h.substring( ss + s.length );
            return sh.indexOf( a ) > 0 ? 
                       sh.substring( 0, sh.indexOf( a ) ) : 
                       sh;
        }
        return "";
    },
     
     
       
      Flash : function( country, project, location, action, actionname, section )
   {
        this.baseURL = "http://switch.atdmt.com/action/";
        var dr = document.referrer;
      	
      
		this.section = section;
		this.actionname = actionname;
		this.project = project;
		this.country = country;
		this.language = country;
		this.location = location;
		this.action = action;
		this.resolution = screen.width + "x" + screen.height;
		
        this.domain   = this.GetDomain( dr );
        this.keywords  = this.GetSearchKeywords( dr );
        this.search   = this.GetSearchResult( dr );   
        this.source   = this.GetQuerystringValue( "source" );
	
     },
       
       
     setClickTrack : function (HTMLvars,href){
		this.viewURL = this.GetURL( HTMLvars );
		this.trackingImage( this.viewURL );
		clearTimeout(this.clickDelay);
		if (href!='nothing'){
		this.clickDelay=setTimeout( "document.location='"+href+"'",500);
		}else{
		
		}
     },
       
     sendFlashTag : function ( flashVars ){
        this.urlDriverVar = this.GetQuerystringValue("driver");
		this.viewURL = this.GetURL( flashVars );
		this.trackingImage( this.viewURL );
     },
        
     GetURL : function( sendVars )
     {  
        this.urlDriverVar = this.GetQuerystringValue("driver");
		this.callURL = this.baseURL + this.project + "/v3/language." + this.language + "/country." + this.country +"/" + sendVars;
		this.purl = "nodriver";
		if(this.urlDriverVar != ""){
			this.purl = encodeURIComponent(this.urlDriverVar );
		}
		this.callURL = this.baseURL + this.project + "/v3/language." + this.language + "/country." + this.country +"/url."+this.purl+"/" + sendVars;
		if (this.source!=""){		
		this.callURL += "/source."+this.source
		}
		if (this.domain!=""){		
		this.callURL += "/domain."+this.domain
		}
		if (this.search!=""){		
		this.callURL += "/search."+this.search
		}
		if (this.keywords!=""){		
		this.callURL += "/keywords."+this.keywords
		}
		this.callURL +="/resolution."+this.resolution+"?" + Math.random();
		
		return this.callURL;
     },
     
     trackingImage : function(sentURL)
     {    
    
     this.trackImage = new Image();
     this.trackImage.src=sentURL;
     } 
}