	function checkform()
	{
		var mytag = document.getElementById('mytag').value;
		//var myurl = "javascript:void(location.href='http://www.textbox1.com/apps/awslink/awslink.rst?url='+location.href+'&amazonid=" + mytag + "')";
		var myurl = "javascript:void(location.href='http://www.textbox1.com/apps/awslink/awslink.rst?amazonid=" + mytag + "&url='+location.href)";
		//var myurl = "javascript:void(location.href='http://tinyurl.com/create.php?url='+location.href)"
		setdiv('content', '3.  Thank you!  Here is your <a href="' + myurl + '">AWSLink</a> bookmarklet.  To use it, just drag it into your bookmarks of your browser.  When on an Amazon product page, click this bookmark to automatically generate a link to that product.');
		return false;
	}
	
function urlencode(str) {
str = escape(str);
str = str.replace('+', '%2B');
str = str.replace(' ', '%2B');
str = str.replace('*', '%2A');
str = str.replace('/', '%2F');
str = str.replace('@', '%40');
str = str.replace('=', '%3D');
str = str.replace('?', '%3F');
str = str.replace('&', '%26');
return str;
}


function httpObject() {
	var req = false;
    	// branch for native XMLHttpRequest object
    	if(window.XMLHttpRequest) {
    		try {
			req = new XMLHttpRequest();
        	} catch(e) {
			req = false;
        	}
	// branch for IE/Windows ActiveX version
	} else if(window.ActiveXObject) {
       		try {
        		req = new ActiveXObject("Msxml2.XMLHTTP");
      		} catch(e) {
        		try {
          			req = new ActiveXObject("Microsoft.XMLHTTP");
        		} catch(e) {
          			req = false;
        		}
		}
    	}
    	return req;
}

function load(url) {
	var req = httpObject();
	if(req) {
		req.open("GET", url, false); //true for async
		req.send(null);
		return req.responseText;
	}
	return "";
}

function post(url, data) {
	var req = httpObject();
	if(req) {
		req.open("POST", url, false); //true for async
      		req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      		req.setRequestHeader("Content-length", data.length);
      		req.setRequestHeader("Connection", "close");
      		req.send(data);
		return req.responseText;
	}
	return "";
}

function setdiv(div, data) {
	var div = document.getElementById(div);
	div.innerHTML = data;
}

function updiv(div, url) {
	var div = document.getElementById(div);
	div.innerHTML = load(url);
	if (div.onload != null) div.onload();
	
	return false;
}

function loadscript(o) {
	if (o.getAttribute("src"))
	{
		if (!document.getElementById(o.getAttribute("src")))
		{
			script=document.createElement('script');
			script.setAttribute("type","text/javascript");
			script.setAttribute("src", o.getAttribute("src"));
			script.setAttribute("id", o.getAttribute("src"));
			document.getElementsByTagName("head")[0].appendChild(script);
		}
	} else {
		eval(o.text);
	}
}

function cldiv(div) {
	var div = document.getElementById(div);
	div.innerHTML = "";
}

function formdata(formid) {
	var str = ""; 
	var form = document.getElementById(formid);
	for(var i = 0; i < form.elements.length; i++) { 
		str += form.elements[i].name +  "=" + escape(form.elements[i].value) + "&"; 
	}
   	return str.substr(0, str.length - 1);
}

function togglediv(div) {
	var div = document.getElementById(div);
	div.style.display = (div.style.display=="block" ? "none" : "block");
}
