// JavaScript Document

function check_form(f) {
	
	error = 0;

	msg = "Please correct the following before trying to send your enquiry again:\n\n";
 
	for(i=0; i<check_elements.length;i++) {
		
  
		if(document.getElementById(check_elements[i]).value=="") {
			
			if((window.text_elements)) {
				msg += "- " + text_elements[i] + " field must have a value.\n";
			}else{
				msg += "- " + check_elements[i] + " field must have a value.\n";
			}
			error = 1;
			
		}
				
	}
	
	if(error==1) {
		
		alert(msg);

	}else{
		
		document.getElementById(f).submit();
		
	}
	
}


function vote(ad, url) {
	
	_xmlHttp = getXMLHTTP();
	_xmlHttp.open("GET","/lib/ajax/vote.php?action="+ad+"&url="+url,true);
    
	_xmlHttp.onreadystatechange=function() {
      if(_xmlHttp.readyState==4&&_xmlHttp.responseText) {
          // The response text gets executed as javascript... 
          var check = _xmlHttp.responseText;
		  
		  document.getElementById('vote').innerHTML = check; 
			  
		  
      }
    }
    ;
    _xmlHttp.send(null)	
	
}

function no_vote(url) {
	
	_xmlHttp = getXMLHTTP();
	_xmlHttp.open("GET","/lib/ajax/no_vote.php?url="+url,true);
    
	_xmlHttp.onreadystatechange=function() {
      if(_xmlHttp.readyState==4&&_xmlHttp.responseText) {
          // The response text gets executed as javascript... 
          var check = _xmlHttp.responseText;
		  
		  document.getElementById('vote').innerHTML = check; 
			  
		  
      }
    }
    ;
    _xmlHttp.send(null)	
	
}


// JavaScript Document
function getXMLHTTP(){
  var A=null;
  try{
    A=new ActiveXObject("Msxml2.XMLHTTP")
  }catch(e){
    try{
      A=new ActiveXObject("Microsoft.XMLHTTP")
    } catch(oc){
      A=null
    }
  }
  if(!A && typeof XMLHttpRequest != "undefined") {
    A=new XMLHttpRequest()
  }
  return A
}
