// JavaScript Document
function extract ( urlStr ){
	var tmpstr = urlStr.split(".");
	return tmpstr;
	
}

function checkURL ( urlStr ){
	var tmp = new RegExp ("(http:\/\/)(www\.)?(([a-zA-Z0-9\-\_])+)(\.com)");
	if (!tmp.test(urlStr) ){
		alert ( "String is NOT in good condition\nEX:\n  http://www.domain-name.com \n OR \n  http://domain-name.com");
		return false;
	}return true;
		
}

function capitalize( urlStr ){
	var i, str, t1, t2, finalstr = "";
	str = urlStr.split(" ");
	for( i = 0; i < str.length; i++ ){
		str[i] = (str[i].substring(0,1)).toUpperCase() + str[i].substring(1,str[i].length);
	}
	for ( i = 0; i < str.length; i++ ){
		if ( finalstr == "" ) finalstr = str[i];
		else finalstr = finalstr + " " + str[i];
	}
	return finalstr;
}



function display( clientURL, email, anchortitle, description ){
	var client0, client, anctitle;
	var test = checkURL ( clientURL );	
	if (test){
		client0 = extract (clientURL);
		client = client0[client0.length-2] + "." + client0[client0.length-1];
		anctitle = capitalize ( anchortitle );
  	document.write("<h2>Link to " + client + "</h2>");
  	document.write("<p>Link popularity is fast becoming one of the highest weighted criteria used in ranking your site in the search engines. The more related sites linking to yours ");
  	document.write("the higher your sites ranking climbs in the search engine results. We like to link with sites that complement ours or can offer our clients a valid service. We will not exchange ");
  	document.write("links with any website that is unduly offensive or fraudulently boastful in its claims.<br><br>");
  	document.write("<strong>How do I swap links with " + client + " ?</strong><br><br>");
  	document.write("Exchanging links between our two sites is easy. <a href=\"mailto:" + email + "\">Send us an email</a> with a one or two sentence description of ");
  	document.write("your site and the exact URL. We\"ll review your site as soon as possible, validate the reciprocal link on your site and if we feel that your site provides good complimentary content, ");
  	document.write("we will reciprocate the link.<br><br><b>To add " + client + " link to your website, simply use the following html code:</b><br><br>");
  	document.write("<div style=\"border-style:solid;border-width:2px;border-color:#343434;padding:5px;background-color:#dfdfdf;color:#000000;\">&lt;a href=\"" + clientURL + "\" title=\"" + anctitle + "\"&gt;" + anctitle + "&lt;/a&gt;&lt;br&gt;" + description + "</div>");
  	document.write("<br><br>Thank you kindly,<br>" + client + "<br>");
  	document.write("<h3>Resources</h3>");
	}
	else{
		document.write ("<div style=\"font-size:14px;font-weight:bold;color:#ff0000;\">PLEASE CORRECT URL STRING ! </div>");
	}
}





