<!-- Begin
//alert("START REDIR");
var expDays = 30;
var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

function getCookieVal (offset) {  
var endstr = document.cookie.indexOf (";", offset);  
if (endstr == -1)    
endstr = document.cookie.length;  
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie(c_name)
{

if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=")

  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1
    c_end=document.cookie.indexOf("&",c_start)
    if (document.cookie.indexOf(";", c_start) != -1 && document.cookie.indexOf("&",c_start) == -1) c_end=document.cookie.indexOf(";", c_start)
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end))
    } 
  }
return null
}
function SetCookie (name, value) {  
var argv = SetCookie.arguments;  
var argc = SetCookie.arguments.length;  
var expires = (argc > 2) ? argv[2] : null;  
var path = (argc > 3) ? argv[3] : null;  
var domain = (argc > 4) ? argv[4] : null;  
var secure = (argc > 5) ? argv[5] : false;  
document.cookie = name + "=" + escape (value) + 
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
((path == null) ? "" : ("; path=" + path)) +  
((domain == null) ? "" : ("; domain=" + domain)) +    
((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {  
var exp = new Date();  
exp.setTime (exp.getTime() - 1);  
var cval = GetCookie (name);  
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}


function InStr(strSearch, charSearchFor)
/*
InStr(strSearch, charSearchFor) : Returns the first location a substring (SearchForStr)
                           was found in the string str.  (If the character is not
                           found, -1 is returned.)

Requires use of:
        Mid function
        Len function
*/
{
        for (i=0; i < Len(strSearch); i++)
        {
            if (charSearchFor == Mid(strSearch, i, 1))
            {
                        return i;
            }
        }
        return -1;
}

function Len(str)
/***
        IN: str - the string whose length we are interested in

        RETVAL: The number of characters in the string
***/
{  return String(str).length;  }

function Mid(str, start, len)
/***
        IN: str - the string we are LEFTing
        start - our string's starting position (0 based!!)
        len - how many characters from start we want to get

        RETVAL: The substring from start to start+len
***/
{
        // Make sure start and len are within proper bounds
        if (start < 0 || len < 0) return "";

           var iEnd, iLen = String(str).length;
           if (start + len > iLen)
              iEnd = iLen;
           else
              iEnd = start + len;

           return String(str).substring(start,iEnd);
}

function Left(str, n)
/***
 IN: str - the string we are LEFTing
 n - the number of characters we want to return

 RETVAL: n characters from the left side of the string
***/
{
         if (n <= 0)     // Invalid bound, return blank string
                return "";
         else if (n > String(str).length)   // Invalid bound, return
                return str;                // entire string
         else // Valid bound, return appropriate substring
                return String(str).substring(0,n);
}

function Right(str, n)
/***
        IN: str - the string we are RIGHTing
            n - the number of characters we want to return

        RETVAL: n characters from the right side of the string
***/
{
        if (n <= 0)     // Invalid bound, return blank string
            return "";
        else if (n > String(str).length)   // Invalid bound, return
            return str;                     // entire string
        else { // Valid bound, return appropriate substring
            var iLen = String(str).length;
            return String(str).substring(iLen, iLen - n);
        }
}
var browser_type=navigator.appName
var browser_version=parseInt(navigator.appVersion)
var web_van = GetCookie('Vanity');
if(web_van == '')
	web_van = 'sample';
var web_location = location.host;
var web_sub = Left(location.host,InStr(location.host,'.'));
if(web_sub == "www")
{
	web_location = Right(web_location,String(web_location).length - InStr(web_location,'.') - 1);
	//alert("New loc: " + web_location);
	web_sub = Left(web_location,InStr(web_location,'.'));	
	
}
//alert("Vanity: " + web_van + ", Subdomain: " + web_sub);
if(location.host != "localhost")
{
	if((web_sub != web_van) && (web_sub == "resmax"))
	{
		//var res_url = document.location;
		var res_url = "http://" + web_van + Right(location.host,String(location.host).length - InStr(location.host,'.')) + location.pathname;
		//if NS 6
		if (browser_type=="Netscape"&&browser_version>=5)
		window.location.replace(res_url)
		//if IE 4+
		else if (browser_type=="Microsoft Internet Explorer"&&browser_version>=4)
		window.location.replace(res_url)
		//if NS4+
		else if (browser_type=="Netscape"&&browser_version>=4)
		window.location.replace(res_url)
		//Default goto page (NOT NS 4+ and NOT IE 4+)
		else
		window.location=res_url	
	}
}
else
{
	//alert("Localhost Mode");
}

// -->
