// General Javascript functions

// Open and closing sidebar menu
function sidebarMenu(div)
{
	var submenu = div + '-submenu';
	var target_div = document.getElementById(submenu);
	var doorknob = document.getElementById(div + '-doorknob');
	if (target_div.style.display == 'none') 
	{ 
		target_div.style.display = 'block';
		doorknob.innerHTML = '[&mdash;]';
	}
	else 
	{ 
		target_div.style.display = 'none';
		doorknob.innerHTML = '[+]';
	}
}

// Open and closing feature lists
function featureList( div, open_text, close_text, bold_flag )
{
	var doorknob = document.getElementById( div );
	var submenu = document.getElementById( div + '-submenu' );
	var weight;
	if ( bold_flag == true ) { weight = 'bold'; } else { weight = 'normal'; }
	if ( submenu.style.display == 'none' ) 
	{ 
		submenu.style.display = 'block';
		doorknob.innerHTML = open_text;
		doorknob.parentNode.style.fontWeight = weight;
	}
	else 
	{ 
		submenu.style.display = 'none';
		doorknob.innerHTML = close_text;
		doorknob.parentNode.style.fontWeight = 'normal';
	}
}

// Open and closing more info on the fillMyGym offers
function openMoreInfo( div, open_text, close_text )
{
	var doorknob = document.getElementById( div );
	var submenu = document.getElementById( div + '-submenu' );
	var pix = document.getElementById( 'pix' );
	var weight;
	if ( submenu.style.display == 'none' ) 
	{ 
		submenu.style.display = 'block';
		doorknob.innerHTML = open_text;
		pix.style.display = 'inline';
	}
	else 
	{ 
		submenu.style.display = 'none';
		doorknob.innerHTML = close_text;
		pix.style.display = 'none';
	}
}

// Open and closing feature lists
function toolbarFreeDemo( div )
{
	var doorknob = document.getElementById( div );
	var submenu = document.getElementById( div + '-submenu' );
	if ( submenu.style.display == 'none' ) 
	{ 
		submenu.style.display = 'block';
	}
	else 
	{ 
		submenu.style.display = 'none';
	}
}

/* To make sure users select something in the Ready for more? drop down menu before submitting */
function requiredSelect(selectID)
{
	var optionSelected = document.getElementById(selectID);
	var submitButton = document.getElementById('no_mem_btn')
	if(optionSelected.options[optionSelected.selectedIndex].value=='no_select')
	{
		alert('Please choose the number of members at your facility.');
		submitButton.disabled = true;
	}
}

function enableSubmit(submitButton)
{
	var btn = document.getElementById(submitButton);
	btn.disabled = false;
}

function framesTest( divID )
{
	var testvar = window.frames[ 'about-us-video' ].document.getElementById( divID ).nodeValue;
	return testvar;
}

// Opens the thumbnail in a smaller window
function showThumbnail( img, win, dimensions )
{
	var size = dimensions.split( ',' );
	var w=open('',win,'width=' + size[0] + ',height=' + size[1] );
  with(w.document){
    write('<body style="margin:0px;">');
    write('<img src=\"/wp-content/themes/motionsoft1/_images/' + img + '" />');
    write('</body>');
  }
  return false;
}



/* For thumbnails on Download Info page */
function showThumbnail()
{
	document.getElementById( 'download-info-form-moso-mrm-cloud-solution-label' ).onmouseover = function ()
	{
		document.getElementById( 'moso-mrm-cloud-solution-thumbnail' ).style.display = 'inline';
		document.getElementById( 'member-management-software-thumbnail' ).style.display = 'none';
		document.getElementById( 'moso-faq-thumbnail' ).style.display = 'none';
		document.getElementById( 'myclub-online-member-portal-thumbnail' ).style.display = 'none';
		document.getElementById( 'quickstar-billing-services-thumbnail' ).style.display = 'none';
		document.getElementById( 'solutions-packages-thumbnail' ).style.display = 'none';
		document.getElementById( 'data-conversion-process-thumbnail' ).style.display = 'none';
	}
	document.getElementById( 'download-info-form-member-management-software-label' ).onmouseover = function ()
	{
		document.getElementById( 'moso-mrm-cloud-solution-thumbnail' ).style.display = 'none';
		document.getElementById( 'member-management-software-thumbnail' ).style.display = 'inline';
		document.getElementById( 'moso-faq-thumbnail' ).style.display = 'none';
		document.getElementById( 'myclub-online-member-portal-thumbnail' ).style.display = 'none';
		document.getElementById( 'quickstar-billing-services-thumbnail' ).style.display = 'none';
		document.getElementById( 'solutions-packages-thumbnail' ).style.display = 'none';
		document.getElementById( 'data-conversion-process-thumbnail' ).style.display = 'none';
	}
	document.getElementById( 'download-info-form-moso-faq-label' ).onmouseover = function ()
	{
		document.getElementById( 'moso-mrm-cloud-solution-thumbnail' ).style.display = 'none';
		document.getElementById( 'member-management-software-thumbnail' ).style.display = 'none';
		document.getElementById( 'moso-faq-thumbnail' ).style.display = 'inline';
		document.getElementById( 'myclub-online-member-portal-thumbnail' ).style.display = 'none';
		document.getElementById( 'quickstar-billing-services-thumbnail' ).style.display = 'none';
		document.getElementById( 'solutions-packages-thumbnail' ).style.display = 'none';
		document.getElementById( 'data-conversion-process-thumbnail' ).style.display = 'none';
	}
	document.getElementById( 'download-info-form-myclub-online-member-portal-label' ).onmouseover = function ()
	{
		document.getElementById( 'moso-mrm-cloud-solution-thumbnail' ).style.display = 'none';
		document.getElementById( 'member-management-software-thumbnail' ).style.display = 'none';
		document.getElementById( 'moso-faq-thumbnail' ).style.display = 'none';
		document.getElementById( 'myclub-online-member-portal-thumbnail' ).style.display = 'inline';
		document.getElementById( 'quickstar-billing-services-thumbnail' ).style.display = 'none';
		document.getElementById( 'solutions-packages-thumbnail' ).style.display = 'none';
		document.getElementById( 'data-conversion-process-thumbnail' ).style.display = 'none';
	}
	document.getElementById( 'download-info-form-quickstar-billing-services-label' ).onmouseover = function ()
	{
		document.getElementById( 'moso-mrm-cloud-solution-thumbnail' ).style.display = 'none';
		document.getElementById( 'member-management-software-thumbnail' ).style.display = 'none';
		document.getElementById( 'moso-faq-thumbnail' ).style.display = 'none';
		document.getElementById( 'myclub-online-member-portal-thumbnail' ).style.display = 'none';
		document.getElementById( 'quickstar-billing-services-thumbnail' ).style.display = 'inline';
		document.getElementById( 'solutions-packages-thumbnail' ).style.display = 'none';
		document.getElementById( 'data-conversion-process-thumbnail' ).style.display = 'none';
	}
	document.getElementById( 'download-info-form-solutions-packages-label' ).onmouseover = function ()
	{
		document.getElementById( 'moso-mrm-cloud-solution-thumbnail' ).style.display = 'none';
		document.getElementById( 'member-management-software-thumbnail' ).style.display = 'none';
		document.getElementById( 'moso-faq-thumbnail' ).style.display = 'none';
		document.getElementById( 'myclub-online-member-portal-thumbnail' ).style.display = 'none';
		document.getElementById( 'quickstar-billing-services-thumbnail' ).style.display = 'none';
		document.getElementById( 'solutions-packages-thumbnail' ).style.display = 'inline';
		document.getElementById( 'data-conversion-process-thumbnail' ).style.display = 'none';
	}
	document.getElementById( 'download-info-form-data-conversion-process-label' ).onmouseover = function ()
	{
		document.getElementById( 'moso-mrm-cloud-solution-thumbnail' ).style.display = 'none';
		document.getElementById( 'member-management-software-thumbnail' ).style.display = 'none';
		document.getElementById( 'moso-faq-thumbnail' ).style.display = 'none';
		document.getElementById( 'myclub-online-member-portal-thumbnail' ).style.display = 'none';
		document.getElementById( 'quickstar-billing-services-thumbnail' ).style.display = 'none';
		document.getElementById( 'solutions-packages-thumbnail' ).style.display = 'none';
		document.getElementById( 'data-conversion-process-thumbnail' ).style.display = 'inline';
	}
}
