// Copyright 2006-2008 Otto de Voogd
//
// Link, button and banner generation code
// for Fire up the Fox!

var lt = unescape("%3C")
var gt = unescape("%3E")
var qt = unescape("%22")

var url_noid="http://www.fireupthefox.com/";
var url_beg="http://www.fireupthefox.com/?id=";
var url_end="";
var pTitl="Fire up the Fox!";

function generateFutfLink(input) {

	// Set default values
	var SFxId=""
	var url=url_noid;

	// Is an SFx ID being used.
	if (typeof(input.SFx_ID)!="undefined") {
		SFxId=input.SFx_ID.value;
		if (SFxId.length>0) {
			url=url_beg+SFxId+url_end;
		}
	}

	// Determinve the button to use
	if (typeof(input.but)!="undefined") {
		var plen=input.but.length;
		for (i=0; i<plen; i++){
			if(input.but[i].checked) { var pGr=input.but[i].value; }
		}
	}
	if (typeof(pGr)=="undefined") {
		link='';
	} else {
		if (pGr.substring(0,7)!="http://") {
			link=pGr;
			xlink=pGr;
			bblink=pGr;
		} else {
			link=lt+'img src="'+pGr+'" alt="'+pTitl+'" style="border:none;"'+gt;
			xlink=lt+'img src="'+pGr+'" alt="'+pTitl+'" style="border:none;" /'+gt;
			bblink='[img]'+pGr+'[/img]';
		}
	}

	// Update the code
	if (link!='') {
		if (typeof(input.plain_linkcode)!="undefined") {
			input.plain_linkcode.value=url;
		}
		if (typeof(input.html_linkcode)!="undefined") {
			input.html_linkcode.value=lt+'a href="'+url+'" title="'+pTitl+'"'+gt+link+lt+'/a'+gt;
		}
		if (typeof(input.xhtml_linkcode)!="undefined") {
			input.xhtml_linkcode.value=lt+'a href="'+url+'" title="'+pTitl+'"'+gt+xlink+lt+'/a'+gt;
		}
		if (typeof(input.bb_linkcode)!="undefined") {
			input.bb_linkcode.value='[url='+url+']'+bblink+'[/url]';
		}
	} else {
		alert("Choose a button or banner!");
	}
}

// That's all Folks!
