function CapitalizeFirstLetterOfString(obj)
{
	val = obj.value;
	ch = val.substring(0,1);
	rest = val.substring(1);
	up = ch.toUpperCase();
    newVal = up + rest;
	obj.value = newVal;
}

function CapitalizeFirstLetterOfEachWord(obj) 
{
    val = obj.value;
    newVal = '';
    val = val.split(' ');
    for(var c=0; c < val.length; c++) 
	{
       newVal += val[c].substring(0,1).toUpperCase() + val[c].substring(1,val[c].length) + ' ';
    }
    obj.value = newVal;
}

function CapitalizeAllLetters(obj) 
{
	val = obj.value;
	newVal = val.toUpperCase();
	obj.value = newVal; 
}

function CheckInitials()
{
	var initials = (document.inforequest.requestforminitials.value);
	initials = initials.toLowerCase();
	var newinitials = initials;
	
	var parsed = true;
  	var validchars = "abcdefghijklmnopqrstuvwxyz";
	for (var i=0; i < initials.length; i++)
	{
    	var letter = initials.charAt(i).toLowerCase();
		if (validchars.indexOf(letter) == -1)
		{
			newinitials = newinitials.replace(letter,'');
  		}
	}
	var newstring = '';
	var initialsresult = newinitials;
	var initialsresult_array = initialsresult.split("");
	for (var j=0; j < initialsresult_array.length; j++)
	{
		var thisresult = initialsresult_array[j];
		var newletter = ((initialsresult_array[j]) + (". "));
		newstring = ((newstring) + (newletter)); 
	}
	
	initialsresult = newstring;
	document.inforequest.requestforminitials.value = initialsresult.toUpperCase();
}

String.prototype.trim = function()
{ 
	return( (ar=/^\s*([\s\S]*\S+)\s*$/.exec(this)) ? ar[1] : "" ); 
}

function RemoveLastWhitespaces(obj)
{
	val=obj.value;
	newVal=((ar=/^\s*([\s\S]*\S+)\s*$/.exec(val))?ar[1]:""); 
	obj.value = newVal;
}
function printproperty(property_id)
{
	//var popurl=("printproperty.php?property_id=property_id");
	var popurl=("printproperty.php?property_id=");
	popurl = (popurl+property_id);
	//property_id");
	//var popurl=(printproperty.php?property_id=property_id&reference=reference);
	//alert(property_id);
	//alert("property_id");	
	winpops=window.open(popurl,"","width=750,height=400,")
	//winpops=window.open(popurl,"","width=400,height=338,")
}
function viewimage(property_id,thisimage,reference)
{
	var strpropertyid=("http://www.francenet.nl/viewimage.php?propertyid=");
	var strthisimage=("&thisimage=");
	var strreference=("&reference=");
	//var popurl=("printproperty.php?property_id=");
	popurl = (strpropertyid+property_id+strthisimage+thisimage+strreference+reference);
	winpops=window.open(popurl,"","width=359,height=200,")
}

function PreloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.portal_p) d.portal_p=new Array();
    var i,j=d.portal_p.length,a=PreloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.portal_p[j]=new Image; d.portal_p[j++].src=a[i];}}
}

function ImageRestore() { //v3.0
  var i,x,a=document.portal_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function FindObject(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=FindObject(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function SwapImage() { //v3.0
  var i,j=0,x,a=SwapImage.arguments; document.portal_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=FindObject(a[i]))!=null){document.portal_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}