function checkForm(form) {   
if (form.str.value.length < 4) {
alert("The search string you have entered is too short, it must be 4 characters or longer.");
return false;
}
if(form.str.value.search(/^[\w\d\_\~\-\.]+$/) == -1 ) {
alert("Invalid name of domain");
return false;
}
}

function bann_url(src, id, num) {
src.style.color = '#0000FF';
try {
var s = document.getElementById('hidd');
var f = document.createElement('form');
f.setAttribute('target', 'ifrm_hidd');
f.setAttribute('action', 'http://www.gaypasslist.net/cgi-bin/a/bann/b_out.cgi');
s.appendChild(f);
var i = document.createElement('input');
i.setAttribute('type', 'hidden');
i.setAttribute('name', 'id');
i.setAttribute('value', id);
f.appendChild(i);
var i = document.createElement('input');
i.setAttribute('type', 'hidden');
i.setAttribute('name', 'num');
i.setAttribute('value', num);
f.appendChild(i);
f.submit();
s.removeChild(f);
} catch (err) { }
}

function url(src) {
	src.style.color = '#0000FF';
}

function rep(src, rec) {
try {
var td = src.parentNode;
var tr = td.parentNode;
var name = tr.childNodes[2].firstChild.firstChild.nodeValue;
var login = tr.childNodes[3].firstChild.nodeValue;
var passw = tr.childNodes[4].firstChild.nodeValue;
rec = '' + rec; while (rec.length < 3) {rec='_'+rec}
req = encode64('rec=' + escape(rec) + '&name=' + escape(name) + '&login=' + escape(login) + '&passw=' + escape(passw) + '&src=' + escape(' '));
src.href = 'http://www.gaypasslist.net/younggaypass/report.html?' + req;
src.firstChild.nodeValue = '';
return true;
} catch (err) {
alert("Error! Your Internet browser does not allow to execute this action.");
return false;
}
}

// Base64 encode for rep() function
function encode64(input) {
	var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
   var output = "";
   var chr1, chr2, chr3;
   var enc1, enc2, enc3, enc4;
   var i = 0;

   do {
      chr1 = input.charCodeAt(i++);
      chr2 = input.charCodeAt(i++);
      chr3 = input.charCodeAt(i++);

      enc1 = chr1 >> 2;
      enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
      enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
      enc4 = chr3 & 63;

      if (isNaN(chr2)) {
         enc3 = enc4 = 64;
      } else if (isNaN(chr3)) {
         enc4 = 64;
      }

      output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + 
         keyStr.charAt(enc3) + keyStr.charAt(enc4);
   } while (i < input.length);
   
   return output;
}
