/*
  (C) Intimate Associates Swingware Software Development, 2000-2009
  IMPORTANT: This is a commercial software product and any use of it means you
  agree to the Swingware Software License agreement. It can be found
  at http://www.intimateassociates.com/swingware/license.html
  Please report License abuse to the Admin at
  http://www.intimateassociates.com/swingware/support/index.php
  This notice may not be removed from the source code.

File Test: 09.15.2006
File Validation: 09.15.2006

Change Log:

================================================================================

================================================================================
*/

/**
 * 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;
                if (the_form + "_submit" == elts[i].name) {
                        elts[i].disabled = !do_check;
                }
    } // end for

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

function setCheckbox(the_form)
{
    var elts      = document.forms[the_form].elements;
    var elts_cnt  = elts.length;

    var allUnchecked = true;

    for (var i = 0; i < elts_cnt; i++)
    {
        if(elts[i].checked) allUnchecked = false;
    }

    for (var i = 0; i < elts_cnt; i++)
    {
        if(elts[i].name == (the_form + "_submit")) elts[i].disabled = allUnchecked;
    }

    return true;
}



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

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

function launchTellFriendProfile ( sID )
{
    var win = "width=300,height=300,left=0,top=100,copyhistory=no,directories=no,menubar=no,location=no,resizable=no,scrollbars=yes";
    window.open("tellfriend.php?ID="+sID,'tellfriendprofile',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;
}

/**
 * set status of the browser window to 's'
 */
function ss(s)
{
        window.status = s;
        return true;
}

/**
 * set status of the browser window to empty
 */
function ce()
{
        window.status='';
}


/**
 * insert emotion item
 */
function emoticon( txtarea, text ) {

        text = ' ' + text + ' ';
        if (txtarea.createTextRange && txtarea.caretPos) {
                var caretPos = txtarea.caretPos;
                caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
                txtarea.focus();
        } else {
                txtarea.value  += text;
                txtarea.focus();
        }
}

function launchAddToIM (id)
{
    var win = "width=600,height=160,left=100,top=100,copyhistory=no,directories=no,menubar=no,location=no,resizable=no,scrollbars=yes";
    window.open("explanation.php?explain=imadd&ID="+id,'add_to_im',win);
    return false;
}

function docOpen(text)
{
        newWindow=window.open('','','toolbar=no,resizable=yes,scrollbars=yes,width=400,height=300');
        newWindow.document.open("text/html");
        newWindow.document.write(unescape(text));
        newWindow.document.close();
}
/**
 * Launches the Swingware Contact Us Standard Addition
 *
 * @param   none, launch modal window
 *
 * @return  boolean  always false
 *
 * MOD Contact Us by IA 01.06.2006
 *
 * Add FROM "//--" TO  "}" to the inc/js/functions.js in aedating directory
 */
//--  MOD 200 Contact Us STD by Swingware 01.05.2006 --//
function launchContactUs( path, name, width, height )
{
    var w = "width="+width;
    var h = "height="+height;
    var win = "width=" + width + ",height=" + height + ",left=200,top=100,copyhistory=no,directories=no,menubar=no,location=no,resizable=no,scrollbars=no";

    window.open(path,name,win);
    return false;
}
//--  MOD 200 Contact Us STD by Swingware 01.05.2006 --//
function launchContactUsSTD ()
{
    var win = "width=450,height=495,left=200,top=100,copyhistory=no,directories=no,menubar=no,location=no,resizable=no,scrollbars=no";
    window.open("sw_contact_us_std.php",'contactusstd',win);
    return false;
}
//--  MOD 201 Contact Us B2B by Swingware 01.05.2006 --//
function launchContactUsB2B ()
{
    var win = "width=450,height=775,left=200,top=10,copyhistory=no,directories=no,menubar=no,location=no,resizable=no,scrollbars=no";
    window.open("sw_contact_us_b2b.php",'contactusb2b',win);
    return false;
}
//--  MOD 202 Contact Us BUG by Swingware 01.05.2006 --//
function launchContactUsBUG ()
{
    var win = "width=450,height=495,left=200,top=10,copyhistory=no,directories=no,menubar=no,location=no,resizable=no,scrollbars=no";
    window.open("sw_contact_us_bug.php",'contactusbug',win);
    return false;
}
/**
 * Launches the Swingware reload for Geo ZipCodes
 *  self.location = 'geo_locations.php?CID=' + val ;
 */
function reload1( form )
{
    var val0 = form.GeoLocationActions.value;
    var val1 = form.Country.options[form.Country.options.selectedIndex].value;

    self.location = val0 + '&CID=' + val1 ;
}
function reload2( form )
{
    var val0 = form.GeoLocationActions.value;
    var val1 = form.Country.options[form.Country.options.selectedIndex].value;
    var val2 = form.State.options[form.State.options.selectedIndex].value;

    self.location = val0 +'&CID=' + val1 + '&SID=' + val2 ;
}
function reload3( form )
{
    var val0 = form.GeoLocationActions.value;
    var val1 = form.Country.options[form.Country.options.selectedIndex].value;
    var val2 = form.State.options[form.State.options.selectedIndex].value;
    var val3 = form.City.options[form.City.options.selectedIndex].value;

    self.location = val0 +'&CID=' + val1 + '&SID=' + val2 + '&TID=' + val3 ;
}
function reload4( form )
{
    var val0 = form.GeoLocationActions.value;
    var val1 = form.Country.options[form.Country.options.selectedIndex].value;
    var val2 = form.State.options[form.State.options.selectedIndex].value;
    var val3 = form.City.options[form.City.options.selectedIndex].value;
    var val4 = form.ZipCode.options[form.ZipCode.options.selectedIndex].value;

    self.location=val0 + '&CID=' + val1 + '&SID=' + val2 + '&TID=' + val3 + '&ZID=' + val4;
}

        //-- Popup any file and pass data via uri:
        //   list_pop_file.php?acd=123&tcd=ABC&formid=list1 ,
        //   W = width, H = height of popup
        //use form id in uri to pass form specific data
/**
 * pop up window
 *  new standard popup window with not attrabutes enabled
 *  pass url, uri, popup width and height.
 */
function popup_noall(SITE, URI, W, H)
{
    var str= SITE + URL;
    window.open(str,"Attachment","top=5,left=30,toolbars=no,maximize=no,resize=no,width=" + W + ",height=" + H + ",location=no,directories=no,scrollbars=no");
}