/**
 *	anchor's fix for modrewrite
 *	iterate all <a>'s and if it's a anchor, modify the href to compensate for mod_rewrite
 *  more dynamite code by evan lynch in 2008
 * @access public
 * @return void
 **/
function fixAnchors(path, host){

	var anchors=document.getElementsByTagName("A");

	for (i = 0; i < anchors.length; i++) {

		if (anchors[i].href.match(host) &&
			anchors[i].href.match('#') &&
			!anchors[i].href.match('javascript') &&
			!anchors[i].href.match('mailto:') &&
			anchors[i].href.length > 1) {

			var anchorname = anchors[i].href;
			anchorname = anchorname.substr(anchorname.indexOf("#"), anchorname.length - anchorname.indexOf("#"));
			anchors[i].href = path + anchorname;
		}
	}
}


/**
 *	dynamically add file inputs
 *	just create a new element
 *  even more dynamite code by evan lynch in 2008
 * @access public
 * @return void
 **/
var counter = 1;
var limit = 6;
function addInput(divName, inputName){
     if (counter == limit)  {
          //alert("You have reached the limit of adding " + counter + " inputs");
     }
     else {
          var newdiv = document.createElement('p');

          newdiv.innerHTML = '<label>Additional Select File:</label><br/><input name="' + inputName + '[]" type="file" style="width: 400px; font-size: 1.07em;" />';
          document.getElementById(divName).appendChild(newdiv);
          counter++;
     }
}


/**
 *	hide e-mail addresses from spiders/bots
 *  only use this if you have to, it's not as good as using the old
 *	css bait and switch. plus, i just love saying bait and switch
 * @access public
 * @return void
 **/
function emailHide(email, domain, display) {
 //document.write('<a href=' + 'mail' + 'to:' + email + '@' + domain + '>' + display + '</a>');
 document.write('<a href="' + 'mail' + 'to:' + email + '@' + domain + '" title="' + display + '" >' + display + '</a>');
}
