/*
(C) AEwebworks Software Development Ltd., 2002-2003
IMPORTANT: This is a commercial software product and any kind of using it must agree
to the AEwebworks Software Development Ltd. license agreement. It can be found at
http://www.aewebworks.com/license.htm
This notice may not be removed from the source code.
*/

/**
 * Checks/unchecks all tables
 *
 * @param   string   the form name
 * @param   boolean  whether to check or to uncheck the element
 *
 * @return  boolean  always true
 */
function setCheckboxes(the_form, do_check)
{
    var elts      = document.forms[the_form].elements;
    var elts_cnt  = elts.length;
	
    for (var i = 0; i < elts_cnt; i++) {
        elts[i].checked = do_check;
    } // end for

    return true;
} // end of the 'setCheckboxes()' function


var win = "width=400,height=500,left=100,top=100,copyhistory=no,directories=no,menubar=no,location=no,resizable=no,scrollbars=yes";
function get_gallery(id_prof)
{
   window.open("photos_gallery.php?ID="+id_prof,'html',win);
}


function launchIM ()
{
	var win = "width=600,height=450,left=100,top=100,copyhistory=no,directories=no,menubar=no,location=no,resizable=no,scrollbars=no";
	window.open("imchat/",'html',win);
	return false;
}

function launchTellFriend ()
{
    var win = "width=300,height=300,left=100,top=100,copyhistory=no,directories=no,menubar=no,location=no,resizable=no,scrollbars=yes";
    window.open("tellfriend.php",'html',win);
    return false;
}

function launchTellFriendProfile ( sID )
{
    var win = "width=300,height=300,left=100,top=100,copyhistory=no,directories=no,menubar=no,location=no,resizable=no,scrollbars=yes";
    window.open("tellfriend.php?ID="+sID,'html',win);
    return false;
}

function launchProfile ( sID )											// DS128.sn
{
    var win = "width=810,height=700,left=100,top=100,copyhistory=no,directories=no,menubar=no,location=no,resizable=yes,scrollbars=yes";
    window.open("profile.php?ID="+sID+"&view=1",'profview',win);
    return false;
}

function launchExtdProfile ( Page, sID )
{
    var win = "width=800,height=700,left=150,top=150,copyhistory=no,directories=no,menubar=no,location=no,resizable=yes,scrollbars=yes";
    window.open("profile_extd.php?page="+Page+"&ID="+sID+"&view=1",'extdview',win);
    return false;
}																		// DS128.en

function launchAChelp ( Type, Code )									// DS193.sn
{
    var win = "width=400,height=300,left=50,top=200,copyhistory=no,directories=no,menubar=no,location=no,resizable=no,scrollbars=yes";
    window.open("achelp.php?type="+Type+"&code="+Code,'achelp',win);
    return false;
}																		// DS193.en

function launchPopup ( Prog )											// DS302.sn // DS401.c
{
    var win = "width=800,height=700,left=200,top=200,copyhistory=no,directories=no,menubar=no,location=no,resizable=yes,scrollbars=yes";
    window.open( Prog,'popup',win);
    return false;
}																		// DS302.en

function launchVKiss ( ID, Type )
{
	var Prog = "vkiss.php?type=" + Type + "&to="+ID;
    var win = "width=400,height=200,left=200,top=50,copyhistory=no,directories=no,menubar=no,location=no,resizable=yes,scrollbars=yes";
    window.open( Prog,'smallpopup',win);
    return false;
}

function launchVKiss_reply ( ID, Type )
{
	var Prog = "vkiss.php?type=" + Type + "&to="+ID;
    var win = "width=400,height=550,left=200,top=50,copyhistory=no,directories=no,menubar=no,location=no,resizable=yes,scrollbars=yes";
    window.open( Prog,'smallpopup',win);
    return false;
}

function ShowShowHide ( show_name, show_name2, hide_name )
{
    if (hide_name) hide_name.style.display = 'none';
    if (show_name) show_name.style.display = 'inline';
    if (show_name2) show_name2.style.display = 'inline';
}

function ShowHideHide ( show_name, hide_name, hide_name2 )
{
    if (hide_name) hide_name.style.display = 'none';
    if (hide_name2) hide_name2.style.display = 'none';
    if (show_name) show_name.style.display = 'inline';
}


/**
 * change images onHover mouse action
 */
function show(FileName,jpg1Name)
{
	document.images[FileName].src = jpg1Name;
}

function launchExplain ( Status )										// DS300.sn
{
	var win = "width=350,height=300";
	if (Status=='terms') win = "width=630,height=600";
	win = win+",left=100,top=100,menubar=no,status=no,resizeable=yes,scrollbars=yes,toolbar=no,location=no";
	window.open( "explanation.php?explain="+Status, '', win );
	return false;
}																		// DS300.en

/**
 * Displays an confirmation box.
 *
 * @param   object   the message to display
 *
 * @return  boolean  whether the user confirmed or not
 */
function confirmAction( theMessage )
{
    // Browser is Opera (crappy js implementation)
    if (typeof(window.opera) != 'undefined') {
        return true;
    }

    return confirm(theMessage);
} // end of the 'confirmAction()' function

/**
 * Payment Warning Popup
 *
 * @return  boolean  whether the user confirmed or not
 */
function paymentPopup()
{
    // Browser is Opera (crappy js implementation)
    if (typeof(window.opera) != 'undefined') {
        return true;
    }

	msg = "At the end of this payment process a 'pop-up' window from 2CO will appear\n" +
	"with a security warning about sending data over an unencrypted connection.\n" +
	"For your security, your credit card details or any personal information will NOT\n" +
	"be sent or compromised during this payment process.  This step is only for administration purposes.\n" +
	"Please press 'CONTINUE' in the pop-up to allow your paid membership to be auto-credited\n" +
	"to your Profile, otherwise payment amd membership will not be finalised.";
    return confirm( msg );
} // end of the 'paymentPopup()' function
