
// Omniture Sitecatalyst start
// default vars
var s_pageName=""
var s_server="gap.com"  // site server
var s_channel="main"     // channel
var s_pageType=""        // locale
var s_prop1="";          // Langauge
var s_prop2="";          // Media Source type
var s_prop3="";          // Ref referer
var s_prop4=""
var s_prop5=""
var s_prop6=""
var s_prop7=""
var s_prop8=""
var s_prop9=""
var s_prop10=""
var s_prop11=""
var s_prop12="";         // Site Category
var s_prop13="";         // Region
var s_prop14="";         // Subregion
var s_prop15="";         // Langauge in iso639
var s_prop16=""
var s_prop17=""
var s_prop18=""
var s_prop19=""
var s_prop20=""

/* E-commerce Variables */
var s_campaign=""
var s_state=""
var s_zip=""
var s_events=""
var s_products=""
var s_purchaseID=""
var s_account=""
var s_visitorNamespace = "gap"

//Omniture Sitecatalyst end

// Omniture functions
function sendAnalyticsEvent(accnt)
{
    accnt=accnt?accnt:s_account;
	void(s_gs(accnt))
}

function sendLinkEvent(accnt,lnkname,type)
{
    accnt=accnt?accnt:s_account;s_linkType=type?type:"o";s_lnk=true;
    s_linkName=lnkname?lnkname:s_linkName?s_linkName:"Flash Link Event";
    void(s_gs(accnt))
}

//Debug variables
var blnAlert = false; // set this to true to debug
var statSeq = 0;

// Page Views Tag
/**
 * @param channel The channel of the page, i.e., US_NL>product
 * @param id The id of the page, i.e., nike-hyperdunk>detail
 */
function createPageViewTag( channel, id )
{	
	//alert("createPageViewTag" + channel + " || " + id);

    if (s_channel == null || s_channel =="") s_channel = "undefined";
    if (s_server == null || s_server =="") s_server = "undefined";
    if (s_prop14 == null || s_prop14 =="") s_prop14 = "undefined";
    if (s_prop15 == null || s_prop15 =="") s_prop15 = "undefined";

	s_prop18 = channel;
	s_prop19 = id.split( ">" )[ 0 ];
	
	s_pageName = ( id.length > 0 ) ? channel + ">" + id : channel;
	
    // send vars
    void(sendAnalyticsEvent(s_account));//SiteCatalyst specific
    if (blnAlert) printTagVariables(); // un-comment this function if you want to do some debugging on the information being sent
}

// Link Tag
function createLinkEventTag( channel, id )
{	
    // setup vars that we need to send
    s_linkTrackVars="s_pageName,strlinkName,s_prop4";

    if (s_channel == null || s_channel =="") s_channel = "undefined";
    if (s_server == null || s_server =="") s_server = "undefined";
    if (s_prop14 == null || s_prop14 =="") s_prop14 = "undefined";
    if (s_prop15 == null || s_prop15 =="") s_prop15 = "undefined";

	s_prop18 = channel;
	s_prop19 = id.split( ">" )[ 0 ];

    // send vars
    void(sendLinkEvent(s_account, id, "link"));//SiteCatalyst specific
    if (blnAlert) printTagVariables(); // un-comment this function if you want to do some debugging on the information being sent
}

function setLocale( locale ) {
	s_prop6 = locale;
	s_prop14 = locale.split( "_" )[ 1 ];
}

function setRegion( region ) {
	s_prop13 = region;
}

function setLanguage( language ) {
	s_prop15 = language;
}

// Omniture Functions
function printTagVariables()
{
    statSeq+=1; //This offsets multiple catalyst debug windows!
    var statWinNm = "stats_debugger" + Math.round(Math.random()*10000);
    void(window.open("",statWinNm,"width=600,height=600,location=0,menubar=0,status=1,toolbar=0,resizable=1,scrollbars=1,top=" + statSeq * 10 + ",left="  + statSeq * 10).document.write("<script language=\"JavaScript\" src=\"http://192.168.112.2O7.net/stats_debugger.php\"></"+"script>"));
}
