function test(){
	alert("You have successfully accessed the API");
}

function writeBasicForm(mcCoId,returnURL,sbmtImage,defaultGroup,apiKey){
	document.writeln("<div><form name=\"c2mSignup\" id=\"c2mSignup\" action=\"http://www.click2mycustomers.com/signupapi.php\" method=\"post\" style='margin:0px; border:0px'>")
	document.writeln("<input type=\"hidden\" name=\"mcCoId\" value=\""+mcCoId+"\">");
    document.writeln("<input type=\"hidden\" name=\"returnUrl\" value="+returnURL+">");
	document.writeln("<input type=\"hidden\" name=\"defaultGroup\" value="+defaultGroup+">");
	document.writeln("<input type=\"hidden\" name=\"apiKey\" value="+apiKey+">");
	document.writeln("<input type=\"hidden\" name=\"sbmt\" value=\"1\">");
	document.writeln("<input type=\"text\" name=\"suEmail\" value=\"\">");
	if(sbmtImage){
		document.writeln("<input type=\"Image\" src=\""+sbmtImage+"\" name=\"Subscribe\" id=\"basicSubmitBtn\" value=\"Subscribe\" onClick=\"document.c2mSignup.submit();\"/>");	
	} else {
		document.writeln("<input type=\"Submit\" name=\"Subscribe\" value=\"Subscribe\"/>");
	}
	document.writeln("</form></div>");
}

function writeForm(mcCoId,returnURL,sbmtImage,defaultGroup,apiKey){
	document.writeln("<form name=\"c2mSignup\" id=\"c2mSignup\" action=\"http://www.click2mycustomers.com/signupapi.php\" method=\"post\"><table class=\"c2mTable\" cellspacing=\"0\" cellpadding=\"0\">");
	document.writeln("<input type=\"hidden\" name=\"mcCoId\" value=\""+mcCoId+"\">");
    document.writeln("<input type=\"hidden\" name=\"returnUrl\" value="+returnURL+">");
	document.writeln("<input type=\"hidden\" name=\"defaultGroup\" value="+defaultGroup+">");
	document.writeln("<input type=\"hidden\" name=\"apiKey\" value="+apiKey+">");
	document.writeln("<input type=\"hidden\" name=\"sbmt\" value=\"1\">");
 	document.writeln("<tr><td class=\"c2mLabel\">Name:</td><td class=\"c2mInput\"><input type=\"text\" name=\"suName\" value=\"\"></td></tr>");
	document.writeln("<tr><td class=\"c2mLabel\">Email Address:</td><td class=\"c2mInput\"><input type=\"text\" name=\"suEmail\" value=\"\"></td></tr>");
	document.writeln("<tr><td class=\"c2mLabel\">Company:</td><td class=\"c2mInput\"><input type=\"text\" name=\"suCompany\" value=\"\"></td></tr>");
	document.writeln("<tr><td class=\"c2mLabel\">Where did you hear about us?:</td><td class=\"c2mInput\"><input type=\"text\" name=\"suSource\" value=\"\"></td></tr>");
	if(sbmtImage){
		document.writeln("<tr><td colspan=\"2\" class=\"c2mSubmit\"><input type=\"Image\" src=\""+sbmtImage+"\" name=\"Subscribe\" value=\"Subscribe\" onClick=\"document.c2mSignup.submit();\"/></td></tr>");	
	} else {
		document.writeln("<tr><td colspan=\"2\" class=\"c2mSubmit\"><input type=\"Submit\" name=\"Subscribe\" value=\"Subscribe\"/></td></tr>");
	}
	document.writeln("</table></form>");
}

function getError(errCode){
	document.writeln("<div class=\"c2mError\">");
	if(errCode != ""){
		switch(errCode){
			case 1:
				document.writeln("Your Company Id was not passed correctly");
				break;
			case 2:
				document.writeln("Your API doesn't match your returnUrl");
				break;
			case 3:
				document.writeln("You have not filled in your name");
				break;
			case 4:
				document.writeln("You have not filled in your Email Address");
				break;
			case 5:
				document.writeln("You have not filled in your Company Name");
				break;
			case 34:
				document.writeln("You have not filled in your name<br/>");
				document.writeln("You have not filled in your Email Address");
				break;
			case 35:
				document.writeln("You have not filled in your name<br/>");
				document.writeln("You have not filled in your Company Name");
				break;
			case 45:
				document.writeln("You have not filled in your Email Address<br/>");
				document.writeln("You have not filled in your Company Name");
				break;
			case 345:
				document.writeln("You have not filled in your name<br/>");
				document.writeln("You have not filled in your Email Address<br/>");
				document.writeln("You have not filled in your Company Name");
				break;
			case 6:
				document.writeln("You appear to already have signed up for this newsletter.<br/>If you have unsubscribed yourself, please contact us");
				break;
			case 7:
				document.writeln("Your email does not appear to be a valid email address");
				break;
			case 8:
				document.writeln("Your company number does not match our database");
				break;
			case 9:
				document.writeln("Your company number does not match our database");
				break;
			default:
				document.writeln("An Unknown error has occured");
				break;
		}
	} else {
		document.writeln("No Errors Occured");
	}
	document.writeln("</div>");
}

function getBasicError(errCode){
	switch(errCode){
			case 1:
				alert("Your Company Id was not passed correctly");
				break;
			case 2:
				alert("Your API doesn't match your returnUrl");
				break;
			case 3:
				alert("You have not filled in your name");
				break;
			case 4:
				alert("You have not filled in your Email Address");
				break;
			case 5:
				alert("You have not filled in your Company Name");
				break;
			case 34:
				alert("You have not filled in your name<br/>");
				alert("You have not filled in your Email Address");
				break;
			case 35:
				alert("You have not filled in your name<br/>");
				alert("You have not filled in your Company Name");
				break;
			case 45:
				alert("You have not filled in your Email Address<br/>");
				alert("You have not filled in your Company Name");
				break;
			case 345:
				alert("You have not filled in your name<br/>");
				alert("You have not filled in your Email Address<br/>");
				alert("You have not filled in your Company Name");
				break;
			case 6:
				alert("You appear to already have signed up for this newsletter.<br/>If you have unsubscribed yourself, please contact us");
				break;
			case 7:
				alert("Your email does not appear to be a valid email address");
				break;
			case 8:
				alert("Your company number does not match our database");
				break;
			case 9:
				alert("Your company number does not match our database");
				break;
			default:
				alert("An Unknown error has occured");
				break;
		}	
}

function getBasicSuccess(){
	alert('Thank You. You have been signed up to our newsletter');	
}

function getSuccess(){
	document.writeln("<div class=\"c2mSuccess\">");	
	document.writeln("You have been signed up to our newsletter!");
	document.writeln("</div>");
}
