var xmlhttp=false
try{
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")
}catch(e){
try{
xmlhttp=newActiveXObject("Microsoft.XMLHTTP")
}catch(E){
xmlhttp=false}}
if(!xmlhttp&&typeof XMLHttpRequest !='undefined'){
xmlhttp=new XMLHttpRequest()
}

function GoToURL(){
window.location.href = "http://www.yahoo.com";  
}

function PopUpMap(url){

 var width  = 450;
 var height = 275;
 var left   = (screen.width  - width)/2;
 var top    = (screen.height - height)/2;
 var params = 'width='+width+', height='+height;
 params += ', top='+top+', left='+left;
 params += ', directories=no';
 params += ', location=no';
 params += ', menubar=no';
 params += ', resizable=no';
 params += ', scrollbars=no';
 params += ', status=no';
 params += ', toolbar=no';
 newwin=window.open(url,'windowname5', params);
 if (window.focus) {newwin.focus()}
 return false;

 
}

function PopUp(mouse, div)
{
  	var mousex = mouse.clientX + document.body.scrollLeft;
    var mousey = mouse.clientY + document.body.scrollTop -  document.getElementById(div).offsetHeight - 5;
    var popup = document.getElementById(div);
    popup.style.visibility = 'visible';
    popup.style.left = mousex+'px';
    popup.style.top = mousey+'px';

}

function HidePopUp(div){

document.getElementById(div).style.visibility = 'hidden';
 
}

function autocomplete(destinationid){
theValue=document.getElementById("search").value;
theValue=theValue.replace("'", "-")
theObject=document.getElementById("superdiv");
theObject.style.visibility='visible';

var serverPage = "text.php?d="+destinationid+"&string="+theValue;

xmlhttp.open("GET", serverPage);
xmlhttp.onreadystatechange = function(){
if(xmlhttp.readyState == 4 && xmlhttp.status == 200){
theObject.innerHTML = xmlhttp.responseText;  
}  
}
xmlhttp.send(null);
}

function ChangeBg(div){
if(document.getElementById){
document.getElementById(div).style.backgroundColor='#FCFAFA'}}
function ReturnBg(div){
if(document.getElementById){
document.getElementById(div).style.backgroundColor='#FFFFFF'}}
function HideSearchDiv(){
document.getElementById('superdiv').style.visibility='hidden'}

function Rules(div, cbdiv){
document.getElementById(div).style.visibility='visible';  
document.getElementById(cbdiv).style.visibility='hidden';
}

function AddListing ( form ){
  
  if ((form.attraction.value == "")) {
    alert( "You Need To Enter A Listing Name" );
    form.attraction.focus();
    return false ;
  }

 if ((form.tag.value == "")) {
    alert( "Describe Your Listing" );
    form.tag.focus();
    return false ;
  }
}

function load(addy) {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(60, 100), 10);
      }
      var address = addy;
	var location = new GClientGeocoder;
location.getLatLng(address, function(point) {
if (point) {
    	map.clearOverlays();
    	map.addOverlay(new GMarker(point));
    	map.setCenter(point, 15);
		}
}
);

}

function checkComment ( form ){

 if ((form.comment.value == "")) {
	alert( "You Need To Enter A Comment" );
	form.comment.focus();
	return false ;
  }
  
}

function tagAttraction ( form )
{
  if ((form.tags.value == "")) {
    alert( "Please Enter Tags For This Listing" );
    form.tags.focus();
    return false ;
  }
}

function editAttraction ( form ){

  if ((form.attname.value == "")) {
    alert( "You need to enter a Name" );
    form.attname.focus();
    return false ;
  }
  return true;
  }
   
function checkRegistration ( form ){

  if ((form.username.value == "")) {
    alert( "You Need To Enter A Username" );
    form.username.focus();
    return false ;
  }
  
  if ((form.fname.value == "")) {
    alert( "You Need To Enter A First Name" );
    form.username.focus();
    return false ;
  }
  
  if ((form.email.value == "")) {
    alert( "You Need To Enter A Email" );
    form.username.focus();
    return false ;
  }
  
  if ((form.email.value.indexOf('@')==-1)) {
    alert( "You're Email Is Not Valid" );
    form.username.focus();
    return false ;
  }
  
   if ((form.password.value == "")) {
    alert( "You Need To Enter A Password" );
    form.password.focus();
    return false ;
  }
  
  if ((form.confirm.value == "")) {
    alert( "You Need To Confirm Your Password" );
    form.username.focus();
    return false ;
  }
  
  if ((form.password.value != form.confirm.value)) {
    alert( "Your Passwords Did Not Match" );
    form.password.focus();
    return false ;
  }

return true ;
}

function AddNews ( form )
{
  if ((form.headline.value == "")) {
    alert( "You Need To Enter A Headline" );
    form.headline.focus();
    return false ;
  }
  
   if ((form.story.value == "")) {
    alert( "You Need To Enter A Story" );
    form.story.focus();
    return false ;
  }
  
  return true ;
}


function changeform (form){
form.style.display='block';
}