
// <!-- [gnetGeneratedTime]=[Fri Nov 20 2009 15:41:35 PST] -->
// <!-- [gnetCachedTime]=[Fri Nov 20 2009 15:43:57 PST] -->
window.glam_atf_line = 350;
window.glam_atf_kv = 'atf=s';
window.glam_session = new Object();
window.glam_session.country_code = null;
/*
*/
window.glam_session.edge = true;



window.glam_session.country_code='US';

window.glam_session.dma='803';

window.glam_session.region_code='CA';


/*
*/

window.glam_affiliate_info = new Array();
window.glam_homepage_urls = [];

window.glam_affiliate_id = '277283507';
window.glam_affiliateId = '277283507';
window.glam_ad_size = '300x250';

window.glam_dart_include = 'ec=tq;ec=tls;dr=m;p=1;ec=tl;ec=tls;ec=tco;ec=tls;al=satc;al=adc;at=r;cm=1;rmt=exp;sc=w35p';
window.glam_dart_ge_tags = 'lf=1;';
window.glam_dart_pepe_tags = 'lf=1;';




// Begin Utility functions

function GlamGetQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  }
  return null;
}


function GlamGetDartViewId()
{
  if ( ! window.glam_dart_ord )
  {
      window.glam_dart_ord = Math.random()*10000000000000000;
  }
  return window.glam_dart_ord;
}

function GlamCallExternalJs(pFile)
{
document.write('<scr' + 'ipt type="text/javascript" language="JavaScript" src="' +
                 pFile +
                 '"><' + '/sc' + 'ript>');
}



function CallExternalJs(pFile)
{
document.write('<scr' + 'ipt type="text/javascript" language="JavaScript" src="' +
                 pFile +
                 '"><' + '/sc' + 'ript>');
}


function GlamCallDart(protocol, siteName, adSize, keyValues)

{
  GlamCallExternalJs(protocol + 
                     '://ad.doubleclick.net/adj/' + siteName +
                     '/;sz=' + adSize +
                     ';' + keyValues + ';' +
                     ';ord=' + GlamGetDartViewId() +
                     '?');
}



function GlamRotateContextualAd()
{
  // This ad call gets a google ad, we override the placement type
  window.glam_placement_type = 'glam_rotating';
  window.glam_module_type = 'c_ad';
  window.glam_ad_type = 'text,image';

  // Then a publisher might have overriden some defaults
  
  CallExternalJs('http://www8.glam.com/js/glam_ads.js');
}



function CallGlamAdsJs()
{
   CallExternalJs('http://www8.glam.com/js/glam_ads.js');
}

function CallGlamSearchJs()
{
   CallExternalJs('http://www8.glam.com/js/glam_search.js');
}



// End Utility functions


window.glam_zone = '';
window.glam_ad_sequence=0;

function GlamGetDoubleclickUrl()
{
  if (  GlamGetAffiliateInfo('country') == 'JP' || GlamGetAffiliateInfo('country') == 'jp' ) {
     return 'ad.jp.doubleclick.net';
  }
  else {
     return 'ad.doubleclick.net';
  }
}

function GlamGetUrlId()
{
   tmpStr = window.location.href.substr(7 + window.location.href.indexOf('http://'));
   key = tmpStr.substr(tmpStr.indexOf('/'));
   return glamURLHash(key);
}
   
function GlamGetUValuesExploded()
{
  var uValues='';
  if ( window.glam_uvalues )
  {
    for(vname in window.glam_uvalues)
    {
      uValues += vname + '-' + window.glam_uvalues[vname] + ',';
    }
  }
  return uValues;
}

function GlamCallQuantcast(quant_id, quant_pec)
{
      
      _qoptions=
      {	
         qacct:"p-874AVp33Bbtkg",	
         labels:"Style"	
      };
      _qoptions['qacct'] = quant_id;

      var glam_qc_map = {
         gl:'Style',
         b:'Style',
         c:'Entertainment',
         co:'Entertainment',
         e:'Entertainment',
         f:'Style',
         fm:'Family',
         h:'HealthAndWellness',
         ls:'Style',
         lt:'Lifestyle',
         lu:'Luxury',
         lv:'Living',
         q:'Entertainment',
         s:'Style',
         t:'Entertainment',
         w:'HealthAndWellness',
         mi:'Style',
         be:'Entertainment',
         bls:'Lifestyle',
         ba:'Autos',
         bt:'Technology',
         br:'Lifestyle'
         };

      if ( quant_pec == null && glam_info['pec'] && glam_qc_map[glam_info['pec']] )
      {
          _qoptions['labels'] = glam_qc_map[glam_info['pec']];
      }
      else if ( quant_pec != null )
      {
          _qoptions['labels'] = quant_pec;
      }
      if ( window.location.href.indexOf('glamShowQuantcast') > -1 )
      {
         alert(_qoptions['qacct']);
         alert(_qoptions['labels']);
      }
      else if ( window.location.href.indexOf('glamShowGeoData') > -1 )
      {
         alert(GlamGetGeoData('cc'));
      }
      CallExternalJs("http://edge.quantserve.com/quant.js");

            /* This function will be called in every page view for sites using JS tags 
         and on every impression for sites using iframe tags */

      // Custom Tracking code for Australia
      if ( GlamGetGeoData('cc') == 'AU' )
      {
         // Now lets take care of Nielsen
         _rsCI="us-glam";
         _rsCG=_qoptions['labels'];
         _rsDN="//secure-us.imrworldwide.com/";
         _rsPLfl=0;
         _rsSE=1;
         _rsSM=1.0;
         CallExternalJs("http://secure-us.imrworldwide.com/v53.js");
      }

      // Insert other custom tracking here

      // Comscore beacon
      if ( GlamGetGeoData('cc') != 'DE' ) {
      if (!window.glam_comscore_beacon && window.GlamGetAffiliateInfo && GlamGetAffiliateInfo('cs_beacon') != 'disable' ) {
	document.write('<scr'+'ipt src="'+ (document.location.protocol == "https:" ? "https://sb" : "http://b") + '.scorecardresearch.com/beacon.js"' +'"></scr'+'ipt>');
	document.write('<scr'+'ipt src="http://www8.glam.com/js/widgets/glam_comscore.js"></scr'+'ipt>');          
	window.glam_comscore_beacon = true;
      }    
}
}


function GlamGetZone()
{
   return window.glam_zone;
}

window.glam_homepage_urls = [];

function GlamGetAdSizeMetaData(adSize) {
 if ( ! window.glam_ad_size_meta ) {
  window.glam_ad_size_meta = {"968x90":{"id":"19"},"224x126":{"id":"22"},"444x10":{"id":"22"},"160x600":{"id":"1"},"300x250":{"id":"2"},"800x150":{"id":"7"},"630x150":{"id":"8"},"480x270":{"id":"22"},"444x2":{"id":"22"},"444x3":{"id":"22"},"300x250,300x600":{"id":"6"},"968x16":{"id":"20"},"928x60":{"id":"21"},"160x600,300x600":{"id":"5"},"444x1":{"id":"22"},"270x150":{"id":"9"},"984x258":{"id":"13"},"468x60":{"id":"17"},"120x600,160x600":{"id":"23"},"240x135":{"id":"22"},"728x90":{"id":"3"},"160x160":{"id":"11"},"120x600":{"id":"16"},"300x600":{"id":"4"},"728x91":{"id":"15"},"650x35":{"id":"12"},"990x26":{"id":"14"},"800x50":{"id":"10"}};
 }
 var real_size = adSize.split(',');
 var width_height = real_size[0].split('x');
 if ( window.glam_ad_size_meta[adSize] && width_height[0] && width_height[1] ) {
   window.glam_ad_size_meta[adSize].width=parseInt(width_height[0]);
   window.glam_ad_size_meta[adSize].height=parseInt(width_height[1]);
 }

 return ( window.glam_ad_size_meta[adSize] ? window.glam_ad_size_meta[adSize] : null );

}
function glamStringHash(str){var hash=0;for(var i=0;i<str.length;i++){hash=hash<<1;if(hash<0){hash|=1;}
hash^=str.charCodeAt(i);}
return hash&0x7FFFFFFF;}
function glamURLHash(url){var urlHash=glamStringHash(url);var urlHashString=urlHash.toString(36).slice(-6);urlHashString='000000'.substring(urlHashString.length)+urlHashString;return urlHashString;}
function glamOrd(){var url=window.location.host+window.location.pathname;if(window!=window.top){url=document.referrer;var query=url.indexOf('?');if(query>-1)
url=url.slice(0,query);}
var urlHashString=glamURLHash(url);var now=new Date().getTime();var timestamp=Math.floor((now-1199145600000)/1000);var timestampString=timestamp.toString(36).slice(-6);timestampString='000000'.substring(timestampString.length)+timestampString;return urlHashString+timestampString+(Math.random()).toString(36).slice(-2);}
function glamGetUValue(formatid,keyvalues){if(formatid.charAt(0)!='b'){return formatid;}
var flagkeys={error:1,i:2};var u='';var subformat='';var tile='x';var adsize='x';var error=0;var flags=0;if(arguments.length>1){var pageid='';var kv='';if(keyvalues){for(key in keyvalues){if(typeof key!='string')
continue;var value=keyvalues[key];if(key=='pid'){pageid=value;continue;}else if(key=='fid'){value=value.toString();subformat=value.charAt(0);if(value.length>1)
error=1;continue;}else if(key=='aid'){value=value.toString();adsize=value.charAt(0);if(value.length>1)
error=1;continue;}else if(key=='tid'){tile=parseInt(value).toString(36);if(tile.length>1){tile=tile.charAt(0);error=1;}
continue;}else if(flagkeys[key]){if(parseInt(value))
flags|=flagkeys[key];continue;}else if(key=='g'){if(typeof value[1]=='undefined'){var sequence='0';var networkFlags=parseInt(value).toString(36);}else{var sequence=parseInt(value[1]).toString(36);var networkFlags=parseInt(value[0]).toString(36);}
value=sequence.slice(0,1)+'00000'.substring(networkFlags.length)+networkFlags;}
var k=key.charAt(0);kv+=','+k;if(typeof value=='number'||(typeof value=='string'&&key!='g'&&value.match(/^\d+$/))){value=parseInt(value).toString(36);}
if(typeof value!='string')
value='';if(value.length>6){error=1;value=value.slice(0,5)+'x';}
value='000000'.substring(value.length)+value;kv+=value;}}
if(pageid.length!=14){error=1;pageid='00000000000000'.substring(pageid.length)+pageid;u+=pageid.slice(0,13)+'x';}else
u+=pageid;u+=kv;if(u.length>58){error=1;u=u.slice(0,58);}
if(!subformat&&formatid.length>1){subformat=formatid.charAt(1);}else if(!subformat){subformat='0';}
flags|=error;flags=flags.toString(36);return'b'+subformat+flags+adsize+tile+u;}else{return'b01';}}
function GlamResetUValues()
{window.glam_uvalues={};}
function GlamSetUValue(vName,vValue)
{if(!window.glam_uvalues){GlamResetUValues();}
if(arguments.length<3)
window.glam_uvalues[vName]=vValue;else
window.glam_uvalues[vName]=Array.prototype.slice.call(arguments,1);}
function GlamGetUValue(vName)
{if(window.glam_uvalues[vName]){return window.glam_uvalues[vName];}}
function GlamGetUValuesAsString(pFormat)
{return glamGetUValue('b',window.glam_uvalues);}

function GlamGetSessionData(session_var) {

  glam_page_data = GlamGetCookie('GS_' + session_var);

  return glam_page_data;
}


function GlamSetSessionData(session_var, session_data, seconds_timeout) {

  GlamSetCookie2('GS_' + session_var, session_data, seconds_timeout);
}





function GlamLoadSessionData(callback)
{
   document.write('<scr' +
               'ipt type="text/javascript" language="JavaScript" src="' + 
               'http://www17-orig.glam.com/bt/gsdata.php?callback=' + callback + 
               '"><' +
               '/sc' + 'ript>');

}


function GlamPrioritizeSplit(site_priority, seed)
{
   var glam_split = seed - Math.floor(Math.random()*seed);

   if ( window.location.href.indexOf('glamAtpDebug') > -1 )
   {
     document.write('<br>Priority = ' + site_priority + ' / Split= ' + glam_split);
   }
   if ( glam_split >= site_priority )
   {
      return true;
   }

   return false;
}


function GlamIsPremiumPriority()
{
  if ( window.glam_priority_split_done  )
  {
    return window.glam_priority_split;
  }

  // By default, the atp is what comes in the 'atp' info
  var site_priority = parseInt( GlamGetAffiliateInfo('atp') == null ? 6 : GlamGetAffiliateInfo('atp') );
  var country_priority = 6;
  var ec_priority = 6;
  var seed = 5;

  var glam_ec_found='ec_default';

  // if we are in a cc that is different that the geoip info, we set the priority to other things...
  if ( GlamGetAffiliateInfo('country') == GlamGetGeoData('cc') )
  {
     var glam_lit = GlamGetAffiliateInfo('dart_tags');
     var glam_lit_arr = glam_lit.split(';');
     for(var i=0;i < glam_lit_arr.length; i++)
     {
        if ( glam_lit_arr[i].indexOf('ec=t') > -1 )
        {
            var cdata =  glam_lit_arr[i].split('=');
            var glam_ckey = 'ec_' + cdata[1] + '_atp';
            if ( GlamGetAffiliateInfo(glam_ckey) && parseInt(GlamGetAffiliateInfo(glam_ckey)) < ec_priority )
            {
               ec_priority = parseInt(GlamGetAffiliateInfo(glam_ckey));
               glam_ec_found=glam_ckey;
            }
        }
     }
  }
  else 
  {
     var glam_atp_geo = 'atp_' + ( GlamGetGeoData('cc') == null ? 'not_found' :  GlamGetGeoData('cc').toLowerCase() );
     country_priority = parseInt( GlamGetAffiliateInfo(glam_atp_geo) == null ? 1 : GlamGetAffiliateInfo(glam_atp_geo) );
     site_priority = 6;
     ec_priority = 6;
  }


  window.glam_priority_split_done = true;
  window.glam_priority_split = false;

  if ( GlamPrioritizeSplit(site_priority, seed) || GlamPrioritizeSplit(ec_priority, seed) || GlamPrioritizeSplit(country_priority, seed) )
  {
     window.glam_priority_split = true;
  }

  if ( window.location.href.indexOf('glamAtpDebug') > -1 )
  {
     document.write( '<br>site = ' + site_priority + 
                     '<br>' + glam_ec_found + ' = ' + ec_priority + 
                     '<br>country = ' + country_priority + 
                     '<br>result = ' + window.glam_priority_split);
     document.write('<br>LIST INFO TAGS ' + GlamGetAffiliateInfo('list_info_tags') + '<br>' );
  }


  return window.glam_priority_split;
}




if ( ! window.glam_atf_line )
{
    window.glam_atf_line = 800;
}

if ( ! window.glam_atf_kv )
{
    window.glam_atf_kv = 'atf=s';
}


function GlamCallDlNodeIdWithBt(dl_study_id) {}


function GlamDoDisplayAdTimeout(adCallId)
{

  var my_adData = GlamGetRegisteredAdCall(adCallId);

  if ( my_adData != null && ! my_adData['adDisplayed']  ) 
  {
    // we got called so we let the timeout functions know...
    window.glam_reg_ad_calls[adCallId]['adDisplayed'] = true;

    GlamSetStatus('gs_timeout');
    var adSize = my_adData['adSize'];
    var affiliateId = my_adData['affiliateId'];
    var spanId = my_adData['spanId'];

    var glam_iframe_size='width="0" height="0"';

    var ads_data = GlamGetAdSizeMetaData(adSize);
    if ( ads_data != null ) {
        glam_iframe_size='width="' + ads_data.width + '" height="' + ads_data.height + '"';
    }

    var glam_iframe_tag = '<iframe frameborder="0" marginheight="0" marginwidth="0" scrolling="no" '+
                          ' allowTransparency="true" ' +
                          glam_iframe_size +
                          ' src="http://www2.glam.com/app/site/affiliate/viewChannelModule.act?mName=viewAd&affiliateId=' +
                          affiliateId +
                          '&adSize=' + adSize + '&status=gs_timeout"></iframe>';

    //document.getElementById(spanId).innerHTML = 'I failed at displaying an ad for ' + affiliateId + '/' + adSize + '/' + spanId;
    if ( document.getElementById(spanId) != null ) 
    {
       document.getElementById(spanId).innerHTML = glam_iframe_tag;
    }


  }
}

function GlamIsStandardAdSize(adSize)
{
  return ( GlamGetAdSizeMetaData(adSize) == null ? false : true );
}

function GlamRegisterAdCall(adData)
{
  if ( ! window.glam_reg_ad_counter ) {
    window.glam_reg_ad_counter=0;
    window.glam_reg_ad_calls = [];
  }
  window.glam_reg_ad_counter++;

  window.glam_reg_ad_calls[window.glam_reg_ad_counter] = adData;

  return window.glam_reg_ad_counter;
}


function GlamGetRegisteredAdCall(adId)
{
  if (  window.glam_reg_ad_calls && window.glam_reg_ad_calls[adId] )
  {
     return window.glam_reg_ad_calls[adId];
  }

  return null;
}


function GlamIsCountryTargeted()
{
   if ( ! window.glam_is_country_targeted_set )
   {
      var vCountry = GlamGetGeoData('co');
      vCountry = ( vCountry == null ? 'US' : vCountry );
      vCountry = vCountry.toUpperCase();

      var vAllTargetedCountries = GlamGetAffiliateInfo('all_glam_targeted_countries');
      vAllTargetedCountries = ( vAllTargetedCountries == null ? 'US,' : vAllTargetedCountries );
      vAllTargetedCountries =  vAllTargetedCountries.toUpperCase();

      window.glam_is_country_targeted = ( vAllTargetedCountries.indexOf(vCountry + ',') > -1 ? true : false );
      window.glam_is_country_targeted_set=true;
   }

   return window.glam_is_country_targeted;
}


function GlamGetGeoData(pName)
{
   var vName = (pName == 'cc' || pName == 'co' ? 'country_code' : pName);
   
   return (window.glam_session && window.glam_session[vName] ? window.glam_session[vName] : null);
}


function GlamGetSessionId()
{
  return ( window.glam_session && window.glam_session.glam_sid ? window.glam_session.glam_sid : null );
}


function GlamGetStatus()
{
   if ( ! window.glam_status )
   {
     window.glam_status = null;
   }
   return window.glam_status;
}

function GlamSetStatus(status)
{
     window.glam_status = status;
}


function GlamDisplayAd() 
{ 
var my_ad_call_data = GlamGetAdCallData();

if ( window.glam_session && ! window.glam_session.glam_bt && 
     (window.glam_session.glam_sid || ! window.glam_session.edge) &&
     GlamIsCountryTargeted() == true && GlamGetStatus() != 'gs_timeout' && GlamIsStandardAdSize(GlamGetAdSize()) == true ) 
{
  var my_ad_data = [];
  my_ad_data['affiliateId'] = GlamGetAffiliateId();
  my_ad_data['adSize']      = GlamGetAdSize();
  my_ad_data['adDisplayed'] = false;

  if ( ! window.glam_page_ad_counter ) {
    window.glam_page_ad_counter=0;
  }
  window.glam_page_ad_counter++;
  
  var glam_span_id = GlamGetAffiliateId() + GlamGetAdSize() + window.glam_page_ad_counter;

  my_ad_data['spanId'] = glam_span_id;

  var my_ad_call_id = GlamRegisterAdCall(my_ad_data);

  //document.write('<span id="' + glam_span_id + '">Ad call id = ' + my_ad_call_id + ' / span = ' + glam_span_id + '</span>');
  document.write('<span id="' + glam_span_id + '"></span>');

  // Now we call the function that will get the cookie id and then call th display ad function
  setTimeout('GlamDoDisplayAdTimeout( ' + my_ad_call_id + ');', 8000);
  GlamLoadSessionData('GlamDoDisplayAdWithBT');

}
else 
{
  // We see if we have a BT string to append...
  if ( GlamGetBtData() != null ) {
        GlamAppendAdTag(GlamGetBtData());
  }

 GlamDoDisplayAd();
}

}

function GlamDoDisplayAdWithBT(data)
{
  // if this ad was already displayed , we exit...
  if ( window.glam_reg_ad_calls[window.glam_reg_ad_counter]['adDisplayed'] )
  {
    return;
  }

  // we got called so we let the timeout functions know...
  window.glam_reg_ad_calls[window.glam_reg_ad_counter]['adDisplayed'] = true;

  // we concatenate all the bt strings and then show the ad...
  var my_bt_data = '';

  if ( data.vars && data.vars.ctags )
  {
     window.glam_session.ctags = data.vars.ctags;
  }
  if ( data.vars && data.vars.glam_bt )
  {
     window.glam_session.glam_bt = data.vars.glam_bt;
  }

  // We see if we have a BT string to append...
  if ( GlamGetBtData() != null ) {
        GlamAppendAdTag(GlamGetBtData());
  }

  GlamDoDisplayAd();
}



function GlamDisplayAdCallback(context)
{
   // We let the ad server know that we are on a callback call for that context
   GlamSetCallbackContext(context);
   GlamAppendCallbackTag('clb=' + context);
   GlamHideAdsByGlam();

   GlamDoDisplayAd();
}


function GlamSetCallbackContext(ClbData)
{
    window.glam_clb_context = ClbData;
}


function GlamGetULogData()
{
  if ( ! window.glam_ulog_info ) {
    return null;
  }

   return window.glam_ulog_info;
}

function GlamGetULogData(uData)
{
    window.glam_ulog_info = uData;
}



function GlamGetCallbackContext()
{
  if ( ! window.glam_clb_context ) {
    return null;
  }

   return window.glam_clb_context;
}

function GlamGetLastCallTags()
{
  if ( ! window.window.glam_last_call_tags ) {
    return null;
  }

   return window.window.glam_last_call_tags;
}



function GlamSetBtData(btData)
{
    window.glam_bt_data = btData;
}


function GlamGetBtData()
{
  if ( window.glam_session && window.glam_session.glam_bt )
  {
    window.glam_bt_data = window.glam_session.glam_bt;
  }

  if ( window.glam_session && window.glam_session.ctags )
  {
    window.glam_bt_data = ( window.glam_bt_data ? 
                            window.glam_bt_data + ';' + window.glam_session.ctags :
                            window.glam_session.ctags );
  }


  if ( ! window.glam_bt_data || window.glam_bt_data == null) 
  {
    return null;
  }

  // we only return the kvs that are used in targeting...
  var kvs_str = GlamGetAffiliateInfo('bt_tags_used');
  var bt_kvs = ';';
  if ( kvs_str && kvs_str.indexOf('bt=') > -1 )
  {
    var kvs=window.glam_bt_data.split(';');
    for ( i = 0; i < kvs.length; i++ )
    {
       bt_kvs = bt_kvs + ( kvs_str.indexOf(kvs[i]+';') > -1 || kvs[i].indexOf('al=') > -1 || kvs[i].indexOf('ct=') > -1  ? kvs[i] + ';': '' );
    }
  }
  return bt_kvs;
}



function GlamGetMode() {

  if ( ! window.glam_mode ) {
     window.glam_mode = 'dart';
  }

   if ( window.location.href.indexOf('glamEvolutionTest') > -1 )
   {
      glam_mode = 'glamEvolutionTest';
   }
   else if ( window.location.href.indexOf('glamTest') > -1 )
   {
      glam_mode = 'glamTest';
   }
   else if ( window.location.href.indexOf('googleTest') > -1 )
   {
      glam_mode = 'googleTest';
   }
   else if ( window.location.href.indexOf('glamDouble') > -1 )
   {
      glam_nbr_ads=2;
   }
   else if ( window.location.href.indexOf('showPageData') > -1 )
   {
      alert('Glam Page Data -> ' + GlamGetPageData());
   }

   return window.glam_mode;
}

function GlamGetAffiliateId() {
  if ( ! window.glam_affiliate_id ) {
     window.glam_affiliate_id = null;
  }

   return window.glam_affiliate_id;
}

function GlamGetAdTile() {
  if ( ! document.glam_dart_tile )
  {
     document.glam_dart_tile = 0;
  }
  return document.glam_dart_tile;
}

function GlamGetAdSize() {
  if ( ! window.glam_ad_size ) {
     window.glam_ad_size = null;
  }

   return window.glam_ad_size;
}


function GlamCleanupKeyValues(st)
{
   var st_ar = {};

   var vars = st.split(";");
   for (var i=0;i<vars.length;i++) {
     if ( vars[i].indexOf('=') > -1 )  {
       var pair = vars[i].replace('=', '_');
       st_ar[pair] = 1;
     }
   }
   var st_clean = '';
   for(v in st_ar)
   {
      st_clean = st_clean + v.replace('_', '=') + ';';
   }
   
   while ( st_clean.indexOf(';;') > -1) {
          st_clean = st_clean.replace(';;', ';');
   }

return st_clean;

}



function GlamGetAdCallData() {
   if ( ! window.glam_dart_ge_tags ) {
     window.glam_dart_ge_tags = '';
   }
   window.glam_dart_ge_tags = GlamCleanupKeyValues(window.glam_dart_ge_tags);

   return window.glam_dart_ge_tags;
}

function GlamGetAdTile() {
  if ( ! document.glam_dart_tile ) {
     document.glam_dart_tile = 0;
  }

   return document.glam_dart_tile;
}


function GlamResetAdTag() {
   window.glam_ad_tag_type = null;

   window.glam_client_ad_tag = '';
   GlamResetUValues();
}

function GlamAppendAdTag(ad_tag_string) {

if ( ! window.glam_client_ad_tag ) 
{
   window.glam_client_ad_tag = ad_tag_string +';';
}
else
{
   window.glam_client_ad_tag = window.glam_client_ad_tag +
                               ad_tag_string + ';';
}
while ( window.glam_client_ad_tag.indexOf(';;') > -1) {
          window.glam_client_ad_tag = window.glam_client_ad_tag.replace(';;', ';');
}
return window.glam_client_ad_tag;
}



function GlamGetAdSizeKvs(pAdSize)
{
  var ads_data = GlamGetAdSizeMetaData(pAdSize);
  if ( ads_data == null ) 
  {
   return '';
  }
  var size_kvs_str = GlamGetAffiliateInfo('ctr_opt_tags');
  var kvs = '';
  if (size_kvs_str) {
	  var kvs = (size_kvs_str.indexOf('cpall=') > -1 ? size_kvs_str + ';' : '');
	  if ( size_kvs_str && size_kvs_str.indexOf('cp' + ads_data.id + '=') > -1 )
	  {
	    var size_kvs=size_kvs_str.split(';');
	    for ( i = 0; i < size_kvs.length; i++ )
	    {
	       kvs = kvs + ( size_kvs[i].indexOf('cp' + ads_data.id + '=') > -1 ? size_kvs[i] + ';': '' );
	    }
	  }
  }
  return kvs;
}



function GlamGetAdSizeId(pAdSize)
{
  var ads_data = GlamGetAdSizeMetaData(pAdSize);
  if ( ads_data == null ) {
   return '0';
  }
  else {
   return ads_data.id;
  }
}


function GlamGetPageViewId()
{
   if ( ! window.glam_page_view_id )
   {
     window.glam_page_view_id = glamOrd();
   }

   return ('a' + GlamGetAdSizeId(window.glam_ad_size) + window.glam_page_view_id);
}

function GlamGetPageViewIdN()
{
   if ( ! window.glam_page_view_id )
   {
     window.glam_page_view_id = glamOrd();
   }

   return window.glam_page_view_id;
}

function GlamGetAdTagType()
{
  if ( window.glam_ad_tag_type )
  {
     return window.glam_ad_tag_type;
  }
  else
  {
     return 'jscript';
  }
}

function GlamGetAdTagTypeId()
{
  if ( GlamGetAdTagType() == 'jscript' ) {
    return 'j';
  }
  else if ( GlamGetAdTagType() == 'iframe' ) {
    return 'i';
  }
  else {
    return 'u';
  }
}


function GlamSetAdTagType(tagType)
{
   window.glam_ad_tag_type = tagType;
}


function GlamDisableAds(glamDisableAdPars)
{
   var doDisableAdPars = 'ALL';
   if ( glamDisableAdPars ) {
      doDisableAdPars = glamDisableAdPars;
   }

   if ( ! window.glam_ads_disabled ) {
     window.glam_ads_disabled = '';
   }
   window.glam_ads_disabled = window.glam_ads_disabled + ';' + doDisableAdPars;
}


function GlamIsAdDisabled()
{
     if (window.rosietest) {
        alert(GlamGetAdSize());
     }


     // If an ad has called GlamDisableAds(), we stop processing this request
     if ( window.glam_ads_disabled && window.glam_ads_disabled.indexOf('ALL') > -1 )
     {
        return true;
     }
     else if ( window.glam_ads_disabled && window.glam_ads_disabled.indexOf(GlamGetAdSize() + '|' + GlamGetAffiliateId()) > -1 )
     {
        return true;
     }
     else if ( window.glam_ads_disabled && window.glam_ads_disabled.indexOf( '*|' + GlamGetAffiliateId()) > -1 )
     {
        return true;
     }
     else if ( window.glam_ads_disabled && window.glam_ads_disabled.indexOf(GlamGetAdSize() + '|*') > -1 )
     {
        return true;
     }
     return false;
}

function GlamCallDartAd()
{
     // If an ad has called GlamDisableAds(), we stop processing this request
     if ( GlamIsAdDisabled() )
     {
        return;
     }

     
if ( ! window.glam_excluded_urls )
{
   window.glam_excluded_urls = [];

   window.glam_excluded_urls.push('k8l.info');
   window.glam_excluded_urls.push('purplepussy.net');
   window.glam_excluded_urls.push('gay.skinindex.com'); 
}


    var url = window.location.href.toLowerCase();
     if ( window.glam_excluded_urls )
     {
        for(i=0; i < window.glam_excluded_urls.length; i++)
        {
           var exc_url = window.glam_excluded_urls[i].toLowerCase();
   
           if ( window != window.top  && document.referrer && document.referrer.toLowerCase().indexOf(exc_url) > -1 )
           {
               return;
           }
           else if ( url.indexOf(exc_url) > -1 )
           {
               return;
           }
        }
      }


     

     /* We set some flags */
     var my_ad_flags = 64; // we start at 64 to ensure that we see the code changes in the log.
     var my_glam_tags = GlamGetAdCallData();
     
     var browser_url   = window.location.href;

     if ( window != window.top )
     {
        browser_url = document.referrer;
     }

     browser_url = browser_url.replace('www.', '');
     browser_url = browser_url.replace('http://', '');
     browser_url = browser_url.replace('/', '');
     browser_url = browser_url.toLowerCase();
     browser_url = browser_url.replace('index.php', '');
     browser_url = browser_url.replace('index.html', '');
     browser_url = browser_url.replace('index.htm', '');
     browser_url = browser_url.replace('home.html', '');
     browser_url = browser_url.replace('home.htm', '');

     for(i=0; i < window.glam_homepage_urls.length; i++)
     {
        var glam_home_url = window.glam_homepage_urls[i];

        glam_home_url = glam_home_url.replace('www.', '');
        glam_home_url = glam_home_url.replace('http://', '');
        glam_home_url = glam_home_url.replace('/', '');
        glam_home_url = glam_home_url.toLowerCase();
        glam_home_url = glam_home_url.replace('index.php', '');
        glam_home_url = glam_home_url.replace('index.html', '');
        glam_home_url = glam_home_url.replace('index.htm', '');
        glam_home_url = glam_home_url.replace('home.html', '');
        glam_home_url = glam_home_url.replace('home.htm', '');

        if ( browser_url == glam_home_url )
        {
            my_ad_flags =  my_ad_flags | 1; // First bit means home page
            my_glam_tags = my_glam_tags + ';pl=h;';
            break;
        }
     }


     var glam_url = ( window == window.top ? window.location.href : document.referrer );
     var tmpStr = glam_url.substr(7 + glam_url.indexOf('http://'));
     var url_key = tmpStr.substr(tmpStr.indexOf('/'));
     url_key = url_key.replace('?glamShowKvsUrl', '');
     var key = glamURLHash(url_key);

     if ( glam_url.indexOf('glamShowKvsUrl') > -1 )
     {
            alert('Url :' + glam_url);
            alert('Url Key: ' + url_key);
            alert('Url Encoded Key: ' + key);
            alert('Info ' + window.glam_url_info[key]);
     }
     if ( window.glam_url_info[key] )
     {
        my_glam_tags = my_glam_tags + ';' + window.glam_url_info[key];
     }

     GlamSetUValue('tid', GlamGetAdTile());
     GlamSetUValue('pid', GlamGetPageViewIdN());
     GlamSetUValue('aid', GlamGetAdSizeId(GlamGetAdSize()));           


     if ( glam_dart_ge_tags.indexOf('!c=nptr') == -1 )
     {
        my_glam_tags = my_glam_tags + ';p=0;pt=0';
     }

     // we check if this is a video player in case, we should force the ad tag type to be iframe
     glam_ctags = GlamAppendAdTag('');
     if ( glam_ctags.indexOf('ap=gtv') > -1 || my_glam_tags.indexOf('ap=gtv') > -1 ) 
     {
         my_ad_flags = my_ad_flags | 4; // Third bit means GlamTv
         GlamSetAdTagType('iframe');
         // we need to make sure that glam.com or glamtv are never in p=0;pt=0
         my_glam_tags = my_glam_tags.replace('p=0', 'p=1');
         my_glam_tags = my_glam_tags.replace('pt=0', 'pt=1');
         my_glam_tags = my_glam_tags.replace('rmt=exp', '');
         my_glam_tags = my_glam_tags.replace('rmt=ov', '');
     }
     else if ( glam_ctags.indexOf('ap=btv') > -1 || my_glam_tags.indexOf('ap=btv') > -1 )
     {
         my_ad_flags = my_ad_flags | 4; // Third bit means GlamTv
         GlamSetAdTagType('iframe');
         // we need to make sure that glam.com or glamtv are never in p=0;pt=0
         my_glam_tags = my_glam_tags.replace('ec=ron', '');
         my_glam_tags = my_glam_tags.replace('p=0', 'p=b');
         my_glam_tags = my_glam_tags.replace('pt=0', '');
         my_glam_tags = my_glam_tags.replace('rmt=exp', '');
         my_glam_tags = my_glam_tags.replace('rmt=ov', '');
     }
     else if ( window != window.top ) // we are in iframe and we shouldnt so we should report this
     {
         my_ad_flags = my_ad_flags | 8; // Fourth bit means Iframe
         GlamSetAdTagType('iframe');
         GlamSetUValue('i', 1);
     }

     my_glam_tags += ';afid=' + GlamGetAffiliateId() + ';dsid=' + GlamGetAffiliateInfo('dart_site_id') + ';';

     // If this is glamTV but we are calling from fbt, it is glam.com's glamtv...
     if ( GlamGetAffiliateId() == '61091505' && glam_ctags.indexOf('ap=gtv') > -1 )
     {
           window.glam_affiliate_id = '0';
     }

     var my_bt_data = GlamGetBtData();
     if ( my_bt_data != null && my_bt_data.indexOf('bt=') > -1 ) 
     {
        my_ad_flags = my_ad_flags | 2; // Second bit means BT Profile
     }

     // we check all the things needed for reskins
     window.glam_reskin_tags = my_glam_tags;
     window.glam_last_call_tags =  GlamCleanupKeyValues(my_glam_tags + ';' + GlamAppendCallbackTag(''));
     if ( window.location.href.indexOf('glamReskinEnabled') > -1 &&  window.glam_reskin_tags.indexOf('rsid') > -1 )
     {
        if ( glam_info['rsid'] )
        {
           alert('rsid = ' + glam_info['rsid']);
        }
        else
        {
           alert('no rsid in glam tags');
        }
     }
     else if (  GlamGetAdTagTypeId() == 'j' && window.glam_info['rs']  && 
                window.glam_info['rs'] == 1 && ! window.glam_reskin_called )
     {
        window.glam_reskin_called = 1;
        GlamCallExternalJs('http://www8.glam.com/js/widgets/glam_reskin.js');
     }
     else if ( (GlamGetAffiliateId() == 0 || GlamGetAffiliateId() == 1) && window.glam_ad_call_str &&
                window.glam_ad_call_str.indexOf('rsid') > -1 && ! window.glam_reskin_called )
     {
        window.glam_reskin_tags = window.glam_ad_call_str;

        window.glam_reskin_called = 1;
        GlamCallExternalJs('http://www8.glam.com/js/widgets/glam_reskin.js');
     }

     window.glam_ad_sequence++;

     var my_glam_ord = ( window.glam_append_adtags && window.glam_append_adtags['ord'] ?  window.glam_append_adtags['ord'] :  GlamGetDartViewId() );
     var my_glam_tile = ( window.glam_append_adtags && window.glam_append_adtags['tile'] ?  window.glam_append_adtags['tile'] :  document.glam_dart_tile );

     if ( window.location.href.indexOf('glamExternalTest') > -1 && ! window.glam_external_test)
     {
       window.glam_external_test = true;
       document.write('<scr' + 'ipt type="text/javascript" language="JavaScript" src="' +
                            'http://scripts.glam.com/js/test/glam_test_' + window.glam_ad_size +
                            '.js?"><' + '/sc' + 'ript>');

     }
     else if ( (GlamGetAffiliateId() == 0 || GlamGetAffiliateId() == 1) && window.glam_ad_call_str ) /* This is glam.com */ 
     {
         if ( (my_ad_flags & 4) == 4 ) // we are on glamtv so we get rid of expandables
         {
             // we need to make sure that glam.com or glamtv are never in p=0;pt=0
             window.glam_ad_call_str = window.glam_ad_call_str.replace('p=0', 'p=1');
             window.glam_ad_call_str = window.glam_ad_call_str.replace('pt=0', 'pt=1');
             window.glam_ad_call_str = window.glam_ad_call_str.replace('rmt=exp', '');
             window.glam_ad_call_str = window.glam_ad_call_str.replace('rmt=ov', '');
         }

         GlamSetUValue('g', my_ad_flags, window.glam_ad_sequence);
         // we need to make sure that glam.com or glamtv are never in p=0;pt=0
         var my_glam_appended_tags = GlamAppendAdTag('') + ';' + GlamAppendCallbackTag('');

         my_glam_appended_tags = my_glam_appended_tags.replace('p=0', 'p=1');
         my_glam_appended_tags = my_glam_appended_tags.replace('pt=0', 'pt=1');

         if ( window.location.href.indexOf('glamSetKv') > -1  )
         {
            my_glam_appended_tags  = my_glam_appended_tags + 
                                     window.location.href.substr(
                                     window.location.href.indexOf('glamSetKv')) +  ';';
         }
        if ( window.location.href.indexOf('glam_pda_override') > -1 || 
                 (window.glam_pda_override && window.glam_pda_override.indexOf(GlamGetAdSize()) > -1) )
        {
            GlamHideAdsByGlam(); 
            GlamShowPublisherDefaultAd();
        }
        else
        {

         document.write('<scr' + 'ipt type="text/javascript" language="JavaScript" src="' +
                         document.glam_protocol + GlamGetDoubleclickUrl() +
                            '/adj/' +
                            window.glam_ad_call_str + 
                            ';' + my_glam_appended_tags  +
                            ';tt=' + GlamGetAdTagTypeId() + 
                            ';u=' + GlamGetUValuesAsString('dart') +
                            ';sz=' + glam_ad_size +
                            ';tile=' + my_glam_tile + 
                            ';ord=' + my_glam_ord + '?"><' + '/sc' + 'ript>');
         window.glam_ad_call_str = null;
        }

     }
     else
     {
        if ( '' == 'Marketplace' || '' == 'Marketplace/' || my_glam_tags.indexOf('npt=1') > -1)
        {
           // if this is a marketplace ad, we reset the ad tags to be all NPT
           my_glam_tags = my_glam_tags.replace('p=1', '');
           my_glam_tags = my_glam_tags.replace('p=2', '');
           my_glam_tags = my_glam_tags.replace('p=3', '');
           my_glam_tags = my_glam_tags.replace('p=4', '');
           my_glam_tags = my_glam_tags.replace('ggl=1', '');
           my_glam_tags = my_glam_tags.replace('!c=nptr', '');
           my_glam_tags = my_glam_tags + ';at=m';
           if ( my_glam_tags.indexOf('p=0') == -1 ) {
              my_glam_tags = my_glam_tags + ';p=0';
           }
           if ( my_glam_tags.indexOf('pt=0') == -1 ) {
              my_glam_tags = my_glam_tags + ';pt=0';
           }
           my_ad_flags = my_ad_flags | 16; // Fifth bit means Marketplace

        }
        var glam_appended_zone = '';

        // If this is and Atako APP, for now we undo a few tags
        if ( glam_ctags.indexOf('ap=atk') > -1 || my_glam_tags.indexOf('ap=atk') > -1 )
        {
            my_ad_flags = my_ad_flags | 256; // We set the flag for Atako

            if ( my_glam_tags.indexOf('at=dft') > -1 )
            {
               my_glam_tags = ';ap=atk;at=dft;';
            }
            else
            {
               while ( my_glam_tags.indexOf('ec=ron') > -1 || my_glam_tags.indexOf('p=1') > -1 )
               {
                  my_glam_tags = my_glam_tags.replace('ec=ron', '');
                  my_glam_tags = my_glam_tags.replace('p=1', '');
               }
            }
            my_glam_tags = my_glam_tags + ';at=m;';
            glam_appended_zone = 'GlamApp/';
        }
 
        // we only add the size based kvs on premium tags....
        if ( my_glam_tags.indexOf('ap=atk') == -1 && my_glam_tags.indexOf('at=m') == -1 )
        { 
            my_glam_tags = my_glam_tags + ';' + GlamGetAdSizeKvs(GlamGetAdSize());
        }

        my_glam_tags =  GlamCleanupKeyValues(my_glam_tags + ';' + GlamAppendCallbackTag(''));

        var my_premium_priority = GlamIsPremiumPriority();
        if ( my_premium_priority == false )
        {
           my_ad_flags = my_ad_flags | 128; // We set the flag for de-prioritized imp
           while ( my_glam_tags.indexOf('p=1') > -1 )
           {
              my_glam_tags = my_glam_tags.replace('p=1', 'p=a');
           }
           my_glam_tags = my_glam_tags.replace('p=2', '');
           my_glam_tags = my_glam_tags.replace('p=3', '');
           my_glam_tags = my_glam_tags.replace('p=4', '');
        }

        my_glam_tags =  GlamCleanupKeyValues(my_glam_tags + ';' + GlamAppendCallbackTag(''));

        if ( GlamGetAffiliateInfo('removekvs') )
        {
           var kvs=GlamGetAffiliateInfo('removekvs');
           var kvsarray=kvs.split(',');
           for(var i=0;i < kvsarray.length; i++) 
           {
             while( my_glam_tags.indexOf(';'+kvsarray[i]+'=') > -1 ) 
             {
                my_glam_tags = my_glam_tags.replace(';'+kvsarray[i]+'=', ';');
             }
           }
        }


        if ( GlamAppendCallbackTag('') != ';' && GlamAppendCallbackTag('') != '')
        {
           glam_appended_zone = 'Callback_' + GlamGetCallbackContext();
           my_glam_tags += ';aclb=' + GlamGetCallbackContext() + ';';
           my_ad_flags = my_ad_flags | 32; // sixth bit means callback
        }

        // We undo rmt=exp if this is an iframe tag...
        if ( GlamGetAdTagTypeId() == 'i' )
        {
           my_glam_tags = my_glam_tags.replace('rmt=exp;', '');
        }

        var my_ad_size = GlamGetAdSize();
        if ( my_ad_size == '160x600' )
        {
           my_ad_size = my_ad_size + ',120x600';
        }

        GlamSetUValue('g', my_ad_flags, window.glam_ad_sequence);

        my_glam_tags += (window.glam_session.ga_kvs ? window.glam_session.ga_kvs : '');

        my_glam_tags =  GlamCleanupKeyValues(my_glam_tags);

        var my_glam_adcall_url = '/adj/GNET_' + GlamGetAffiliateId() + 
                                 '/' + glam_appended_zone + ';' +
                                 my_glam_tags + 
                                 ';tt=' + GlamGetAdTagTypeId() + 
                                 ';u=' + GlamGetUValuesAsString('dart') + 
                                 ';sz=' + my_ad_size + 
                                 ';tile=' + 
                                 my_glam_tile + ';ord=' + my_glam_ord + ';?';

        window.glam_adapt_kvs = my_glam_adcall_url.replace('/adj/GNET_' + GlamGetAffiliateId() + '/',
                                                            'afid=' + GlamGetAffiliateId() +
                                                            ';dsid=' + GlamGetAffiliateInfo('dart_site_id') +
                                                            ';zone=/');
        window.glam_adapt_kvs = window.glam_adapt_kvs.replace('?','');

        var dt = new Date;
        window.glam_adapt_kvs += ( window.location.href.indexOf('glamCallGlamAdaptJs') > -1 ? ';glamadapt=js' : '' ) +
                                 ( window.location.href.indexOf('glamCallGlamAdaptDefault') > -1 ? ';glamadapt=default' : '' ) +
                                ';url=' + GlamGetUrlId() +
                                ';flg=' + my_ad_flags +
                                ';seq=' + window.glam_ad_sequence +
                                ';ux=' + GlamGetUValuesExploded() +
                                ';dt=' + parseInt(dt.getTime().toString().substring(0, 10)) +
                                ';a_tz=' + -dt.getTimezoneOffset() +
                                ';_g_cv=1';

        var adSize = GlamGetAdSize();
        var glamAdaptAdSizes = '888x10,888x6,888x7,888x14,110x90,888x11,';

        if ( window.location.href.indexOf('glamShowAdSizeMetaData') > -1 )
        {
           var ads_data = GlamGetAdSizeMetaData(GlamGetAdSize());
           document.write('ad size = ' + GlamGetAdSize() + '<br>id = ' + ads_data.id);
           document.write('<br>width = ' + ads_data.width);
           document.write('<br>height = ' + ads_data.height);
        }
        else if ( window.location.href.indexOf('glamCallGlamAdapt') > -1 || 
                 (window.glam_session.ga_call && window.glam_session.ga_call == 'glamadapt') )
        { 
           GlamCallExternalJs(  'http://www35.glam.com/gad/glamadapt_jsrv.act?' + window.glam_adapt_kvs);
        }
        else if ( glamAdaptAdSizes.indexOf(adSize) > -1 || GlamIsCountryTargeted() == false || window.glam_adapt_kvs.indexOf('glamadapt=nyfw') > -1 )
        {
           GlamCallExternalJs(  'http://www35.glam.com/gad/glamadapt_jsrv.act?' + window.glam_adapt_kvs);
        }
        else if (  false && window.glam_adapt_kvs.indexOf('at=dft') > -1 || window.glam_adapt_kvs.indexOf('ap=mev') > -1 ||
                  (GlamPrioritizeSplit(2, 4) == false && GlamGetAffiliateInfo('atp_rank') == 6 && window.glam_adapt_kvs.indexOf('pl=h') == -1 && 
                  GlamGetAffiliateInfo('is_takeover_targeted') != 1 && GlamGetAffiliateInfo('is_site_targeted') != 1 && 
                  GlamGetGeoData('cc') == 'US'&& GlamGetAffiliateInfo('country') == 'US' && GlamGetAffiliateInfo('ctr_opt_tags') == null) )
        {
           GlamCallExternalJs(  'http://www35.glam.com/gad/glamadapt_jsrv.act?;gadp=1;' + window.glam_adapt_kvs);
        }
        else if ( window.location.href.indexOf('glam_pda_override') > -1 || 
                 (window.glam_pda_override && window.glam_pda_override.indexOf(GlamGetAdSize()) > -1) )
        {
            GlamHideAdsByGlam(); 
            GlamShowPublisherDefaultAd();
        }
        else if ( !( my_glam_tags.indexOf(';at=m') > -1 && my_glam_tags.indexOf(';tox=') > -1) )
        {
           GlamCallExternalJs( document.glam_protocol + GlamGetDoubleclickUrl() + my_glam_adcall_url );
        }
        if ( GlamGetAffiliateInfo('spy') != 1 )
        {
           GlamCallExternalJs(  'http://www35.glam.com/gad/glamadapt_jsrv.act?;' + window.glam_adapt_kvs + '&gtrack=yes');
           //GlamCallExternalJs(  'http://www30t1-orig.glam.com/gad/glamadapt_ad_nop.act?;' + window.glam_adapt_kvs + '&gtrack=yes');
        }

     }

   window.glam_append_adtags = null;
   window.glam_append_user_info = null;

   // we record this impression with Quantcast
   if ( ! window._quantcast_called && glam_info['pec'] && ! glam_info['nielsen_track'] && GlamGetAdSize() != '888x12')
   {
      window._quantcast_called = 1;

      GlamCallQuantcast( ( glam_info['qid'] ?  glam_info['qid'] : 'p-874AVp33Bbtkg' ) ,
                         ( glam_info['qc']  ?  glam_info['qc'] : null  )  );
   }
   
   if ( (GlamGetGeoData('cc') == 'UK' || GlamGetGeoData('cc') == 'GB') && GlamGetAdSize() != '888x12')
   {
     var uk_page_view_flag  = ( my_glam_tile == 1 ?  'pageview=1&' : '' ) ;
     var uk_additional_variables = GlamGetAffiliateId() + '_' + GlamGetUrlId() + '_' + my_glam_ord + '_' + my_glam_tile + '_' + window.glam_ad_sequence + '_' + GlamGetAdSize() + '_' + GlamGetAdCallData()  ;
     document.write("<img src=\"http://secure-uk.imrworldwide.com/cgi-bin/m?ci=uk-ade&cg=12161&" + uk_page_view_flag + "si=uk-glammedia_"+uk_additional_variables+"&cc=1\" height=\"1\" width=\"1\" border=\"0\">");
   }


   if ( window.glamAdVisibility.doLogImpression && ! (my_ad_flags & 32) )
   {
       window.glamAdVisibility.doLogImpression();
   }
}


function GlamLoadEvolutionPlugins()
{

if(!window.glamAdVisibility){window.glamAdVisibility={VER:1,isOpera:navigator.userAgent.toLowerCase().indexOf("opera")>-1,isSafari:(/webkit|khtml/).test(navigator.userAgent.toLowerCase()),isIE:navigator.userAgent.toLowerCase().indexOf("msie")>-1,patterns:{HYPHEN:/(-[a-z])/i,ROOT_TAG:/^body|html$/i},getDocumentScrollLeft:function(doc){doc=doc||document;return Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft);},getDocumentScrollTop:function(doc){doc=doc||document;return Math.max(doc.documentElement.scrollTop,doc.body.scrollTop);},getViewportHeight:function(){var height=self.innerHeight;var mode=document.compatMode;if((mode||this.isIE)&&!this.isOpera){height=(mode=='CSS1Compat')?document.documentElement.clientHeight:document.body.clientHeight;}
return height;},getViewportWidth:function(){var width=self.innerWidth;var mode=document.compatMode;if(mode||this.isIE){width=(mode=='CSS1Compat')?document.documentElement.clientWidth:document.body.clientWidth;}
return width;},_getXY:function(){if(document.documentElement.getBoundingClientRect){return function(el){var box=el.getBoundingClientRect();var rootNode=el.ownerDocument;return[box.left+this.getDocumentScrollLeft(rootNode),box.top+
this.getDocumentScrollTop(rootNode)];};}else{return function(el){var pos=[el.offsetLeft,el.offsetTop];var parentNode=el.offsetParent;var accountForBody=(this.isSafari&&el.style.position=='absolute'&&el.offsetParent==el.ownerDocument.body);if(parentNode!=el){while(parentNode){pos[0]+=parentNode.offsetLeft;pos[1]+=parentNode.offsetTop;if(!accountForBody&&this.isSafari&&parentNode.style.position=='absolute'){accountForBody=true;}
parentNode=parentNode.offsetParent;}}
if(accountForBody){pos[0]-=el.ownerDocument.body.offsetLeft;pos[1]-=el.ownerDocument.body.offsetTop;}
parentNode=el.parentNode;while(parentNode.tagName&&!this.patterns.ROOT_TAG.test(parentNode.tagName))
{if(parentNode.style.display.search(/^inline|table-row.*$/i)){pos[0]-=parentNode.scrollLeft;pos[1]-=parentNode.scrollTop;}
parentNode=parentNode.parentNode;}
return pos;};}}(),getXY:function(el){if((el.parentNode===null||el.offsetParent===null||el.display=='none')&&el!=el.ownerDocument.body){return false;}
return this._getXY(el);},visibilityCode:function(adY,adHeight){var ad_top=parseInt(adY);var ad_height=parseInt(adHeight);if(ad_top+ad_height<this.fold){return"1";}else if(ad_top+this.partialThreshold<this.fold){return"p";}else{return"0";}},getActualUrl:function(){var isiframe=window!=top;var referrer=false;var url;try{url=top.location.href;}catch(e){if(isiframe){try{url=parent.document.referrer;if(!url)
url=location.href;else
referrer=true;}catch(e){url=document.referrer;if(!url)
url=location.href;else
referrer=true;}}else{url=location.href;}}
return{'url':url,'iframe':isiframe,'referrer':referrer};},tmpData:[],doLogImpression:function(){d=window.glamAdVisibility.tmpData[0];full_utag=window.glamAdVisibility.tmpData[1];var currentTile=(GlamGetAdTile()||'0');var flags=GlamGetUValue('g');var glamData={'a':GlamGetAffiliateId()||'null','g':flags?flags[0]:'null','cc':GlamGetGeoData('cc')||'null','ses':GlamGetSessionId()||'null'};setTimeout(function(){window.glamAdVisibility.deferred(d,2,full_utag,glamData);},2000);},check:function(d){tagdata={'tile':d.tile,'atf':'u'};try{var ad=document.getElementById(d.divid);if(ad){var p=this.getXY(ad);if(p[0]>0&&p[1]>0){var vis=this.visibilityCode(p[1],d.size.split('x')[1]);tagdata['atf']=vis;tagdata['pos']=p[0]+","+p[1];}else{tagdata['err']=true;}
tagdata['viewport']=this.getViewportWidth()+"x"+this.getViewportHeight();return tagdata;}}catch(e){}
tagdata['err']=true;return tagdata;},deferred:function(d,delay,old,glamData){var tagdata=this.check(d);this.hideMarker(d);var a=this.getActualUrl();var actualUrl=encodeURIComponent(a['url']);var utag=this.formatExtendedTag(tagdata);var gdata="";for(var x in glamData){gdata+="&"+x+"="+encodeURIComponent(glamData[x]);}
var img=new Image();var tmp="http://64.151.94.43/clear.gif?u="+utag+"&s="+d.size+"&v="+d.pageview+gdata+"&url="+actualUrl+"&rand="+(window.glamAdVisibility.VER+Math.random());},hideMarker:function(d){var tmp=document.getElementById(d.divid);if(tmp){tmp.style.display="none";}},formatDartTag:function(data){var atf=data.atf||'u';var foldTmp=this.fold/10;var thresholdTmp=this.partialThreshold/10;return'f'+atf+foldTmp.toString(36)+thresholdTmp.toString(36);},formatExtendedTag:function(data){function lpad(x){x=''+Math.floor(x);return'0000'.substring(x.length)+x;}
var atf=data.atf||'u';var adPosition="0000-0000";var viewport="0000-0000";try{var tmp=data.pos.split(',');adPosition=lpad(tmp[0])+"-"+lpad(tmp[1]);}catch(e){}
try{var tmp=data.viewport.split('x');viewport=lpad(tmp[0])+"-"+lpad(tmp[1]);}catch(e){}
return"af"+atf+","+data.tile+","+adPosition+","+viewport+","+this.fold+","+this.partialThreshold;},fold:1000,partialThreshold:100};}
var d={'tile':(GlamGetAdTile()||'0'),'size':GlamGetAdSize(),'pageview':GlamGetPageViewId()};d['divid']="glamad_"+d.tile+"_"+d.pageview;if(window.glamAdVisibility.isIE){document.write('<div id="'+d.divid+'" style="undo zoom: 1;"><!-- --></div>');}else{document.write('<div id="'+d.divid+'" style="margin:0;padding:0;width:0;height:0;border-width:0;background-image:none;"></div>');}
var tagdata=window.glamAdVisibility.check(d);var zone=GlamGetZone()||'Premium';if(GlamGetMode()=='glamEvolutionTest'){var size=d.size.split('x');document.write("<div style='width:"+parseInt(size[0])+"px;height:"+parseInt(size[1])+"px;color:#000;background-color:pink;border-color:#000;border-style:solid;border-width:1px;padding:1px; font-size:11px;'>");document.write("pos="+tagdata.pos+"<br>");document.write("size="+d.size+"<br>");document.write("tile="+d.tile+"<br>");document.write("atf="+tagdata.atf+"<br>");document.write("pageview="+d.pageview+"<br>");document.write("zone="+zone+"<br>");document.write("</div>");}else{var tiny_utag=window.glamAdVisibility.formatDartTag(tagdata);var full_utag=window.glamAdVisibility.formatExtendedTag(tagdata);if(window.GlamSetUValue){GlamSetUValue('f',tiny_utag);}else{GlamSetPageCallData(full_utag);}
GlamAppendAdTag("atf="+tagdata.atf);if(window.glam_atf_line){var y=0;try{y=tagdata.pos.split(',')[1];}catch(e){}
if(y!=0&&y<window.glam_atf_line){GlamAppendAdTag(window.glam_atf_kv);}}
window.glamAdVisibility.tmpData=[d,full_utag];}if (window.glam_atf_info) {
  if (window.glam_atf_info.x) {
     if (window.glam_atf_info.x >= 300) 
     	GlamAppendAdTag('pfl=3');
     else if (window.glam_atf_info.x >=160) 
        GlamAppendAdTag('pfl=1');
     else 
        GlamAppendAdTag('pfl=0');
  } 
} else 
   GlamAppendAdTag('pfl=u');

}

function GlamSetPageCallData(pvData)
{
  window.glam_page_call_data = pvData;
}

function GlamGetPageCallData()
{
  if ( ! window.glam_page_call_data ) {
     window.glam_page_call_data = '';
  }
  return window.glam_page_call_data;
}


function GlamResetCallbackTag() {

   window.glam_callback_ad_tag = '';
}

function GlamAppendCallbackTag(ad_tag_string) {
   if ( ! window.glam_callback_ad_tags )
   {
      window.glam_callback_ad_tags = new Array();
      for (i=0; i < 50 ; i++)
      {
         window.glam_callback_ad_tags[i] = '';
      }
   }
   window.glam_callback_ad_tags[GlamGetAdTile()] = window.glam_callback_ad_tags[GlamGetAdTile()] +
                                                   ad_tag_string + ';';
   var glam_callback_ad_tag = window.glam_callback_ad_tags[GlamGetAdTile()];
   while ( glam_callback_ad_tag.indexOf(';;') > -1) {
             glam_callback_ad_tag = glam_callback_ad_tag.replace(';;', ';');
   }
   return glam_callback_ad_tag;
}



function GlamCheckClientEnv()
{
if (window.glam_append_adtags) {
  for (var k in window.glam_append_adtags) {
    GlamAppendAdTag(k+'='+window.glam_append_adtags[k]);
  }
}

if (window.glam_append_user_info) {
  for (var k in window.glam_append_user_info) {
    GlamSetUValue(k, window.glam_append_user_info[k]);
  }
}

// If we are in glamtv mode, we hide ads by glam
glam_ctags = GlamAppendAdTag('');
if ( glam_ctags.indexOf('ap=gtv') > -1 || glam_ctags.indexOf('ap=btv') > -1)
{
   GlamHideAdsByGlam();
}

var my_glam_tags = GlamGetAdCallData();

if ( window.location.href.indexOf('glamReskinTest') > -1 && ! window.glam_reskin_test && ! window.glam_reskin_done)
{
   window.glam_reskin_test = true;
   GlamCallExternalJs('http://www8.glam.com/js/widgets/glam_reskin.js');
}

if ( window == window.top && window.location.href.indexOf('glamShowUrl') > -1 )
{
   alert(window.location.href);
}
else if ( window != window.top && document.referrer.indexOf('glamShowUrl') > -1)
{
   alert(document.referrer);
}



}


function GlamValidateAdTags()
{
  GlamSetAdTagType('jscript');
  if ( window.location.href.indexOf('glamAppendKv') > -1  )
  {
     glam_dart_ge_tags = glam_dart_ge_tags + 
                         window.location.href.substr(
                         window.location.href.indexOf('glamAppendKv')) +
                         ';';
  }
  if ( window.location.href.indexOf('glamSetKv') > -1  )
  {
     glam_dart_ge_tags = window.location.href.substr(
                         window.location.href.indexOf('glamSetKv')) +
                         ';';
  }

  if ( window.location.href.indexOf('glamLinkTarget') > -1  )
  {
     GlamAppendAdTag(window.location.href.substr(
                     window.location.href.indexOf('glamLinkTarget')+15));
  }

  if ( window.location.href.indexOf('glamLinkTargetTest') > -1  )
  {
     alert(window.location.href.substr(
                     window.location.href.indexOf('glamLinkTargetTest')+19));
  }

  // if the publisher has set the tags for default ads, we set them...
  if ( GlamGetAffiliateInfo('ap_info') == 'dt=yes' || GlamGetZone() == 'Marketplace' ) {
     glam_default_selected = false;
     gzone = GlamGetZone();
     if ( GlamGetZone() == '' ) {
         gzone = 'Premium';
     }
  
     if ( GlamGetAffiliateInfo(gzone + '_' + 'ca') == 'yes' ) {
       glam_default_selected = true;
       GlamHideAdsByGlam();
       GlamAppendAdTag('dt=c');
     }

     if ( GlamGetAffiliateInfo(gzone + '_' + 'noad') == 'yes' ) {
       glam_default_selected = true;
       GlamHideAdsByGlam();
       GlamAppendAdTag('dt=n');
     }

     if ( GlamGetAffiliateInfo(gzone + '_' + 'psa') == 'yes' ) {
       glam_default_selected = true;
       GlamHideAdsByGlam();
       GlamAppendAdTag('dt=p');
     }
     if ( GlamGetAffiliateInfo(gzone + '_' + 'awga') == 'yes' ) {
       glam_default_selected = true;
       GlamAppendAdTag('dt=b');
     }
     if ( GlamGetAffiliateInfo(gzone + '_' + 'ownad'+window.glam_ad_size) != null ) {
       glam_default_selected = true;
       GlamHideAdsByGlam();
       GlamAppendAdTag('dt=s');
     }
     else if ( window.glam_ad_size.indexOf('160x600') > -1 &&
               GlamGetAffiliateInfo(gzone + '_' + 'ownad160x600') != null ) {
       glam_default_selected = true;
       GlamHideAdsByGlam();
       GlamAppendAdTag('dt=s');
     }
     else if ( window.glam_ad_size.indexOf('300x250') > -1 &&
               GlamGetAffiliateInfo(gzone + '_' + 'ownad300x250') != null ) {
       glam_default_selected = true;
       GlamHideAdsByGlam();
       GlamAppendAdTag('dt=s');
     }

     // if there was no selection done, we default to awga ads
     if ( glam_default_selected == false && (GlamGetAffiliateInfo('country') == 'UK'  || GlamGetAffiliateInfo('country') == 'DE' )) {
       GlamHideAdsByGlam();
       GlamAppendAdTag('dt=n');
     }
     else if ( glam_default_selected == false ) {
       GlamAppendAdTag('dt=b');
     }
     GlamAppendAdTag('!c=hagl;!c=hagn');
  }

  // We now add any variables that might have been sent on the url
  

  // We check for date of day or ad below the fold so we undo premium ad settings
  now = new Date();
  hour = now.getHours();
  ge_tags = GlamAppendAdTag('');

  if ( false ) /* hour < 7 || ge_tags.indexOf('atf=0') > -1 || glam_dart_ge_tags.indexOf('ge=ro') > -1 ) */
  {
     // We only do this if this publisher is not on the exclusion list for remnant
     if ( glam_dart_ge_tags.indexOf('!c=nptr') > -1 && GlamGetAffiliateInfo('nptr') == 'pt' )
     {
        while(glam_dart_ge_tags.indexOf('!c=nptr') > -1)
        {
           glam_dart_ge_tags = glam_dart_ge_tags.replace('!c=nptr', '');
        }
     }

     if ( glam_dart_ge_tags.indexOf('!c=nptr') == -1 )
     {
        // we set the non prime time flag
        glam_dart_ge_tags = glam_dart_ge_tags + ';pt=0;';
        // now we undo all the prime time ad targeting flags
        glam_dart_ge_tags = glam_dart_ge_tags.replace('p=1', 'p=0');
        glam_dart_ge_tags = glam_dart_ge_tags.replace('p=1', 'p=0');
        glam_dart_ge_tags = glam_dart_ge_tags.replace('p=1', 'p=0');
        glam_dart_ge_tags = glam_dart_ge_tags.replace('p=2', 'p=0');
        glam_dart_ge_tags = glam_dart_ge_tags.replace('p=3', 'p=0');
        glam_dart_ge_tags = glam_dart_ge_tags.replace('p=4', 'p=0');
     }
  }   

  // Now we figure out what type of application is calling the ad
  if ( window.location.href.indexOf('/videos') > -1 && GlamGetAffiliateId() == 0  )
  {
    GlamAppendAdTag('ap=gtv');
  }
  else if ( window.location.href.indexOf('/videos') > -1 && GlamGetAffiliateId() == 1 )
  {
    GlamAppendAdTag('ap=btv');
  }
  else if ( window.location.href.indexOf('feeds.glam.com/static/video') > -1 )
  {
    GlamAppendAdTag('ap=gtv');
  }

}

// Begin Definitions for Affiliate Information
window.dbg_ad_size = window.glam_ad_size;


function GlamGetAffiliateInfo(info_var) {
if ( window.glam_affiliate_info[info_var] ) {
  return window.glam_affiliate_info[info_var];
 }
else if ( window.glam_info[info_var] ) {
  return window.glam_info[info_var];
 }
else {
  return null;
 }
}

// End Definitions for Affiliate Information


// Begin Definitions for Default ads
function GlamShowCustomDefaultAd(zone, adSize) {}

function GlamHideAdsByGlam()
{
   window.glam_show_ads_by_glam = 'no';

   var glam_abg_div = document.getElementById(window.glam_abg_id);

   if ( glam_abg_div )
   {
      glam_abg_div.innerHTML = '';
   }
}



function GlamShowAdsByGlam()
{
  window.glam_abg_id = GlamGetDartViewId() + '-' + document.glam_dart_tile;

  if ( window.location.href.indexOf('https') > -1 || 
       GlamGetAdSize() == '888x12' ||
       window.glam_dart_include.indexOf('ggl=1')    > -1 ||
       window.location.href.indexOf('glamTVplayer') > -1 )
  {
       GlamHideAdsByGlam();
  }

  if ( ! window.glam_show_ads_by_glam ||
         window.glam_show_ads_by_glam == 'yes' )
  {
     document.write('<div style="display:inline;" id="'+ window.glam_abg_id +'"><img src="http://fileserver.glam.com/35/277283507-6112475845f5ea799.gif"><br /></div>');
  }

}


function GlamShowPublisherDefaultAd()
{
  var gadsize = GlamGetAdSize();
  var gadsize_array = gadsize.split(',');

  if ( gadsize_array && gadsize_array[0] ) {
      GlamShowCustomDefaultAd(GlamGetZone(), gadsize_array[0]);
  }
}


function GlamShowNoDefaultAd() {}

// End Definitions for Default ads



// Begin Key Value Appending Functions


// Specific implementation for dyamic logic sets a cookie with specific timeout
function GlamSetDlExposedAdTag(ad_entry, ad_kv) {}

// End Key Value Appending Functions


// Begin Cookie Functions

function GlamSetCookie(name,value,days) {
     GlamSetCookie(name,value,days*86400);
}

function GlamSetCookie2( name, value, expires, path, domain, secure )
{
   // set time, it's in milliseconds
   var today = new Date();
   today.setTime( today.getTime() );

   if ( ! expires )
   {
      expires = 60;
   }
   var expires_date = new Date( today.getTime() + (expires * 1000) );

   document.cookie = name + "=" +escape( value ) +
      ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
      ( ( path ) ? ";path=" + path : "" ) +
      ( ( domain ) ? ";domain=" + domain : "" ) +
      ( ( secure ) ? ";secure" : "" );
}

function GlamGetCookie( check_name ) {
        // first we'll split this cookie up into name/value pairs
        // note: document.cookie only returns name=value, not the other components
        var a_all_cookies = document.cookie.split( ';' );
        var a_temp_cookie = '';
        var cookie_name = '';
        var cookie_value = '';
        var b_cookie_found = false; // set boolean t/f default f

        for ( i = 0; i < a_all_cookies.length; i++ )
        {
                // now we'll split apart each name=value pair
                a_temp_cookie = a_all_cookies[i].split( '=' );


                // and trim left/right whitespace while we're at it
                cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');

                // if the extracted name matches passed check_name
                if ( cookie_name == check_name )
                {
                        b_cookie_found = true;
                        // we need to handle case where cookie has no value but exists (no = sign, that is):
                        if ( a_temp_cookie.length > 1 )
                        {
                                cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
                        }
                        // note that in cases where cookie is initialized but no value, null is returned
                        return cookie_value;
                        break;
                }
                a_temp_cookie = null;
                cookie_name = '';
        }
        if ( !b_cookie_found )
        {
                return null;
        }
}

function GlamEraseCookie(name) {
	createCookie(name,"",-1);
}


// End Cookie functions

window.glam_affiliate_info={"home_url":"http:\/\/www.realationship.com","dart_tags":"nt=g;cc=us;ec=ron;p=0;al=cin;cl=masm;ctr=ll;ec=thw;ec=tmbs;ec=tw;ia=pc;p=1;pec=w;vec=hw;vpec=hw;","dart_tags_orig":"nt=g;cc=us;ec=ron;p=0;al=cin;al=nd;al=ort;cl=masm;ctr=ll;ec=thw;ec=tmbs;ec=tw;ia=o;ia=pc;iatc=y;p=1;pec=w;st=nug;st=ws;vec=hw;vpec=hw;","list_tags":"al=cin;al=nd;al=ort;cl=masm;ctr=ll;ec=thw;ec=tmbs;ec=tw;ia=o;ia=pc;iatc=y;p=1;pec=w;st=nug;st=ws;vec=hw;vpec=hw;","country":"US","network":"Glam","currency":"USD","affiliate_type":"Publisher","list_info_tags":"atp=6;ec_tau_atp=6;ec_taut_atp=6;ec_tb_atp=6;ec_tbl_atp=5;ec_tc_atp=6;ec_te_atp=3;ec_teb_atp=6;ec_tf_atp=4;ec_tfm_atp=6;ec_th_atp=6;ec_thw_atp=6;ec_tls_atp=6;ec_tlt_atp=6;ec_tlu_atp=6;ec_tlv_atp=6;ec_ts_atp=5;ec_tsp_atp=6;ec_tw_atp=6;agof_c=LIS;agof_sc=00;dir=mbs;dir=w;iash_audit=pc;rs=1;sitetype=website;","parent_affiliate_id":277283507,"atp_rank":"6","dart_site_id":"517331","pec":"w","ctr_opt_tags":"cpall=all;","ctr_opt_tags_orig":"cpall=all;","is_site_targeted":"0","bt_tags_used":"bt=bcp;bt=er;bt=wa;bt=sl;bt=sj;bt=sb;bt=lt;bt=lm;bt=lfw;bt=fp;bt=fj;bt=es;bt=f;bt=sa;bt=ss;bt=s;bt=b;bt=fc;bt=lts;bt=wd;bt=wf;bt=ws;bt=ec;bt=ef;bt=hb;bt=lc;bt=lfc;bt=lfo;bt=lh;bt=lhd;bt=lhf;bt=lhp;bt=lhr;bt=lp;bt=sh;bt=sk;bt=wc;bt=wr;bt=lf;bt=ltb;bt=w;bt=h;bt=se;bt=ls;bt=lhe;bt=le;bt=lg;bt=mb;","all_targeted_countries":"AT,CH,DE,GB,US,IN,JP,CA,NL,NZ,AU,SE,IE,ES,IT,FR,JE,GG,IM,AM,","all_dart_targeted_countries":"AT,CH,DE,GB,US,IN,JP,CA,NL,NZ,AU,SE,IE,ES,IT,FR,JE,GG,IM,AM,","all_glam_targeted_countries":"US,UK,GB,DE,JP,CA,IE,AT,CH,SA,SE,FR,BE,IT,NL,","ap_info":null,"is_takeover_targeted":0,"site_targeted_ad_sizes":"","Premium_ownad160x600":"<!-- BEGIN TAG - 160x600 - realationship.com - DO NOT MODIFY -->\r\n<script type=\"text\/javascript\" src=\"http:\/\/optimizedby.rmxads.com\/st?ad_type=ad&ad_size=160x600&section=288588\"><\/script>\r\n<!-- END TAG -->\r\n","Premium_ownad300x250":"<!-- BEGIN TAG - 300x250 - realationship.com - DO NOT MODIFY -->\r\n<script type=\"text\/javascript\" src=\"http:\/\/optimizedby.rmxads.com\/st?ad_type=ad&ad_size=300x250&section=288588\"><\/script>\r\n<!-- END TAG -->\r\n","Premium_ownad728x90":"<!-- BEGIN TAG - 728x90 - realationship.com - DO NOT MODIFY -->\r\n<script type=\"text\/javascript\" src=\"http:\/\/optimizedby.rmxads.com\/st?ad_type=ad&ad_size=728x90&section=288588\"><\/script>\r\n<!-- END TAG -->\r\n","Premium_ca":"no","Premium_awga":"no","Premium_psa":"no","Premium_noad":"no"};
window.glam_homepage_urls=["http:\/\/www.realationship.com"];
window.glam_dart_ge_tags = window.glam_dart_pepe_tags + 'nt=g;cc=us;ec=ron;p=0;al=cin;cl=masm;ctr=ll;ec=thw;ec=tmbs;ec=tw;ia=pc;p=1;pec=w;vec=hw;vpec=hw;';

window.glam_url_info=[];

/* Default ads */

function GlamShowCustomDefaultAd(zone, adSize) {
if ( false ) {
 document.write('');
 }
else if ( zone == '' && adSize == '160x600' ) {
 document.write('<!-- BEGIN TAG - 160x600 - realationship.com - DO NOT MODIFY -->\n<script type=\"text/javascript\" src=\"http://optimizedby.rmxads.com/st?ad_type=ad&ad_size=160x600&section=288588\"></scri' + 'pt>\n<!-- END TAG -->\n');
 }
else if ( zone == '' && adSize == '300x600' ) {
 document.write('');
 }
else if ( zone == '' && adSize == '728x90' ) {
 document.write('<!-- BEGIN TAG - 728x90 - realationship.com - DO NOT MODIFY -->\n<script type=\"text/javascript\" src=\"http://optimizedby.rmxads.com/st?ad_type=ad&ad_size=728x90&section=288588\"></scri' + 'pt>\n<!-- END TAG -->\n');
 }
else if ( zone == '' && adSize == '300x250' ) {
 document.write('<!-- BEGIN TAG - 300x250 - realationship.com - DO NOT MODIFY -->\n<script type=\"text/javascript\" src=\"http://optimizedby.rmxads.com/st?ad_type=ad&ad_size=300x250&section=288588\"></scri' + 'pt>\n<!-- END TAG -->\n');
 }
else if ( zone == '' && adSize == '800x150' ) {
 document.write('');
 }
else if ( zone == '' && adSize == '630x150' ) {
 document.write('');
 }
else if ( zone == '' && adSize == '270x150' ) {
 document.write('');
 }
else if ( zone == '' && adSize == '800x50' ) {
 document.write('');
 }
else if ( zone == '' && adSize == '160x160' ) {
 document.write('');
 }
else if ( zone == '' && adSize == '650x35' ) {
 document.write('');
 }
else if ( zone == '' && adSize == '984x258' ) {
 document.write('');
 }
else if ( zone == '' && adSize == '990x26' ) {
 document.write('');
 }
else if ( zone == '' && adSize == '728x91' ) {
 document.write('');
 }
else if ( zone == '' && adSize == '468x60' ) {
 document.write('');
 }
else if ( zone == '' && adSize == '120x600' ) {
 document.write('');
 }
else if ( zone == 'Marketplace' && adSize == '160x600' ) {
 document.write('');
 }
else if ( zone == 'Marketplace' && adSize == '300x600' ) {
 document.write('');
 }
else if ( zone == 'Marketplace' && adSize == '728x90' ) {
 document.write('');
 }
else if ( zone == 'Marketplace' && adSize == '300x250' ) {
 document.write('');
 }
else if ( zone == 'Marketplace' && adSize == '800x150' ) {
 document.write('');
 }
else if ( zone == 'Marketplace' && adSize == '630x150' ) {
 document.write('');
 }
else if ( zone == 'Marketplace' && adSize == '270x150' ) {
 document.write('');
 }
else if ( zone == 'Marketplace' && adSize == '800x50' ) {
 document.write('');
 }
else if ( zone == 'Marketplace' && adSize == '160x160' ) {
 document.write('');
 }
else if ( zone == 'Marketplace' && adSize == '650x35' ) {
 document.write('');
 }
else if ( zone == 'Marketplace' && adSize == '984x258' ) {
 document.write('');
 }
else if ( zone == 'Marketplace' && adSize == '990x26' ) {
 document.write('');
 }
else if ( zone == 'Marketplace' && adSize == '728x91' ) {
 document.write('');
 }
else if ( zone == 'Marketplace' && adSize == '468x60' ) {
 document.write('');
 }
else if ( zone == 'Marketplace' && adSize == '120x600' ) {
 document.write('');
 }
}

 

// Begin Code for publisher's ads

document.glam_css='<style> </style> ';

glam_mode=GlamGetMode();
glam_nbr_ads=1;


var glam_info = new Array();

if ( window.glam_affiliate_info['dart_tags'] )
{
   vars = window.glam_affiliate_info['dart_tags'].split(";");
   for (var i=0;i<vars.length;i++) {
     var pair = vars[i].split("=");
     glam_info[pair[0]] = pair[1];
   }
}


if ( window.glam_affiliate_info['list_info_tags'] )
{
   vars = window.glam_affiliate_info['list_info_tags'].split(";");
   for (var i=0;i<vars.length;i++) {
     var pair = vars[i].split("=");
     glam_info[pair[0]] = pair[1];
   }
}



        if ( ! document.glam_dart_tile )
        {
           document.glam_dart_tile = 0;
        }
        document.glam_dart_tile = document.glam_dart_tile + 1;

        // We reset any client ad tag settings that were created by other units
        GlamResetAdTag();
        GlamCheckClientEnv();

/* ----------------- BEGIN OF GlamDoDisplayAd() Function ---------------------- */

function GlamDoDisplayAd() {

// If an ad has called GlamDisableAds(), we stop processing this request
if ( window.glam_ads_disabled && window.glam_ads_disabled == true )
{
        return;
}

if ( glam_mode == 'dart' || glam_mode == 'glamEvolutionTest' ) 
{

        // we are in normal ad mode
         document.glam_protocol='http://';
        if ( window.location.href.indexOf('https') > -1 )
        {
           document.glam_protocol='https://';
        }

        GlamShowAdsByGlam();


                  
          // <!-- begin DART AD for channel:  -->
          if ( window.location.href.indexOf('caTestViaDart') > -1 || window.glam_ca_test_via_dart )
          {
              glam_dart_include = 'ggl=1;';
          }

          GlamAppendAdTag(window.glam_kwv);


          // In case we were asked to override a certain adsize on a given spot, we do so...
          if ( window.location.href.indexOf('glamAdSizeOverride') > -1  && 
               window.location.href.indexOf('glamAdTile') > -1          &&
               GlamGetQueryVariable('glamAdTile') == document.glam_dart_tile )
          {
              glam_ad_size = GlamGetQueryVariable('glamAdSizeOverride');
          }

          GlamLoadEvolutionPlugins();

          GlamValidateAdTags();

          // we concatenate the tags with some custom driven tags...
          glam_dart_ge_tags = glam_dart_ge_tags + GlamAppendAdTag('');

          if ( glam_mode == 'dart' )
          {
             GlamCallDartAd();
          }

          if ( glam_nbr_ads > 1 )
          {
             document.glam_dart_tile = document.glam_dart_tile + 1;
             document.write('<br>');
             GlamCallDartAd();
          }

                // <!-- end DART ADfor channel: -->
}
else if ( glam_mode == 'glamTest' )
{
  document.write('<scr' + 'ipt type="text/javascript" language="JavaScript" src="' +
                 'http://www4.glam.com/app/site/affiliate/viewChannelModule.act?mName=getBiteJs&affiliateId=' + 
                 '277283507&bite=glamTest_300x250"><' + '/sc' + 'ript>');
}
else if ( glam_mode == 'googleTest' )
{

  document.write('<scr' + 'ipt type="text/javascript" language="JavaScript" src="' +
                 'http://scripts.glam.com/js/googleTest/googleTest_' + 
                 '277283507.js"><' + '/sc' + 'ript>');
}

}
/* ----------------- END OF GlamDoDisplayAd() Function ---------------------- */

GlamDisplayAd();


