//------------------------------------------------------------------------------------------------
function lcpscroll(url, name, width, height,scroll) {
   winSet = "toolbar=no,location=no,directories=no,menubar=no,scrollbars="+scroll+",resizable=no";
   winSet += ",width="+width +",height="+height+",left="+(screen.availWidth-width)/2+",top="+(screen.availHeight-height)/2;
   mypopwnd = window.open(url, name, winSet);
   mypopwnd.focus();
  }
//----------------------------------------------------------------------------
function lcp(url, name, width, height) {
   lcpscroll(url, name, width, height,"yes");
  }
//------------------------------------------------------------------------------------------------
function SetHTMLtoInput(inputname,HTML){
	eval("this.document.forms[0]."+inputname+".value=HTML;");
}
var win;
function RichEdit(inputname){
	var HTML;
	var text;
	win=window.open("/admin/_redit/edit.html","_blank","alwaysRaised=yes,status=yes,resizable=yes,height=480,width=640,dependent=true");
        win.varname = inputname;
	win.focus(win);
}
//------------------------------------------------------------------------------------------------
function CheckAll() 
{
	with(document.f1)
	{
		var i=0;
		for( i=0; i<elements.length; i++) 
		{
			if(all.checked==true) elements[i].checked=true;  else elements[i].checked=false; 

		}
	}
}
//------------------------------------------------------------------------------------------------
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_changeProp(objName,x,theProp,theValue) { //v6.0
this.location='#search';
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}
//------------------------------------------------------------------------------------------------
PopUpURL    = "/getpopup.php";

isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;

if (isIE||isNN){
document.oncontextmenu=checkV;
}else{
document.captureEvents(Event.MOUSEDOWN || Event.MOUSEUP);
document.onmousedown=checkV;}

function checkV(e){
if (isN4){
if (e.which==2||e.which==3){
dPUW=window.showModalDialog(PopUpURL,'nrc','dialogHeight=150px;help=0;status=0;center');
return false;
}}else{
dPUW=window.showModalDialog(PopUpURL,'nrc','dialogHeight=150px;help=0;status=0;center');
return false;}}
//------------------------------------------------------------------------------------------------
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//------------------------------------------------------------------------------------------------
//var message='French Accommodation';
//function tntstatus()
// {
//	window.status=message;
//	timerID=setTimeout("tntstatus()",0);
//}
//tntstatus();
//------------------------------------------------------------------------------------------------
function isNumeric(field,message) 
	{
	var Chars = "0123456789";
	
	for (var i = 0; i < field.value.length; i++) 
		{
		if (Chars.indexOf(field.value.charAt(i)) == -1) 
			{
			alert(message);
			field.focus();
			return false;
			}
		}
	return true;
	}
//------------------------------------------------------------------------------------------------
function ControlAddPForm(rform)
{
if (isFieldEmpty(rform.RFNr,"Reference number is required")) return false;
if (isFieldEmpty(rform.PName,"Property name is required")) return false;
if (isFieldEmpty(rform.Bedrooms,"Bedrooms is required")) return false;
if (isFieldEmpty(rform.Sleeps,"Sleeps is required")) return false;
if (isFieldEmpty(rform.SummeryB,"Brief description is required")) return false;
if (isFieldEmpty(rform.SummeryF,"Full description is required")) return false;
if (isFieldEmpty(rform.Price3,"High price in pounds is required")) return false;

if (!isNumeric(rform.Price3,"High price numeric values required")) return false;
if (!isNumeric(rform.Price2,"Mid price numeric values required")) return false;
if (!isNumeric(rform.Price1,"Low price numeric values required")) return false;
return true;
}
//------------------------------------------------------------------------------------------------
function isFieldEmpty(field,message)
{
//control if field is not empty
if(field.value.length==0)
	{
	alert(message);
	field.focus();
	return true;
	}
else return false;
}

