<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// Converts password into asterisks (*)
function convertPassword(_field) {
		var str = _field.value;
		if(str != '') {
			var _password = '';
			// Set hidden password field to the password
			document.login_form.password.value = str;
			
			// Hide password from user
			for(i=0; i<str.length; i++) {
				_password = _password + '*';
			}
			_field.value = _password;
		}
		else {
			// Revert to default text message and clear out hidden password
			_field.value = 'Enter your password';
			document.login_form.password.value = '';
		}
}

// Checks for default field values and clears fields
function checkFieldDefault(action,field,default_text) {
			if(action == 'focus') {
				if(field.value == default_text) {
					field.value = '';
				}
			}
			else if(action == 'blur') {
				if(field.value == '') {
					field.value = default_text;
				}
			}
		}
		
// Returns element reference by id
function getElement(id) {
    if (document.getElementById)
		return document.getElementById(id);
    else if (document.all)
		return document.all(id);
	else
		return null;
}

// Changes class for id passed
function changeClassByID(id, class_name) {
	getElement(id).className = class_name;
}

function changeClass(object, class_name) {
	object.className = class_name;
}

// Checks the field length of a message box and updates the counter field
function checkTextBox(form_box,count_field,max_length){
	_length = form_box.value.length;
	
	// Check length
	if(_length > max_length){
			// More than allowed, so concatenate and warn
			alert('There is a maximum of '+max_length+' characters allowed. Please reduce your text length');
			form_box.value = form_box.value.substring(0,max_length);
	}
	if(count_field) {
		// Update counter field
		count_field.value = max_length - form_box.value.length;
	}
}

// Confirms a delete button
function confirm_delete(address) {
		if(confirm('Are you sure you want to delete this item?')) {
			location.href=address;
			return false;
		}
		return false;
}

// Changes class for id passed
function highlight_date(id,class_name) {
	getElement(id).className = class_name;
}

function change_width(photo) {
	var width = getElement(photo).width;
	getElement('popup').style.width = width+'px';
}

// Opens popup for gallery photos
function show_photo(path,file,gallery) {
	var page = 'popup_gallery.php?gallery='+gallery+'&file='+file+'&path='+escape('gallery'+path);
	var win = window.open(page,'loading','width=850,height=630,resizable=yes,scrollbars=yes');
}

// Opens popup for small windows
function open_window_small(page) {
	var win = window.open(page,'loading','width=400,height=200,resizable=yes,scrollbars=yes');
}

//-->