function showPassword(fShow, fHide) {
	document.getElementById(fShow).style.display = "block";
	document.getElementById(fHide).style.display = "none";
};

function hidePassword(fShow, fHide) {
	document.getElementById(fShow).style.display = "block";
	document.getElementById(fHide).style.display = "none";
	document.getElementById('password').value = '';
};

function openWindow(url) {
	newwindow=window.open(url,'name','height=500,width=250');
	if (window.focus) {
		newwindow.focus();
	};
};

function adminToOpener(id, username) {
	opener.document.getElementById('admin_id').value = id;
	opener.document.getElementById('admin').value = username;
	this.close();
};

function adminRemove() {
	document.getElementById('admin_id').value = '';
	document.getElementById('admin').value = '';
};

function openImage(propertyRef, imgRef) {
	imgWin = window.open('images.php?id='+imgRef+'&pid='+propertyRef, propertyRef, 'width=200,height=200,scrollbars=0');
	imgWin.focus();
};

function openImageEvent(eventRef) {
	imgWin = window.open('images_event.php?id='+eventRef, eventRef, 'width=200,height=200,scrollbars=0');
	imgWin.focus();
};

function homeJump() {
	region = document.getElementById('region_select').options[document.getElementById('region_select').selectedIndex].value;
	
	if (region != "#") {
		window.location.href = 'accommodation/vic/'+region+'/';
	}
};

function pagingJump(pageRef) {
	pg = document.getElementById('jump').options[document.getElementById('jump').selectedIndex].value;
	window.location.href = pageRef+pg+'/';
};

function pagingSort(pageRef) {
	//pageRef = pageRef.split('/');
	mode = document.getElementById('sort').options[document.getElementById('sort').selectedIndex].value;
	window.location.href = pageRef+mode+'/1/';
};

function availabilitySort(pageRef) {
	month = document.getElementById('monthSelect').options[document.getElementById('monthSelect').selectedIndex].value;
	window.location.href = pageRef+month+'/';
	
};


function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}