/* Script containing common functions for the whole site */
<!-- ImageReady Preload Script -->

function popupPicture(pic_url, heigth, width)
{
	if (heigth == null)
		heigth = 200;

	if (width == null)
		width = 200;

	window.open(pic_url, "", "resizable=0, HEIGHT="+heigth+", WIDTH="+width);
}

function showEverything(text_id, more_id, links_id)
{
	document.getElementById(text_id).style.display  = '';
	document.getElementById(links_id).style.display = '';
	document.getElementById(more_id).style.display  = 'none';
}

function showPhoto(photo_id, photo_s_id, photo_h_id)
{
	document.getElementById(photo_id).style.display = '';
	document.getElementById(photo_s_id).style.display = 'none';
	document.getElementById(photo_h_id).style.display = '';
	window.scrollBy(0, 300);
}

function hidePhoto(photo_id, photo_s_id, photo_h_id)
{
	document.getElementById(photo_id).style.display = 'none';
	document.getElementById(photo_s_id).style.display = '';
	document.getElementById(photo_h_id).style.display = 'none';
}

function showEmailForm(email_id, email_s_id, email_h_id)
{
	document.getElementById(email_id).style.display = '';
	document.getElementById(email_s_id).style.display = 'none';
	document.getElementById(email_h_id).style.display = '';
	window.scrollBy(0, 200);
}

function hideEmailForm(email_id, email_s_id, email_h_id)
{
	document.getElementById(email_id).style.display = 'none';
	document.getElementById(email_s_id).style.display = '';
	document.getElementById(email_h_id).style.display = 'none';
}

var newWindow = null;

// This function will work only with a special script page that handles the close button
function openNewWindow(page, width, height)
{
	var wsize;

	if (width == 0 && height == 0)
		wsize = "toolbar=0,scrollbars=1,status=0,menubar=0,resizable=1";
	else
		wsize = "toolbar=0,scrollbars=1,status=0,menubar=0,resizable=0,width="+width+",height="+height;

	if (newWindow)
		newWindow.close();

	newWindow = window.open(page,"",wsize);
	newWindow.focus();
}

function closeNewWindow()
{
	if (newWindow)
		newWindow.close();

	newWindow = null;
}

function destroyNewWindow()
{
	newWindow = null;
}

// This is a standard new window without creating window object
function openPageInNewWindow(page, width, height)
{
	var wsize;

	var wsize;

	if (width == 0 && height == 0)
		wsize = "toolbar=0,scrollbars=1,status=0,menubar=0,resizable=1";
	else
	{
		var adjust_size = 0;

		if (height > screen.availHeight)
		{
			height = screen.availHeight;
			adjust_size = 1;
		}

		if (width > screen.availWidth)
		{
			width = screen.availWidth;
			adjust_size = 1;
		}

		if (adjust_size == 1)
			wsize = "toolbar=0,scrollbars=1,status=0,menubar=0,resizable=1,width="+width+",height="+height;
		else
			wsize = "toolbar=0,scrollbars=0,status=0,menubar=0,resizable=0,width="+width+",height="+height;
	}

	window.open(page,"Picture",wsize);
}

// Used to change the listing type from the summarized version to detailed and vice versa
function changeListingType(dropdown, baseURL)
{
	var newURL;
    var myIndex  = dropdown.selectedIndex;
	var selValue = dropdown.options[myIndex].value;

    if (selValue == 'detailed')
        newURL = baseURL+"&dl=1";
    else
        newURL = baseURL+"&dl=0";
        
    top.location.href = newURL;

    return true;
}

<!-- End Preload Script -->