var oInterval = window.setInterval("mystic_counter()",15000);

function mystic_counter()  {
	
	var str1 = parseInt(Math.random()*100) + 100;
	var str2 = parseInt(Math.random()*100) + 100;
	var str3 = parseInt(Math.random()*100) + 100;

	var query = "?a="+str1+"&b="+str2+"&c="+str3;

	//document.getElementById("mycounter").disabled=true;

  var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
	    document.getElementById("mycounter").value=xmlHttp.responseText;
        }
      }
    xmlHttp.open("GET","get_count_ajax.php"+query,true);
    xmlHttp.send(null);
}

function verify (frmobj) {

	var empty_fields = "";
	var invalid_email_txt = "";
	var msg = "";
	
	//alert("verifying data...");

	els = frmobj.verify_fields.value.split(",");
	
	for (var i = 0; i < els.length; i++) {
		var e = eval("frmobj."+els[i]);
//   		alert('type ' + e.type + '!\n Name = ' + e.name + '!\nvalue = ' +e.value+'!');

		if ((e.type == "text") || (e.type == "textarea") || (e.type == "file") || (e.type == "password")) {
			if (e.name.indexOf("email") >= 0) {
				if (!valid_email(e.value)) {
					if (!isblank(e.value))
						invalid_email_txt = e.value + " appears to be invalid!";
				}
			}
			
			if ((e.value == null) || (e.value == "") || isblank(e.value)) {				

				empty_fields += "\n     " + e.name;
				
				continue;
			}		
		}
	}

	
if (!empty_fields && !invalid_email_txt ) 
	return true;

msg =  "______________________________________________________  \n\n";
msg += "The form was not submitted because of the following error(s).\n";
msg += "Please correct them and resubmit the form.\n";
msg += "______________________________________________________  \n\n";


		
		
if (empty_fields)	{
	
	if (!invalid_email_txt)
		msg += "\n\n";
		
	msg += " The following required fields are empty:\n" + empty_fields + '\n';

}
	
if (invalid_email_txt)
	msg += '\n\n' + invalid_email_txt;


alert(msg);

return false;
		
}

function isblank(s) {
	
	for (var i = 0; i < s.length; i++) {
		var c = s.charAt(i);
		if ((c != ' ') && (c != '\n' ) && (c != '\t')) return false;
	}
	return true;	
	
}
function valid_hex(hex) {
alert(hex);
  // check a hex value
  if (hex.match('[a-fA-F0-9]'))
    return true;
 else  
    return false;

}

function valid_email(email) {

  // check an email address is possibly valid
  if (email.match('^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$'))
    return true;
 else  
    return false;

}

function table_mouseover(obj, ncolor) {
	
	obj.style.backgroundColor = ncolor ;
	
}



function table_mouseout(obj, ncolor) {
		
	obj.style.backgroundColor = ncolor;
		
}

function status_on(text) {
	
	status = text;
	return true;
	
}

function status_off() {
	
	status = '';	
	return true;

}

function site_help(topic) {

	var s = '';

	var t = "inc/inc_admin_help.php?topic="+topic+"#"+topic;
	var w = "650";
	var h = "300";

	var w = window.open(t,"site_help","width="+w+",height="+h+",scrollbars"+s);

}