

           //                getObject
           // Find an object with a specific name
           // ----------------------------------------------------
           function getObject(sObjectName)
           {
                var frm = getForm();
                var result = null;
                if(frm!=null){
	                for(var i = 0; i < frm.length; i++)
	                {
	                  var e = frm.elements[i];
	                  if (e.name == sObjectName) 
	                  {
	                      result = e;
	                  }
	                }
                }
                return result;
           }

           
           


           //              setInputObjectTextValue
           // Find an object with a specific name and set value
           // -------------------------------------------------------------------------
           function setInputObjectTextValue( sObjectName, sObjectValue, sObjectType, sLength, sMask )
           {
              var e = getObject(sObjectName);
              if (e!=null)
              {
                 e.value = sObjectValue;
                 if (e.type=="text")
                 {
                   e.maxLength=sLength;
                    e.size = sLength;
                    if (e.size>50){
                    	e.width=327;
                    	
                    	// for firefox
                    	e.setAttribute("size","30");
                    }
                 }
                 e.mask = sMask;
                 e.ObjectType=sObjectType;
                 e.onchange=Function("setFormModified();");
              }
           }

           //              setInputObjectColorValue
           // Find an object with a specific name and set value
           // -------------------------------------------------------------------------
           function setInputObjectColorValue( sObjectName, sObjectValue )
           {
              var e = getObject(sObjectName);
              //alert(sObjectValue);
              if (e!=null)
              {
                 e.value = sObjectValue;
                 e.type="text";
                 e.size = 7;
                 e.style.backgroundColor=sObjectValue;
                 refreshColor(sObjectName);
                 e.onchange=Function("refreshColor(this.name);setFormModified();");                 
              }
           }

           //              setInputObjectIndicatorValue
           // Find an object with a specific name and set value
           // -------------------------------------------------------------------------
           function setInputObjectIndicatorValue( sObjectName, sCheckObjectName, sObjectValue, sObjectType, sLength, sMask )
           {
              var e = getObject(sObjectName);
              var eCheck = getObject(sCheckObjectName);
              if (e!=null)
              {
                 e.value = sObjectValue;
                 if (e.type=="text")
                 {
                    e.size = sLength;
                 }
                 e.mask = sMask;
                 e.ObjectType=sObjectType;
                 e.onchange=Function("setFormModified();");
              }
              if (eCheck!=null)
              {
                 eCheck.checked = false;
                 if (sObjectValue=="Y"){
                    eCheck.checked = true;
                 }
              }
           }

           //              setInputObjectSimpleValue
           // Find an object with a specific name and set value
           // -------------------------------------------------------------------------
           function setInputObjectSimpleValue( sObjectName, sObjectValue )
           {
              var e = getObject(sObjectName);
              if (e!=null)
              {
                 e.value = sObjectValue;
              }
           }

           //              setInputObjectStateValue
           // Find an object with a specific name and set value
           // -------------------------------------------------------------------------
           function setInputObjectStateValue( sObjectName, sObjectValue)
           {
              var e = getObject(sObjectName);
              if (e!=null)
              {
                 e.ObjectType='State';
         addState( e, "AK");         
         addState( e, "AL");         
         addState( e, "AR");         
         addState( e, "AZ");         
         addState( e, "CA");         
         addState( e, "CO");         
         addState( e, "CT");         
         addState( e, "DC");         
         addState( e, "DE");         
         addState( e, "FL");         
         addState( e, "GA");         
         addState( e, "HI");         
         addState( e, "IA");         
         addState( e, "ID");         
         addState( e, "IL");         
         addState( e, "IN");         
         addState( e, "KS");         
         addState( e, "KY");         
         addState( e, "LA");         
         addState( e, "MA");         
         addState( e, "MD");         
         addState( e, "ME");         
         addState( e, "MI");         
         addState( e, "MN");         
         addState( e, "MO");         
         addState( e, "MS");         
         addState( e, "MT");         
         addState( e, "NC");         
         addState( e, "ND");         
         addState( e, "NE");         
         addState( e, "NH");         
         addState( e, "NJ");         
         addState( e, "NM");         
         addState( e, "NV");         
         addState( e, "NY");         
         addState( e, "OH");         
         addState( e, "OK");         
         addState( e, "OR");         
         addState( e, "PA");         
         addState( e, "RI");         
         addState( e, "SC");         
         addState( e, "SD");         
         addState( e, "TN");         
         addState( e, "TX");         
         addState( e, "UT");         
         addState( e, "VA");         
         addState( e, "VT");         
         addState( e, "WA");         
         addState( e, "WI");         
         addState( e, "WV");         
         addState( e, "WY");   
                 e.value = sObjectValue;
                 e.onchange=Function("setFormModified();");
              }
           }
           function addState( e, sState)
           {
                 e.options.length=e.options.length+1;
                 e.options[e.options.length-1].value = sState;
                 e.options[e.options.length-1].text = sState;
           }

           //    addSelectObjectOption
           // Find an object with a specific name and add a selection
           // -------------------------------------------------------------------------------
           function addSelectObjectOption( sObjectName, sValue, sText  )
           {
             var e = getObject(sObjectName);
              if (e!=null && e.type=="select-one")
              {
                 e.options.length=e.options.length+1;
                 e.options[e.options.length-1].value = sValue;
                 e.options[e.options.length-1].text = sText;
              }
           }

           //              setInputObjectDateValue
           // Find an object with a specific name and set value
           // -------------------------------------------------------------------------
           function setInputObjectDateValue( sObjectName, sObjectValue )
           {
              var e = getObject(sObjectName);
              if (e!=null)
              {
                 e.value = sObjectValue;
                 e.size = 10;
                 e.decimal = 0;
                 e.mask = '##/##/####';
                 e.ObjectType='Date';
                 e.onblur=Function("isDate(this, true);" );
                 e.onchange=Function("formatAsDate(this);setFormModified();");
                 formatAsDate(e);
              }
           }

           //              setInputObjectDateTimeValue
           // Find an object with a specific name and set value
           // -------------------------------------------------------------------------
           function setInputObjectDateTimeValue( sObjectName, sObjectValue )
           {
              var e = getObject(sObjectName);
              if (e!=null)
              {
                 e.value = sObjectValue.substring(0,10);
                 e.size = 10;
                 e.decimal = 0;
                 e.mask = '##/##/####';
                 e.ObjectType='DateTime';
                 e.onblur=Function("isDate(this, true);" );
                 e.onchange=Function("formatAsDate(this);setFormModified();");
                 formatAsDate(e);
              }
              var e = getObject(sObjectName+"Hour");
              if (e!=null)
              {
                 e.options.length=12;
                 e.options[0].value = "12";
                 e.options[0].text = "12";
                 e.options[1].value = "01";
                 e.options[1].text = "1";
                 e.options[2].value = "02";
                 e.options[2].text = "2";
                 e.options[3].value = "03";
                 e.options[3].text = "3";
                 e.options[4].value = "04";
                 e.options[4].text = "4";
                 e.options[5].value = "05";
                 e.options[5].text = "5";
                 e.options[6].value = "06";
                 e.options[6].text = "6";
                 e.options[7].value = "07";
                 e.options[7].text = "7";
                 e.options[8].value = "08";
                 e.options[8].text = "8";
                 e.options[9].value = "09";
                 e.options[9].text = "9";
                 e.options[10].value = "10";
                 e.options[10].text = "10";
                 e.options[11].value = "11";
                 e.options[11].text = "11";
                 var sHour=sObjectValue.substring(11,13);
                 e.value=sHour;
              }
              var e = getObject(sObjectName+"Minute");
              if (e!=null)
              {
                 e.options.length=12;
                 e.options[0].value = "00";
                 e.options[0].text = "00";
                 e.options[1].value = "05";
                 e.options[1].text = "05";
                 e.options[2].value = "10";
                 e.options[2].text = "10";
                 e.options[3].value = "15";
                 e.options[3].text = "15";
                 e.options[4].value = "20";
                 e.options[4].text = "20";
                 e.options[5].value = "25";
                 e.options[5].text = "25";
                 e.options[6].value = "30";
                 e.options[6].text = "30";
                 e.options[7].value = "35";
                 e.options[7].text = "35";
                 e.options[8].value = "40";
                 e.options[8].text = "40";
                 e.options[9].value = "45";
                 e.options[9].text = "45";
                 e.options[10].value = "50";
                 e.options[10].text = "50";
                 e.options[11].value = "55";
                 e.options[11].text = "55";
                 var sMinute=sObjectValue.substring(14,16);
                 e.value=sMinute
              } 
              var e = getObject(sObjectName+"AmPm");
              if (e!=null)
              {
                 e.options.length=2;
                 e.options[0].value = "AM";
                 e.options[0].text = "am";
                 e.options[1].value = "PM";
                 e.options[1].text = "pm";
                 var sAmPm=sObjectValue.substring(17,19);
               	 e.value=sAmPm;
              }
          }

           //              setInputObjectNumberValue
           // Find an object with a specific name and set value
           // -------------------------------------------------------------------------
           function setInputObjectNumberValue( sObjectName, sObjectValue, sObjectType, sLength, sDecimal, sMask )
           {
              var e = getObject(sObjectName);
              if (e!=null && (e.type=="text" || e.type=="hidden"))
              {
                 e.value = sObjectValue;
                 e.size = sLength;
                 e.decimal = sDecimal;
                 e.mask = sMask;
                 e.ObjectType=sObjectType;
                 e.onfocus=Function("setAlign(this, 'left');" );
                 e.onblur=Function("setAlign(this, 'right');" );
                 e.onchange=Function("formatDecimalField(this);setFormModified();");
                 e.style.textAlign="right";
                 formatDecimalField(e);
              }
           }

           //              setInputObjectSocialSecurityNumberValue
           // Find an object with a specific name and set value
           // -------------------------------------------------------------------------
           function setInputObjectSocialSecurityNumberValue( sObjectName, sObjectValue )
           {
              var e = getObject(sObjectName);
              if (e!=null)
              {
                 e.value = sObjectValue;
                 e.size = 11;
                 e.ObjectType='SocialSecurityNumber';
                 e.onblur=Function("isSocialSecurityNumber(this, true);" );
                 e.onchange=Function("formatAsSocialSecurity(this);setFormModified();");
                 formatAsSocialSecurity(e);
              }
           }

           //              setInputObjectPhoneNumberValue
           // Find an object with a specific name and set value
           // -------------------------------------------------------------------------
           function setInputObjectPhoneNumberValue( sObjectName, sObjectValue )
           {
              var e = getObject(sObjectName);
              if (e!=null)
              {
                 e.value = sObjectValue;
                 e.size = 14;
                 e.ObjectType='PhoneNumber';
                 e.onblur=Function("isPhoneNumber(this, true);" );
                 e.onchange=Function("formatAsPhoneNumber(this);setFormModified();");
                 formatAsPhoneNumber(e);
              }
           }

           //              setInputObjectSelectValue
           // Find an object with a specific name and set value
           // -------------------------------------------------------------------------
           function setInputObjectSelectValue( sObjectName, sObjectValue )
           {
              var e = getObject(sObjectName);
              if (e!=null)
              {
                 e.value = sObjectValue;
                 e.ObjectType='Select';
                 e.onchange=Function("setFormModified();");
              }
           }

           function setInputObjectSelectFontValue( sObjectName, sObjectValue )
           {
              var selectValue = getObject(sObjectName);
              if (selectValue!=null && selectValue.size==0)
              {
				addOneFontSelectValue(selectValue, 'Tahoma,Microsoft Sans Serif,Arial,SANS-SERIF', 'default(Tahoma)');
				addOneFontSelectValue(selectValue, 'Arial');
				addOneFontSelectValue(selectValue, 'Arial Black'); 
				addOneFontSelectValue(selectValue, 'Comic Sans MS'); 
				addOneFontSelectValue(selectValue, 'Courier New');
				addOneFontSelectValue(selectValue, 'Georgia');
				addOneFontSelectValue(selectValue, 'Impact');
				addOneFontSelectValue(selectValue, 'Times New Roman'); 
				addOneFontSelectValue(selectValue, 'Trebuchet MS');
				addOneFontSelectValue(selectValue, 'Verdana');
				addOneFontSelectValue(selectValue, 'Andale Mono');
				addOneFontSelectValue(selectValue, 'Helvetica');
              }
              setInputObjectSelectValue( sObjectName, sObjectValue );
           }
           function addOneFontSelectValue(selectValue, sValue, sText)
           {
				var y=document.createElement('option');
				if(sText==null){
					sText = sValue;
				}
				y.text=sText;
				//y.text.style="font:"+sValue;
				y.value=sValue;              
				try
				  {
				  selectValue.add(y,null); // standards compliant
				  }
				catch(ex)
				  {
				  selectValue.add(y); // IE only
				}
           }
            function formatDecimalField(e){
               iDecimal=2;
               if (e.decimal!=null) { iDecimal=e.decimal;}
               //formatNum = formatNumber(e,false,false);
               strDigits = e.value;
               if( strDigits=="") { strDigits="0";}
               while (strDigits.indexOf(",") > 0)
                 strDigits = strDigits.replace(",", "");
               //roundNum = roundOff(strDigits,iDecimal);
               if (iDecimal==0 && strDigits.indexOf(".")>0)
                  { 
                    strDigits=strDigits.substring(0,strDigits.indexOf("."));
                  }
               if (iDecimal>0)
                  { 
                      if (strDigits.indexOf(".")<0){strDigits=strDigits+".";}
                      iCur = strDigits.length-strDigits.indexOf(".")-1;
                      if (iCur<iDecimal)
                      {
                          while (iCur<iDecimal)
                          {
                               strDigits = strDigits+"0";
                               iCur = strDigits.length-strDigits.indexOf(".")-1;
                          }
                      }
                      if (iCur>iDecimal)
                      {
                          while (iCur>iDecimal)
                          {
                               strDigits = strDigits.substring(0,strDigits.length-1);
                               iCur = strDigits.length-strDigits.indexOf(".")-1;
                          }
                      }
                  }
               e.value=strDigits;
            }
            function test()
            {
                alert("test");
            }
            function setAlign(element, dir)
            {
               element.style.textAlign=dir;
            }

function formatAsPhoneNumber(fld)
{
    var key = '';
    var i = 0;
    var len = 0;
    var strCheck = '0123456789';
    var aux ='';
//    var whichCode = (window.Event) ? e.which : e.keyCode;
//    if (whichCode == 13) return true;  // Enter
//    key = String.fromCharCode(whichCode);  // Get key value from key code
//    if (strCheck.indexOf(key) == -1) return false;  // Not a valid key
    len = fld.value.length;

    for(i=0; i < len; i++)
    {
        if (strCheck.indexOf(fld.value.charAt(i))!=-1)
            aux += fld.value.charAt(i);
     }

     len = aux.length;
     if (len==10)
        fld.value = "(" +
                          aux.substr(0,3) + ")" +
                          aux.substr(3,3) + "-" +
                          aux.substr(6,4) 
    return true;
}

// ----------------------------------------------------------------
function isPhoneNumber(e, bAreaCodeRequired, bFormatField)
{
	// If the string is empty then just ignore it. If the field is required,
  // this would have been caught already.
	if (trim(e.value).length == 0)
    return true;

  // Parse out just the digits
  var strDigits = e.value.replace(/\D/g, "");

  if (strDigits.length != 10)
    if (bAreaCodeRequired || strDigits.length != 7)
      return false;

  if (bFormatField)
  {
    e.value = "(" + strDigits.substr(0, 3) +
              ")" + " " +
              strDigits.substr(3, 3);

    if (strDigits.length == 10)
      e.value += "-";
    e.value += strDigits.substr(6);

  }

  return true;
}

function formatAsSocialSecurity(fld)
{
    var key = '';
    var i = 0;
    var len = 0;
    var strCheck = '0123456789';
    var aux ='';
//    var whichCode = (window.Event) ? e.which : e.keyCode;
//    if (whichCode == 13) return true;  // Enter
//    key = String.fromCharCode(whichCode);  // Get key value from key code
//    if (strCheck.indexOf(key) == -1) return false;  // Not a valid key
    len = fld.value.length;

    for(i=0; i < len; i++)
    {
        if (strCheck.indexOf(fld.value.charAt(i))!=-1)
            aux += fld.value.charAt(i);
     }
     len = aux.length;
     if (len == 0)
        fld.value = '';
     if(len == 9)
     {
        fld.value = aux.substr(0,3) + "-" +
                          aux.substr(3,2) + "-" +
                          aux.substr(5,4) 
                          ;
     }
    return true;
}

// ----------------------------------------------------------------
function isSocialSecurityNumber(e, bFormatField)
{
  var strSSNum = trim(e.value);

  // If the string is empty then just ignore it. If the field is required,
  // this would have been caught already.
	if (strSSNum.length == 0)
    return true;

  // Match any character that is not a digit or a hyphen
  var results = strSSNum.match(/[^0-9\-]/g);
  if (results != null)
    return false;

  // Parse just the digits and verify length
  var strDigits = strSSNum.replace(/\D/g, "");
  if (strDigits.length != 9)
    return false;

  // Format if necessary
  if (bFormatField)
  {
    e.value = strDigits.substring(0, 3) +
              "-" +
              strDigits.substring(3, 5) +
              "-" +
              strDigits.substring(5);
  }
  return true;

}

function formatAsDate(fld)
{
    var key = '';
    var i = 0;
    var len = 0;
    var strCheck = '0123456789';
    var aux ='';
//    var whichCode = (window.Event) ? e.which : e.keyCode;
//    if (whichCode == 13) return true;  // Enter
//    key = String.fromCharCode(whichCode);  // Get key value from key code
//    if (strCheck.indexOf(key) == -1) return false;  // Not a valid key
    len = fld.value.length;

    for(i=0; i < len; i++)
    {
        if (strCheck.indexOf(fld.value.charAt(i))!=-1)
            aux += fld.value.charAt(i);
     }
     len = aux.length;
     if (len == 0)
        fld.value = '';
     if(len == 8)
     {
        fld.value = aux.substr(0,2) + "/" +
                          aux.substr(2,2) + "/" +
                          aux.substr(4,4) 
                          ;
     }
    return true;
}

function formatAsDateTime(fld)
{
    var key = '';
    var i = 0;
    var len = 0;
    var strCheck = '0123456789';
    var aux ='';
//    var whichCode = (window.Event) ? e.which : e.keyCode;
//    if (whichCode == 13) return true;  // Enter
//    key = String.fromCharCode(whichCode);  // Get key value from key code
//    if (strCheck.indexOf(key) == -1) return false;  // Not a valid key
    len = fld.value.length;

    for(i=0; i < len; i++)
    {
        if (strCheck.indexOf(fld.value.charAt(i))!=-1)
            aux += fld.value.charAt(i);
     }
     len = aux.length;
     if (len == 0)
        fld.value = '';
     if(len == 13)
     {
        fld.value = aux.substr(0,2) + "/" +
                          aux.substr(2,2) + "/" +
                          aux.substr(4,4)  +" " +
                          aux.substr(6,6)  +":" +
                          aux.substr(8,8)  +" " +
                          "";
     }
    return true;
}

// ----------------------------------------------------------------
/*
// dont use this function any more use one in date.js
function isDate(e, bFormatField)
{
  var strSSNum = trim(e.value);

  // If the string is empty then just ignore it. If the field is required,
  // this would have been caught already.
	if (strSSNum.length == 0)
    return true;

  // Match any character that is not a digit or a hyphen
  var results = strSSNum.match(/[^0-9\-]/g);
  if (results != null)
    return false;

  // Parse just the digits and verify length
  var strDigits = strSSNum.replace(/\D/g, "");
  if (strDigits.length != 8)
    return false;

  // Format if necessary
  if (bFormatField)
  {
    e.value = strDigits.substring(0, 2) +
              "/" +
              strDigits.substring(2, 2) +
              "/" +
              strDigits.substring(4);
  }
  return true;

}
*/
// ----------------------------------------------------------------
function isDateTime(e, bFormatField)
{
  var strSSNum = trim(e.value);

  // If the string is empty then just ignore it. If the field is required,
  // this would have been caught already.
	if (strSSNum.length == 0)
    return true;

  // Match any character that is not a digit or a hyphen
  var results = strSSNum.match(/[^0-9\-: apm]/g);
  if (results != null)
    return false;

  // Parse just the digits and verify length
  var strDigits = strSSNum.replace(/\D/g, "");
  if (strDigits.length != 18)
    return false;

  // Format if necessary
  if (bFormatField)
  {
    e.value = strDigits.substring(0, 2) +
              "/" +
              strDigits.substring(2, 2) +
              "/" +
              strDigits.substring(4);
  }
  return true;

}


           //              nextPage
           // goto next page
           // -------------------------------------------------------------------------
           function nextPage()
           {
              var e = getObject("NEXT_URL");
              if (e!=null)
              {
                 if (e.value=="")
                 {
                    alert("No URL in Next Link");
                 }
                 else
                 {
                     var e2 = getObject("saveForm");
                     if (e2!=null)
                     {
                         if(isFormModified()){
                            if ( confirm("Form is modified would you like to save it first?") )
                            {
                                e2.value="SaveNext";
                                var frm = getForm();
                                submitForm(frm);
                            }
                            else
                            {
                                location.href = e.value;
                            }
                         }
                         else { location.href = e.value; }
                     }
                    else
                    {
                        location.href = e.value;
                    }
                 }
              }
             else
             {
                 alert("Next Link not found");
             }
           }

           //              priorPage
           // goto prior page
           // -------------------------------------------------------------------------
           function priorPage()
           {
              var e = getObject("PRIOR_URL");
              var frm = getForm();
              if (e!=null)
              {
                 if (e.value=="")
                 {
                    alert("No URL in Prior Link");
                 }
                 else
                 {
                     var e2 = getObject("saveForm");
                     if (e2!=null)
                     {
                         if(isFormModified()){
                            if ( confirm("Form is modified would you like to save it first?") )
                            {
                                e2.value="SavePrior";
                                var frm = getForm();
                                submitForm(frm);
                            }
                            else
                            {
                                location.href = e.value;
                            }
                         }
                         else { location.href = e.value; }
                     }
                    else
                    {
                        location.href = e.value;
                    }
                 }
              }
              else
              {
                 alert("Prior Link not found");
              }
           }
           //              updateButtons
           // update Buttons
           // -------------------------------------------------------------------------
           function updateButtons()
           {
              var frm = getForm();
              var btn = frm.btnNEXT;
              if (btn!=null)
              {
                  var url = getObject("NEXT_URL");
                  if (url==null) {btn.style.visibility = "hidden";}
                  else if (url.value==null) { btn.style.visibility = "hidden";}
                  else if (url.value=="") { btn.style.visibility = "hidden"; }
                  if(btn.style.visibility == "hidden") { btn.style.width = "0";}
              }
              var btn = frm.btnPRIOR;
              if (btn!=null)
              {
                  var url = getObject("PRIOR_URL");
                  if (url==null) {btn.style.visibility = "hidden";}
                  else if (url.value==null) { btn.style.visibility = "hidden";  }
                  else if (url.value=="") { btn.style.visibility = "hidden";  }
                  if(btn.style.visibility == "hidden") { btn.style.width = "0";}
              }
           }


           function getForm()
           {
	// Returns form[0]
             var frm = document.forms[0];
             if (frm == null || typeof(frm) == "undefined")
             {
             if (document.Layer1 != null && typeof(document.Layer1) != "undefined")
                 return document.Layer1.document.forms[0];
             }
             else
             {
               return frm;
             }
           }

           function setFormModified()
           {
               var frm = getForm();
               if(frm.formModified!=null){ frm.formModified.value = 'Y';}
           }

           function isFormModified()
           {
               var frm = getForm();
               var bResult = false;
               if(frm.formModified!=null){ bResult = (frm.formModified.value == 'Y');}
               return bResult;
           }


           function resizeDivTopMiddleBottom( topObject, iBottomHeight) {  //reloads the window if Nav4 resized
              var iTopHeight;
              if(document.getElementById('layTop')!=null &&
                 document.getElementById('layMiddle')!=null &&
                 document.getElementById('layBottom')!=null ) 
              {
             
                 if (topObject==null){iTopHeight=100;}
                 else if (typeof topObject == 'object'){iTopHeight=topObject.offsetTop-1;}
                 else {iTopHeight=topObject;}
                 if (iBottomHeight==null){iBottomHeight=55;}
                 var iHeight = (document.body.clientHeight) ? document.body.clientHeight : document.documentElement.clientHeight;
           
                 var oTop = document.getElementById('layTop');
                 oTop.style.top=0;
           
                 var oBottom = document.getElementById('layBottom');
           
                 if (iHeight-iTopHeight-iBottomHeight>0)
                 {            
                    var oMiddle = document.getElementById('layMiddle');
                    oMiddle.style.top=iTopHeight;
                    oMiddle.style.height=iHeight-iTopHeight-iBottomHeight;
           
                    oBottom.style.top=iHeight-iBottomHeight;
                 }
              }
           }

           function validateReferenceIdentifier()
           {
              // get objects you will need
              var oCurrentReferenceIdentifierValue = getObject("CurrentReferenceIdentifierValue");
              var oCurrentReferenceIdentifierName = getObject("CurrentReferenceIdentifierName");
              var oAllReferenceIdentifierValues = getObject("AllReferenceIdentifierValues");
              var bResult = true;

              // make sure all objects are available & have values
              if (oCurrentReferenceIdentifierValue==null) {   }
              else if (oCurrentReferenceIdentifierName==null) {   }
              else if (oAllReferenceIdentifierValues==null) {   }
//              else if (oCurrentReferenceIdentifierValue.value=="") {   }
              else if (oCurrentReferenceIdentifierName.value=="") {   }
              else if (oAllReferenceIdentifierValues.value=="") {   }
              else
              {
                  // Find object which we are editing
                  var oReferenceIdentifier = getObject(oCurrentReferenceIdentifierName.value);
                  if (oReferenceIdentifier!=null)
                  {
                          // if value has not changed then fine
//alert(oCurrentReferenceIdentifierValue);                          
                          if (oReferenceIdentifier.value==oCurrentReferenceIdentifierValue.value){}
                          else 
                          {
                             if( (",,,"+oAllReferenceIdentifierValues.value.toUpperCase()+",,,").indexOf(","+oReferenceIdentifier.value.toUpperCase()+",")>0)
                             {
                                bResult = false;
                                alert( "Refrence identifier is already used. Please enter a diffrent Identifier (" + oReferenceIdentifier.value + ")" );
                             }
                          }
                  }

              }
              return bResult;
                
           }
           //              priorPageQuery
           // goto prior page on a querying page
           // -------------------------------------------------------------------------
           function priorPageQuery()
           {
              setInputObjectSimpleValue("QueryCommand","prior");
              refreshQuery();
           }
           //              nextPageQuery
           // goto prior page on a querying page
           // -------------------------------------------------------------------------
           function nextPageQuery()
           {
              setInputObjectSimpleValue("QueryCommand","next");
              refreshQuery();
           }
           
    function setTimeZone()
    {
	  var cookie_date = new Date ( );  // current date & time
	  //alert((cookie_date.getTimezoneOffset()/60));
	  document.cookie = "UserTimeZoneOffset=" + ((cookie_date.getTimezoneOffset()/60))+";";
    }
	function defaultOnLoad()
	{
	  var frm = getForm();

	  // close pleasewait
      //var pleaseWait=parent.open('sessiontimeout/PleaseWait.html', 'PleaseWait', 'status=yes,resizable=yes, width=1, height=1, top=0, left=0');   
	  //pleaseWait.close();
	  
	  if (parent.winPleaseWait && !parent.winPleaseWait.closed){
			parent.winPleaseWait.close();
	  }

	  if (window.formOnLoad){
	    window.formOnLoad();
	  }
	
	  if (window.frmOnLoad){
	    window.frmOnLoad();
	  }
	
	
	  // If a form exists, then set the initial focus
	  if (frm != null)
		{
	    setInitialFocus();
			// Clear out the strJumpTo if it is present
			if (frm.strJumpTo != null && typeof(frm.strJumpTo) != "undefined")
				frm.strJumpTo.value = "";
		}
	  parent.scrollTo(0,0);
	//  alertSessionExpiry('');
	}

	function setInitialFocus()
	{
	  var frm = getForm();
	  for (var i = 0; i < frm.elements.length; i++)
	  {
	    var e = frm.elements[i];
	    if (e.type == "hidden" || e.disabled)
	      continue;
	
	    if ((e.type == "text") ||
	        (e.type == "textarea") ||
	        //(e.type == "select-one") ||
	        (e.type == "select-multiple") ||
	        (e.type == "checkbox") ||
	        (e.type == "radio"))
	    {
	      e.focus();
	      // Select text in text field or textarea
	      if (e.type.indexOf("text") != -1)
	        e.select();
	
	      break;
	    }
	  }
	  return true;
	}

function saveData(argFrm)
{
    var frm;

//    if(argFrm != null ){
//        frm = argFrm;
//    } else {
//        frm = getForm();
//    }
    frm = getForm();
    //parent.open('sessiontimeout/PleaseWait.html', 'PleaseWait', 'status=yes,resizable=yes, width=150, height=130');   
    //pleaseWait.close();
    showPleaseWait();
    
    if (typeof frm.saveForm != "undefined")
        frm.saveForm.value = "Save";

}


function submitCurrentForm()
{
  var frm = getForm();
  submitForm(frm);
}

function submitForm(frm)
{
  if (null != frm.Submit && typeof(frm.Submit) != "undefined")
	{
    frm.Submit.click();
	}
  else
	{
		// Note that the form's onSubmit() will NOT be called as a result of
		// executing the submit() method, so we call it manually
		var onSubmit = frm.onsubmit;
		if (null != onSubmit && typeof(onSubmit) != "undefined")
		{
			if (onSubmit())
				frm.submit();
		}
		else
		{
			frm.submit();
		}
	}
}

	function pickColor(objText,objForm) {
		if (colorPickerPopupWindow != null) {
			colorPickerPopupWindow.close();
		}
		
		//var myArguments = new Object();
   		//myArguments.param1 = document.all.myColor.value;
		//window.open("colorpicker/ColorPicker.htm", myArguments, '');
   
		//var colorPickerPopupWindow = window.showModalDialog('colorpicker/ColorPicker.htm');
		
		var colorPickerPopupWindow = window.open('colorpicker/ColorPicker.jsp?TEXT_OBJECT='+objText, 'popup', 'modal,status=yes,resizable=no, width=150, height=130');
		//colorPickerPopupWindow.focus();
		//alert(objText);
		//alert(colorPickerPopupWindow.document);
  		//colorPickerPopupWindow.document.getElementById('idColorPickerTextObject').value = objText;
		//colorPickerPopupWindow.document.getElementById('idColorPickerFormObject').value = objForm;
		//colorPickerPopupWindow.ColorPickerFormObject.value = objForm;

//  		colorPickerPopupWindow.document.ColorPickerTextObject.value = objText;
//		colorPickerPopupWindow.document.ColorPickerFormObject.value = objForm;


//		colorPickerPopupWindow.document.getObject('idColorPickerFormObject').value = objForm;
		
//		colorPickerPopupWindow.document.all['idColorPickerTextObject'].value = objText;			
		
//		setFormModified();	
		//alert(colorPickerPopupWindow.name);
		//colorPickerPopupWindow.InitUpdateObject(obj);	
	}
	function setColor( objText,objForm, color) {
		if(document.getElementById(objText)!=null){
		   document.getElementById(objText).value=color;
		   document.getElementById(objText).style.backgroundColor=color;
		}
	}
	function refreshColor( objText ) {
		if(document.getElementById(objText)!=null){
   		   document.getElementById(objText).style.backgroundColor=document.getElementById(objText).value;		
   		}
	}

   //                showMenu
   // Show Menu
   // ----------------------------------------------------
   var lastMenuDisplayed=null;
   function showMenu(szDivID)
   { 
   	showMenuPos(szDivID,15,10);
   }
   function makeDivAbsolute(szDivID){
   
   
      if(findElement("container")!=null){
      	var iLeft = findElement("container").offsetLeft;
      	var iTop = findElement("container").offsetTop;
      	var iHeight = findElement("container").offsetHeight;
      	var iWidth = findElement("container").offsetWidth;
      }
      if(findElement("content0")!=null){
      	var iLeft0 = findElement("content0").offsetLeft;
      	var iTop0 = findElement("content0").offsetTop;
      	//findElement("content0").style.visibility="hidden";
      }
      if(findElement("content1")!=null){
      	var iLeft1 = findElement("content1").offsetLeft;
      	var iTop1 = findElement("content1").offsetTop;
      	//findElement("content1").style.visibility="hidden";
      }
      if(findElement("content2")!=null){
      	var iLeft2 = findElement("content2").offsetLeft;
      	var iTop2 = findElement("content2").offsetTop;
      	//findElement("content2").style.visibility="hidden";
      }
      if(findElement("content3")!=null){
      	var iLeft3 = findElement("content3").offsetLeft;
      	var iTop3 = findElement("content3").offsetTop;
      	//findElement("content3").style.visibility="hidden";
      }
      if(findElement("content4")!=null){
      	var iLeft4 = findElement("content4").offsetLeft;
      	var iTop4 = findElement("content4").offsetTop;
      	//findElement("content4").style.visibility="hidden";
      }
      if(findElement("content5")!=null){
      	var iLeft5 = findElement("content5").offsetLeft;
      	var iTop5 = findElement("content5").offsetTop;
      	//findElement("content5").style.visibility="hidden";
      }
      if(findElement("content6")!=null){
      	var iLeft6 = findElement("content6").offsetLeft;
      	var iTop6 = findElement("content6").offsetTop;
      	//findElement("content6").style.zindex=-1;
      	//findElement("content6").style.visibility="hidden";
      }
      if(findElement("content7")!=null){
      	var iLeft7 = findElement("content7").offsetLeft;
      	var iTop7 = findElement("content7").offsetTop;
      	//findElement("content7").style.visibility="hidden";
      }
      if(findElement("content8")!=null){
      	var iLeft8 = findElement("content8").offsetLeft;
      	var iTop8 = findElement("content8").offsetTop;
      	//findElement("content8").style.visibility="hidden";
      }
      if(findElement("content9")!=null){
      	var iLeft9 = findElement("content9").offsetLeft;
      	var iTop9 = findElement("content9").offsetTop;
      	//findElement("content9").style.visibility="hidden";
      }


      if(findElement("content0")!=null){
      	findElement("content0").style.left = iLeft0;
      	findElement("content0").style.top = iTop0;
      	findElement("content0").style.position = "static";
      	//findElement("content0").style.zindex=-1;
      	//findElement("content0").style.visibility="visible";
      }
      if(findElement("content1")!=null){
      	findElement("content1").style.left = iLeft1;
      	findElement("content1").style.top = iTop1;
      	findElement("content1").style.position = "static";
      	//findElement("content1").style.zindex=-1;
      	//findElement("content1").style.visibility="visible";
      }
      if(findElement("content2")!=null){
      	findElement("content2").style.left = iLeft2;
      	findElement("content2").style.top = iTop2;
      	findElement("content2").style.position = "static";
      	//findElement("content2").style.zindex=-1;
      	//findElement("content2").style.visibility="visible";
      }
      if(findElement("content3")!=null){
      	findElement("content3").style.left = iLeft3;
      	findElement("content3").style.top = iTop3;
      	findElement("content3").style.position = "static";
      	//findElement("content3").style.zindex=-1;
      	//findElement("content3").style.visibility="visible";
      }
      if(findElement("content4")!=null){
      	findElement("content4").style.left = iLeft4;
      	findElement("content4").style.top = iTop4;
      	findElement("content4").style.position = "static";
      	//findElement("content4").style.zindex=-1;
      	//findElement("content4").style.visibility="visible";
      }
      if(findElement("content5")!=null){
      	findElement("content5").style.left = iLeft5;
      	findElement("content5").style.top = iTop5;
      	findElement("content5").style.position = "static";
      	//findElement("content5").style.zindex=-1;
      	//findElement("content5").style.visibility="visible";
      }
      if(findElement("content6")!=null){
      	findElement("content6").style.left = iLeft6;
      	findElement("content6").style.top = iTop6;
      	findElement("content6").style.position = "static";
      	//findElement("content6").style.zindex=-1;
      	//findElement("content6").style.visibility="visible";
      }
      if(findElement("content7")!=null){
      	findElement("content7").style.left = iLeft7;
      	findElement("content7").style.top = iTop7;
      	findElement("content7").style.position = "static";
      	//findElement("content7").style.zindex=-1;
      	//findElement("content7").style.visibility="visible";
      }
      if(findElement("content8")!=null){
      	findElement("content8").style.left = iLeft8;
      	findElement("content8").style.top = iTop8;
      	findElement("content8").style.position = "static";
      	//findElement("content8").style.zindex=-1;
      	//findElement("content8").style.visibility="visible";
      }
      if(findElement("content9")!=null){
      	findElement("content9").style.left = iLeft9;
      	findElement("content9").style.top = iTop9;
      	findElement("content9").style.position = "static";
      	//findElement("content9").style.zindex=-1;
      	//findElement("content9").style.visibility="visible";
      }
      if(findElement("container")!=null){
      //alert(iHeight);
      //alert(iWidth);
      	//findElement("container").style.left = iLeft;
      	//findElement("container").style.top = iTop;
      	findElement("container").style.height = iHeight;
      	findElement("container").style.width = iWidth;
      	//findElement("container").style.position = "static";
      	//findElement("content0").style.zindex=-1;
      }
  	  findElement(szDivID).style.zindex=100;
   }
   
   function showMenuPos(szDivID,iTop,iLeft)
   { 
		var curDiv=findElement(szDivID);
		
		if(curDiv==null){
			alert('Menu not found:'+szDivID);            
		}
		// hide all menus
		hideAll();
		lastMenuDisplayed = szDivID;

		curDiv.isMenu="y";
       		
       		
  		curDiv.style.position='absolute';


 		makeDivAbsolute(szDivID);
 		//alert(curDiv.style.zindex);

   		var div = findElement('div'+szDivID);
      		
		// First, determine how much the visitor has scrolled 
		var scrolledLeft, scrolledTop; 
		if( self.pageYOffset ) { 
		  scrolledLeft = self.pageXOffset; 
		  scrolledTop = self.pageYOffset; 
		} else if( document.documentElement && document.documentElement.scrollTop ) { 
		  scrolledLeft = document.documentElement.scrollLeft; 
		  scrolledTop = document.documentElement.scrollTop; 
		} else if( document.body ) { 
		  scrolledLeft = document.body.scrollLeft; 
		  scrolledTop = document.body.scrollTop; 
		} 
		
		// Next, determine the size of the browser's window 
		var windowWidth, windowHeight; 
		if( self.innerHeight ) { 
		   windowWidth = self.innerWidth; 
		   windowHeight = self.innerHeight; 
		} else if( document.documentElement && document.documentElement.clientHeight ) { 
		   windowWidth = document.documentElement.clientWidth; 
		   windowHeight = document.documentElement.clientHeight; 
		} else if( document.body ) { 
		   windowWidth = document.body.clientWidth; 
		   windowHeight = document.body.clientHeight; 
		} 
		//alert("window:"+windowWidth+"/"+windowHeight);
		
		
		// Find anchor positions
		var anchorLeft, anchorTop; 
//		anchorTop=findPosY(div,"ui-sortable");
//		anchorLeft=findPosX(div,"ui-sortable");
		anchorTop=findPosY(div);
		anchorLeft=findPosX(div);
		//alert(anchorTop+"/"+anchorLeft+"/"+div);
		// Next, determine the size of the menu div 
		var divWidth, divHeight; 
		if( curDiv.innerHeight ) { 
		   divWidth = curDiv.innerWidth; 
		   divHeight = curDiv.innerHeight; 
		} else if( curDiv.documentElement && curDiv.clientHeight ) { 
		   divWidth = curDiv.clientWidth; 
		   divHeight = curDiv.clientHeight; 
		} else if( document.body ) { 
		   divWidth = curDiv.clientWidth; 
		   divHeight = curDiv.clientHeight; 
		} 
		
		if((scrolledTop+windowHeight)>(divHeight+anchorTop+iTop)){
		  curDiv.style.top=anchorTop+iTop+"px";
		}else if((anchorTop-iTop-divHeight)>(scrolledTop)){
		  curDiv.style.top=anchorTop-divHeight+"px";
		}else{
		  curDiv.style.top=scrolledTop+"px";
		}
		
		if((scrolledLeft+windowWidth)>(divWidth+anchorLeft+iLeft)){
		  curDiv.style.left=anchorLeft+iLeft+"px";
		}else if((anchorLeft-iLeft-divWidth)>(scrolledLeft)){
		  curDiv.style.left=(scrolledLeft+windowWidth-divWidth)+"px";
		}else{
		  curDiv.style.left=scrolledLeft+"px";
		}
			      		  
   		curDiv.style.border="8px";
   		iMoveCount=0;
   		curDiv.style.visibility="visible";
   		curDiv.style.zIndex=100;
   		
   		curDiv.onMouseOut="hideAll();";
//   		curDiv.onMouseOut="alert('111');";
       		

    }

	function findElement(szDivID){
			// find the div
			if(document.layers) 
			{
				curDiv =document.layers[szDivID];
			}
			else if(document.getElementById) 
			{
				curDiv = document.getElementById(szDivID);
			}
			else if(document.all) 
			{
				curDiv =document.all[szDivID];			
			}			

			if(curDiv==null){
			  var objFrame=document.getElementById("manageprofileframe");   
			  if(objFrame!=null){
			  	curDiv=objFrame.contentWindow.document.getElementById(szDivID);
			  	//alert("not found"+szDivID);
			  }
			}
			if(curDiv==null){
			  var objFrame=document.getElementById("manageprofileiframe");   
			  if(objFrame!=null){
			  	curDiv=objFrame.contentWindow.document.getElementById(szDivID);
			  	//alert("not found"+szDivID);
			  }
			}
			
  return curDiv;
}

          
function hideAll(){
  if (document.getElementById('menu0')!=null){
    document.getElementById('menu0').style.visibility="hidden";
  }
  if (lastMenuDisplayed!=null){
  	hideOneMenu(lastMenuDisplayed);
//  } else
//     for(var i = 0; i < 500; i++){
//        hideOneMenu("menu"+i);
//     }
  }
  hideOneMenu("menu998");
  hideOneMenu("menu999");
  
   			var multimediaDiv;
      		var	multimediaIFrame;
			if(document.layers) 
			{
				multimediaDiv =document.layers["MULTIMEDIA_DIV"];

			}
			else if(document.getElementById) 
			{
				multimediaDiv = document.getElementById("MULTIMEDIA_DIV");
			}
			else if(document.all) 
			{
				multimediaDiv =document.all["MULTIMEDIA_DIV"];					
			}			
			if(multimediaDiv!=null){
			    multimediaDiv.style.visibility="hidden";
            }
//  document.getElementById("menu1").style.visibility="hidden";
//  document.getElementById("menu2").style.visibility="hidden";
//  document.getElementById("menu3").style.visibility="hidden";
//  document.getElementById("menu4").style.visibility="hidden";
//  document.getElementById("menu5").style.visibility="hidden";
//  document.getElementById("menu6").style.visibility="hidden";
    
}
function  hideOneMenu(sMenuDiv){
//  menuDiv = document.getElementById(sMenuDiv)
  menuDiv = findElement(sMenuDiv);
  if (menuDiv){
	if (menuDiv.isMenu=="y"){
		menuDiv.style.visibility="hidden"; 
	}  
  }
}

function hideEventually(e,oThis,sMenu){
    iMoveCount=0;
	iMoveCount++;
	var cursor = getPosition(e);
	//alert(e.className);
	//alert(cursor.x+"/"+cursor.y+"/"+findPosX(oThis)+"/"+findPosY(oThis)+"/"+oThis.clientWidth+"/"+oThis.clientHeight);
//var mydiv = document.getElementById(sMenu);
//var curr_width = parseInt(mydiv.style.width.value); // removes the "px" at the end
//alert(mydiv.clientWidth);
	
	if (iMoveCount>30){
	  iMoveCount=0;
	  hideAll();
	}
	if (cursor.x<=findPosX(oThis) ){
	  iMoveCount=0;
	  hideAll();
	}
	if (cursor.y<=findPosY(oThis)){
	  iMoveCount=0;
	  hideAll();
	  //alert("y");
	}
	if (cursor.x>=findPosX(oThis)+oThis.clientWidth){
	  iMoveCount=0;
	  hideAll();
	  //alert(iMoveCount);
	}
	if (cursor.y>=findPosY(oThis)+oThis.clientHeight ){
	  iMoveCount=0;
	  hideAll();
	  //alert("x");
	}
}



function findPosX(obj,sParentDivClass)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
			if(sParentDivClass!=null && obj.className==sParentDivClass){
			    //curleft = curleft-100;
			    //alert('x');
				break;
			}
		}
	}
	else if (obj.x)
		curleft += obj.x;
//alert(curleft);
	return curleft;
}

function findPosY(obj, sParentDivClass)
{
//alert(sParentDivClass);
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
			if(sParentDivClass!=null && obj.className==sParentDivClass){
				curtop = curtop;
				break;
			}
		}
	}
	else if (obj.y)
		curtop += obj.y;
//alert(curtop);
	return curtop;
}

function getPosition(e) {
    e = e || window.event;
    var cursor = {x:0, y:0};
    if (e.pageX || e.pageY) {
        cursor.x = e.pageX;
        cursor.y = e.pageY;
    } 
    else {
        var de = document.documentElement;
        var b = document.body;
        cursor.x = e.clientX + 
            (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
        cursor.y = e.clientY + 
            (de.scrollTop || b.scrollTop) - (de.clientTop || 0);
    }
    return cursor;
}

	function deleteSelectValueNotInList( sControl, sValueList){
        var e = getObject(sControl);
        //alert(e.name);
        
        if (e!=null && e.type=="select-one")
        {
          var bFound = 0;
          var deleteCount=0;
        	for(var i=0;i<e.options.length;i++){
        	  var optionValue="," + e.options[i].value +",";
        	  //alert(validContentTypes+"/"+optionValue+"/"+validContentTypes.indexOf(optionValue));
        	  if( sValueList.indexOf(optionValue)<0) {
               e.options[i].value = "xxx";
               e.options[i].text = "xxx";
               deleteCount = deleteCount+1;
            }
        	}
        	for(var i=0;i<deleteCount;i++){
        		deleteSelectValue("ContentTypeRecordNumber","xxx");
        	}
        }  
		
	}

            function deleteSelectValue( sControl, sValue){
	              var e = getObject(sControl);
	              //alert(e.name);
	              if (e!=null && e.type=="select-one")
	              {
	                var bFound = 0;
	              	for(var i=0;i<e.options.length;i++){
	              	  //alert(e.options[i].value);
	              	  if( e.options[i].value==sValue) {
	              	    //alert("found1");
	              	    bFound=1;
	              	  }
	              	  else if(bFound==1){
	              	    //alert("found2");
		                 e.options[i-1].value = e.options[i].value;
		                 e.options[i-1].text = e.options[i].text;
		              }
	              	}
	              	if(bFound=1){
	              	    //alert("shorten");
	              	    e.options.length = e.options.length-1;
	              	}
//	                 e.options.length=e.options.length+1;
//	                 e.options[e.options.length-1].value = sValue;
//	                 e.options[e.options.length-1].text = sText;
	              }            
            }

            function deleteSelectValueNotInList( sControl, sValue){
	              var e = getObject(sControl);
	              if (e!=null && e.type=="select-one")
	              {
	                //alert(e.name);
	              	for(var i=e.options.length-1;i>=0;i--){
	              	  var currentValue = "," + e.options[i].value+","; 
	              	  if (sValue.indexOf(currentValue)<0){
	              		  //alert("delete "+e.options[i].text);
	              		  for(j=i+1;j<e.options.length;j++){
	     	                 e.options[j-1].value =  e.options[j].value
	     	                 e.options[j-1].text = e.options[j].text;
	              		  }
	  	              	  e.options.length=e.options.length-1;
		              }
	              	}
	              } 
	                         
          }
            
      function showMultiMediaFrame(multimediaDiv,multimediaIFrame,multimediaDefaultImg) {
//      alert("xxx");
//      alert(multimediaDefaultImg.name);
                multimediaDiv.style.visibility="hidden";

	       		multimediaIFrame.width = multimediaDefaultImg.width+"px";
	       		multimediaIFrame.height= multimediaDefaultImg.height+"px";

       			//multimediaDiv.style.top=multimediaDefaultImg.offsetParent.offsetTop;
       			//multimediaDiv.style.left=multimediaDefaultImg.offsetParent.offsetLeft;
       			multimediaDiv.style.top=findPosY(multimediaDefaultImg);
       			multimediaDiv.style.left=findPosX(multimediaDefaultImg);
	       		multimediaDiv.style.width = multimediaDefaultImg.width+"px";
	       		multimediaDiv.style.height= multimediaDefaultImg.height+"px";
                multimediaDiv.style.visibility="visible";

                multimediaIFrame.location.href="ShowMultiMedia.do?FileName="+multimediaDefaultImg.name;
      }

		function playMultiMedia(sName){
		      			alert(sName);
		}
      function showMultiMedia(multimediaDefaultImgIn, multimediaFile) {
			// find the div
			var multimediaDefaultImg;
			if(multimediaDefaultImgIn==null){
				if (typeof window.event != 'undefined') { // IE
					multimediaDefaultImg = window.event.srcElement;
				}
  			  	multimediaFile=multimediaDefaultImg.id;
			} else if(typeof multimediaDefaultImgIn=="string"){
				multimediaDefaultImg = document.getElementById(multimediaDefaultImgIn);
				if(multimediaDefaultImg==null){
					multimediaDefaultImg=getObject(multimediaDefaultImgIn);
				}
			} else {
				multimediaDefaultImg = multimediaDefaultImgIn;
			}
   			var multimediaDiv;
      		var	multimediaIFrame;
      		if(multimediaFile==null){
				if(multimediaDefaultImg.name==""){
					multimediaFile=multimediaDefaultImg.id;
				} else {
      		   		multimediaFile=multimediaDefaultImg.name;
      		    }
      		}
			if(document.layers) 
			{
				multimediaDiv =document.layers["MULTIMEDIA_DIV"];

			}
			else if(document.getElementById) 
			{
				multimediaDiv = document.getElementById("MULTIMEDIA_DIV");
			}
			else if(document.all) 
			{
				multimediaDiv =document.all["MULTIMEDIA_DIV"];					
			}			
			multimediaIFrame = frames["MULTIMEDIA_IFRAME"];
                multimediaDiv.style.visibility="hidden";
				multimediaDiv.style.position='absolute';
				
	       		//multimediaIFrame.width = multimediaDefaultImg.width+"px";
	       		//multimediaIFrame.height= multimediaDefaultImg.height+"px";
	       		//multimediaIFrame.style.top= "10px";
	       		//multimediaIFrame.left= findPosX(multimediaDefaultImg);


       			//multimediaDiv.style.top=multimediaDefaultImg.offsetParent.offsetTop;
       			//multimediaDiv.style.left=multimediaDefaultImg.offsetParent.offsetLeft;
//       			alert(findPosY(multimediaDefaultImg));
//       			alert(findPosX(multimediaDefaultImg));
                multimediaIFrame.location.href="ShowMultiMedia.do?FileName="+multimediaFile;
       			multimediaDiv.style.top=findPosY(multimediaDefaultImg)+"px";
       			multimediaDiv.style.left=findPosX(multimediaDefaultImg)+"px";
	       		multimediaDiv.style.width = multimediaDefaultImg.width+"px";
	       		multimediaDiv.style.height= multimediaDefaultImg.height+"px";
	       		//alert(multimediaDiv.style.height);
                multimediaDiv.style.visibility="visible";
                //multimediaIFrame.height="100%";
	       		//alert(multimediaIFrame.height);
      }

      function showQuickMessage(sTarget, sLink){
        iFrame = document.getElementById(sTarget);
        iFrame.height="20px";
        //rame.width="200px";
        frames[sTarget].location.href=sLink;
        
        //iFrame.location.href=sLink;     	
      }

      function changeListDescription(sObjectName,sValue, sNewDescription){
      	object = getObject(sObjectName);
      	//alert(object.name);
      	for(var i=0;i<object.options.length;i++){
      	  //alert(e.options[i].value);
      	  if( object.options[i].value==sValue) {
             object.options[i].text = sNewDescription;
          }
      	}
      	
      }

      function cleanURL(sURL){
		var sResult=sURL;
		sResult = sResult.replace("//localhost:8081/Example1/","");
		sResult = sResult.replace("//208.109.124.129/","");
		return sResult;
      	
      }      
      
     function DoTopSearchKeyPress(inField, e){
	    var charCode;
	    
	    if(e && e.which){
	        charCode = e.which;
	    }else if(window.event){
	        e = window.event;
	        charCode = e.keyCode;
	    }	
	    if(charCode == "13") {
	     	DoTopSearch();
	    }         
     }      

     function RefreshQueryKeyPress(inField, e){
	    var charCode;
	    
	    if(e && e.which){
	        charCode = e.which;
	    }else if(window.event){
	        e = window.event;
	        charCode = e.keyCode;
	    }	
	    if(charCode == "13") {
	     	//refreshQuery();
	     	//alert(document.getElementById('goButton').id);
	     	document.getElementById('goButton').click();
	    }         
     }      

     function DoTopSearch(){
     	if(document.getElementById('TopSearch').value!=""){
             this.location = "FindContent.do?TopSearch="+document.getElementById('TopSearch').value;
        }
     }      
     
     function unloadCheckModified(){
     	return unloadCheckModifiedAndSaved();
     }
     
     function unloadCheckModifiedAndSaved(){
                     var e2 = getObject("saveForm");
                     if (e2!=null)
                     {
                       if(e2.value==""){
                         if(isFormModified()){
                            if ( confirm("Form is modified would you like to save it first?") )
                            {
                                var frm = getForm();
                                saveData();
                                submitForm(frm);
                                return true;
                            }     
                         }
                       }
                     }
                     return false;
     }
     
     function confirmIfSubFormNeedsToBeSavedBeforeContinuing(sEditFrame,sURL){
			multimediaIFrame = frames[sEditFrame];
//			alert(multimediaIFrame.formModified);
			if(multimediaIFrame!=null && multimediaIFrame.getObject!=null){
			//alert(multimediaIFrame.getObject);
			    var formModified=multimediaIFrame.getObject('formModified');
//			    alert(formModified.url);
				if(formModified!=null){
					if(multimediaIFrame.getObject('formModified').value=="Y"){
						if(!multimediaIFrame.unloadCheckModifiedAndSaved()){
						   multimediaIFrame.getObject("saveForm").value='Cancel';
						   location=sURL;
						} else {
							//location=sURL;
						}
					} else {
	       			   location=sURL;
					}
				} else {
       			   location=sURL;
				}
			} else {
     			location=sURL;
			}
	}
/*
     function confirmIfSubFormNeedsToBeSavedBeforeContinuing(sEditFrame,sURL){
   			var multimediaDiv=null;
      		var	multimediaIFrame=null;
			if(document.layers) 
			{
				multimediaDiv =document.layers[sEditFrame];
				alert('1');

			}
			else if(document.getElementById) 
			{
				multimediaDiv = document.getElementById(sEditFrame);
				//alert('2');
				//alert(multimediaDiv.getElementById('saveForm'));
				//alert(document.getElementById('saveForm'));
				//alert(multimediaDiv.document.getElementById('saveForm'));
				//alert(multimediaDiv.forms.length);
				//alert(multimediaDiv.type);
			}
			else if(document.all) 
			{
				multimediaDiv =document.all[sEditFrame];					
				//alert('3');
			}	
			multimediaIFrame = frames[sEditFrame];
			if(multimediaIFrame!=null){
				alert(multimediaIFrame);
				alert(multimediaIFrame.name);
				//alert(multimediaIFrame.forms[0]);
				//alert(multimediaDiv.forms.length);
				//alert(multimediaDiv.height);
				//alert(multimediaDiv.document);
				alert(multimediaIFrame.document.all.length);
				alert(multimediaIFrame.getObject('formModified').value);
                //for(var i = 0; i < multimediaIFrame.document.all.length; i++)
                //{
                	//if(multimediaDiv.document.all[i].name!='undefined'){
                //	   alert(multimediaIFrame.document.all[i].name + '/'+i+'/'+multimediaIFrame.document.all[i].type);
                	//}
				//}
				//alert(multimediaDiv.frames.length);
				//alert(multimediaDiv.url);
				//alert(multimediaDiv.type);
			} else {
     			location=sURL;
     		}
     }
     //.getObject('formModified')
*/     
     function UpdateCurrentUserDate(){
             this.location = "UpdateCurrentUserDate.do?CurrentUserDate="+document.getElementById('CurrentUserDate').value;
     }
     
function calcHeight(sFrame)
{
  //find the height of the internal page
  var the_height=
    document.getElementById(sFrame).contentWindow.
      document.body.scrollHeight;


  //change the height of the iframe
  document.getElementById(sFrame).height=
      the_height;
}

function calcWidth(sFrame)
{
  //find the height of the internal page
  var the_width=
    document.getElementById(sFrame).contentWindow.
      document.body.scrollWidth;


  //change the height of the iframe
  document.getElementById(sFrame).width=
      the_width;
}

function calcWidthAndHeight(sFrame)
{
	calcWidth(sFrame);
	calcHeight(sFrame);
}    
    
/**
 * DHTML email validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

		function ShowPopup(popupObject,anchorObject)
		{
			hp = document.getElementById(popupObject);
			x = document.getElementById(anchorObject);
			//alert(x.offsetParent);
			
			// Set position of hover-over popup
			//hp.style.top = hoveritem.offsetTop + 18;
			//hp.style.left = hoveritem.offsetLeft + 20;
			var iTop=findPosY(x)+20;
			if(iTop>400){
			   iTop=iTop-70;
			}
			var iLeft=findPosX(x)+20;
			if(iLeft>400){
			   iLeft=iLeft-150;
			}
   			hp.style.top=iTop+"px";
   			hp.style.left=iLeft+"px";
			
			// Set popup to visible
			hp.style.visibility = "Visible";
		}
		
		function HidePopup(popupObject)
		{
			hp = document.getElementById(popupObject);
			hp.style.visibility = "Hidden";
		}
		function refreshScreenQuery(sURL)
		{
//				 var frm = getForm();
//                 submitForm(frm);		
			var sURL2=sURL+"StartValue=";
//alert(sURL2);			
			sURL2=sURL2 + document.getElementById( "StartValue" ).value;
			//sURL2=sURL2 + getObject( "StartValue" ).value;
            //var frm = getForm();		
	  	  	//sURL2=sURL2 + frm.getElementById( "StartValue" ).value;
//alert(sURL2);			
//			if(document.getElementById( "StartValue" )!=null){			
//alert(document.getElementById( "StartValue" ).value);			
//			  sURL2=sURL2 + document.getElementById( "StartValue" ).value;
//			} else {
			//alert('1');
//              var frm = getForm();		
//			  sURL2=sURL2 + frm.getElementById( "StartValue" ).value;
//			}
			//sURL2 = sURL2 + "&FilterFieldName1=" + document.getElementById( "FilterFieldName1" ).value;
			//sURL2 = sURL2 + "&FilterOperator1=" + document.getElementById( "FilterOperator1" ).value;
			//sURL2 = sURL2 + "&FilterFieldValue1=" + document.getElementById( "FilterFieldValue1" ).value;
			//sURL2 = sURL2 + "&FilterFieldName2=" + document.getElementById( "FilterFieldName2" ).value;
			//sURL2 = sURL2 + "&FilterOperator2=" + document.getElementById( "FilterOperator2" ).value;
			//sURL2 = sURL2 + "&FilterFieldValue2=" + document.getElementById( "FilterFieldValue2" ).value;
			//sURL2 = sURL2 + "&Sort1=" + document.getElementById( "Sort1" ).value;
			//sURL2 = sURL2 + "&FilterConnector2=" + document.getElementById( "FilterConnector2" ).value;
//alert(sURL2);			
			location.href = sURL2;
			//alert(sURL2);
		}
/*			     
		function showMenuSimple(szDivID)
		{
			var iTop  = 0;
			var iLeft = 0;
			//popup.style.visibility = "Visible";
			//popup = document.getElementById(popupObject);
			//anchor = document.getElementById('div'+popupObject);
			//popup.x=anchor.x+10;
			//popup.y=anchor.y;
			//alert(anchor.x);
			//alert(anchor.height);
			//ShowPopup(popupObject,'div'+popupObject);
			
		var curDiv=findElement(szDivID);
		
		if(curDiv==null){
			alert('Menu not found:'+szDivID);            
		}
		// hide all menus
		hideAll();

		
		curDiv.isMenu="y";
       		
       		
  		curDiv.style.position='absolute';
   		var div = findElement('div'+szDivID);
      		
		// First, determine how much the visitor has scrolled 
		var scrolledLeft, scrolledTop; 
		if( self.pageYOffset ) { 
		  scrolledLeft = self.pageXOffset; 
		  scrolledTop = self.pageYOffset; 
		} else if( document.documentElement && document.documentElement.scrollTop ) { 
		  scrolledLeft = document.documentElement.scrollLeft; 
		  scrolledTop = document.documentElement.scrollTop; 
		} else if( document.body ) { 
		  scrolledLeft = document.body.scrollLeft; 
		  scrolledTop = document.body.scrollTop; 
		} 
		
		// Next, determine the size of the browser's window 
		var windowWidth, windowHeight; 
		if( self.innerHeight ) { 
		   windowWidth = self.innerWidth; 
		   windowHeight = self.innerHeight; 
		} else if( document.documentElement && document.documentElement.clientHeight ) { 
		   windowWidth = document.documentElement.clientWidth; 
		   windowHeight = document.documentElement.clientHeight; 
		} else if( document.body ) { 
		   windowWidth = document.body.clientWidth; 
		   windowHeight = document.body.clientHeight; 
		} 
		//alert("window:"+windowWidth+"/"+windowHeight);
		
		
		// Find anchor positions
		var anchorLeft, anchorTop; 
		anchorTop=findPosY(div);
		anchorLeft=findPosX(div);
		
		// Next, determine the size of the menu div 
		var divWidth, divHeight; 
		if( curDiv.innerHeight ) { 
		   divWidth = curDiv.innerWidth; 
		   divHeight = curDiv.innerHeight; 
		} else if( curDiv.documentElement && curDiv.clientHeight ) { 
		   divWidth = curDiv.clientWidth; 
		   divHeight = curDiv.clientHeight; 
		} else if( document.body ) { 
		   divWidth = curDiv.clientWidth; 
		   divHeight = curDiv.clientHeight; 
		} 
		
		// ie		
		if((scrolledTop+windowHeight)>(divHeight+anchorTop+iTop)){
		  curDiv.style.top=anchorTop+iTop+"px";
		}else if((anchorTop-iTop-divHeight)>(scrolledTop)){
		  curDiv.style.top=anchorTop-divHeight+"px";
		}else{
		  curDiv.style.top=scrolledTop+"px";
		}
		// ie		
		if((scrolledLeft+windowWidth)>(divWidth+anchorLeft+iLeft)){
		  curDiv.style.left=anchorLeft+iLeft+"px";
		}else if((anchorLeft-iLeft-divWidth)>(scrolledLeft)){
		  curDiv.style.left=(scrolledLeft+windowWidth-divWidth)+"px";
		}else{
		  curDiv.style.left=scrolledLeft+"px";
		}
			      		  
   		curDiv.style.border="8px";
   		iMoveCount=0;
   		curDiv.style.visibility="visible";
   		
   		curDiv.onMouseOut="hideAll();";
       		
			
		}
*/		
/*
function showMenuSimple(szDivID)
   { 
		var curDiv=findElement(szDivID);
		if(curDiv==null){
			alert('Menu not found:'+szDivID);            
		}
		// hide all menus
		hideAll();

		curDiv.isMenu="y";
       		
       		
  		curDiv.style.position='absolute';


 		makeDivAbsolute(szDivID);
 		//alert(curDiv.style.zindex);

   		var div = findElement('div'+szDivID);
   		curDiv.style.left = 0;
   		curDiv.style.top = 0;
		//alert(findPosY(div));
   		iTop = findPosY(div)-curDiv.clientHeight-findPosY(curDiv);
   		//alert(iTop);
   		curDiv.style.left = findPosX(div);
   		curDiv.style.top = iTop;
   		curDiv.style.border="8px";
   		iMoveCount=0;
   		curDiv.style.visibility="visible";
   		curDiv.style.zIndex=100;
   }
*/

   function showMenuSimple(szDivID)
   { 
   		var iTop=15;
   		var iLeft=10;
		var curDiv=findElement(szDivID);
		
		if(curDiv==null){
			alert('Menu not found:'+szDivID);            
		}
		// hide all menus
		hideAll();
		curDiv.isMenu="y";
//   		curDiv.style.left = 0;
//   		curDiv.style.top = 0;
       		
       		
  		curDiv.style.position='absolute';


 		makeDivAbsolute(szDivID);
 		//alert(curDiv.style.zindex);

   		var div = findElement('div'+szDivID);
      	var divMenu0 = findElement('menu0');
      	
		// First, determine how much the visitor has scrolled 
		var scrolledLeft, scrolledTop; 
		if( self.pageYOffset ) { 
		  scrolledLeft = self.pageXOffset; 
		  scrolledTop = self.pageYOffset; 
		} else if( document.documentElement && document.documentElement.scrollTop ) { 
		  scrolledLeft = document.documentElement.scrollLeft; 
		  scrolledTop = document.documentElement.scrollTop; 
		} else if( document.body ) { 
		  scrolledLeft = document.body.scrollLeft; 
		  scrolledTop = document.body.scrollTop; 
		} 
		
		// Next, determine the size of the browser's window 
		var windowWidth, windowHeight; 
		if( self.innerHeight ) { 
		   windowWidth = self.innerWidth; 
		   windowHeight = self.innerHeight; 
		} else if( document.documentElement && document.documentElement.clientHeight ) { 
		   windowWidth = document.documentElement.clientWidth; 
		   windowHeight = document.documentElement.clientHeight; 
		} else if( document.body ) { 
		   windowWidth = document.body.clientWidth; 
		   windowHeight = document.body.clientHeight; 
		} 
		//alert("window:"+windowWidth+"/"+windowHeight);
		
		
		// Find anchor positions
		var anchorLeft, anchorTop; 
//		anchorTop=findPosY(div,"ui-sortable");
//		anchorLeft=findPosX(div,"ui-sortable");
		anchorTop=findPosY(div);
		anchorLeft=findPosX(div);
		//alert(anchorTop+"/"+anchorLeft+"/"+div);
		// Next, determine the size of the menu div 
		var divWidth, divHeight; 
		if( curDiv.innerHeight ) { 
		   divWidth = curDiv.innerWidth; 
		   divHeight = curDiv.innerHeight; 
		} else if( curDiv.documentElement && curDiv.clientHeight ) { 
		   divWidth = curDiv.clientWidth; 
		   divHeight = curDiv.clientHeight; 
		} else if( document.body ) { 
		   divWidth = curDiv.clientWidth; 
		   divHeight = curDiv.clientHeight; 
		} 
		
		if((scrolledTop+windowHeight)>(divHeight+anchorTop+iTop)){
		  divMenu0.style.top=anchorTop+iTop+"px";
		}else if((anchorTop-iTop-divHeight)>(scrolledTop)){
		  divMenu0.style.top=anchorTop-divHeight+"px";
		}else{
		  divMenu0.style.top=scrolledTop+"px";
		}
		
		// force above if in a div
		//if(findPosY(curDiv)!=0){
		//  curDiv.style.top=anchorTop-divHeight+"px" 
		//}		
		if((scrolledLeft+windowWidth)>(divWidth+anchorLeft+iLeft)){
		  divMenu0.style.left=anchorLeft+iLeft+"px";
		}else if((anchorLeft-iLeft-divWidth)>(scrolledLeft)){
		  divMenu0.style.left=(scrolledLeft+windowWidth-divWidth)+"px";
		}else{
		  divMenu0.style.left=scrolledLeft+"px";
		}
		divMenu0.innerHTML =curDiv.innerHTML;
		divMenu0.style.position='absolute';      		  
   		divMenu0.style.border="8px";
   		iMoveCount=0;
   		divMenu0.style.visibility="visible";
   		divMenu0.style.zIndex=100;
   		
   		divMenu0.onMouseOut="hideAll();";
//   		curDiv.onMouseOut="alert('111');";
       		

    }

			function postComment(sContentRecordNumber, sFieldName, sParentRecordNumber){
			   var frm = getForm();
			   //frm.ContentRecordNumber.value = sContentRecordNumber;
			   document.getElementById("ContentRecordNumber").value = sContentRecordNumber;
			   document.getElementById("ContentCommentHTML").value = //"<PRE>"+
			   									document.getElementById(sFieldName).value 
			   									//+"</PRE>"
			   									;
			   document.getElementById("ParentRecordNumber").value = sParentRecordNumber;
			   frm.action = "ContentCommentPostQuick.do";
			   frm.submit();
			   //ThemedCommentDisplay.do
			}
			
   	function SwapMenu(sMenu){
	  if (document.getElementById("channelLinksListInstitutionMenuRecordNumber").value!=sMenu){
		  var displayDiv=findElement("TabMenu");
		  var hoverDiv=findElement("TabMenu"+sMenu)
		  displayDiv.innerHTML = hoverDiv.value;
		  document.getElementById("channelLinksListInstitutionMenuRecordNumber").value=sMenu;
	  }
	  return true;
	}
	
            function logon()
            {         
            	if(getObject("InstitutionRecordNumber").value==""){
            		alert("Institution number is required");
            	} else if(getObject("UserId").value==""){
            		alert("User Id is required");
            	} else if(getObject("Password").value==""){
            		alert("Password is required");
            	} else {
//            		var btn=getObject("btnLogon");
            		//if(btn!=null){
//            			btn.ONKEYPRESS="";
//						btn.onClick="";
					//}
            		showPleaseWait();
					submitCurrentForm();
                }
            }
            
            function checkIfPressedEnterThenLogin(inField, e){
			    var charCode;
			    
			    if(e && e.which){
			        charCode = e.which;
			    }else if(window.event){
			        e = window.event;
			        charCode = e.keyCode;
			    }	
			    if(charCode == "13") {
			        logon();
			    }            
            }
            function doNothing(){}
            
            function facebookLogon(){
            	//alert(this.location);
            	//alert('facebookLogon-1');
            	//this.location='/facebook/';
            	//alert('facebookLogon-2');
            	//location='/facebook/';
            	//alert('facebookLogon-3');
            	//this.location='/LoginWithFacebook.do';
            	//alert('facebookLogon-4');
          	    showPleaseWait();
            	location='/LoginWithFacebook.do';
            	//alert('facebookLogon-5');
            	
            }
            
            function showPleaseWait(){
          	  if (parent.winPleaseWait && !parent.winPleaseWait.closed){
      			parent.winPleaseWait.close();
          	  }

          	  // show please wait if it exists
                var waitDiv=null;
            	if(document.layers) 
            	{
            		waitDiv =document.layers['pleaseWait'];
            	}
            	else if(document.getElementById) 
            	{
            		waitDiv = document.getElementById('pleaseWait');
            	}
            	else if(document.all) 
            	{
            		waitDiv =document.all['pleaseWait'];			
            	}	    
                if(waitDiv!=null){
            	    var iLeft = ((document.body.clientWidth-350)/2);
            	    var iTop = 17;
		            waitDiv.style.height="128px";
		            waitDiv.style.width="350px";
		            waitDiv.style.top=iTop;
		            waitDiv.style.left=iLeft;
		            waitDiv.style.visibility="visible";
		            parent.scrollTo(0,0);
            	}
            }

            function hidePleaseWait(){
            	  if (parent.winPleaseWait && !parent.winPleaseWait.closed){
        			parent.winPleaseWait.close();
            	  }

            	  // show please wait if it exists
                  var waitDiv=null;
              	if(document.layers) 
              	{
              		waitDiv =document.layers['pleaseWait'];
              	}
              	else if(document.getElementById) 
              	{
              		waitDiv = document.getElementById('pleaseWait');
              	}
              	else if(document.all) 
              	{
              		waitDiv =document.all['pleaseWait'];			
              	}	    
                  if(waitDiv!=null){
  		            waitDiv.style.visibility="hidden";
              	}
              }
            
            function reloadExample()
            {
            	if(document.getElementById('ThemeExample')!=null){
            	 	//alert('iframe');
	            	var sURL="http:ThemedNoPageOnTab.do?AlternateTheme=Y&DisplayInstitutionInfo=N"
	                sURL+="&BarColor="+getObject("BarColor").value.substr(1);
	                sURL+="&BarTextColor="+getObject("BarTextColor").value.substr(1);
	                sURL+="&ButtonColor="+getObject("ButtonColor").value.substr(1);
	                sURL+="&ButtonTextColor="+getObject("ButtonTextColor").value.substr(1);
	                sURL+="&SelectedTabColor="+getObject("SelectedTabColor").value.substr(1);
	                sURL+="&SelectedTabTextColor="+getObject("SelectedTabTextColor").value.substr(1);
	                sURL+="&UnseletedTabColor="+getObject("UnseletedTabColor").value.substr(1);
	                sURL+="&UnseletedTabTextColor="+getObject("UnseletedTabTextColor").value.substr(1);
	                sURL+="&TitleColor="+getObject("TitleColor").value.substr(1);
	                sURL+="&LinkColor="+getObject("LinkColor").value.substr(1);
	                sURL+="&BackgroundColor="+getObject("BackgroundColor").value.substr(1);
	                sURL+="&BackgroundTextColor="+getObject("BackgroundTextColor").value.substr(1);
                	sURL+="&TempBannerImageBackgroundColor="+getObject("DefaultBackgroundColor").value.substr(1);
	                sURL+="&TempBannerImage="+getObject("ImageFileFileName").value;
	                //alert("xxx");
	                //alert(document.getElementById("DefaultBackgroundColor").value);
	                //alert(getObject("DefaultBackgroundColor").value);
	                //if(getObject("DefaultBackgroundColor").value==null){
	                //	sURL+="&TempBannerImageBackgroundColor="+document.document.getElementById("DefaultBackgroundColor").value;
	                //} else {
	                //}
	            	document.getElementById('ThemeExample').src=sURL;
            	} else {
            	 	//alert('no iframe');
            	}
            }
            
            function printdiv( div ){
            	var DocumentContainer = document.getElementById(div);
            	var WindowObject = window.open("", 
            			"PrintWindow",
            			"width=450,height=450,top=50,left=50,toolbars=no,scrollbars=yes,status=no,resizable=yes");
            	WindowObject.document.writeln(DocumentContainer.innerHTML);
            	WindowObject.document.close();
            	WindowObject.focus();
            	WindowObject.print();
            	WindowObject.close();            	
            }