//   utilities.js
//
// This is a file of common JavaScript form validation 
// utilities which can be reused between various modules.
//
//  Created by: M.K
//  Created on: 07/23/2004
//
var scrollPosition="none";

var onloads = new Array();

_editor_url = "./includes/htmlarea/";                     // URL to htmlarea files
var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
if (navigator.userAgent.indexOf('Mac')        >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Opera')      >= 0) { win_ie_ver = 0; }
if (win_ie_ver >= 5.5) {
  document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
  document.write(' language="Javascript1.2"></scr' + 'ipt>');  
} else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }


//trim a string by removing all external spaces
function trim(str) { 
	try
	{
		str.replace(/^\s*/, '').replace(/\s*$/, ''); 
	}
	catch (e)
	{
	}
    

   return str;
} 





function getObj(n,d) {

  var p,i,x; 

  if(!d)

      d=document;
  else
	{
    if (d.getElementById)
        {
		return d.getElementById(n);
        }
	}

   //alert(d.type);
   //return;


   
  if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);

  }



  if(!(x=d[n])&&d.all)

      x=d.all[n];

 

  for(i=0;!x&&i<d.forms.length;i++)

      x=d.forms[i][n];

 

  for(i=0;!x&&d.layers&&i<d.layers.length;i++)

      x=getObj(n,d.layers[i].document);

 

  if(!x && d.getElementById)

      x=d.getElementById(n);



  return x;

}    

function doScroll() 
{
   if(scrollPosition!="none")
	{
       if (scrollPosition=="left")
       {
	   document.getElementById("scroll3").scrollLeft -= 10;
       }
	   else
	   {
       document.getElementById("scroll3").scrollLeft += 10;
	   }

    
	}

   if(scrollPosition!="none")
	{
	setTimeout('doScroll()','30');
	}
   

}

function startScroll(direction)
{
    scrollPosition=direction;
	doScroll();
}

function stopScroll()
{
	scrollPosition="none";
}


/**
 *  String convenience method for checking if the
 *  end of this string equals a given string.
 *
 *  @returns boolean
 *  @throws IllegalArgumentException for parameters
 *                          not of type String
 */
String.prototype.endsWith = function (s) {
    if ('string' != typeof s) {
        throw('IllegalArgumentException: Must pass a ' +
            ' string to String.prototype.endsWith()');
    }
    var start = this.length - s.length;
    return this.substring(start) == s;
};



// Declaring valid date character, minimum year and maximum year
var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(0,pos1)
	var strDay=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		alert("The date format should be : mm/dd/yyyy")
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		alert("Please enter a valid month")
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		alert("Please enter a valid day")
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		alert("Please enter a valid date")
		return false
	}
return true
}

//check if a field exists on a given form
function fieldExists(dform,fieldName)
    {
    for(i=0;i<dform.elements.length;i++)
        {
            if (dform.elements[i].name==fieldName)
                {
                return true;
                }
        }

    return false;
    }

//check if a form by given name exists
function formExists(formName)
    {
    for(i=0;i<document.forms.length;i++)
        {
            if (document.forms[i].name==formName)
                {
                return true;
                }
        }

    return false;
    }

//validate all required fields on a form
// (requires ASP function AddInputValidators called to set the list of required fields)
function validateRequiredFields(dform)
    {
    if (fieldExists(dform,'RequiredTitles'))
		{
       titleArray=dform.RequiredTitles.value.split('!!');
       fieldArray=dform.RequiredFields.value.split('!!');

       for(i=1;i<fieldArray.length;i++)
          {
            if (titleArray[i]!="" && dform.elements[fieldArray[i]] )
                {
                    if (trim(dform.elements[fieldArray[i]].value)=="" || trim(dform.elements[fieldArray[i]].value)=="-1")
                        {
                        alert(titleArray[i]+" is a required field! Please complete.");


                            try
							{
								dform.elements[fieldArray[i]].focus();
                            }
							catch(e)
							{
							}
                            

                        return false;
                        }
                }
           }
        }

    return true;
    }



function ValidateNumber(fld,title)
    {
    if(isNaN(fld.value)) 
        {
        alert(title+' is a numeric field! Please enter a number');
        fld.focus();
        return false;
        }

    return true;
    }

function ValidateDate(fld,Title)
    {
       if (!isDate(fld.value))
          {
          //alert(Title+" is not a valid date! Please correct.");
          fld.focus();
          return false;
          }

    return true;
    }



function tpopup(s)
{
msg=window.open(s, "rblPopup", "scrollbars=yes,status=no,toolbar=no,directories=no,menubar=no,location=no,resizable=yes,width=400,height=400");
}

function cpopup(s,wdth,hght)
{
msg=window.open(s, "rblPopup", "scrollbars=yes,status=no,toolbar=no,directories=no,menubar=no,location=no,resizable=yes,width="+wdth+",height="+hght);
}


function DateAdd(startDate, numDays, numMonths, numYears)
{
	var returnDate = new Date(startDate.getTime());
	var yearsToAdd = numYears;
	
	var month = returnDate.getMonth()	+ numMonths;
	if (month > 11)
	{
		yearsToAdd = Math.floor((month+1)/12);
		month -= 12*yearsToAdd;
		yearsToAdd += numYears;
	}
	returnDate.setMonth(month);
	returnDate.setFullYear(returnDate.getFullYear()	+ yearsToAdd);
	
	returnDate.setTime(returnDate.getTime()+60000*60*24*numDays);
	
	return returnDate;

}

function YearAdd(startDate, numYears)
{
		return DateAdd(startDate,0,0,numYears);
}

function MonthAdd(startDate, numMonths)
{
		return DateAdd(startDate,0,numMonths,0);
}

function DayAdd(startDate, numDays)
{
		return DateAdd(startDate,numDays,0,0);
}

function disallowDate(date) {
  // date is a JS Date object
  if ( date<DayAdd(new Date(),-1) ) {
    return false; // disable everything prior to today
  }
  return false; // enable other dates
}

function UploadFile(FormName,FieldName,Path,Notes)
    {
    window.open('printshop_upload.asp?formname='+FormName+'&fieldname='+FieldName+'&path='+Path+'&Notes='+Notes,'upload_window','resizable=1,location=1,left=10,top=10,height=600,width=800,scrollbars=1');
    }
  
function HTMLEdit(FieldTitle,FieldName)
    {
    fld=document.getElementById(FieldName);

    FormName=escape(fld.form.name);
    FieldName=escape(FieldName);
    FieldTitle=escape(FieldTitle);
    FieldValue=escape(fld.value);

    window.open('printshop_htmledit.asp?FormName='+FormName+'&FieldName='+FieldName+'&FieldTitle='+FieldTitle+'&FieldValue='+FieldValue,'html_window','resizable=1,location=1,left=10,top=10,height=700,width=700');
    }



function SubmitSettingWithAction(dform,setting_id,actionType)
     {
      dform.setting_id.value=setting_id;
      SubmitWithAction(dform,actionType);

	  return false;
     }
     
function SubmitValueWithAction(dform,value_id,actionType)
     {
      dform.value_id.value=value_id;
      SubmitWithAction(dform,actionType);

	  return false;
     }     
     
     
     
     
function SubmitWithAction(dform,actionType)
     {
     
        if (actionType.toUpperCase().indexOf("DELETE")>=0 || actionType.toUpperCase().indexOf("PAY")>=0 || actionType.toUpperCase().indexOf("SUBMIT")>=0 || actionType.toUpperCase().indexOf("COMPLETE")>=0 )
            {
              if (!confirm("Are you sure?"))
                  {
                  return false;
                  }
            }
            
     actionKeyword="actiontype";

     
     if ( actionType.indexOf("2")>=0 )
         {
         actionKeyword="subactiontype";       
         }  
     
     dform.elements[actionKeyword].value=actionType;
     
     
     dform.submit();
	 return false;
     }     
     

function AddToElement(ElementID,Value)
    {
    var fld=document.getElementById(ElementID);

       if (win_ie_ver>5.5)
           {
           editor_insertHTML(ElementID,'\n<br>'+Value,'',0);
           }
       else
           {
           fld.value=fld.value+'\n<br>'+Value;
           }

    }

/* 

Specific functions from this point on

*/
function JobDetails(JobID,ToPrint)
    {
    window.open('printshop_jobdetails.asp?JobID='+JobID+'&ToPrint='+ToPrint,'job_details','resizable=1,scrollbars=1,location=0,menubar=1,left=10,top=10,height=600,width=652');
    }

function ConvertToPDF(FileID)
    {
    window.open('printshop_pdfconvert.asp?FileID='+FileID,'pdf_conversion','resizable=1,scrollbars=1,location=0,left=10,top=10,height=250,width=500');
    }

function UserDetails(UserID)
    {
    window.open('printshop_customerdetails.asp?UserID='+escape(UserID),'user_details','resizable=1,scrollbars=1,location=0,left=10,top=10,height=400,width=450');
    }

function RerouteJob(JobID)
    {
    window.open('printshop_jobadminreroute.asp?JobID='+JobID,'job_reroute','resizable=1,scrollbars=1,location=0,left=10,top=10,height=400,width=450');
    }

function ManageJob(JobID)
    {
    window.open('printshop_adminmanagejobs.asp?JobID='+JobID,'job_manage','resizable=1,scrollbars=1,location=0,left=10,top=10,height=400,width=450');
    }


function JobStatusHistory(JobID)
    {
    window.open('printshop_jobstatushistory.asp?JobID='+JobID,'job_status','resizable=1,scrollbars=1,location=0,left=10,top=10,height=400,width=450');
    }


function ViewInvoice(InvoiceID)
    {
    window.open('printshop_invoicedetails.asp?InvoiceID='+InvoiceID,'invoice_details','resizable=1,scrollbars=1,location=0,menubar=1,left=10,top=10,height=600,width=652');
    }

function ModifyJobAdmin(JobID)
{
window.open('printshop_jobformedit.asp?recordid='+JobID,'job_manage','resizable=1,scrollbars=1,location=0,left=10,top=10,height=700,width=800');
}

function ShippingRequiredSwitch(Nm,Vl,Fm)
    {
    //alert('whopsie!');
    

        for (i=0;i<Fm.elements.length;i++)
           {
           if (Fm.elements[i].name.indexOf("shipping")>=0 && Fm.elements[i].name!=Nm )
               {
               if (Vl=='No')
                   {
                   Fm.elements[i].disabled=true;
                   }
               else
                   {
                   Fm.elements[i].disabled=false;
                   }
               }
           }


 
    }


function SettingDescription(SettingID)
    {
    window.open('printshop_settingdesc.asp?SettingID='+SettingID,'setting_description','resizable=1,scrollbars=1,location=0,left=10,top=10,height=400,width=400');
    }


  
  function DisplayDescription(event,Title,Description)
  {
    Title=unescape(Title);
    Description=unescape(Description);   
     
    doTooltip(event,'<div class=tdrow><b>'+Title+'</b><br><br>'+Description+'</div>');  
  }
  
 function filterTooltip(txt)
 {
 return txt;
 } 
  
  
  function doTooltip(e, msg) {
  if ( typeof Tooltip == "undefined" || !Tooltip.ready ) return;
  Tooltip.show(e, filterTooltip(msg));
}

function hideTip() {
  if ( typeof Tooltip == "undefined" || !Tooltip.ready ) return;
  Tooltip.hide();
}

function doHourglass()
{
  document.body.style.cursor = 'wait';
}

function EditTemplateForm(TemplateID,Side)
{
window.open('printshop_settemplateform.asp?TemplateID='+TemplateID+'&Side='+Side,'template_form','resizable=1,scrollbars=1,location=0,left=10,top=10,height=600,width=850');
}


function PreviewCustomFile(dform,editor_name,content_name,base_url)
    {
    editor=document.getElementById("CE_"+editor_name+"_ID");
    
    var htmlVal=unescape(dform.elements[content_name].value);
    htmlVal=htmlVal.replace("+"," ");
        
    for (i=0;i<dform.elements.length;i++)
        {
           if (dform.elements[i].type=="text")
               {
               htmlVal=htmlVal.replace("["+dform.elements[i].name+"]",dform.elements[i].value);
               htmlVal=htmlVal.replace("["+dform.elements[i].name+"-image]",base_url+dform.elements[i].value);
               }
        }
    
    editor.SetHTML(htmlVal);
    
    
    }
    
function CheckCustomFileEditorFields(dform)
   {
   
      if (fieldExists(dform,"SetFieldsfront"))
          {
          dform.elements["SetFieldsfront"].click();
          }
          
      if (fieldExists(dform,"SetFieldsback"))
          {
          dform.elements["SetFieldsback"].click();
          }      
   
   }    
    
function SubmitJobReport(dform)
   {
   dform.action="printshop_jobreport.asp";
   dform.target="_blank";
   dform.submit();
   
   dform.action="";
   dform.target="_self";
    
   }
   
   
function SubmitWithAction2(dform,recordID,actionType,ispopup)
     {
     //dform.recordid.value=recordID;
    //dform.actiontype.value=actionType;
     
        if (actionType.toUpperCase().indexOf("DELETE")>=0 || actionType.toUpperCase().indexOf("PAY")>=0 || actionType.toUpperCase().indexOf("SUBMIT")>=0 || actionType.toUpperCase().indexOf("COMPLETE")>=0 )
            {
              if (!confirm("Are you sure?"))
                  {
                  return false;
                  }
            }
            
     actionKeyword="actiontype";
     recordKeyword="recordid";
     
     if (actionType.indexOf("up")>=0 || actionType.indexOf("down")>=0 || actionType.indexOf("2")>=0 )
         {
         actionKeyword="subactiontype";
         recordKeyword="subrecordid";         
         }          
     
     var str=window.location.href;
     str=ExcludeQuerystring(str,actionKeyword);
     str=ExcludeQuerystring(str,recordKeyword);

     if (str.indexOf("#")>0)
         { 
         str=str.substr(0,str.indexOf("#"));
         }         
     
	 var myurl=str+ "&"+recordKeyword+"="+recordID+"&"+actionKeyword+"="+actionType;

     if(ispopup=="1")
         {
         window.open(myurl);
		 }
	 else
         {
         window.location.href=myurl;
         }


     return false;
     }   
     
     
 function ExcludeQuerystring(str,queryStr)
    {
    var localStr=str;
    
    
         if (localStr.indexOf(queryStr)>0)
         {
         indexStart=localStr.indexOf(queryStr);
         indexEnd=localStr.indexOf("&",indexStart);
         
             if (indexEnd==-1)
                {
                indexEnd=localStr.length;
                }             
         
         //alert(queryStr+" found at index"+indexStart+",ends at "+indexEnd+"!");        
         //alert(localStr.substring(localStr,indexEnd,localStr.length));
         localStr=localStr.replace(localStr.substring(indexStart,indexEnd),"");
         
         while (localStr.indexOf("&&")>=0)
             {
             localStr=localStr.replace("&&","");
             }
         
         
         //localStr=localStr.substring(localStr,0,indexStart)+localStr.substring(localStr,indexEnd,localStr.length);
         }
     
    return localStr;
    }         


function DisplayReport(dform)
    {
       if (!validateRequiredFields(dform) )
           {
           return;
           }
           
    var BaseURL=dform.BaseURL.value;
    
    parameterArray=dform.ReportParameters.value.split(',');
    
    for (i=0;i<parameterArray.length;i++)
        {
		if (parameterArray[i]!="")
		{
			if (trim(dform.elements[parameterArray[i]].value)!="")
              {        
              BaseURL=BaseURL+"&"+parameterArray[i]+"="+dform.elements[parameterArray[i]].value;
              }
		}

        }
    
         window.open(BaseURL,"reporting_window","location=0,toolbars=0,left=10,top=10,width=800,height=600,resizable=1,scrollbars=1")   
     }
 
 function enableAllFields(dform)
     {
     for (i=0;i<dform.elements.length;i++)
        {
        dform.elements[i].disabled=false;
        }
     }
 
 function getFieldValue(dform,fieldName)
     {
     var val="";
	 var it=0;

     myObj=document.getElementsByName(fieldName);

     if (myObj)
     {
     
     for (it=0;it<myObj.length;it++)
		 {
		 el=myObj[it];

		 if (el.form)
		 {
             if (el.form.name==dform.name)
             {
             val=val+getOneElementValue(el);
             }
		 }
         
		 }
	 }
	 

     return val;       
     }
  
function getOneElementValue(elm)
{
var val1="";
//alert("one element "+elm.name);
//alert(elm.name+" is "+elm.type);
if(elm.type=="hidden")
	{
	return "";
	}

if (elm.type=="radio" || elm.type=="checkbox")
    {

    if (elm.checked==true)
      {
	  //alert(elm.name+" is checked and is checkbox/radio");
      val1=trim(elm.value);
      }
    }
else
    val1=trim(elm.value);

return val1;
}

     
function checkAllAdons(dform)
    {
    return true;

    var i=0;

     for (i=0;i<dform.elements.length;i++)
        {
           if (dform.elements[i].name.endsWith("addon"))
               {
               setIndex=i;
               
               realFieldName=dform.elements[i].name.replace("!!addon","");
               realFieldValue=getFieldValue(dform,realFieldName);
               
               addOnParentName=realFieldName+"!!addonparent";
               addOnParentValue=getFieldValue(dform,addOnParentName);
               
              
               if (realFieldValue.toUpperCase().indexOf(addOnParentValue.toUpperCase())>=0)
                  {
               
                  if (!isEmptySettingValue(realFieldValue) && isEmptySettingValue(dform.elements[setIndex].value) )
                      {
					  alert(addOnParentName);
                      displayName=realFieldName.replace("pjs_","");
                     
					  displayName=displayName.substring(0,displayName.indexOf("!!"));

                      alert(displayName+' is specified as '+realFieldValue+', and has an additional specification value that needs to be provided! Please check.');
                      dform.elements[setIndex].focus();
                      return false;
                      }
                  }
               
               } 
        }   
        
    return true;     
    }     

function isEmptySettingValue(val)
    {
    var val=trim(val);
    
    return (val=="" || val=="-1" || val.toUpperCase().indexOf("NO")==0 );
    }


function checkExclusiveSetting(dform,sourceCategory,sourceFieldName,sourceName)
{
    //alert("checking exclusivity of "+sourceFieldName);
    var it=0;

	for (it=0;it<dform.elements.length;it++)
	{
		var en=dform.elements[it];

		if (en.name!=sourceFieldName && en.name.indexOf("!!"+sourceCategory)>0)
		{
			//alert("found "+en.name);
			var env=getFieldValue(dform,en.name);

			if (!isEmptySettingValue(env))
			{
				alert("["+sourceName+"] is an exclusive setting in category ["+sourceCategory+"]. Please make sure that no other settings in that category are set!");
				return false;
			}
		}
	}

	return true;
}

function checkValidationRule(dform,sourceCategory,sourceDisplayType,sourceName,sourceOperator,sourceValue,targetCategory,targetDisplayType,targetName,targetOperator,targetValue)
     {
     var returnVal=true;
     
	 var sourceFieldName="pjs_"+sourceName+"!!"+sourceDisplayType+"!!"+sourceCategory;
	 var targetFieldName="pjs_"+targetName+"!!"+targetDisplayType+"!!"+targetCategory;

	 

     val1=trim(getFieldValue(dform,sourceFieldName));
     val2=trim(getFieldValue(dform,"pjs_"+targetName+"!!"+targetDisplayType+"!!"+targetCategory));

     //alert("Source value is"+val1);
    

	 if (sourceOperator=="exclusive in category" && !isEmptySettingValue(val1))
	 {
		 return checkExclusiveSetting(dform,sourceCategory,sourceFieldName,sourceName);
	 }

     
     if ( (sourceOperator==">" && ToNumber(val1)>ToNumber(sourceValue)) || (sourceOperator=="<" && ToNumber(val1)<ToNumber(sourceValue)) 
         || (sourceOperator=="=" && val1==sourceValue) || (sourceOperator=="LIKE" && val1.indexof(sourceValue)>=0)
         || (sourceOperator=="empty" && isEmptySettingValue(val1)) || (sourceOperator=="not empty" && !isEmptySettingValue(val1)) )
         {
         //criteria for comparison is met
             returnVal=
             ((targetOperator==">" && ToNumber(val2)>ToNumber(targetValue)) || (targetOperator=="<" && ToNumber(val2)<ToNumber(targetValue)) 
         || (targetOperator=="=" && val2==targetValue) || (targetOperator=="LIKE" && val2.indexof(targetValue)>=0)
         || (targetOperator=="empty" && isEmptySettingValue(val2)) || (targetOperator=="not empty" && !isEmptySettingValue(val2)));
         
         if (!returnVal)
             {
             alert('The following validation rule is violated: \n IF '+sourceName+' '+sourceOperator+' '+sourceValue+'\n'+
             'THEN '+targetName+' '+targetOperator+' '+targetValue+'.\n Please correct the information and submit again.');
             }
               
         
         }
   
   
     return returnVal;  
     }

function ToNumber(val)
{
    if (isNaN(val))
    return 0;
    
    return parseFloat(val);
}


function validateJobUploadFiles(dform)
{
var i=1;

    for(i=1;i<=5;i++)
	{
         fileName=trim(getFieldValue(dform,"addfile"+i));
		 desc=trim(getFieldValue(dform,"addfiledesc"+i));

        if (fileName!="" && desc=="")
        {
        alert('Please provide description for uploaded file #'+i+'!');
        dform.elements["addfiledesc"+i].focus();
		return false;
        }
 
	}

	return true;
}

function bodyOnLoad() 
    {

	      for ( var i = 0 ; i < onloads.length ; i++ )
	         onloads[i]();

    Tooltip.init();
    }

function popupCloseRedirect(href)
{
   var win=window;

   if (window.opener)
   {
	   win=window.opener;
   }

   win.document.location.href=href;

   if (window.opener)
   {
	  window.close();
   }
}


function displayLookup(definitionId)
{
window.open('printshop_lookup.asp?definitionId='+definitionId,'lookup','resizable=1,scrollbars=1,location=0,left=10,top=10,height=400,width=400');
}

function AcceptLookupValue(columnName,columnValue)
{
   
	try
	{
		window.opener.document.getElementById(columnName+"!!filter").value=columnValue
	}
	catch (e)
	{
	}
	
	try
	{
		window.opener.document.getElementById(columnName+"!!filter_low").value=columnValue
	}
	catch (e)
	{
	}	
	
	try
	{
		window.opener.document.getElementById(columnName+"!!filter_high").value=columnValue
	}
	catch (e)
	{
	}
	
	this.close();
	
}