﻿var gridErrIconUrl,gridDivColIcon,gridDivRowIcon;function gridwpUpdatePreview(f,d,k,m,l){var i=document.getElementById(k),j=document.getElementById(m),e="";if(d!=null){var c=d.options[d.selectedIndex];if(c!=null){var a=c.value;if(a!=null&&a!=""){var b=a.indexOf("|"),g="";if(b>0){g=a.substr(b+1);e=a.substr(0,b)}else e=a}}}if(f!=null&&j!=null&&i!=null){var c=f.options[f.selectedIndex];if(c!=null){var a=c.value;if(a!=null&&a!=""){var b=a.indexOf("|"),g="",h;if(b>0){g=a.substr(b+1);h=a.substr(0,b)}else h=a;j.innerHTML='<img src="'+l+e+"\\"+h+'.gif"/>';i.innerText=g}}}}function initializeThemeSelector(b){var a=document.getElementById(b);if(a!=null)a.fireEvent("onchange")}function doGridWZDialog(e,d,c,f,g){var h={},a=window.showModalDialog(GridDialogUrl,h,"scroll:no;center:yes;help:no;status:yes;dialogHeight:420px;dialogWidth:620px");if(a&&a.theme&&a.color&&a.numRows&&a.numCols){var b=document.getElementById(e);b.value=a.theme;b=document.getElementById(d);b.value=a.color;if(a.colorGuid){b=document.getElementById(c);b.value=a.colorGuid}b=document.getElementById(f);b.value=a.numCols;b=document.getElementById(g);b.value=a.numRows;return true}else return false}function validatePosInteger(c){var a=document.getElementById(c);a.value=a.value.replace(/[\t\n ]/,"");if(a.value.match(/^[0-9]+$/)==null||a.value.match(/^0+$/)!=null){var b={};b.field=a;throw b}return a.value}function ValidateRange(c,d){var a=document.getElementById(c);if(a.value>d){var b={};b.field=a;throw b}}function okDialog(){var b={},a="",f=null,e=document.getElementById("_lbTheme"),c=e.options(e.selectedIndex).value,d=c.indexOf("|");if(d!=-1)b.theme=c.substring(0,d);else b.theme=c;e=document.getElementById("_tbColor");c=e.options(e.selectedIndex).value;d=c.indexOf("|");if(d!=-1){b.color=c.substring(0,d);b.colorGuid=c.substring(d+1)}else b.color=c;try{b.numRows=validatePosInteger("_tbRows")}catch(g){a+="- "+L_GridInvalidRow_ErrorMessage;f=g.field}try{b.numCols=validatePosInteger("_tbColumns")}catch(g){if(a!="")a+="\n";else f=g.field;a+="- "+L_GridInvalidCol_ErrorMessage}try{ValidateRange("_tbRows",40);ValidateRange("_tbColumns",20)}catch(g){if(a!="")a+="\n";else f=g.field;a+="- "+L_GridOutOfRange_ErrorMessage}if(a==""){returnValue=b;window.close()}else{alert(a);f.focus()}}