/* *********************************************
Includes common or global JS functions for Omniture Stats. Tracking 
************************************************ */

function VideoLinkTracking(id)
{   
	var s = s_gi(s_account_twa); 
    s.eVar20=id;
    s.linkTrackVars="events,eVar20"; 
    s.linkTrackEvents="event9";	
    s.events="event9";
    s.tl(this, 'o','Link Name');    
}

function resetVarsToSCODE()
{
    s.cookieDomainPeriods="3";
    /* E-commerce Config */
    s.currencyCode="AUD";
    /* Link Tracking Config */
    s.trackDownloadLinks=true;
    s.trackExternalLinks=true;
    s.trackInlineStats=true;
    s.linkDownloadFileTypes="exe,zip,wav,mp3,mov,mpg,avi,wmv,doc,pdf,xls";
    s.linkInternalFilters="javascript:,westernaustralia.com,.westernaustralia.com";
    s.linkLeaveQueryString=false;
    s.linkTrackVars="None";
    s.linkTrackEvents="None";
}

// Custom Google Maps Omniture Tracking
function callEvent17_GMAPMarkerView(eVar32_MarkerTitle)
{
    var s = s_gi(s_account_twa); 
    s.eVar32 = eVar32_MarkerTitle;
    s.linkTrackVars="events,eVar32"; 
    s.linkTrackEvents="event17";
    s.events="event17";
    s.tl(this, 'o','Link Name');  
}

function callEvent18_GMAPProductView(productId)
{
    var s = s_gi(s_account_twa); 
    s.products = ";" + productId;
    s.linkTrackVars="events,products"; 
    s.linkTrackEvents="event18";
    s.events="event18";
    s.tl(this, 'o','Link Name');
}

function callEvent19_GMAPMore_Info_Product(productId)
{
    var s = s_gi(s_account_twa); 
    s.products = ";" + productId;
    s.linkTrackVars="events,products";
    s.linkTrackEvents="event19";
    s.events="event19";
    s.tl(this, 'o','Link Name');  
}

function callEvent20_GMAPMore_Info_General(evar32_MarkerTitle)
{
    var s = s_gi(s_account_twa); 
    s.eVar32 = eVar32_MarkerTitle;
    s.linkTrackVars="events,eVar32";
    s.linkTrackEvents="event20";
    s.events="event20";
    s.tl(this, 'o','Link Name');
}

function callEvent21_GMAPEnquiryNow(productId)
{
    var s = s_gi(s_account_twa);
    s.products = ";" + productId;    
    s.linkTrackVars="events,products";
    s.linkTrackEvents="event21";
    s.events="event21";
    s.tl(this, 'o','Link Name');
}

function callEvent22_GMAPBookNow(productId)
{
    var s = s_gi(s_account_twa); 
    s.products = ";" + productId;
    s.linkTrackVars="events,products"; 
    s.linkTrackEvents="event22"; 
    s.events="event22";
    s.tl(this, 'o','Book Now');    
}

function callEventProdViewBookNowClick(productId)
{
    var s = s_gi(s_account_twa); 
    s.products = ";" + productId;    
    s.linkTrackVars="events,products"; 
    s.linkTrackEvents="event1"; 
    s.events="event1";
    s.tl(this, 'o','Link Name');    
    resetVarsToSCODE();
}

function callEventProdViewEnquireNowCompletion(productId, leadType)
{
    var s = s_gi(s_account_twa); 
    s.products = ";" + productId;
    s.eVar19= leadType;
    s.linkTrackVars="eVar19,events,products"; 
    s.linkTrackEvents="event8"; 
    s.events="event8";
    s.tl(this, 'o','Link Name');    
    resetVarsToSCODE();
}

function callEventProdViewEnquireNowInit(productId, leadType)
{
    var s = s_gi(s_account_twa); 
    s.products = ";" + productId;
    s.eVar19= leadType;
    s.linkTrackVars="eVar19,events,products"; 
    s.linkTrackEvents="event7"; 
    s.events="event7";
    s.tl(this, 'o','Link Name');    
    resetVarsToSCODE();
}

function callEventProdViewBrochureLinkClick(productId)
{
    var s = s_gi(s_account_twa); 
    s.products = ";" + productId;
    s.linkTrackVars="events,products"; 
    s.linkTrackEvents="event3"; 
    s.events="event3";
    s.tl(this, 'o','Link Name');    
    resetVarsToSCODE();
}

function callEventProdViewBrochureLinkClick(productId)
{
    var s = s_gi(s_account_twa); 
    s.products = ";" + productId;
    s.linkTrackVars="events,products"; 
    s.linkTrackEvents="event3"; 
    s.events="event3";
    s.tl(this, 'o','Link Name');    
    resetVarsToSCODE();
}

function callEventProdViewEmailLinkClick(productId)
{
    var s = s_gi(s_account_twa); 
    s.products = ";" + productId;
    s.linkTrackVars="events,products"; 
    s.linkTrackEvents="event4"; 
    s.events="event4";
    s.tl(this, 'o','Link Name');    
    resetVarsToSCODE();
}

function callEventProdViewWebsiteLinkClick(productId)
{
    var s = s_gi(s_account_twa); 
    s.products = ";" + productId;
    s.linkTrackVars="events,products"; 
    s.linkTrackEvents="event5"; 
    s.events="event5";
    s.tl(this, 'o','Link Name');    
    resetVarsToSCODE();
}

function callEventProdView(productId)
{
    var s = s_gi(s_account_twa); 
    s.products = ";" + productId;
    s.linkTrackVars="events,products"; 
    s.linkTrackEvents="prodView"; 
    s.events="prodView";
    s.tl(this, 'o','Link Name');    
    resetVarsToSCODE();
}

function AdImpressions(adids)
{
    var s = s_gi(s_account_twa); 
    s.eVar31 = adids;
    s.products =";" + adids;
    s.linkTrackVars="events,eVar31,products"; 
    s.linkTrackEvents="event14"; 
    s.events="event14";
    s.tl(this, 'o','Link Name');
    // reset variables for page view event - otherwise its double counted.
    s.eVar31 = "";
    s.products = "";
    s.linkTrackVars="";
    s.linkTrackEvents="";
    s.events="";
    resetVarsToSCODE();
}

function SearchResultsListings(productIds)
{
    var s = s_gi(s_account_twa);     
    s.products =";" + productIds;
    s.linkTrackVars="events,products"; 
    s.linkTrackEvents="event10"; 
    s.events="event10";
    s.tl(this, 'o','Link Name');
    // reset variables for page view event - otherwise its double counted.    
    s.products = "";
    s.linkTrackVars="";
    s.linkTrackEvents="";
    s.events="";
    resetVarsToSCODE();
}

function getQueryParamTWA(name)
{
	getQueryParamTWA(name, null);
}

function getQueryParamTWA( name, url )
{
	var regexS = "[\\?&;]"+name+"=([^&#]*)";
	var regex = new RegExp( regexS );
	tmpURL = url.toLowerCase();
	var results = regex.exec(tmpURL);

	if( results == null )
	return "";
	else
	return results[1];
}


if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();