var ifIe6 = false;
var ifIe7 = false;
if(navigator.userAgent.toLowerCase().indexOf("msie 6")!= -1){ifIe6 = true;}
if(navigator.userAgent.toLowerCase().indexOf("msie 7")!= -1){ifIe7 = true;}
var panelsAreValid = true;
var EmptyPanelMsg = "אין ערכים";
function find(id){
return document.getElementById(id);
}
//the class of the searchPanel
function searchData(){
this.type = null;
this.controlName = null;
this.dataArray = [];
this.textArray = [];
this.changeSelection = changeSelection;
this.confirmCriterias = function (){};
this.UpdatePanelTriggerId = "";
this.isLeftSideControl = false;
this.rightSideControlName = "";
this.isRightSideControl = false;
this.leftSideControlName = "";
this.isRequiredDivId = null;
this.AlertMsg = "";
this.CloseBoxFunctionCall = "";
this.dSAr = [];
this.template = null;
this.valueISTxt = false;
this.firstRun = true;
this.EmptyAletMsg = "";
this.AletMsgLeft = "0px";
this.AletMsgTop = "0px";
this.dependentControls = [];
}
mainDataContainer = new searchData();
//here the class "searchData" is extended in order to have the custom functions and Vars for the control
oneSelectClass.prototype = new searchData;
function oneSelectClass(){
this.fromValue = null;
this.fromText = null;
this.controlDivName = null;
this.DisplayValue = null;
this.queryVar = null;
this.confirmCriterias = oneSelectConfirmCriterias;
this.valuesArray = [];
this.hiddenValues = ""; // the input hidden id that holds the criterias selected
this.hiddenText = "";
this.dSAr = [];
this.template = null;
this.template = '
';
}
doubleOneSelectClass.prototype = new searchData;
function doubleOneSelectClass(){
this.fromValue = null;
this.toValue = null;
this.fromText = null;
this.toText = null;
this.controlDivName = null;
this.controlDivNameTo = null;
this.valuesList = "";
this.selectedList = "";
this.changeSelectionTo = changeSelectionTo;
this.confirmCriterias = doubleOneSelectConfirmCriterias;
this.DisplayValue = null;
this.queryVar = null;
this.queryVarTo = null;
this.queryVarAll = null;
this.dSAr = [];
this.template = '';
this.templateTo = '';
}
checkBoxSelectClass.prototype = new searchData;
function checkBoxSelectClass(){
this.prototype = new searchData;
this.valuesList = "";
this.namesList = "";
this.controlDivName = null;
this.controlDivBoxName = null;
this.selectedText = null;
this.DisplayValue = null;
this.queryVar = null;
this.confirmCriterias = checkBoxConfirmCriterias;
this.valuesArray = [];
this.selectionLimit = 0;
this.DisplayLimitMsgId = "";
this.selectionCount = 0;
this.hiddenValues = ""; // the input hidden id that holds the criterias selected
this.hiddenText = "";
this.isDependent = false; // used to skip the control in the initialize function. isDependent=true control must have it's own initialize
this.dSAr = [];
this.template = '';
}
dateSelectClass.prototype = new searchData;
function dateSelectClass(){
this.fromValueY = null;
this.fromTextY = null;
this.fromValueM = null;
this.fromTextM = null;
this.controlDivNameY = null;
this.controlDivNameM = null;
this.DisplayValue = null;
this.queryVar = null;
this.confirmCriterias = dateSelectClassConfirmCriterias;
this.valuesArray = [];
this.changeSelection = dateSelectChangeSelection;
this.dSAr = [];
}
REDateSelectClass.prototype = new searchData;
function REDateSelectClass(){
this.fromValue = null;
this.toValue = null;
this.fromText = null;
this.toText = null;
this.controlDivName = null;
this.controlDivNameTo = null;
this.valuesList = "";
this.selectedList = "";
this.changeSelection = REchangeSelection;
this.changeSelectionTo = REchangeSelectionTo;
this.confirmCriterias = RESelectConfirmCriterias;
this.DisplayValue = null;
this.queryVar = null;
this.queryVarTo = null;
this.queryVarAll = null;
this.dSAr = [];
}
RentPeriodSelectClass.prototype = new searchData;
function RentPeriodSelectClass(){
this.prototype = new searchData;
this.controlDivDayName = null;
this.controlDivMonthName = null;
this.changeSelectionDay = RERentPeriodChangeSelectionDay;
this.changeSelectionMonth = RERentPeriodChangeSelectionMonth;
this.selectedDay = null;
this.selectedMonth = null;
this.DisplayValue = null;
this.queryVar = null;
this.confirmCriterias = RERentPeriodConfirmCriterias;
this.valuesArray = [];
this.hiddenValues = ""; // the input hidden id that holds the criterias selected
this.hiddenText = "";
this.dSAr = [];
}
jobsRolesDomainsSelections.prototype = new searchData;
function jobsRolesDomainsSelections(){
this.prototype = new searchData;
this.queryVar = null;
this.RenderList = jobsRolesDomainsRenderList;
this.AddNewItem = jobsRolesDomainsAddNewItem;
this.RemoveItem = jobsRolesDomainsDeleteItem;
this.valuesArray = [];
this.textArray = [];
this.template = '';
}
//Begin Instance Creation - DataBinding
function RowPanel(){
this.text = null;
this.value = null;
this.objId = 0;
}
var currentDistrict = "";
function instanceDataBindClassReplace(currentTemplate, currentAr, control) {
if(currentTemplate.indexOf("#oneSel#") != -1){
if(typeof(currentAr[2]) != "undefined"){
currentTemplate = currentTemplate.replace("#oneSel#", currentAr[2]);
currentTemplate = currentTemplate.replace("clickRepCss(this.id, " + control.controlName + ");" + control.controlName + ".changeSelection(this.id, " + control.controlName + ")", "");
currentTemplate = currentTemplate.replace("#id#", control.controlDivName + currentAr[0]);
currentTemplate = currentTemplate.replace("#value#", currentAr[0]);
}
else
currentTemplate = currentTemplate.replace("#oneSel#", "oneSel");
}
if(currentTemplate.indexOf("#cSelD#") != -1){
if (typeof (currentAr[2]) != "undefined") {
if (typeof (control.HeaderTemplate) != "undefined") {
control.HeaderTemplate = control.HeaderTemplate.replace(/#control#/g, control.controlName);
currentTemplate = control.HeaderTemplate;
}
currentTemplate = currentTemplate.replace("#cSelD#", currentAr[2]);
if (control.controlName != "sDistricts") {
//dist
currentTemplate = currentTemplate.replace("cClick(this.id, " + control.controlName + ");", "");
currentTemplate = currentTemplate.replace("cClick(this.id, " + control.controlName + ");", "");
} else {
currentTemplate = currentTemplate.replace("cClick(this.id, " + control.controlName + ", \'DontCloseBox\', true);", "");
currentTemplate = currentTemplate.replace("cClick(this.id, " + control.controlName + ", \'DontCloseBox\', true);", "");
}
currentTemplate = currentTemplate.replace("#id#", control.controlDivName + currentAr[0]);
currentTemplate = currentTemplate.replace("#boxId#", control.controlDivBoxName + currentAr[0]);
currentTemplate = currentTemplate.replace("#value#", currentAr[0]);
currentTemplate = currentTemplate.replace("#groupName#", control.controlDivName + currentAr[0]);
currentDistrict = control.controlDivName + currentAr[0];
}
else {
//sub
currentTemplate = currentTemplate.replace("#cSelD#", "cSelD");
currentTemplate = currentTemplate.replace("#groupName#", currentDistrict);
}
}
return currentTemplate;
}
function instanceDataBind(control) {
//Take care that if the page hasbt completely loaded - firstrun stays true
if (typeof(endflag)!='undefined'&&!endflag)
{
control.firstRun=true;
return;
}
//Take care that if the page hasbt completely loaded - firstrun stays true
var MDObj = $get(control.controlName + "MD");
var MDObj2 = $get(control.controlName + "MDTo");
if(MDObj != null){
if(control.firstRun){
var currentAr = control.dSAr;
// alert(currentAr);
// alert(carTypes.dSAr);
MDObj.innerHTML = "";
InnerTob = "";
InnerTobTo = "";
var currentTemplate = control.template;
control.template = currentTemplate.replace(/#control#/g, control.controlName);
if(typeof(control.templateTo) != "undefined")
control.templateTo = control.templateTo.replace(/#control#/g, control.controlName);
for(i=0;i 0){
currentTemplate = currentTemplate.replace("#onOff#", "On");
currentTemplate = currentTemplate.replace("#checked#", "checked=\"checked\"");
}else{
currentTemplate = currentTemplate.replace("#onOff#", "Off");
currentTemplate = currentTemplate.replace("#checked#", "");
}
}else{
currentTemplate = currentTemplate.replace("#onOff#", "Off");
currentTemplate = currentTemplate.replace("#checked#", "");
}
}
if(control.type == "doubleOneSelect"){
if(MDObj2 != null){
currentTemplate2 = control.templateTo;
currentTemplate2 = currentTemplate2.replace("#id#", control.controlDivNameTo + currentAr[i][0]);
if(control.valueISTxt){//checks if the text of the instance also acts as it's value. [0] is id. [1] is text
currentTemplate2 = currentTemplate2.replace("#value#", currentAr[i][0]);
currentTemplate2 = currentTemplate2.replace("#text#", currentAr[i][0]);
currentTemplate2 = currentTemplate2.replace("#inText#", currentAr[i][0]);
}
else{
currentTemplate2 = currentTemplate2.replace("#value#", currentAr[i][0]);
currentTemplate2 = currentTemplate2.replace("#text#", currentAr[i][1]);
currentTemplate2 = currentTemplate2.replace("#inText#", currentAr[i][1]);
}
if(control.queryVarAll == null){
ConVal = intDataContainer[control.queryVarTo.substring(0, control.queryVarTo.length-1)];
if(ConVal == currentAr[i][0]){
currentTemplate2 = currentTemplate2.replace("#onOff#", "On");
}else{
currentTemplate2 = currentTemplate2.replace("#onOff#", "Off");
}
}
if(control.queryVarAll){
ConValTo = intDataContainer[control.queryVarAll.substring(0, control.queryVarAll.length-1)];
if(ConValTo){
tempFirstLoc = ConValTo.indexOf(",");
if(tempFirstLoc > 0){
ConValTo = ConValTo.substring(0, ConValTo.indexOf(","));//if it has "queryVarAll"m it takes the first value (the "from") and the last value (the "to")
if(ConValTo == currentAr[i][0]){
currentTemplate = currentTemplate.replace("#onOff#", "On");
}else{
currentTemplate = currentTemplate.replace("#onOff#", "Off");
}
}
}else{
currentTemplate = currentTemplate.replace("#onOff#", "Off");
}
ConValTo = intDataContainer[control.queryVarAll.substring(0, control.queryVarAll.length-1)];
if(ConValTo){
tempLastLoc = ConValTo.lastIndexOf(",") + 1;
if(tempLastLoc > 0){
ConValTo = ConValTo.substring(tempLastLoc, ConValTo.length);//take last value
if(ConValTo == currentAr[i][0]){
currentTemplate2 = currentTemplate2.replace("#onOff#", "On");
}else{
currentTemplate2 = currentTemplate2.replace("#onOff#", "Off");
}
}
}else{
currentTemplate2 = currentTemplate2.replace("#onOff#", "Off");
}
}
InnerTobTo += currentTemplate2;
}
}
InnerTob += currentTemplate;
}
MDObj.innerHTML = InnerTob;
if(MDObj2 != null)
MDObj2.innerHTML = InnerTobTo;
control.firstRun = false;
GlobalSectionToEnable = "right";
if(control.isLeftSideControl == true){
ConVal = intDataContainer[control.queryVar.substring(0, control.queryVar.length-1)];
if(ConVal){
initializeSearch(searchDataManuf, searchDataFamilies, 'left');
ConVal = intDataContainer[control.queryVar.substring(0, control.queryVar.length-1)];
curVar = find(control.controlDivName + control.fromValue);
if(curVar != null)
curVar.className = curVar.className.replace("On","Off");
OnOverItemReplaceClass(find(control.controlDivName + ConVal), control.controlDivName, ConVal);
SelectedItemReplaceClass(control.controlDivName + ConVal, control.controlDivName, ConVal);
control.changeSelection(control.controlDivName + ConVal, control, "DontCloseBox");
control.confirmCriterias(control);
}
}
}
}
}
//=================================SearchPannel Function Bank===================================
//Change the selection - defines the from "value" and "text" of the control
function changeSelection(divId, control, section){
if(checkSectionClick(section)){
if(find(divId) != null){
control.fromValue = find(divId).attributes["value"].value;
control.fromText = find(divId).attributes["text"].value;
if(section != "DontCloseBox" && control.type == "oneSelect"){
//Confirm
ShouldOpenPanelSetMsg(control);
control.confirmCriterias(control);
//Close Box
if(control.CloseBoxFunctionCall != null && control.CloseBoxFunctionCall != "")
eval(control.CloseBoxFunctionCall);
}
}
}
}
//Change the selection - defines the from "value" and "text" of the control
function dateSelectChangeSelection(divId, control, section) {
if(checkSectionClick(section)){
if(divId.indexOf("carTestsYear") != -1){
control.fromValueY = find(divId).attributes["value"].value;
control.fromTextY = find(divId).attributes["text"].value;
}else{
control.fromValueM = find(divId).attributes["value"].value;
control.fromTextM = find(divId).attributes["text"].value;
}
if(control.fromValueY != null && control.fromValueY != ""){
if(control.fromValueM != null && control.fromValueM != ""){
if(control.CloseBoxFunctionCall != null && control.CloseBoxFunctionCall != ""){
//Confirm
control.confirmCriterias(control);
//Close Box
eval(control.CloseBoxFunctionCall);
}
}
}
}
}
//Change the selection - defines the from "value" and "text" of the control
function checkBoxChangeSelection(divId, control){
control.fromValue = find(divId).attributes["value"].value;
control.fromText = find(divId).attributes["text"].value;
}
//Change the selection - defines the from "value" and "text" of the control
function REchangeSelection(control, dd, mm, yy){
if(control != null && dd != null && mm != null && yy != null){
yy = String(yy);
mm = Number(mm)+1;
var currentDateDisplay = dd+"/"+mm+"/"+yy.substring(yy.length-2, yy.length);
if(String(dd).length == 1)
dd = "0" + dd;
if(String(mm).length == 1)
mm = "0" + mm;
if(yy.length == 1)
yy = "0" + yy;
var currentDate = mm+"/"+dd+"/"+yy;
control.fromValue = currentDate;
control.fromText = currentDateDisplay;
}
}
//defines the to "value" and "text" of the control
function changeSelectionTo(divId, control){
control.toValue = find(divId).attributes["value"].value;
control.toText = find(divId).attributes["text"].value;
}
//defines the to "value" and "text" of the control
function REchangeSelectionTo(control, dd, mm, yy){
if(control != null && dd != null && mm != null && yy != null){
yy = String(yy);
mm = Number(mm)+1;
var currentDateDisplay = dd+"/"+mm+"/"+yy.substring(yy.length-2, yy.length);
if(String(dd).length == 1)
dd = "0" + dd;
if(String(mm).length == 1)
mm = "0" + mm;
if(yy.length == 1)
yy = "0" + yy;
var currentDate = mm+"/"+dd+"/"+yy;
control.toValue = currentDate;
control.toText = currentDateDisplay;
}
}
//Change the selection - change the day selection of the RentPeriod Panel
function RERentPeriodChangeSelectionDay(divId, control){
control.selectedDay = find(divId).attributes["value"].value;
}
//Change the selection - change the Month selection of the RentPeriod Panel
function RERentPeriodChangeSelectionMonth(divId, control){
control.selectedMonth = find(divId).attributes["value"].value;
}
//the confirm criteria function of the oneSelect SearchPannel
function oneSelectConfirmCriterias(control){
if(control.fromValue == "All"){
mainDataContainer.dataArray[control.controlName] = "";
tempDisplayObj = find(control.DisplayValue);
if(tempDisplayObj)
tempDisplayObj.innerHTML = searchAllString;
}else{
mainDataContainer.dataArray[control.controlName] = control.queryVar + control.fromValue;
mainDataContainer.textArray[control.controlName] = control.queryVar + control.fromText;
tempDisplayObj = find(control.DisplayValue);
if(tempDisplayObj)
tempDisplayObj.innerHTML = control.fromText;
}
if(control.hiddenValues != "" && control.hiddenValues != null){
if(control.hiddenText != "" && control.hiddenText != null){
tempNamesList = control.fromText;
tempValueList = control.fromValue;
find(control.hiddenValues).value = tempValueList;
find(control.hiddenText).value = tempNamesList;
controlOpenKeeper = false;//change the status of the models pannel
//__doPostBack("'"+eval(control.UpdatePanelTriggerId)+"',''");
//alert(eval(control.UpdatePanelTriggerId) );
document.location.href = "javascript:__doPostBack('" + eval(control.UpdatePanelTriggerId) + "','')";
//alert(carTypesMD);
//clickRepCss(control.id, control);
// control.changeSelection(control.id, control);
}
}
}
//the confirm criteria function of the REDateSelect SearchPannel
function RESelectConfirmCriterias(control){
if(control.fromValue == "All" || control.toValue == "All"){
if(control.fromValue == "All" && control.toValue != "All"){
mainDataContainer.dataArray[control.controlName] = control.queryVarTo + control.toValue;
mainDataContainer.textArray[control.controlName] = control.queryVarTo + control.toText;
find(control.DisplayValue).innerHTML = searchToString + control.toText;
}
if(control.fromValue != "All" && control.toValue == "All"){
mainDataContainer.dataArray[control.controlName] = control.queryVar + control.fromValue;
mainDataContainer.textArray[control.controlName] = control.queryVar + control.fromText;
find(control.DisplayValue).innerHTML = searchFromString + control.fromText;
}
if(control.fromValue == "All" && control.toValue == "All"){
mainDataContainer.dataArray[control.controlName] = "";
mainDataContainer.textArray[control.controlName] = "";
find(control.DisplayValue).innerHTML = searchAllString;
}
}else{
mainDataContainer.textArray[control.controlName] = control.queryVar + control.toText + "&" + control.queryVarTo + control.fromText;
mainDataContainer.dataArray[control.controlName] = control.queryVar + control.fromValue + "&"+ control.queryVarTo + control.toValue;
find(control.DisplayValue).innerHTML = control.fromText + " - " + control.toText;
}
}
//the confirm criteria function of the dateSelect SearchPannel
function dateSelectClassConfirmCriterias(control){
mainDataContainer.dataArray[control.controlName] = control.queryVar + "01/" + control.fromValueM + "/" + control.fromValueY;
mainDataContainer.textArray[control.controlName] = control.queryVar + control.fromTextM + " " + control.fromTextY;
find(control.DisplayValue).innerHTML = control.fromTextM + " " + control.fromTextY;
}
//inserts the "mainDataContainer" the selected values AND changes the innerHTML of the "DisplayValue" div to the selected value
function doubleOneSelectConfirmCriterias(control){
if(control.fromValue == "All" || control.toValue == "All"){
if(control.fromValue == "All" && control.toValue != "All"){
if(control.queryVarAll != null && control.queryVarAll != ""){
valuesListAr = control.valuesList.split(",");
selectedListList = "";
if (Number(valuesListAr[0]) >= Number(control.toValue)) {
for (ij = valuesListAr.length-1; ij >= 0; ij--) {
if (valuesListAr[ij] == control.toValue) {
selectedListList += valuesListAr[ij] + ",";
break;
} else
selectedListList += valuesListAr[ij] + ",";
}
}
else {
for (ij = 0; ij < valuesListAr.length; ij++) {
if (valuesListAr[ij] == control.toValue) {
selectedListList += valuesListAr[ij] + ",";
break;
} else
selectedListList += valuesListAr[ij] + ",";
}
}
if(selectedListList.substring(selectedListList.length-1, selectedListList.length) == ",")
selectedListList = selectedListList.substring(0, selectedListList.length - 1);
if (selectedListList.substring(0, 1) == ",")
selectedListList = selectedListList.substring(1, selectedListList.length);
control.selectedList = selectedListList;
//control.selectedList = control.valuesList.substring(0, control.valuesList.indexOf(control.toValue)+control.toValue.length);
mainDataContainer.dataArray[control.controlName] = control.queryVarAll + control.selectedList;
mainDataContainer.textArray[control.controlName] = control.queryVar + control.fromText + "&" + control.queryVarTo + control.toText;
}else{
mainDataContainer.dataArray[control.controlName] = control.queryVarTo + control.toValue;
mainDataContainer.textArray[control.controlName] = control.queryVarTo + control.toText;
}
find(control.DisplayValue).innerHTML = searchToString + control.toText;
}
if(control.fromValue != "All" && control.toValue == "All"){
if(control.queryVarAll != null && control.queryVarAll != ""){
valuesListAr = control.valuesList.split(",");
selectedListList = "";
if (Number(valuesListAr[0]) <= Number(control.fromValue)) {
for (ij = 0; ij < valuesListAr.length; ij++) {
if (valuesListAr[ij] == control.fromValue) {
selectedListList = valuesListAr[ij] + ",";
} else {
if (typeof (valuesListAr[ij]) != "undefined" && valuesListAr[ij] != "")
selectedListList += valuesListAr[ij] + ",";
}
}
}
else {
for (ij = valuesListAr.length-1; ij >= 0; ij--) {
if (valuesListAr[ij] == control.fromValue) {
selectedListList = valuesListAr[ij] + ",";
} else {
if (typeof (valuesListAr[ij]) != "undefined" && valuesListAr[ij] != "")
selectedListList += valuesListAr[ij] + ",";
}
}
}
if(selectedListList.substring(selectedListList.length-1, selectedListList.length) == ",")
selectedListList = selectedListList.substring(0, selectedListList.length-1);
control.selectedList = selectedListList;
//control.selectedList = control.valuesList.substring(0, control.valuesList.indexOf(control.toValue)+control.toValue.length);
mainDataContainer.dataArray[control.controlName] = control.queryVarAll + control.selectedList;
mainDataContainer.textArray[control.controlName] = control.queryVar + control.fromText + "&" + control.queryVarTo + control.toText;
}else{
mainDataContainer.dataArray[control.controlName] = control.queryVar + control.fromValue;
mainDataContainer.textArray[control.controlName] = control.queryVar + control.fromText;
}
find(control.DisplayValue).innerHTML = searchFromString + control.fromText;
}
if(control.fromValue == "All" && control.toValue == "All"){
mainDataContainer.dataArray[control.controlName] = "";
mainDataContainer.textArray[control.controlName] = "";
find(control.DisplayValue).innerHTML = searchAllString;
}
}else{
if(Number(control.fromText) > Number(control.toText)){
valuesListAr = control.valuesList.split(",");
selectedListList = "";
if (Number(valuesListAr[0]) >= Number(control.fromValue)) {
for (ij = valuesListAr.length - 1; ij >= 0; ij--) {
if (valuesListAr[ij] == control.toValue) {
selectedListList = valuesListAr[ij] + ",";
} else {
if (typeof (valuesListAr[ij]) != "undefined" && valuesListAr[ij] != "") {
if (Number(valuesListAr[ij]) <= Number(control.fromValue) && Number(valuesListAr[ij]) >= Number(control.toValue))
selectedListList += valuesListAr[ij] + ",";
if (valuesListAr[ij] == control.fromValue)
break;
}
}
}
}
else {
for (ij = 0; ij < valuesListAr.length; ij++) {
if (valuesListAr[ij] == control.toValue) {
selectedListList = valuesListAr[ij] + ",";
} else {
if (typeof (valuesListAr[ij]) != "undefined" && valuesListAr[ij] != "") {
if (Number(valuesListAr[ij]) <= Number(control.fromValue) && Number(valuesListAr[ij]) >= Number(control.toValue))
selectedListList += valuesListAr[ij] + ",";
if (valuesListAr[ij] == control.fromValue)
break;
}
}
}
}
if(selectedListList.substring(selectedListList.length-1, selectedListList.length) == ",")
selectedListList = selectedListList.substring(0, selectedListList.length-1);
control.selectedList = selectedListList;
//control.selectedList = control.valuesList.substring(control.valuesList.indexOf(control.toValue), control.valuesList.indexOf(control.fromValue)+control.fromValue.length);
//check if the control has "queryVarAll". if it does, it means that it uses List_FK IDs as values, not hardcoded values
if(control.queryVarAll != null && control.queryVarAll != ""){
mainDataContainer.dataArray[control.controlName] = control.queryVarAll + control.selectedList;
}else{
mainDataContainer.dataArray[control.controlName] = control.queryVar + control.toValue + "&" + control.queryVarTo + control.fromValue;
}
mainDataContainer.textArray[control.controlName] = control.queryVar + control.toText + "&" + control.queryVarTo + control.fromText;
find(control.DisplayValue).innerHTML = control.fromText + " - " + control.toText;
}else{
valuesListAr = control.valuesList.split(",");
selectedListList = "";
if (Number(valuesListAr[0]) >= Number(control.toValue)) {
for (ij = valuesListAr.length-1; ij >= 0; ij--) {
if (valuesListAr[ij] == control.fromValue) {
selectedListList = valuesListAr[ij] + ",";
} else {
if (typeof (valuesListAr[ij]) != "undefined" && valuesListAr[ij] != "") {
if (Number(valuesListAr[ij]) >= Number(control.fromValue) && Number(valuesListAr[ij]) <= Number(control.toValue))
selectedListList += valuesListAr[ij] + ",";
if (valuesListAr[ij] == control.toValue)
break;
}
}
}
}
else {
for (ij = 0; ij < valuesListAr.length; ij++) {
if (valuesListAr[ij] == control.fromValue) {
selectedListList = valuesListAr[ij] + ",";
} else {
if (typeof (valuesListAr[ij]) != "undefined" && valuesListAr[ij] != "") {
if (Number(valuesListAr[ij]) >= Number(control.fromValue) && Number(valuesListAr[ij]) <= Number(control.toValue))
selectedListList += valuesListAr[ij] + ",";
if (valuesListAr[ij] == control.toValue)
break;
}
}
}
}
if(selectedListList.substring(selectedListList.length-1, selectedListList.length) == ",")
selectedListList = selectedListList.substring(0, selectedListList.length-1);
control.selectedList = selectedListList;
//control.selectedList = control.valuesList.substring(control.valuesList.indexOf(control.fromValue), control.valuesList.indexOf(control.toValue)+control.toValue.length);
//check if the control has "queryVarAll". if it does, it means that it uses List_FK IDs as values, not hardcoded values
if(control.queryVarAll != null && control.queryVarAll != ""){
mainDataContainer.dataArray[control.controlName] = control.queryVarAll + control.selectedList;
}else{
mainDataContainer.dataArray[control.controlName] = control.queryVar + control.fromValue + "&"+ control.queryVarTo + control.toValue;
}
mainDataContainer.textArray[control.controlName] = control.queryVar + control.fromText + "&" + control.queryVarTo + control.toText;
find(control.DisplayValue).innerHTML = control.toText + " - " + control.fromText;
}
}
}
//inserts the "mainDataContainer" the selected values AND changes the innerHTML of the "DisplayValue" div to the selected value
function checkBoxConfirmCriterias(control, clearDeafultTxt){
//control.valuesList = control.valuesList.substring(0, control.valuesList.length-1);//remove the ',' from the string
tempNamesListCB = control.namesList;
tempValueListCB = control.valuesList;
if(control.namesList.substring(control.namesList.length-1, control.namesList.length) == ",")
tempNamesListCB = control.namesList.substring(0, control.namesList.length-1);
if(control.valuesList.substring(control.valuesList.length-1, control.valuesList.length) == ",")
tempValueListCB = control.valuesList.substring(0, control.valuesList.length-1);
if(tempValueListCB != "" && tempValueListCB != "All"){
mainDataContainer.dataArray[control.controlName] = control.queryVar + tempValueListCB;
}else{
mainDataContainer.dataArray[control.controlName] = "";
}
if(tempNamesListCB != "" && tempNamesListCB != searchAllString){
mainDataContainer.textArray[control.controlName] = control.queryVar + tempNamesListCB;
}else{
mainDataContainer.textArray[control.controlName] = "";
}
tempDisplayValue = tempNamesListCB;
if(tempDisplayValue.length >14)
tempDisplayValue = tempDisplayValue.substring(0, 13) + "...";
if(tempValueListCB != "" && tempNamesListCB != "" && find(control.DisplayValue) != null){
find(control.DisplayValue).innerHTML = tempDisplayValue;
find(control.DisplayValue).setAttribute("title", tempNamesListCB);
}
else{
if(!clearDeafultTxt && find(control.DisplayValue) != null){
find(control.DisplayValue).innerHTML = searchAllString;
find(control.DisplayValue).setAttribute("title", searchAllString);
}
}
if(control.hiddenValues != "" && control.hiddenValues != null){
if(control.hiddenText != "" && control.hiddenText != null){
try{
//if(tempValueList != "" && tempNamesList != ""){
find(control.hiddenValues).value = tempValueListCB;
find(control.hiddenText).value = tempNamesListCB;
controlOpenKeeper = false;//change the status of the models pannel
document.location.href = "javascript:__doPostBack('" + eval(control.UpdatePanelTriggerId) + "','')";
//}
}
catch(Error)
{
controlOpenKeeper = false;//change the status of the models pannel
}
}
}
}
//inserts the "mainDataContainer" the selected values AND changes the innerHTML of the "DisplayValue" div to the selected value
function RERentPeriodConfirmCriterias(control){
DaysSum = Number(control.selectedDay) + Number(control.selectedMonth)*31
mainDataContainer.dataArray[control.controlName] = control.queryVar + DaysSum;
mainDataContainer.textArray[control.controlName] = control.queryVar + DaysSum;
find(control.DisplayValue).innerHTML = DaysSum + " ימים";
}
//this function used to be "replaceClass12". it gets the id of the selected div and changes it's css to "SELECTED"
function SelectedItemReplaceClass(theObjId, divName, selectedValue, section){
if(checkSectionClick(section)){
if(selectedValue != null && selectedValue != "undefined"){
//change the old SELECTED to unSELECTED
var oldObjTemp = find(divName + selectedValue);
if(oldObjTemp != null){
oldObjTemp.className = oldObjTemp.className.replace("On","Off");
}
}
//change the clicked div from unChecked to Checked
var objTemp = find(theObjId);
if(objTemp != null){
objTemp.className = objTemp.className.replace("Off","On");
}
}
}
//this function used to be "replaceClass12". it gets the id of the selected div and changes it's css to "SELECTED"
function clickRepCss(theObjId, control, section){
divName = control.controlDivName;
selectedValue = control.fromValue;
if(typeof(control.controlDivNameTo) != "undefined" && theObjId.indexOf(control.controlDivNameTo) > -1){//check if it's a doubleOneSelect AND if it's the To part of it.
divName = control.controlDivNameTo;
selectedValue = control.toValue;
}
if(checkSectionClick(section)){
if(selectedValue != null && selectedValue != "undefined"){
//change the old SELECTED to unSELECTED
var oldObjTemp = find(divName + selectedValue);
if(oldObjTemp != null){
oldObjTemp.className = oldObjTemp.className.replace("On","Off");
}
}
//change the clicked div from unChecked to Checked
var objTemp = find(theObjId);
if(objTemp != null){
objTemp.className = objTemp.className.replace("Off","On");
}
}
}
//this function used to be "checkBoxMark". it gets the id of the selected div and changes it's css to "SELECTED"
function checkSectionClick(section){
if(section == "DontCloseBox")
return true;
if(section){
if(GlobalSectionToEnable == section){
return true;
}else{
return false;
}
}else{
return true;
}
}
function SelectedItemReplaceCBClass(theObjId, control, section, DoPostBack){
if(checkSectionClick(section)){
if(theObjId.indexOf(control.controlDivBoxName) != -1){//if the click was on the checkbox itself, cancel the selection. when the function is called from the upper div, the checkbox will be anabled again
var boxObj = find(theObjId);
if(boxObj.checked){
boxObj.checked = false;
}else{
boxObj.checked = true;
}
}else{// else - if the click was NOT on the check box, "check" the checkbox and contunue changing the css...
var theObj = find(theObjId);
var divBoxName = control.controlDivBoxName + theObj.attributes["value"].value;
var boxObj = find(divBoxName);
var theObjValue = theObj.attributes["value"].value;
var theObjText = theObj.attributes["text"].value;
if(boxObj.checked == false){
if(control.selectionLimit == 0 || control.selectionCount < control.selectionLimit){//check the limit of selections
//change the clicked div from unChecked to Checked
boxObj.checked = true;
control.valuesList += theObjValue + ",";
control.namesList += theObjText + ",";
boxObj.setAttribute("checked","checked");
control.selectionCount++;
}else{
tempLimitObj = find(control.DisplayLimitMsgId);//alert the user that he exceeded the selection limit
if(tempLimitObj != null){
tempLimitObj.style.fontWeight = "bolder";
tempLimitObj.style.color = "Red";
}
}
}else{
//change the clicked div from Checked to unChecked
//if(control.valuesList != ""){
if(control.valuesList != "" && control.valuesList != "All" ){
boxObj.checked = false;
control.valuesList = control.valuesList.replace(theObjValue + ",", "");
control.namesList = control.namesList.replace(theObjText + ",", "");
boxObj.removeAttribute("checked");
control.selectionCount--;
//check there is a DisplayLimitMsgId to return to it's previews style
tempLimitObj = find(control.DisplayLimitMsgId);
if(tempLimitObj != null){
tempLimitObj.style.fontWeight = "normal";
tempLimitObj.style.color = "#0084c4";
}
}
}
if(typeof(DoPostBack) != "undefined" && DoPostBack == true){ //check if DoPostBack is enabled, go and confirm the criterias
if(control.valuesList != "All" && control.namesList != searchAllString)
tempNamesListCB = control.namesList;
tempValueListCB = control.valuesList;
if(control.namesList.substring(control.namesList.length-1, control.namesList.length) == ",")
tempNamesListCB = control.namesList.substring(0, control.namesList.length-1);
if(control.valuesList.substring(control.valuesList.length-1, control.valuesList.length) == ",")
tempValueListCB = control.valuesList.substring(0, control.valuesList.length-1);
if(tempValueListCB != "" && tempValueListCB != "All"){
mainDataContainer.dataArray[control.controlName] = control.queryVar + tempValueListCB;
}else{
mainDataContainer.dataArray[control.controlName] = "";
}
if(tempNamesListCB != "" && tempNamesListCB != searchAllString){
mainDataContainer.textArray[control.controlName] = control.queryVar + tempNamesListCB;
}else{
mainDataContainer.textArray[control.controlName] = "";
}
if(control.hiddenValues != "" && control.hiddenValues != null){
if(control.hiddenText != "" && control.hiddenText != null){
//if(tempValueList != "" && tempNamesList != ""){
find(control.hiddenValues).value = tempValueListCB;
find(control.hiddenText).value = tempNamesListCB;
controlOpenKeeper = false;//change the status of the models pannel
document.location.href = "javascript:__doPostBack('" + eval(control.UpdatePanelTriggerId) + "','')";
//}
}
}
//control.confirmCriterias(control);
}
}
}
}
function cClick(theObjId, control, section, DoPostBack) {
if (theObjId.indexOf("Head") > 0) {
theObjId = theObjId.substring(0, theObjId.indexOf("Head"));
}
if(checkSectionClick(section)){
if(theObjId.indexOf(control.controlDivBoxName) != -1){//if the click was on the checkbox itself, cancel the selection. when the function is called from the upper div, the checkbox will be anabled again
var boxObj = find(theObjId);
if(boxObj.checked){
boxObj.checked = false;
}else{
boxObj.checked = true;
}
}else{// else - if the click was NOT on the check box, "check" the checkbox and contunue changing the css...
var theObj = find(theObjId);
var divBoxName = control.controlDivBoxName + theObj.attributes["value"].value;
var boxObj = find(divBoxName);
var theObjValue = theObj.attributes["value"].value;
var theObjText = theObj.attributes["text"].value;
if(boxObj.checked == false){
if(control.selectionLimit == 0 || control.selectionCount < control.selectionLimit){//check the limit of selections
//change the clicked div from unChecked to Checked
boxObj.checked = true;
control.valuesList += theObjValue + ",";
control.namesList += theObjText + ",";
boxObj.setAttribute("checked","checked");
control.selectionCount++;
}else{
tempLimitObj = find(control.DisplayLimitMsgId);//alert the user that he exceeded the selection limit
if(tempLimitObj != null){
tempLimitObj.style.fontWeight = "bolder";
tempLimitObj.style.color = "Red";
}
}
}else{
//change the clicked div from Checked to unChecked
//if(control.valuesList != ""){
if(control.valuesList != "" && control.valuesList != "All" ){
boxObj.checked = false;
control.valuesList = control.valuesList.replace(theObjValue + ",", "");
control.namesList = control.namesList.replace(theObjText + ",", "");
boxObj.removeAttribute("checked");
control.selectionCount--;
//check there is a DisplayLimitMsgId to return to it's previews style
tempLimitObj = find(control.DisplayLimitMsgId);
if(tempLimitObj != null){
tempLimitObj.style.fontWeight = "normal";
tempLimitObj.style.color = "#0084c4";
}
}
}
if(typeof(DoPostBack) != "undefined" && DoPostBack == true){ //check if DoPostBack is enabled, go and confirm the criterias
if(control.valuesList != "All" && control.namesList != searchAllString)
tempNamesListCB = control.namesList;
tempValueListCB = control.valuesList;
if(control.namesList.substring(control.namesList.length-1, control.namesList.length) == ",")
tempNamesListCB = control.namesList.substring(0, control.namesList.length-1);
if(control.valuesList.substring(control.valuesList.length-1, control.valuesList.length) == ",")
tempValueListCB = control.valuesList.substring(0, control.valuesList.length-1);
if(tempValueListCB != "" && tempValueListCB != "All"){
mainDataContainer.dataArray[control.controlName] = control.queryVar + tempValueListCB;
}else{
mainDataContainer.dataArray[control.controlName] = "";
}
if(tempNamesListCB != "" && tempNamesListCB != searchAllString){
mainDataContainer.textArray[control.controlName] = control.queryVar + tempNamesListCB;
}else{
mainDataContainer.textArray[control.controlName] = "";
}
if(control.hiddenValues != "" && control.hiddenValues != null){
if(control.hiddenText != "" && control.hiddenText != null){
//if(tempValueList != "" && tempNamesList != ""){
find(control.hiddenValues).value = tempValueListCB;
find(control.hiddenText).value = tempNamesListCB;
controlOpenKeeper = false;//change the status of the models pannel
document.location.href = "javascript:__doPostBack('" + eval(control.UpdatePanelTriggerId) + "','')";
//}
}
}
//control.confirmCriterias(control);
}
}
}else{
if(typeof(section) != "undefined" && section == "right" && control.controlName == "searchDataManuf" && theObjId.indexOf(control.controlDivBoxName) != -1){//if the click was on the checkbox itself, cancel the selection. when the function is called from the upper div, the checkbox will be anabled again
var boxObj = find(theObjId);
if(boxObj.checked){
boxObj.checked = false;
}else{
boxObj.checked = true;
}
}
}
}
//this function used to be "replaceClass13". it gets the Object of the selected div and changes it's css to "SELECTED"
function OnOverItemReplaceClass(theObj, divName, selectedValue, operation)
{
if(theObj.id != divName+selectedValue)
{
if(theObj.className.indexOf("Off")!= -1){
if(operation != "out"){
theObj.className = theObj.className.replace("Off","On");
}
}else{
theObj.className = theObj.className.replace("On","Off");
}
}
}
//this function used to be "replaceClass13". it gets the Object of the selected div and changes it's css to "SELECTED"
function ItemRepCss(theObj, control, operation)
{
divName = control.controlDivName;
selectedValue = control.fromValue;
if(typeof(control.controlDivNameTo) != "undefined" && theObj.id.indexOf(control.controlDivNameTo) > -1){
divName = control.controlDivNameTo;
selectedValue = control.toValue;
}
if(theObj.id != divName+selectedValue)
{
if(theObj.className.indexOf("Off")!= -1){
if(operation != "out"){
theObj.className = theObj.className.replace("Off","On");
}
}else{
theObj.className = theObj.className.replace("On","Off");
}
}
}
//this function used to be "replaceClass11" for CheckBoxes. it gets the Object of the selected div and changes it's css to "SELECTED"
function OnOverItemReplaceCBClass(theObj, control, operation)
{
var divBoxName = control.controlDivBoxName + theObj.attributes["value"].value;
var boxObj = find(divBoxName);
if(boxObj.checked == false)
{
if(theObj.className.indexOf("Off")!= -1){
if(operation != "out"){
theObj.className = theObj.className.replace("Off","On");
}
}else{
theObj.className = theObj.className.replace("On","Off");
}
}
}
//this function used to be "replaceClass11" for CheckBoxes. it gets the Object of the selected div and changes it's css to "SELECTED"
function cRepCss(theObj, control, operation)
{
var divBoxName = control.controlDivBoxName + theObj.attributes["value"].value;
var boxObj = find(divBoxName);
if(boxObj != null && boxObj.checked == false)
{
if(theObj.className.indexOf("Off")!= -1){
if(operation != "out"){
theObj.className = theObj.className.replace("Off","On");
}
}else{
theObj.className = theObj.className.replace("On","Off");
}
}
}
function checkAllCB(control, ShowAllResults){
//field = document.getElementsByName("listCB");
field = control.valuesArray;
for (i = 0; i < field.length; i++){
var theObj = find(control.controlDivName + field[i]);
if(theObj != null){
var divBoxName = control.controlDivBoxName + field[i];
var boxObj = find(divBoxName);
var theObjValue = field[i];
var theObjText = theObj.attributes["text"].value;
//change the clicked div from unChecked to Checked
boxObj.checked = true;
//control.valuesList += theObjValue + ",";
//control.namesList += theObjText + ",";
control.valuesList = "";
control.namesList = "";
if(typeof(ShowAllResults) != "undefined" && ShowAllResults == true){
control.valuesList = "All";
control.namesList = searchAllString;
}
control.selectionCount = 0;
boxObj.setAttribute("checked","checked");
theObj.className = theObj.className.replace("Off","On");
}
}
}
function unCheckAllCB(control) {
//field = document.getElementsByName("listCB");
field = control.valuesArray;
for (i = 0; i < field.length; i++) {
var theObj = find(control.controlDivName + field[i]);
if (theObj != null) {
var divBoxName = control.controlDivBoxName + field[i];
var boxObj = find(divBoxName);
var theObjValue = field[i];
var theObjText = theObj.attributes["text"].value;
//change the clicked div from unChecked to Checked
boxObj.checked = false;
control.valuesList = control.valuesList.replace(theObjValue + ",", "");
control.namesList = control.namesList.replace(theObjText + ",", "");
boxObj.removeAttribute("checked", "checked");
theObj.className = theObj.className.replace("On", "Off");
}
}
control.valuesList = "";
control.namesList = "";
control.selectionCount = 0;
tempLimitObj = find(control.DisplayLimitMsgId); //alert the user that he exceeded the selection limit
if (tempLimitObj != null) {
tempLimitObj.style.fontWeight = "normal";
tempLimitObj.style.color = "#0084c4";
}
}
function engageSearch(mainDataContainer){
var searchQuery = "";
var searchTextQuery ="";
for (i = 0; i < controlsNames.length; i++) {
currentVal = mainDataContainer.dataArray[controlsNames[i]];
currentText = mainDataContainer.textArray[controlsNames[i]];
if(currentVal != "" && currentVal != null && currentVal != "undefined"){
searchQuery += currentVal + "&";
searchTextQuery += currentText + "&";
}
}
if(searchQuery.length > 0)
searchQuery = searchQuery.substring(0, searchQuery.length-1);
if(searchTextQuery.length > 0)
searchTextQuery = searchTextQuery.substring(0, searchTextQuery.length-1);
//searchQuery = searchQuery.substring(0, searchQuery.length-1);
//searchTextQuery = searchTextQuery.substring(0, searchTextQuery.length-1);
find('searchQueryH').value = searchQuery;
find('searchTextQueryH').value = searchTextQuery;
if(typeof(document.getElementById('hdnPublish'))!='undefined'&&document.getElementById('hdnPublish')!=null)
{
document.getElementById('hdnPublish').value=1;
}
// **************************************************
//Custom Validations - Created By Ruben-K - 14.10.2009
// **************************************************
//alert("SourceRequester: " + SourceRequester + " | AgentType: " + AgentType + " | searchQuery: " + searchQuery);
var ErrorMsgTitle = "יש לבחור ערכים ב: ";
var ErrorMsg = ErrorMsgTitle;
if (typeof(SourceRequester) != "undefined")
{
if (SourceRequester == "SearchAgent")
{
if (AgentType == "carAgent") // Cars
{
if (searchQuery.indexOf("Type") < 0)
ErrorMsg += " סוג,";
if (searchQuery.indexOf("carManuf") < 0 && searchQuery.indexOf("Family") < 0)
ErrorMsg += " משפחה / יצרן,";
if (searchQuery.indexOf("carModel") < 0)
ErrorMsg += " דגם,";
}
if (AgentType == "SecHandAgent" || AgentType == "SpecAgent") // Second Hands || Specialist
{
if (searchQuery.indexOf("Category") < 0)
ErrorMsg += " קטגוריה,";
if (searchQuery.indexOf("SubCategory") < 0)
ErrorMsg += " תת קטגוריה,";
}
if (AgentType == "AnimalsAgent") // Animals
{
if (searchQuery.indexOf("AnimalSubCategory") < 0)
ErrorMsg += " סוג / גזע,";
}
if (AgentType == "RealEstateShortTermAgent" || AgentType == "RealEstateComRentAgent"
|| AgentType == "RealEstateComAgent" || AgentType == "RealEstatePartnerAgent"
|| AgentType == "RealEstateRentAgent" || AgentType == "RealEstateAgent") // Real Estate Short Term
{
if (searchQuery.indexOf("REPType") < 0)
ErrorMsg += " סוג הנכס,";
if (searchQuery.indexOf("RERoomsFrom") < 0 || searchQuery.indexOf("RERoomsTo") < 0)
ErrorMsg += " חדרים,";
if (searchQuery.indexOf("Areas") < 0)
ErrorMsg += " אזור,";
}
if (AgentType == "RealEstateAbroadAgent") // Animals
{
if (searchQuery.indexOf("REPType") < 0)
ErrorMsg += " סוג הנכס,";
if (searchQuery.indexOf("RERoomsFrom") < 0 || searchQuery.indexOf("RERoomsTo") < 0)
ErrorMsg += " חדרים,";
}
if (ErrorMsg == ErrorMsgTitle)
{
document.getElementById('ErrorMsg').innerHTML = "";
return true;
}else {
ErrorMsg = ErrorMsg.substring(0,ErrorMsg.length-1) + ".";
document.getElementById('ErrorMsg').innerHTML = ErrorMsg;
return false;
}
}
}
// **************************************************
// END Custom Validations - Created By Ruben-K - 14.10.2009
// **************************************************
}
function engageSearchRealEstate(mainDataContainer)
{
engageSearch(mainDataContainer);
var searchTextQuery = "";
searchTextQuery = find('searchTextQueryH').value;
searchText = find('searchQueryH').value;
if(searchTextQuery.length > 0)
{
searchTextQuery += "&";
}
if(typeof(currentExtendMinX)!="undefined" && typeof(currentExtendMinY)!="undefined" &&
typeof(currentExtendMaxX)!="undefined" && typeof(currentExtendMaxY)!="undefined" &&
currentExtendMinX && currentExtendMinY && currentExtendMaxX && currentExtendMaxY)
{
searchTextQuery += "minx=" + currentExtendMinX + "&miny=" + currentExtendMinY + "&maxx=" + currentExtendMaxX + "&maxy=" + currentExtendMaxY;
searchText += "minx=" + currentExtendMinX + "&miny=" + currentExtendMinY + "&maxx=" + currentExtendMaxX + "&maxy=" + currentExtendMaxY;
}
if (typeof (storedDDl) != "undefined") {
searchTextQuery += "&Currency=" + storedDDl;
searchText += "&Currency=" + storedDDl;
}
find('searchQueryH').value = searchText;
find('searchTextQueryH').value = searchTextQuery;
}
function engageSearchNewProjectLeft(mainDataContainer)
{
engageSearchNewProjectLeft(mainDataContainer);
var searchTextQuery = "";
searchTextQuery = find('searchTextQueryHLeft').value;
if(searchTextQuery.length > 0)
{
searchTextQuery += "&";
}
if(typeof(currentExtendMinX)!="undefined" && typeof(currentExtendMinY)!="undefined" &&
typeof(currentExtendMaxX)!="undefined" && typeof(currentExtendMaxY)!="undefined" &&
currentExtendMinX && currentExtendMinY && currentExtendMaxX && currentExtendMaxY)
{
searchTextQuery += "minx=" + currentExtendMinX + "&miny=" + currentExtendMinY + "&maxx=" + currentExtendMaxX + "&maxy=" + currentExtendMaxY;
}
find('searchTextQueryHLeft').value = searchTextQuery;
}
function engageSearchNewProjectLeft(mainDataContainer){
//alert(eval("a"+"1"));
var searchQuery = "";
var searchTextQuery ="";
for(i=0;i 0)
searchQuery = searchQuery.substring(0, searchQuery.length-1);
if(searchTextQuery.length > 0)
searchTextQuery = searchTextQuery.substring(0, searchTextQuery.length-1);
//searchQuery = searchQuery.substring(0, searchQuery.length-1);
//searchTextQuery = searchTextQuery.substring(0, searchTextQuery.length-1);
find('searchQueryHLeft').value = searchQuery;
find('searchTextQueryHLeft').value = searchTextQuery;
}
//gets the instance of the controls with OUT the update panels and sets the initial values selected in the search
function initializeSet(tempQueryVar, currentC, varType, tempC){
if(varType == "from" || varType == "to"){
tempC = intDataContainer[tempQueryVar.substring(0, tempQueryVar.length-1)];
}
if (tempC) {
if(currentC.isLeftSideControl){//"isLeftSideControl" means that this control is on the left side of the "sub controls". if it is, this initializes the control
initializeSearch(eval(currentC.rightSideControlName), currentC, 'left');
}
if(currentC.type == "oneSelect"){
iTempObjFrom = currentC.controlDivName + tempC;
if(find(iTempObjFrom) != null){
SelectedItemReplaceClass(iTempObjFrom, currentC.controlDivName, currentC.fromValue);
currentC.changeSelection(iTempObjFrom, currentC, "DontCloseBox");
currentC.confirmCriterias(currentC);
}
}
if(currentC.type == "doubleOneSelect"){
iTempObjFrom = currentC.controlDivName + tempC;
iTempObjTo = currentC.controlDivNameTo + tempC;
if(find(iTempObjFrom) != null && find(iTempObjTo) != null){
if(varType == "from"){
SelectedItemReplaceClass(iTempObjFrom, currentC.controlDivName, currentC.fromValue);
currentC.changeSelection(iTempObjFrom, currentC, "DontCloseBox")
currentC.confirmCriterias(currentC);
}
if(varType == "to"){
SelectedItemReplaceClass(iTempObjTo, currentC.controlDivNameTo, currentC.toValue);
currentC.changeSelectionTo(iTempObjTo, currentC, "DontCloseBox")
currentC.confirmCriterias(currentC);
}
if(varType == "allFrom"){
SelectedItemReplaceClass(iTempObjFrom, currentC.controlDivName, currentC.fromValue);
currentC.changeSelection(iTempObjFrom, currentC, "DontCloseBox")
currentC.confirmCriterias(currentC);
}
if(varType == "allTo"){
SelectedItemReplaceClass(iTempObjTo, currentC.controlDivNameTo, currentC.toValue);
currentC.changeSelectionTo(iTempObjTo, currentC)
currentC.confirmCriterias(currentC);
}
}
}
if(currentC.type == "checkBoxSelect"){
if(currentC.controlName == "REDistricts" || currentC.controlName == "RECountries"){
tempCArrayInt = tempC.split(",");
for(j=0;j14)
tempDisplayValue = tempDisplayValue.substring(0, 13) + "...";
if(ControlADVObj != null){
ControlADVObj.innerHTML = tempDisplayValue;
ControlADVObj.setAttribute("title", tempNamesListACB);
}
}else{
if(tempNamesListBCB != "" && tempNamesListBCB != searchAllString){
tempDisplayValue = tempNamesListBCB;
if(tempDisplayValue.length >14)
tempDisplayValue = tempDisplayValue.substring(0, 13) + "...";
if(ControlADVObj != null){
ControlADVObj.innerHTML = tempDisplayValue;
ControlADVObj.setAttribute("title", tempNamesListBCB);
}
}
}
}
/*BEGIN COPY*/
//gets the instance of the controls with OUT the update pannle and sets the initial values selected in the search
function initializeOpt() {
GlobalIsDependentControl = false;
for(iCount=0;iCount 0){
tempC = tempC.substring(0, tempC.indexOf(","));//if it has "queryVarAll"m it takes the first value (the "from") and the last value (the "to")
initializeSetOpt(currentC.queryVarAll, currentC, "allFrom", tempC);
}
}
tempC = intDataContainer[currentC.queryVarAll.substring(0, currentC.queryVarAll.length-1)];
if(tempC){
tempLastLoc = tempC.lastIndexOf(",") + 1;
if(tempLastLoc > 0){
tempC = tempC.substring(tempLastLoc, tempC.length);//take last value
initializeSetOpt(currentC.queryVarAll, currentC, "allTo", tempC);
}
}
}
}
if(currentC.isDependent){
if(typeof(intDataContainer[currentC.queryVar.substring(0, currentC.queryVar.length-1)]) != "undefined")
GlobalIsDependentControl = true;
}
}
}
//gets the instance of the controls with OUT the update panels and sets the initial values selected in the search
function initializeSetOpt(tempQueryVar, currentC, varType, tempC){
if(varType == "from" || varType == "to"){
tempC = intDataContainer[tempQueryVar.substring(0, tempQueryVar.length-1)];
}
if (tempC) {
if(currentC.isLeftSideControl){//"isLeftSideControl" means that this control is on the left side of the "sub controls". if it is, this initializes the control
initializeSearch(eval(currentC.rightSideControlName), currentC, 'left');
}
if (currentC.type == "dateSelect") {
tempArr = tempC.split('/');
if (tempArr.length == 3) {
currentC.fromValueM = tempArr[1];
if (currentC.fromValueM.indexOf("0") == 0) {
currentC.fromValueM = currentC.fromValueM.substring(1);
}
var currentText = document.getElementById(currentC.controlDivNameM + currentC.fromValueM).innerHTML.toLowerCase();
if (currentText.indexOf("") >= 0) {
currentText = currentText.substring(currentText.indexOf("") + 6,currentText.indexOf(""));
}
currentC.fromTextM = currentText;
currentC.fromValueY = tempArr[2].substring(0, 4);
currentC.fromTextY = tempArr[2].substring(0, 4);
}
SelectedItemReplaceClass(currentC.controlDivNameM + currentC.fromValueM, currentC.controlDivNameM, currentC.fromValueM);
SelectedItemReplaceClass(currentC.controlDivNameY + currentC.fromValueY, currentC.controlDivNameY, currentC.fromValueY);
currentC.confirmCriterias(currentC);
}
if(currentC.type == "oneSelect"){
iTempObjFrom = currentC.controlDivName + tempC;
//Begin changeSelection
changeSelectionOpt(currentC, tempC);
//End changeSelection
}
if(currentC.type == "doubleOneSelect"){
iTempObjFrom = currentC.controlDivName + tempC;
iTempObjTo = currentC.controlDivNameTo + tempC;
if(varType == "from"){
changeSelectionOpt(currentC, tempC);
}
if(varType == "to"){
changeSelectionToOpt(currentC, tempC);
}
if(varType == "allFrom"){
changeSelectionOpt(currentC, tempC);
}
if(varType == "allTo"){
changeSelectionToOpt(currentC, tempC);
}
}
if (currentC.type == "checkBoxSelect") {
if(currentC.controlName == "REDistricts" || currentC.controlName == "RECountries"){
tempCArrayInt = tempC.split(",");
for(j=0;j 0){
curVar = find(currentC.controlDivName + currentC.fromValue);
if(curVar != null)
curVar.className = curVar.className.replace("On","Off");
currentC.fromValue = tempC;
contDsAr = currentC.dSAr;
dsI=0;
while(typeof(contDsAr[dsI]) != "undefined" && contDsAr[dsI][0] != tempC)
dsI++;
if(typeof(contDsAr[dsI]) != "undefined" && typeof(contDsAr[dsI][1]) != "undefined"){
currentC.fromText = contDsAr[dsI][1];
}else{
if(typeof(contDsAr[dsI]) != "undefined" && typeof(contDsAr[dsI][0]) != "undefined")
currentC.fromText = contDsAr[dsI][0];
}
currentC.confirmCriterias(currentC);
ShouldOpenPanelSetMsg(currentC);
}
}
function changeSelectionToOpt(currentC, tempC){
if(currentC.dSAr.length > 0){
curVar = find(currentC.controlDivNameTo + currentC.toValue);
if(curVar != null)
curVar.className = curVar.className.replace("On","Off");
currentC.toValue = tempC;
contDsAr = currentC.dSAr;
dsI=0;
while(dsI 0){
if(currentC.selectionLimit == 0 || currentC.selectionCount < currentC.selectionLimit){//check the limit of selections
//change the clicked div from unChecked to Checked
currentC.valuesList += tempC + ",";
contDsAr = currentC.dSAr;
dsI=0;
while (contDsAr[dsI][0] != tempC && dsI < contDsAr.length - 1)
dsI++;
if (contDsAr[dsI][0] == tempC) {
currentC.namesList += contDsAr[dsI][1] + ",";
}
currentC.selectionCount++;
} else {
tempLimitObj = find(control.DisplayLimitMsgId);//alert the user that he exceeded the selection limit
if(tempLimitObj != null){
tempLimitObj.style.fontWeight = "bolder";
tempLimitObj.style.color = "Red";
}
}
}
}
//gets the instance of the control with the update pannle and sets the initial values selected in the search
function initUpdatePannelInstanceOpt(control, intDataContainer) {
//initialize control (check if there're values in the query string and loads them into the control)
allowInit = true;
if(control.isRightSideControl){
if(GlobalSectionToEnable == "left"){
allowInit = false;
GlobalSectionToEnable = "right";
//initializeSearch(control, eval(control.leftSideControlName),'left');
//initializeOneControl(eval(control.leftSideControlName));
}
}
if(allowInit){
if(control.type == "checkBoxSelect"){
control.valuesList = "";
control.namesList = "";
}
if(control.type == "oneSelect"){
control.fromValue = "All";
control.fromText = searchAllString;
}
InitDisplayObj = find(control.DisplayValue);
if (InitDisplayObj != null) {
InitDisplayObj.innerHTML = searchAllString;//added late at night
InitDisplayObj.setAttribute("title", searchAllString);//added late at night
}
tempC = intDataContainer[control.queryVar.substring(0, control.queryVar.length-1)];
if(tempC){
tempCArray = tempC.split(",");
for(jj=0;jj