function updateReferrer() {
	if (document.getElementById("signup_frame") != null) {
		document.getElementById("signup_frame").src = "https://secure.hostedftp.com/signup?referrer=" + escape(getCookie("referrer")) + "&firstVisitDate=" + getCookie("firstVisitDate");
	}

	if (document.getElementById("success_frame") != null) {
		var path = window.location.pathname;
		
		document.getElementById("success_frame").src = "https://secure.hostedftp.com/success?path=" + escape(path);
	}

        if (document.getElementById("try-it-right-now_frame") != null) {
                var path = window.location.pathname;

                document.getElementById("try-it-right-now_frame").src = "https://secure.hostedftp.com/try-it-right-now?path=" + encodeURIComponent(path);
        }

	if (document.getElementById("payment_frame") != null) {
		var path = window.location.pathname;
		
		document.getElementById("payment_frame").src = "https://secure.hostedftp.com/payment?path=" + escape(path);
	}
}

function updateReferrer2() {
	if (getCookie("referrer") == null) {
		var today = new Date();
		var expires = new Date(today.getTime() + 1000 * 60 * 60 * 24 * 365);

		setCookie('referrer', document.referrer, expires, null, null, null);
		setCookie('firstVisitDate', '' + today.getTime(), expires, null, null, null);
	}
}


function setCookie(name, value, expires, path, domain, secure)
{
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

function deleteCookie(name, path, domain)
{
    if (getCookie(name))
    {
        document.cookie = name + "=" + 
            ((path) ? "; path=" + path : "") +
            ((domain) ? "; domain=" + domain : "") +
            "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}

function gup(name)
{
	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	var regexS = "[\\?&]"+name+"=([^&#]*)";
	var regex = new RegExp( regexS );
	var results = regex.exec( window.location.href );
	
	if( results == null )
    	return "";
    else
    	return results[1];
}

function sendEmail(f_strAddress, f_strDomain) {
	window.location.href = 'mailto:' + f_strAddress + '@' + f_strDomain;
}
	
function sendEmail2(f_strAddress, f_strDomain, f_strSubject) {
	window.location.href = 'mailto:' + f_strAddress + '@' + f_strDomain + '?subject=' + f_strSubject;
}



function getPopupProperties(f_intWidth, f_intHeight) {
		return "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=" + f_intWidth + ",height=" + f_intHeight;
	}

function openWindowCentered(f_strURL, f_intWidth, f_intHeight) {
		openWindowCenteredTitle('', f_strURL, f_intWidth, f_intHeight);
	}

function openWindowCenteredTitle(f_strTitle, f_strURL, f_intWidth, f_intHeight) {
		f_intWidth = getWidth(f_intWidth);
		f_intHeight = getHeight(f_intHeight);
	
		var l_intScreenX = getX(f_intWidth);
		var l_intScreenY = getY(f_intHeight);
		var l_strProperties = getPopupProperties(f_intWidth, f_intHeight);

		l_strProperties += ",screenX=" + l_intScreenX;
		l_strProperties += ",screenY=" + l_intScreenY;
		l_strProperties += ",left=" + l_intScreenX;
		l_strProperties += ",top=" + l_intScreenY;

		if (false && window.opener != null)
			window.opener.open(f_strURL, f_strTitle, l_strProperties).focus();
		else
			window.open(f_strURL, f_strTitle, l_strProperties).focus();
	}

function getX(f_intWidth) {
		return (screen.availWidth - (f_intWidth + 32)) / 2;
	}

function getY(f_intHeight) {
		return (screen.availHeight - (f_intHeight + 48)) / 2;
	}

function getWidth(f_intWidth) {
		if (f_intWidth == -1)
			f_intWidth = screen.availWidth - 96;
			
		if (f_intWidth > 0.0 && f_intWidth <= 1.0)
			f_intWidth = (screen.availWidth - 96) * f_intWidth;
			
		return f_intWidth;
	}
	
function getHeight(f_intHeight) {
		if (f_intHeight == -1)
			f_intHeight = screen.availHeight - 96;

		if (f_intHeight > 0.0 && f_intHeight <= 1.0)
			f_intHeight = (screen.availHeight - 96) * f_intHeight;
			
		return f_intHeight;
	}


