/**
 * Rock, Paper, Scissors llc.
 *
 * lightbox-form.js
 *
 * General javascripts needed for lightbox,
 * most specifically used for centers share with a grandparent form
 *
 * LICENSE: This source file is subject to version 1.0 of the 
 * Rock, Paper, Scissors llc. license that is available through 
 * the world-wide-web at the following URI:
 * http://www.123shoot.com/license/1_0.txt.  If you did not receive 
 * a copy of the Rock, Paper, Scissors llc. License and are unable 
 * to obtain it through the web, please send a note to 
 * support@123shoot.com so we can mail you a copy immediately.
 *
 * @category   js
 * @author     Scott Lively <scott@123shoot.com>
 * @copyright  2010 Rock, Paper, Scissors llc.
 * @license    http://www.123shoot.com/license/1_0.txt  RPS License 1.0
 */


/**
 * function gradient
 *
 */
function gradient(id, level)
{
    var box = document.getElementById(id);
    box.style.opacity = level;
    box.style.MozOpacity = level;
    box.style.KhtmlOpacity = level;
    box.style.filter = "alpha(opacity=" + level * 100 + ")";
    box.style.display="block";
    return;
}

/**
 * function fadein
 *
 */
function fadein(id)
{
    var level = 0;
    while(level <= 1) {
        setTimeout( "gradient('" + id + "'," + level + ")", (level* 1000) + 10);
        level += 0.01;
    }
}

/**
 * function openbox
 *
 * open the lightbox
 *
 */
function openbox(fadin)
{
    var box = document.getElementById('box');
    document.getElementById('filter').style.display='block';
    
    if(fadin) {
        gradient("box", 0);
        fadein("box");
    } else {
        box.style.display='block';
    }  	
}

/**
 * function closebox
 *
 * close the lightbox
 *
 */
function closebox()
{
    document.getElementById('box').style.display='none';
    document.getElementById('filter').style.display='none';
}

