﻿<!--//--><![CDATA[//><!--

// Replaces all instances of the given substring.
String.prototype.replaceAll = function( 
strTarget, // The substring you want to replace
strSubString // The string you want to replace in.
){
var strText = this;
var intIndexOfMatch = strText.indexOf( strTarget );
 

// Keep looping while an instance of the target string
// still exists in the string.
while (intIndexOfMatch != -1){
// Relace out the current instance.
strText = strText.replace( strTarget, strSubString )
 

// Get the index of any next matching substring.
intIndexOfMatch = strText.indexOf( strTarget );
}
 

// Return the updated string with ALL the target strings
// replaced out with the new substring.
return( strText );
}

// get URL param
function gup( name )
{
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var tmpURL = window.location.href;
  var results = regex.exec( tmpURL );
  if( results == null )
    return "";
  else
    return results[1];
}

// get path ELEMENT getpath(1) = get first element of the URL separated by '/'
function getpath(param)
{
	
 
  var wloc = window.location.href;
  var tmpURL = wloc.replaceAll("///","***");  
  tmpURL = tmpURL.replaceAll("//","**");
  tmpURL = tmpURL.replaceAll("/","|");  
  tmpURL = tmpURL.replaceAll("***","///");  
  tmpURL = tmpURL.replaceAll("**","//");
  var tmpURL = tmpURL.split(/\|/);  
  var itemmod = 0;
  if (param != undefined) itemmod = param;
  if (itemmod >= 0) {itemmod--;}
  if (tmpURL.length > 0 && tmpURL.length >= itemmod)
  	return tmpURL[itemmod];
  else
  	return "";
}
var country = getpath(4);
var reseller = getpath(5);
-->