function celOver(obj) {
  var s = obj.className;
  s = s.replace(/-over/g, "");
  obj.className = s+"-over";
}

function celOut(obj) {
  var s = obj.className;
  s = s.replace(/-over/g, "");
  obj.className = s;
}

function verifEmail(chp) {
	
  var returnString = "";
  
  if (chp.value.length == 0) {
    returnString += "- E-mail is required\n";
  } else {
	regex = new RegExp("^[a-z0-9_]([.-]?[a-z0-9_]+)+@[a-z0-9_]([.-]?[a-z0-9_]+)+\.([a-z]{2,4}|[a-z]{6})$", "gi");
	if (!regex.exec(chp.value)) {
       returnString += "- E-mail is invalid\n";
	}				
  }
  return returnString
}


function favoris(txt,url) {
  if ( navigator.appName != 'Microsoft Internet Explorer' ){ 
    window.sidebar.addPanel(txt,url,""); 
  } else { 
    window.external.AddFavorite(url,txt); 
  } 
}

/**********************************************************/

function MM_validateletter() {
  var form = document.newsletter;
  var errors = "";

  if (form.FirstName.value.length == 0) {
	errors += "- First Name is required\n";
  }

  if (form.LastName.value.length == 0) {
	errors += "- Last Name is required\n";
  }

  errors += verifEmail(form.Email);

  var flagCheck = "- Type of properties is required\n";
  for (i=0; i<form.Type.length; i++) {
      if (form.Type[i].checked) {
        flagCheck = "";
        break;
      }
  }  
  errors += flagCheck;

  if (errors) {
    alert('The following error(s) occurred:\n'+errors);
  }
  document.MM_returnValue = (errors == '');
}

/*-------gallery system (item)----------*/
function popup(idimg,width,height) { 
  var yp = 10;
  var xp = 10;
  fen = window.open(idimg,'','toolbar=0,location=0,directories=0,status=0,scrollbars=0,resizable=0,copyhistory=0,menuBar=0,top='+yp+',left='+xp+',width=' + width + ',height=' + height);
  fen.focus(); 
}

/*-------gallery system (itempopup)----------*/
function checksize() {
 if (document.images[0].complete) {
 var width = 320 -12;
 if (document.images[0].width > 310) {
   width = document.images[0].width;
  }
  window.resizeTo(width+12,document.images[0].height+155);
  window.focus();
 }
}
