function readRevID() {
	var expDays = 365; // number of days the cookie should last
	var expDate = new Date();
	expDate.setTime(expDate.getTime() +  (24 * 60 * 60 * 1000 * expDays));
	var revid = GetCookie('revid');
	//alert("revId is: " + revid);
	if (revid == null || revid == "") {
		if (location.search.length > 1) revid = location.search.substring(1,location.search.length);
		else revid = "";
		if (revid != GetCookie('revid')) SetCookie('revid', revid, expDate);
	}
	if(fromUltra()){
		//alert("setting cookie");
		SetCookie('revid', 'ultrasites', expDate);
	}
// You can change the FORM location below
// where the referral ID is stored on your page
// You then access this element to get the ID
}

function getSerialId() {
	if (location.search.length > 1){
		var id = location.search.substring(1,location.search.length);
		id = id.substring(id.indexOf("=")+1,id.length);
		return id;
	}
}

function hasId(){
	if(getSerialId()){
		var id = getSerialId();
		if(id.length > 1){
			return true;
		}
	}
	return false;
}
function wasReferred(){
	var revid = GetCookie('revid');
	if (revid == null || revid == "") {
		return false;
	}
	else{
		return true;
	}
}


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 (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
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" : "");
}
var bikky = document.cookie;
function getCookie(name) { // use: getCookie("name");
    var index = bikky.indexOf(name + "=");
    if (index == -1) return ("");
    index = bikky.indexOf("=", index) + 1; // first character
    var endstr = bikky.indexOf(";", index);
    if (endstr == -1) endstr = bikky.length; // last character
    return unescape(bikky.substring(index, endstr));
}



//my stuff
var NS = (navigator.appName =='Netscape');
function fromUltra(){
	 //alert(document.referrer);
	if(document.referrer.indexOf("ultrawiredsex.com")!= -1){
	//if(document.referrer.indexOf("softbux.com")!= -1){
		return true;
	}
	else{
		return false;
	}
}
function getInputName(num){
	if(num == 1){
		return "x_Header_Email_Receipt";
	}
	if(num == 2){
		return "x_Receipt_Link_Text";
	}
	if(num == 3){
		return "x_Receipt_Link_URL";
	}

}
function getInputValue(num){
	if(num == 1){
		return "YOUR REGISTRATION NUMBER IS: a202a7 This number is needed to unlock the trial version.";
	}
	if(num == 2){
		return "Please continue to the page below for complete registration instructions.";
	}
	if(num == 3){
		return "http://www.jfuse.com/cgi-bin/flregistered.pl";
	}
	if(num == 4){
		return "YOUR REGISTRATION NUMBERS ARE: FileLocker: a202a7    JFuse: 746978. These numbers will unlock the trial versions.";
	}
	if(num == 5){
		return "Visit the link below for more detailed registration information.";
	}
}
function openPage(path){
	var ansWin = null;
	if (ansWin != null) {
		if (!ansWin.closed) {
			ansWin.close();
		}
	}
	if(NS){
		ansWin = window.open(path,'ansWin','width=700,height=700,scrollbars=YES,screenX=10,screenY=10');
	}
	else{
		ansWin = window.open(path,'ansWin','width=700,height=700,scrollbars=YES,left=10,top=10');
	}
}
function openSmallPage(path){
	var ansWin = null;
	if (ansWin != null) {
		if (!ansWin.closed) {
			ansWin.close();
		}
	}
	if(NS){
		ansWin = window.open(path,'ansWin','width=600,height=500,scrollbars=YES,screenX=10,screenY=10');
	}
	else{
		ansWin = window.open(path,'ansWin','width=600,height=500,scrollbars=YES,left=10,top=10');
	}
}

function fillTotal(){
	for(var i=0;i<document.forms[0].elements.length;i++){
		if(document.forms[0].elements[i].checked){
			document.forms[0].elements[6].value="$" + document.forms[0].elements[i].value;
		}
	}
}
function submitForm(formNum){
	var form = document.forms[formNum].submit();	
}
function submitEmailForm(){
	var form = document.forms[0];
        var error = false;
        var msg = "The email address you entered is not valid.\nPlease enter a valid email address to recieve the Jfuse newsletter.\n";
        if(form.elements[0].value.length<2){
                error = true;
        }
        if(form.elements[0].value.indexOf("@")<0){
        	error = true;
        }
        if(error){
        	alert(msg);
        }
        else{
        	form.submit();
        }
}
function viewImage(path){
	var ansWin = null;
	if (ansWin != null) {
		if (!ansWin.closed) {
			ansWin.close();
		}
	}
	if(NS){
		ansWin = window.open(path,'ansWin','width=700,height=700,scrollbars=YES,screenX=10,screenY=10');
	}
	else{
		ansWin = window.open(path,'ansWin','width=700,height=700,scrollbars=YES,left=10,top=10');
	}
}