/* common.js */
/* common javascript functions required throughout the website */

function SelectAllPhotos(PropertyId, CheckAll)
{
	var Property = document.getElementById("property_" + PropertyId);
	var str = "";
	var inputField = Property.getElementsByTagName("input");
	if(CheckAll.checked)
	{
		for(var i=0; i<inputField.length; i++)
		{
			if(inputField[i].type == "checkbox")
			{
				inputField[i].checked = true;
			}
		}
	}
	else 
	{
		for(var i=0; i<inputField.length; i++)
		{
			if(inputField[i].type == "checkbox" && inputField[i].checked)
			{
				inputField[i].checked = false;
			}
		}
	}
}






// setup the modal window by creating the required divs
function SetupAjaxThrobber() 
{
//	return; 
	
	// get all elements within the body tag - get the first
	var bod = window.top.document.getElementsByTagName('body')[0];
	
	// create the overlay
	var overlay = window.top.document.createElement('div');
	overlay.id = 'throbber_overlay';

	// create the modal window
	var lb = window.top.document.createElement('div');
	lb.id = 'throbber_pane';
	lb.innerHTML = '<p><img src="images/throbber.gif" /><b>Loading, please wait ...</b></p>';

	// append them to the body
	bod.appendChild(overlay);
	bod.appendChild(lb);
}

// display the throbber window
function ShowThrobber()
{
	return;
	
	// show..
	SwitchThrobberPane('block');
}

function SwitchThrobberPane(Mode)
{
//	return;
	if (window.top.document.getElementById('throbber_overlay'))
		window.top.document.getElementById('throbber_overlay').style.display = Mode;
	if (window.top.document.getElementById('throbber_pane'))
		window.top.document.getElementById('throbber_pane').style.display = Mode;
}

// hide the modal window
function HideThrobber()
{
	return;
	
	// hide
	SwitchThrobberPane('none');
}

// is the throbber hidden?
function ThrobberHidden()
{
//	return (1);
	
	return (document.getElementById('throbber_overlay').style.display == 'none');
}



// display the throbber window
function ShowImageUploadThrobber()
{
//	return;
	
	// show..
	SwitchThrobberPane('block');
}

// hide the modal window
function HideImageUploadThrobber()
{
//	return;
	
	// hide
	SwitchThrobberPane('none');
}
