// JavaScript Document
if ( typeof window.addEventListener != "undefined" )
	window.addEventListener( "load", setupPlaxoInvite, false );

// IE 
else if ( typeof window.attachEvent != "undefined" ) {
	window.attachEvent( "onload", setupPlaxoInvite );
}

else {
	if ( window.onload != null ) {
		var oldOnload = window.onload;
		window.onload = function ( e ) {
			oldOnload( e );
			setupPlaxoInvite();
		};
	}
	else 
		window.onload = setupPlaxoInvite;
}

function setupPlaxoInvite(){
	if (document.getElementById('invite_details')) {
		invite_details_effect_0 = new fx.Opacity('invite_details', {
			duration: 300, 
			transition: fx.linear, 
			onComplete: function() {
			}
		});
		
		invite_details_effect_1 = new fx.Height('invite_details', {
			duration: 300,
			transition: fx.linear,
			onComplete: function() {
			}
		});
		invite_details_effect2_1 = new fx.Height('invite_details', {
			duration: 90,
			transition: fx.linear,
			onComplete: function() {
			}
		});
		// preload invite_details div
		invite_details_effect_0.hide();
		invite_details_effect_1.hide();
	}
	
	if (document.getElementById('nav_loading')) {
		nav_load_effect_0 = new fx.Opacity2('nav_loading', {
			duration: 300, 
			transition: fx.linear, 
			onComplete: function() {
			}
		});
		
		nav_load_effect_1 = new fx.Height('nav_loading', {
			duration: 300,
			transition: fx.linear,
			onComplete: function() {
			}
		});
		// preload nav_load div
		nav_load_effect_0.hide();
		nav_load_effect_1.hide();
	}
	// preload Check Invites button
	if (document.getElementById('pi_showhideLabel'))
		document.getElementById('pi_showhideLabel').innerHTML = '<a href="javascript:void(0);" class="pi_invites_hidden" onClick="showhide_details();">Check Invites</a>';
}

function showhide_details() {
	invite_details_effect_1.toggle();
	invite_details_effect_0.toggle();
	if (document.getElementById('invite_details').style.visibility == "hidden")
		document.getElementById('pi_showhideLabel').innerHTML = '<a href="javascript:void(0);" class="pi_invites_shown" onClick="showhide_details();">Check Invites</a>';
	else
		document.getElementById('pi_showhideLabel').innerHTML = '<a href="javascript:void(0);" class="pi_invites_hidden" onClick="showhide_details();">Check Invites</a>';
}

<!-- List Change functions -->
function selectTypeChange() {
	document.getElementById('piPage').value = '1';
	document.getElementById('piTask').value = 'changeList';
	pi_changeDetails();
	invite_details_effect2_1.toggle();
}

<!-- Navigation functions -->
function nav_load() {
	nav_load_effect_0.toggle();
	nav_load_effect_1.toggle();
}
function navPage(page) {
	nav_load();
	document.getElementById('piPage').value = page;
	document.getElementById('piTask').value = "changePage";
	pi_changeDetails();
}
function navStart() {
	nav_load();
	document.getElementById('piPage').value = "1";
	document.getElementById('piTask').value = "changePage";
	pi_changeDetails();
}
function navPrev() {
	nav_load();
	document.getElementById('piPage').value = parseInt(document.getElementById('piPage').value) - 1;
	document.getElementById('piTask').value = "changePage";
	pi_changeDetails();
}
function navNext() {
	nav_load();
	document.getElementById('piPage').value = parseInt(document.getElementById('piPage').value) + 1;
	document.getElementById('piTask').value = "changePage";
	pi_changeDetails();
}
function navEnd(page) {
	nav_load();
	document.getElementById('piPage').value = page;
	document.getElementById('piTask').value = "changePage";
	pi_changeDetails();
}

<!-- Actions functions -->
function sendAction(action, iid, custom, invemail) {
	document.getElementById('piTask').value = action;
	document.getElementById('iid').value = iid;
	if (action=="action_resend") {
		if (custom == "0") {
			if (confirm("Confirm resend invite?"))
				pi_sendAction();
		}
		else if (custom == "1") {
			overlib('Personalize your invitation by adding a custom message that will be included in the email.<br /><br />Custom Message (optional):<br /><textarea cols="30" rows="3" name="popup_resendCustom" id="popup_resendCustom"></textarea><br />&nbsp;<input type="button" class="inputbox" onClick="document.getElementById(\'resendCustom\').value=document.getElementById(\'popup_resendCustom\').value;pi_sendAction();cClick();" value="Send" />&nbsp;&nbsp;<input type="button" class="inputbox" onclick="cClick();" value="Cancel" />', STICKY, CAPTION,'Resend Invite to<br />['+invemail+']', CENTER,MOUSEOFF,CLOSETEXT,'CLOSE',WIDTH,260, ANCHOR,'pi_action_'+iid,ANCHORALIGN,'LR','UR');
			document.getElementById("popup_resendCustom").focus();
		}
	}
	if (action=="action_revoke") {
		if (confirm("Confirm remove invite?")) {
			pi_sendAction();
		}
	}
	if (action=="action_delete") {
		if (confirm("Confirm delete invite?")) {
			pi_sendAction();
		}
	}
}

