	 function copyit(theField) {
var tempval=eval("document."+theField)
tempval.focus()
tempval.select()
therange=tempval.createTextRange()
therange.execCommand("Copy")
}
function isNumeric(val){return(parseFloat(val,10)==(val*1));}
function makecode2()
    {
	formObj = document.code;
	url = "http://www.catchthatprize.co.uk/getcompetitionjs.php?";

	if (formObj.images.value == "1") {
			url += "noimage=" + new String (formObj.images.value)+"&";

	}
    	if (formObj.num.value != "") {
url += "num=" + new String (formObj.num.value)+"&";

	    }

codea = "<script type=\"text/javascript\" src=\""+ new String (url)+"\"></script>\n";
codeb = "<a href=\"http://www.catchthatprize.co.uk\" title=\"Catchthatprize - free competitions and prizes\">Competitions Supplied by Catchthatprize.co.uk</a>\n";
formObj.thecode.value = "<!-- Start Catchthatprize.co.uk Competition Code -->\n";
formObj.thecode.value += codeb;
formObj.thecode.value += codea;
formObj.thecode.value += "<!-- End Catchthatprize.co.uk Competition Code -->\n";
return false;
	}
function makecode()
    {
	formObj = document.code;
	url = "http://www.catchthatprize.co.uk/getcompetitionjs.php?";
	if (formObj.pre.value != "") {
			url += "pre=" + new String (formObj.pre.value)+"&";

	}
	if (formObj.post.value != "") {
			url += "post=" + new String (formObj.post.value)+"&";

	}
	if (formObj.images.value == "1") {
			url += "noimage=" + new String (formObj.images.value)+"&";

	}
	if (formObj.num.value == "") {
			alert("You must put the number of competitions you wish to show.");
			return false;

	    }
	if (isNumeric(formObj.num.value) != true) {
			alert("You must use a number in number");
			return false;

	    }
	if (formObj.num.value != "") {
url += "num=" + new String (formObj.num.value)+"&";

	    }
codea = "<script type=\"text/javascript\" src=\""+ new String (url)+"\"></script>\n";
codeb = "<a href=\"http://www.catchthatprize.co.uk\" title=\"Catchthatprize - free competitions and prizes\">Competitions Supplied by Catchthatprize.co.uk</a>\n";
formObj.thecode.value = "<!-- Start Catchthatprize.co.uk Competition Code -->\n";
formObj.thecode.value += codeb;
formObj.thecode.value += codea;
formObj.thecode.value += "<!-- End Catchthatprize.co.uk Competition Code -->\n";
return false;
	}
function displayHTML(form) {
if (form.thecode.value == "") {
alert("you must make the code before you can preview it");
return false;
}
var inf = form.thecode.value;
win = window.open("", "", "popup", "width=300,height=200,top=100,left=100,resizable=yes,scrollbars=yes,menubar=yes,toolbar=yes,status=yes,location=yes");
win.document.write("<html><head><title>preview</title></head><body>");
win.document.write("" + inf + "");
win.document.write("</body></html>");
}
function openWindow(contentURL,backto) {

newWindow = window.open(contentURL);
newWindow.focus()
document.location = backto;
} 
