var post_link = 'http://affiliate.espotting.com/Search/Results.asp';
var post_link2 = 'http://www.espotting.com';
var list_your_site = 'http://www.espotting.com/Advertisers/list_yoursite.asp';
var serve_link = 'http://affiliate.espotting.com/Library/RecordImpressions.asp';
var image_dir = 'http://affiliate.espotting.com/boxes/';

function MakeSearchBox(type, affiliate_Id, post_to){
	if (type == 1)
		MakeBox3(affiliate_Id, post_to);
	else if (type == 2)
		MakeBox2(affiliate_Id, post_to);
	else if (type == 3)
		MakeBox1(affiliate_Id, post_to);
	else if (type == 4)
		MakeBox4(affiliate_Id, post_to);
	else if (type == 5)
		MakeBox5(affiliate_Id, post_to);
	else if (type == 6)
		MakeBox8(affiliate_Id, post_to);
	else if (type == 7)
		MakeBox7(affiliate_Id, post_to);
	else if (type == 8)
		MakeBox6(affiliate_Id, post_to);
	else
		MakeBox3(affiliate_Id, post_to); // Default Box

}

function MakeBox1(affiliate_Id, post_to) {
	if (post_to != '') {
		document.write('<form action="' + post_to + '" method="POST">\n');
	} else {
		document.write('<form action="' + post_link + '" method="POST">\n');
	}
	document.write('<input type="hidden" name="affiliateId" value="' + affiliate_Id + '">\n');
	document.write('<input type="hidden" name="bkfill" value="1">\n');
	document.write('<table width="468" height="60" border="0" cellpadding="0" cellspacing="0">\n');
	document.write('<tr>\n');
	document.write('<td rowspan="3"><a href="' + list_your_site + '"><img src="' + image_dir + 'box1/box1logo.gif" width="229" height="60" border="0" alt="List Your Site on Espotting"></a></td>\n');
	document.write('<td><img src="' + image_dir + 'box1/box1web.gif" width="181" height="23" border="0"></td>\n');
	document.write('<td><img src="' + image_dir + 'box1/box1topcorner.gif" width="59" height="23" border="0" alt=""></td>\n');
	document.write('</tr>\n');
	document.write('<tr>\n');
	document.write('<td background="' + image_dir + 'box1/box1text.gif" width="180" height="28" border="0"><input type="text" name="keyword" size="21"></td>\n');
	document.write('<td><input type="image" src="' + image_dir + 'box1/box1go.gif" width="59" height="28" border="0" alt="go" id="image"1 name="image"1></td>\n');
	document.write('</tr>\n');
	document.write('<tr>\n');
	document.write('<td colspan="2"><img src="' + image_dir + 'box1/box1bar.gif" width="240" height="9" border="0" alt=""></td>\n');
	document.write('</tr>\n');
	document.write('</table>\n');
	document.write('</form>\n');

}

function MakeBox2(affiliate_Id, post_to) {

	document.write('<table width="115" height="116" border="0" cellpadding="0" cellspacing="0">\n');
	if (post_to != '') {
		document.write('<form action="' + post_to + '" method="POST">\n');
	} else {
		document.write('<form action="' + post_link + '" method="POST">\n');
	}
	document.write('<input type="hidden" name="affiliateId" value="' + affiliate_Id + '">\n');
	document.write('<input type="hidden" name="bkfill" value="1">\n');
	document.write('<tr>\n');
	document.write('<td><a href="' + list_your_site + '"><img src="' + image_dir + 'box2/box2logo.gif" width="84" height="45" border="0" alt="List Your Site on Espotting"></a></td>\n');
	document.write('<td><img src="' + image_dir + 'box2/box2logoend.gif" width="31" height="45" border="0" alt=""></td>\n');
	document.write('</tr>\n');
	document.write('<tr>\n');
	document.write('<td><img src="' + image_dir + 'box2/box2web.gif" width="84" height="30" border="0" alt=""></td>\n');
	document.write('<td><img src="' + image_dir + 'box2/box2webend.gif" width="31" height="30" border="0"></td>\n');
	document.write('</tr>\n');
	document.write('<tr>\n');
	document.write('<td background="' + image_dir + 'box2/box2text.gif" width="84" height="41" border="0" align="right"><input type="text" name="keyword" size="8"></td>\n');
	document.write('<td><input type="image" src="' + image_dir + 'box2/box2go.gif" width="31" height="41" border="0" alt="go"></td>\n');
	document.write('</tr>\n');
	document.write('</form>\n');
	document.write('</table>\n');

}

function MakeBox3(affiliate_Id, post_to) {

	if (post_to != '') {
		document.write( '<form action="' + post_to + '" method="POST">\n' );
	} else {
		document.write( '<form action="' + post_link + '" method="POST">\n' );
	}
	document.write( '<table width="146" height="108" border="0" cellpadding="0" cellspacing="0">\n' );
	document.write( '<input type="hidden" name="affiliateId" value="' + affiliate_Id + '">\n' );
	document.write('<input type="hidden" name="bkfill" value="1">\n');
	document.write( '<tr>\n' );
	document.write( '<td><a href="' + list_your_site + '"><img src="' + image_dir + 'box3/box3logo.gif" width="119" height="57" border="0" alt="List Your Site on Espotting"></a></td>\n' );
	document.write( '<td><img src="' + image_dir + 'box3/box3logoend.gif" width="27" height="57" border="0"></td>\n' );
	document.write( '</tr>\n' );
	document.write( '<tr width="146" height="51">\n' );
	document.write( '<td background="' + image_dir + 'box3/box3text.gif" width="119" height="51" border="0" align="right"><input type="text" name="keyword" size="11"></td>\n' );
	document.write( '<td><input type="image" src="' + image_dir + 'box3/box3go.gif" width="27" height="51" border="0" alt="go"></td>\n' );
	document.write( '</tr>\n' );
	document.write( '</table>\n' );
	document.write( '</form>\n' );
}

function MakeBox4(affiliate_Id, post_to) {

	document.write('<table width="146" height="108" border="0" cellpadding="0" cellspacing="0">\n');
	if (post_to != '') {
		document.write('<form action="' + post_to + '" method="POST">\n');
	} else {
		document.write('<form action="' + post_link + '" method="POST">\n');
	}
	document.write('<input type="hidden" name="affiliateId" value="' + affiliate_Id + '">\n');
	document.write('<input type="hidden" name="bkfill" value="1">\n');
	document.write('<tr>\n');
	document.write('<td><a href="' + list_your_site + '"><img src="' + image_dir + 'box4/box4logo.gif" width="119" height="57" border="0" alt="List Your Site on Espotting"></a></td>\n');
	document.write('<td><img src="' + image_dir + 'box4/box4logoend.gif" width="27" height="57" border="0"></td>\n');
	document.write('</tr>\n');
	document.write('<tr width="146" height="51">\n');
	document.write('<td background="' + image_dir + 'box4/box4text.gif" width="119" height="51" border="0" align="right"><input type="text" name="keyword" size="11"></td>\n');
	document.write('<td><input type="image" src="' + image_dir + 'box4/box4go.gif" width="27" height="51" border="0" alt="go"></td>\n');
	document.write('</tr>\n');
	document.write('</form>\n');
	document.write('</table>\n');
}

function MakeBox5(affiliate_Id, post_to) {

	document.write('<table width="146" height="108" border="0" cellpadding="0" cellspacing="0">\n');
	if (post_to != '') {
		document.write('<form action="' + post_to + '" method="POST">\n');
	} else {
		document.write('<form action="' + post_link + '" method="POST">\n');
	}
	document.write('<input type="hidden" name="affiliateId" value="' + affiliate_Id + '">\n');
	document.write('<input type="hidden" name="bkfill" value="1">\n');
	document.write('<tr>\n');
	document.write('<td><a href="' + list_your_site + '"><img src="' + image_dir + 'box5/box5logo.gif" width="119" height="57" border="0" alt="List Your Site on Espotting"></a></td>\n');
	document.write('<td><img src="' + image_dir + 'box5/box5logoend.gif" width="27" height="57" border="0"></td>\n');
	document.write('</tr>\n');
	document.write('<tr width="146" height="51">\n');
	document.write('<td background="' + image_dir + 'box5/box5text.gif" width="119" height="51" border="0" align="right"><input type="text" name="keyword" size="11"></td>\n');
	document.write('<td><input type="image" src="' + image_dir + 'box5/box5go.gif" width="27" height="51" border="0" alt="go"></td>\n');
	document.write('</tr>\n');
	document.write('</form>\n');
	document.write('</table>\n');
}

function MakeBox6(affiliate_Id, post_to) {

	if (post_to != '') {
		document.write('<form action="' + post_to + '" method="POST">\n');
	} else {
		document.write('<form action="' + post_link + '" method="POST">\n');
	}
	document.write('<input type="hidden" name="affiliateId" value="' + affiliate_Id + '">\n');
	document.write('<input type="hidden" name="bkfill" value="1">\n');
	document.write('<table width="150" height="28" border="0" cellpadding="0" cellspacing="0">\n');
	document.write('<tr valign="middle"><td background="' + image_dir + 'box6/box6.gif" width="121" height="28" border="0"><input value="Web Search" type="text" name="keyword" OnClick="this.value = \'\';" size="12"></td><td><input type="image" src="' + image_dir + 'box6/box6go.gif" width="29" height="28" border="0" alt="go"></td></tr>\n');
	document.write('</table>\n');
	document.write('</form>\n');
}

function MakeBox7(affiliate_Id, post_to) {

	document.write('<table width="100" border="0" cellpadding="0" cellspacing="0">\n');
	if (post_to != '') {
		document.write('<form action="' + post_to + '" method="POST">\n');
	} else {
		document.write('<form action="' + post_link + '" method="POST">\n');
	}
	document.write('<input type="hidden" name="affiliateId" value="' + affiliate_Id + '">\n');
	document.write('<input type="hidden" name="bkfill" value="1">\n');
	document.write('<tr>\n');
	document.write('<td  align="center">\n');
	document.write('<input type="Text" size="10" id="keyword" maxlength="50" name="keyword"></td>\n');
	document.write('<td valign="bottom">\n');
	document.write('<input type="image" SRC="' + image_dir + 'box7/go2.gif" width="28" height="30" border="0"></td>\n');
	document.write('</tr>\n');
	document.write('</form>\n');
	document.write('</table>\n');
}

function MakeBox8(affiliate_Id, post_to) {

	document.write('<table width="150" height="28" border="0" cellpadding="0" cellspacing="0">\n');
	if (post_to != '') {
		document.write('<form action="' + post_to + '" method="POST" target="EspResults">\n');
	} else {
		document.write('<form action="' + post_link + '" method="POST" target="EspResults">\n');
	}
	document.write('<input type="hidden" name="affiliateId" value="' + affiliate_Id + '">\n');
	document.write('<input type="hidden" name="bkfill" value="1">\n');
	document.write('<tr>\n');
	document.write('<td background="' + image_dir + 'box8/box8.gif" width="121" height="28" border="0" align="middle">\n');
	document.write('<input value="Web Search" type="text" name="keyword" OnClick="this.value = \'\';" size="12">\n');
	document.write('</td>\n');
	document.write('<td>\n');
	document.write('<input type="image" src="' + image_dir + 'box8/box8go.gif" width="29" height="28" border="0" alt="go">\n');
	document.write('</td>\n');
	document.write('</tr>\n');
	document.write('</form>\n');
	document.write('</table>\n');
}
