/*******************************************************************************************************************************/
/* <summary>                                                                                                                   */
/* Launches the DatePicker page in a popup window,                                                                             */
/* passing a JavaScript reference to the field that we want to set.                                                            */
/* </summary>                                                                                                                  */
/* <param name="strField">String. The JavaScript reference to the field that we want to set, in the format: FormName.FieldName */
/* Please note that JavaScript is case-sensitive.</param>                                                                      */
/*******************************************************************************************************************************/
function calendarPicker(strField)
{
	window.open('/customersurvey/DatePicker.aspx?field=' + strField,'calendarPopup','width=250,height=190,resizable=yes');
}

/* Hide <div> */
function hide_div(div_id) 
{
				// hide the requested div
				document.getElementById(div_id).style.display = 'none';
}

/* Show <div> */
function show_div(div_id) 
{
				// show the requested div
				document.getElementById(div_id).style.display = 'block';
}
			
/*******************************************************************************************************************************/
/* <summary>                                                                                                                   */
/* This function moves items from one Listbox to another Listbox
/* <summary>                                                                                                                   */
/*******************************************************************************************************************************/

function MoveOption(objSourceElement, objTargetElement)
{
    var aryTempSourceOptions = new Array();
    var x = 0;
    
    //looping through source element to find selected options
    for (var i = 0; i < objSourceElement.length; i++) {
        if (objSourceElement.options[i].selected) {
            //need to move this option to target element
            var intTargetLen = objTargetElement.length++;
            objTargetElement.options[intTargetLen].text = objSourceElement.options[i].text;
            objTargetElement.options[intTargetLen].value = objSourceElement.options[i].value;
        }
        else {
            //storing options that stay to recreate select element
            var objTempValues = new Object();
            objTempValues.text = objSourceElement.options[i].text;
            objTempValues.value = objSourceElement.options[i].value;
            aryTempSourceOptions[x] = objTempValues;
            x++;
        }
    }
    
    //resetting length of source
    objSourceElement.length = aryTempSourceOptions.length;
    //looping through temp array to recreate source select element
    for (var i = 0; i < aryTempSourceOptions.length; i++) {
        objSourceElement.options[i].text = aryTempSourceOptions[i].text;
        objSourceElement.options[i].value = aryTempSourceOptions[i].value;
        objSourceElement.options[i].selected = false;
    }
}

