﻿function ShirinkAreas(area) {
    document.write(area.substring(0,15)+ '...');
}
function ChangeColor(tableRow, highLight, normalClassName) {
    if (highLight) {

        tableRow.className = 'highlight-row'; //'#dcfac9';
    }
    else {
        
        tableRow.className = normalClassName;
    }
}
function GetDetailViewLink(OAID, LID, pageID) {

    if(pageID == 0)
    {
    if (OAID == 1) pageID = '36';
    else if (OAID == 2) pageID = '42';
    else if (OAID == 3) pageID = '39';
    else if (OAID == 4) pageID = '18';
    else if (OAID == 5) pageID = '24';
    else if (OAID == 6) pageID = '21';
    else if (OAID == 7) pageID = '9';
    else if (OAID == 8) pageID = '15';
    else if (OAID == 10) pageID = '12';
    else if (OAID == 11) pageID = '27';
    else if (OAID == 12) pageID = '33';
    else if (OAID == 13) pageID = '30';
    }
    var newUrl = "Default.aspx?pageid=" + pageID + "&OAID=" + OAID + "&LID=" + LID;
    window.open(newUrl);
    //window.open(newUrl, "mywindow", "location=0,menubar=0,resizable=1,status=1,scrollbars=1,width=1000,height=800"); 

}
//function GetDetailViewLinkForMostView(OAID, LID) {
//    
//    var pageID = '0';
//    if (OAID == 1) pageID = '36';
//    else if (OAID == 2) pageID = '42';
//    else if (OAID == 3) pageID = '39';
//    else if (OAID == 4) pageID = '18';
//    else if (OAID == 5) pageID = '24';
//    else if (OAID == 6) pageID = '21';
//    else if (OAID == 7) pageID = '9';
//    else if (OAID == 8) pageID = '15';
//    else if (OAID == 10) pageID = '12';
//    else if (OAID == 11) pageID = '27';
//    else if (OAID == 12) pageID = '33';
//    else if (OAID == 13) pageID = '30';
//    document.write("<a target='_blank' href='Default.aspx?pageid=" + pageID + "&amp;OAID=" + OAID + "&amp;LID=" + LID + "'><img src='images/view.gif' alt='نمایش جزئیات'></img></href>");
//    
//}
function ShowCardColumn(columnCard,targetURL) {
    objColumn = document.getElementById('rdoColumn');
    objCard = document.getElementById('rdoCard');
    if (columnCard == 'column') {
        objColumn.checked = 'checked';
        objCard.checked = '';
    }
    else if (columnCard == 'card') {
        objColumn.checked = '';
        objCard.checked = 'checked';
    }
    window.location = targetURL;
}

function EqualCultureUrl(Culture_ID) {
    var result = '';
    var str = self.location.search;
    //alert(str);
var pageIndex = str.indexOf('PageId');
if (pageIndex == '-1') { pageIndex = str.indexOf('pageid'); }
if (pageIndex == '-1') { pageIndex = str.indexOf('pageId'); }
var cultureIndex = str.indexOf('Culture_ID');
var firstAndIndex = str.indexOf('&');

if(pageIndex!= '-1') {
    var pageId = 0;
    if (firstAndIndex == '-1')
        pageId = str.substring(pageIndex + 7);
    else
        pageId = str.substring(pageIndex + 7, firstAndIndex);
    var newPageId = RelatedPageId(pageId);

    result = 'PageId=' + newPageId;
}

var strTail = '';
if (cultureIndex != '-1') {
    strTail = str.substring(firstAndIndex, cultureIndex);
    if (strTail == '0') strTail = '';
    strTail = strTail + str.substring(cultureIndex + 12);
    
    result = result + strTail + '&Culture_ID=' + Culture_ID;
}
else {
    if (firstAndIndex == '-1') { strTail = ''; }
    else { strTail = str.substring(firstAndIndex); }
 result = result + strTail + '&Culture_ID=' + Culture_ID;
}
result = 'Default.aspx?' + result;
return result;
}

function RelatedPageId(pid) {
    
var result = 0;
if (pid == 6) { result = 6; } //search sale
else if (pid == 115) { result = 115; }
//fa to en
//search
else if (pid == 1) { result = 118; } //default
else if (pid == 2) { result = 119; }
else if (pid == 3) { result = 120; }
else if (pid == 4) { result = 121; }
else if (pid == 5) { result = 122; }
//car
else if (pid == 8) { result = 125; }
else if (pid == 11) { result = 128; }
else if (pid == 14) { result = 131; }
else if (pid == 17) { result = 134; }
else if (pid == 20) { result = 137; }
else if (pid == 23) { result = 140; }
else if (pid == 26) { result = 143; }
else if (pid == 29) { result = 146; }
else if (pid == 32) { result = 149; }
else if (pid == 35) { result = 152; }
else if (pid == 38) { result = 155; }
else if (pid == 41) { result = 158; }
//col
else if (pid == 7) { result = 123; }
else if (pid == 16) { result = 133; }
else if (pid == 25) { result = 142; }
else if (pid == 34) { result = 151; }
else if (pid == 10) { result = 127; }
else if (pid == 19) { result = 136; }
else if (pid == 28) { result = 145; }
else if (pid == 37) { result = 154; }
else if (pid == 13) { result = 130; }
else if (pid == 31) { result = 148; }
else if (pid == 22) { result = 139; }
else if (pid == 40) { result = 157; }
//detail
else if (pid == 9) { result = 126; }
else if (pid == 18) { result = 135; }
else if (pid == 27) { result = 144; }
else if (pid == 36) { result = 153; }
else if (pid == 12) { result = 129; }
else if (pid == 21) { result = 138; }
else if (pid == 30) { result = 147; }
else if (pid == 39) { result = 156; }
else if (pid == 15) { result = 132; }
else if (pid == 33) { result = 150; }
else if (pid == 24) { result = 141; }
else if (pid == 42) { result = 159; }


//en to fa
//search
else if (pid == 118) { result = 1; }
else if (pid == 119) { result = 2; }
else if (pid == 120) { result = 3; }
else if (pid == 121) { result = 4; }
else if (pid == 122) { result = 5; }
//car
else if (pid == 125) { result = 8; }
else if (pid == 128) { result = 11; }
else if (pid == 131) { result = 14; }
else if (pid == 134) { result = 17; }
else if (pid == 137) { result = 20; }
else if (pid == 140) { result = 23; }
else if (pid == 143) { result = 26; }
else if (pid == 146) { result = 29; }
else if (pid == 149) { result = 32; }
else if (pid == 152) { result = 35; }
else if (pid == 155) { result = 38; }
else if (pid == 158) { result = 41; }
//col
else if (pid == 123) { result = 7; }
else if (pid == 133) { result = 16; }
else if (pid == 142) { result = 25; }
else if (pid == 151) { result = 34; }
else if (pid == 127) { result = 10; }
else if (pid == 136) { result = 19; }
else if (pid == 145) { result = 28; }
else if (pid == 154) { result = 37; }
else if (pid == 130) { result = 13; }
else if (pid == 148) { result = 31; }
else if (pid == 139) { result = 22; }
else if (pid == 157) { result = 40; }
//detail
else if (pid == 126) { result = 9; }
else if (pid == 135) { result = 18; }
else if (pid == 144) { result = 27; }
else if (pid == 153) { result = 36; }
else if (pid == 129) { result = 12; }
else if (pid == 138) { result = 21; }
else if (pid == 147) { result = 30; }
else if (pid == 156) { result = 39; }
else if (pid == 132) { result = 15; }
else if (pid == 150) { result = 33; }
else if (pid == 141) { result = 24; }
else if (pid == 159) { result = 42; }

//alert('result');
//alert(input);
//alert('pid:'+pid);
//alert('new pid:'+result);
return result;
  
}
function SelectNode(ctrl) {
    var obj = findObj("lblDesc");

    if (!obj)
        return;
    if (ctrl) {
        obj.innerHTML = ctrl.innerHTML;

    }
    else {
        obj.innerHTML = "";
    }
}

function SelectKey(name) {
    window.status = name;
    document.forms.namedItem("Form2").hdnStatus.value = name;
    //alert('Clicked the file ' + name);
}

function findObj(n, d) {

    var p, i, x;
    if (!d)
        d = document;
    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];

    if (!x && d.getElementById)
        x = d.getElementById(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 = findObj(n, d.layers[i].document);
    return x;
}

function toggle(node) {
    var nextDIV = node.nextSibling;
    while (true) {
        if (nextDIV.nodeName == "DIV")
            break;
        if (nextDIV.nodeName == "SPAN") {
            SelectNode(nextDIV);
        }
        nextDIV = nextDIV.nextSibling;
    }
    if (nextDIV.style.display == 'none') {
        if (nextDIV.childNodes.length > 0) {

            if (node.nodeName == "IMG") {
                node.src = getImgDirectory(node.src) + "minus.gif";
            }
        }
        nextDIV.style.display = 'block';
    }
    else {
        if (nextDIV.childNodes.length > 0) {
            if (node.nodeName == "IMG") {
                node.src = getImgDirectory(node.src) + "plus.gif";
            }
        }
        nextDIV.style.display = 'none';
    }
}

function getImgDirectory(source) {
    return source.substring(0, source.lastIndexOf('/') + 1);
}
//----------------------------
function expand(param, param2) {
    alert(param + '--' + param2);
    var param3 = param2.nextSibling;
    alert(param3.tagname);
    var depth = document.getElementById(param);
    alert(depth.style.display);
    depth.style.color = 'red';
    //depth.style.display = 'none';
    depth.style.display = 'none';
    alert(depth.style.display);
}
//-------------------------------------
function ChangedTreeview(checked, val) {
    var where = " dbo.fn_GetLandedAreasWithID(dbo.Landed.ID)  like  '%{" + val + "}%' d54tf ";
    var hf = document.getElementById('hfTreeview');
    value = hf.value;
    if (checked == true) {
        //alert('hi checke is true and val is' + val);
        value = value + where;
    }
    else {
        value = value.replace(where,'');
        //alert('hi checke is false and val is' + val);
    }
    hf.value = value;
    //alert(hf.value);
}
function Seprator(val) {
    var result;
    //alert('val: ' +val);
    var ashar = seprator_ashar(val);
    //alert('ashar: ' + ashar);
    var sahih = seprator_sahih(val);
    //alert('sahih: ' + sahih);
    //seprate sahih part
    var len = sahih.length;
    //alert('len: ' + len);
    if (len > 3) {
        var a = len % 3;
        //alert('a: ' + a);
        var temp;
        temp = sahih.substring(0, a);
        //alert('temp: ' + temp);
        if (a > 0) {temp = temp + ',';}
        for (var i = a; i < len; i++) {
            //alert('i' + i);
            //alert('a' + a);
            temp = temp + sahih.substring(i, i + 3);
            
            //alert('temp: ' + temp);
            i = i + 2;
            if(i<len-1){temp = temp + ',';}
        }
        //alert('last i' + i);
        //temp = temp + ',' + sahih.substring(i);
        sahih = temp;
    }
    /////////////////////////////
    result = sahih;

    if (ashar != '') {
        result = result + '.' + ashar;
    }
    //alert(ashar);
    document.write(result); 
}
function Seprator2(val) {
    val = val.replace(',', '');
    var result;
    var len = val.length;
    if (len > 3) 
    {
        var a = len % 3;
        var temp = '';
        temp = val.substring(0, a);
        if (a > 0) { temp = temp + ','; }
        for (var i = a; i < len; i++) {
            temp = temp + val.substring(i, i + 3);
            i = i + 2;
            if (i < len - 1) { temp = temp + ','; }
        }
        sahih = temp;
    }
    result = sahih;
    return result;
}
function seprator_ashar(val) {
    var result = '';
    var pointer = 0;
    for (var i = 0; i < val.length; i++) {
        //alert('val: ' + val);
        //alert('val' + i + ': ' + val.substring(i, i+1));
        if (val.substring(i,i+1) == '.') {
            pointer = i;
        }
    }
    if (pointer != 0)
        result = val.substring(pointer + 1);
    return result;
}
function seprator_sahih(val) {
    var result = val;
    var pointer = 0;
    for (var i = 0; i < val.length; i++) {
        if (val.substring(i, i + 1) == '.') {
            pointer = i;
        }
    }
    if (pointer != 0)
        result = val.substring(0,pointer);
    return result;
}
//-------------------------------------
function ShowDetial(val)
                {
               
                var a =  document.getElementById('detailDiv');
                var b =  document.getElementById('innerdetailDiv');

                b.innerHTML = val;
                a.style.display="block";

                x = event.clientX;
                y = event.clientY;

                a.style.left= x;
                a.style.top=y;
                alert(InitializeService());

                }
                function CloseDetial(divName)
                {
                target = document.getElementById(divName)
                target.style.display="none";
                }
                function myPopup(url)
                {
                window.open(url,"newWin","width=500, height=500");
                }
//-------------------------------------
function ShowObject(param,isApartment,isVilla,isStore,isBuilding,isResidentialLand)
{

var a = document.getElementById(param.value);

if(isApartment == true)
{
var b = document.getElementById('apartment');
b.style.display='none';
}

if(isVilla == true)
{
var b = document.getElementById('villa');
b.style.display='none';
}

if(isStore == true)
{
var b = document.getElementById('store');
b.style.display='none';
}

if(isBuilding == true)
{
var b = document.getElementById('building');
b.style.display='none';
}
//alert(param.value);
if(isResidentialLand == true)
{
var b = document.getElementById('residentialLand');
b.style.display='none';
}

a.style.display='block';
}
//--------------------------------
function search(pageId,OAID,domainFileCodeFrom,DomainFileCodeTo,where) {
    var hf = document.getElementById('hfTreeview');
    value = hf.value;
    
    if (value.length > 0) {
        where = where + ' and (' + value.substring(0, value.length - 6) + ')';
    }
newURL = CreateNewUrl(pageId,OAID,domainFileCodeFrom,DomainFileCodeTo,where);	 	
//alert(newURL);
document.location.href = newURL;
}
function CreateNewUrl(pageId,OAID,domainFileCodeFrom,DomainFileCodeTo,where)
{
return 'Default.aspx?' + 'PageId=' + pageId + '&OAID=' + OAID + '&DomainFileCodeFrom=' + domainFileCodeFrom + '&DomainFileCodeTo=' + DomainFileCodeTo + '&Where=' + where;
}
function txtVal(param)
{
var result = document.getElementById(param).value;
if (result == '')
   return '0';
return result;   
}
function chkVal(param)
{
return document.getElementById(param).checked;
}
//-------------------------------
function GenerateWhere(varObj,varAct)
{

    var result = '';
    //return '';
//objects
if(varObj == 'apartment')
{
    result = result + WhereObject('3', true, true, true, true, true, true, true, true, false, false, false, false, false, false, false, false, false, true, true, true, false, varAct, false);
}
else if(varObj == 'villa')
{
    result = result + WhereObject('2', false, true, true, true, true, true, false, false, true, true, false, false, false, false, false, true, true, true, true, false, true, varAct, false);
} 
else if(varObj == 'store')
{
    result = result + WhereObject('4', false, false, false, false, false, false, false, false, true, true, true, true, true, true, true, false, false, true, false, false, false, varAct, false);
} 
else if(varObj == 'buildig')
{
    result = result + WhereObject('1', false, true, true, true, true, true, false, false, true, true, false, false, false, false, false, true, true, true, true, true, false, varAct, false);
} 
else if(varObj == 'residentialLand')
{
    result = result + WhereObject('5', false, false, false, false, false, false, false, false, true, true, false, false, false, false, false, false, false, false, false, false, false, varAct, true);
    
} 
//actions
if(varAct == 'sale')
{
  result = result + WhereAction(true,true,true,true,true,true,true,false,false,false,false);
 }
else if(varAct == 'rent')
{
 result = result + WhereAction(false,false,false,true,true,false,false,false,false,true,true);
 }
else if(varAct == 'preSale')
{
  result = result + WhereAction(true,true,true,true,true,false,false,true,true,false,false);
}
else if(varAct == 'goodwill')
{
  result = result + WhereAction(true,true,true,true,true,false,false,false,false,false,false);
 }
else if(varAct == 'partnership')
{
  result = result + WhereAction(true,true,true,true,true,false,false,false,false,false,false);
}
return result; 
}
//----object---------------------------------------------------------------
function WhereObject(id, isDdlUsage, isDdlBuildingStatus, isTxtBuiltOverFrom, isTxtBuiltOverTo, isDdlBedroomFrom, isDdlBedroomTo, isDdlUnitLevelFrom, isDdlUnitLevelTo, isTxtAreaFrom, isTxtAreaTo, isTxtHeightFrom, isTxtHeightTo, isDdlWater, isDdlPowerSubscription, isDdlHeadCountFrom, isTxtAccumulationFrom, isTxtAccumulationTo, isChkPhone, isChkParking, isChkElevator, isChkYard, varAct,isDdlAreaType)
{
//alert('step1');
var result = '';
//Usage
if(isDdlUsage == true)
{
var divUsage = document.getElementById('divUsage'+id);
var  ddlUsage = divUsage.childNodes[0].childNodes[0];
var  Usage_ID = ddlUsage.options[ddlUsage.selectedIndex].value;

if(Usage_ID != '0')
   result = result + ' and Usage_ID=' + Usage_ID;
}
//AreaType
if(isDdlAreaType == true)
{
var divAreaType = document.getElementById('divAreaType'+id);
var  ddlAreaType = divAreaType.childNodes[0].childNodes[0];
var  AreaType_ID = ddlAreaType.options[ddlAreaType.selectedIndex].value;

if(AreaType_ID != '0')
   result = result + ' and AreaType_ID=' + AreaType_ID;
}
//BuildingStatus
if(isDdlBuildingStatus == true)
{
var divBuildingStatus = document.getElementById('divBuildingStatus'+id);

var  ddlBuildingStatus = divBuildingStatus.childNodes[0].childNodes[0];
var  BuildingStatus_ID = ddlBuildingStatus.options[ddlBuildingStatus.selectedIndex].value;

if(BuildingStatus_ID != '0')
   result = result + ' and BuildingStatus_ID=' + BuildingStatus_ID;
}
//alert('step3');
//BuiltOverFrom
if(isTxtBuiltOverFrom == true)
{
    var divBuiltOverFrom = document.getElementById('divBuiltOverFrom' + id);
var  BuiltOverFrom = divBuiltOverFrom.childNodes[1].value;
//alert(BuiltOverFrom);
if(BuiltOverFrom != '')
   result = result + ' and Builtover >= ' + BuiltOverFrom;
}
//alert('step4');
//BuiltOverTo
if(isTxtBuiltOverTo== true)
{
var divBuiltOverTo = document.getElementById('divBuiltOverTo' + id);
var  BuiltOverTo = divBuiltOverTo.childNodes[1].value;
//alert(BuiltOverTo);
if(BuiltOverTo != '')
   result = result + ' and Builtover <= ' + BuiltOverTo;
}
//alert('step5');
//BedroomFrom
if(isDdlBedroomFrom == true)
{
var divBedroomFrom = document.getElementById('divBedroomFrom'+id);
var  ddlBedroomFrom = divBedroomFrom.childNodes[0].childNodes[1];
var  BedroomFrom = ddlBedroomFrom.options[ddlBedroomFrom.selectedIndex].value;

if(BedroomFrom != '0')
   result = result + ' and Bedroom >= ' + BedroomFrom;     
}
//alert('step6');
//BedroomTo
if(isDdlBedroomTo == true)
{
var divBedroomTo = document.getElementById('divBedroomTo'+id);
var  ddlBedroomTo = divBedroomTo.childNodes[0].childNodes[1];
var  BedroomTo = ddlBedroomTo.options[ddlBedroomTo.selectedIndex].value;

if(BedroomTo!= '0')
   result = result + ' and Bedroom <= ' + BedroomTo;     
}
//alert('step7');
//UnitLevelFrom
if(isDdlUnitLevelFrom == true)
{
var divUnitLevelFrom = document.getElementById('divUnitLevelFrom'+id);
var  ddlUnitLevelFrom = divUnitLevelFrom.childNodes[0].childNodes[1];
var  UnitLevelFrom = ddlUnitLevelFrom.options[ddlUnitLevelFrom.selectedIndex].value;

if(UnitLevelFrom != '0')
   result = result + ' and UnitLevel >= ' + UnitLevelFrom;    
}
//alert('step8');
//UnitLevelTo
if(isDdlUnitLevelTo == true)
{
var divUnitLevelTo = document.getElementById('divUnitLevelTo'+id);
var  ddlUnitLevelTo = divUnitLevelTo.childNodes[0].childNodes[1];
var  UnitLevelTo = ddlUnitLevelTo.options[ddlUnitLevelTo.selectedIndex].value;

if(UnitLevelTo != '0')
   result = result + ' and UnitLevel <= ' + UnitLevelTo;    
}
//alert('step9');
//AreaFrom
if(isTxtAreaFrom == true)
{
var divAreaFrom = document.getElementById('divAreaFrom'+id);
var  AreaFrom = divAreaFrom.childNodes[1].value;

if(AreaFrom != '')
   result = result + ' and Area >= ' + AreaFrom;
}
//alert('step10');
//AreaTo
if(isTxtAreaTo == true)
{
var divAreaTo = document.getElementById('divAreaTo'+id);
var  AreaTo = divAreaTo.childNodes[1].value;

if(AreaTo != '')
   result = result + ' and Area <= ' + AreaTo;
}
//alert('step11');
//HeightFrom
if(isTxtHeightFrom == true)
{
var divHeightFrom = document.getElementById('divHeightFrom'+id);
var  HeightFrom = divHeightFrom.childNodes[1].value;

if(HeightFrom != '')
   result = result + ' and Height >= ' + HeightFrom;
}
//alert('step12');
//HeightTo
if(isTxtHeightTo == true)
{
var divHeightTo = document.getElementById('divHeightTo'+id);
var  HeightTo = divHeightTo.childNodes[1].value;

if(HeightTo != '')
   result = result + ' and Height <= ' + HeightTo;
}
//alert('step13');
//Water
if(isDdlWater == true)
{
var divWater = document.getElementById('divWater'+id);
var  ddlWater = divWater.childNodes[0].childNodes[0];
var  Water = ddlWater.options[ddlWater.selectedIndex].value;

if(Water != '0')
     result = result + ' and Water = ' + Water;  
}
//alert('step14');
//PowerSubscription
if(isDdlPowerSubscription == true)
{
var divPowerSubscription = document.getElementById('divPowerSubscription'+id);
var  ddlPowerSubscription = divPowerSubscription.childNodes[0].childNodes[0];
var  PowerSubscription = ddlPowerSubscription.options[ddlPowerSubscription.selectedIndex].value;

if(PowerSubscription != '0')
   result = result + ' and ThreePhasePower = ' + PowerSubscription;  
}
//alert('step15');
//HeadCountFrom
if(isDdlHeadCountFrom == true)
{
var divHeadCountFrom = document.getElementById('divHeadCountFrom'+id);
var  ddlHeadCountFrom = divHeadCountFrom.childNodes[0].childNodes[0];
var  HeadCountFrom = ddlHeadCountFrom.options[ddlHeadCountFrom.selectedIndex].value;

if(HeadCountFrom != '0')
   result = result + ' and HeadCount >= ' + HeadCountFrom;
}
///////////////////isTxtAccumulationFrom

if (isTxtAccumulationFrom == true && varAct == 'partnership') {
    var divAccumulationFrom = document.getElementById('divAccumulationFrom' + id);
    var AccumulationFrom = divAccumulationFrom.childNodes[1].value;
    //alert(BuiltOverFrom);
    if (AccumulationFrom != '')
        result = result + ' and Accumulation >= ' + AccumulationFrom;
}
//alert(varAct);
//BuiltOverTo
if (isTxtAccumulationTo == true && varAct == 'partnership') {
    var divAccumulationTo = document.getElementById('divAccumulationTo' + id);
    var AccumulationTo = divAccumulationTo.childNodes[1].value;
    //alert(BuiltOverTo);
    if (AccumulationTo != '')
        result = result + ' and Accumulation <= ' + AccumulationTo;
}
////////////////////
//alert('step16');
//Phone
if(isChkPhone == true)
{
var divPhone = document.getElementById('divPhone'+id);
var  PhoneLine = divPhone.childNodes[0].checked;

if(PhoneLine == true)
   result = result + ' and PhoneLine > 1 ';  
}
//alert('step17');
//Parking
if(isChkParking == true)
{
var divParking = document.getElementById('divParking'+id);
var  Parking = divParking.childNodes[0].checked;
if(Parking == true)
   result = result + ' and Parking = 1';  
}
//alert('step18');
//Elevator
if(isChkElevator == true)
{
var divElevator = document.getElementById('divElevator'+id);
var  Elevator = divElevator.childNodes[0].checked;
if(Elevator == true)
   result = result + ' and Elevator = 1 ';  
}
//alert('step19');
//Yard
if(isChkYard == true)
{
var divYard = document.getElementById('divYard'+id);
var  Yard = divYard.childNodes[0].checked;
if(Yard == 'True')
   result = result + ' and Yard = True ';  
}
//alert(result);
return result;    
}
//----action-----------------------------------------------------------------------
function WhereAction(isDdlDocumentType,isTxtTotalPriceFrom,isTxtTotalPriceTo,isTxtDomainFileCodeFrom,isTxtDomainFileCodeTo,isTxtLoanFrom,isTxtLoanTo,isTxtDepositFrom,isTxtDepositTo,isTxtLeaseFrom,isTxtLeaseTo)
{
//alert('step1');
var result = '';
//DocumentType
if(isDdlDocumentType == true)
{
var ddlDocumentType = document.getElementById('ddlDocumentType');
var Document_ID = ddlDocumentType.options[ddlDocumentType.selectedIndex].value;

if(Document_ID != '0')
   result = result + ' and Document_ID = ' + Document_ID;
}
//alert('step2');
//TotalPriceFrom
if(isTxtTotalPriceFrom == true)
{
var TotalPriceFrom = document.getElementById('txtTotalPriceFrom').value;

if(TotalPriceFrom != '')
   result = result + ' and TotalPrice >= ' + TotalPriceFrom;
}
//alert('step3');
//TotalPriceTo
if(isTxtTotalPriceTo == true)
{
var TotalPriceTo = document.getElementById('txtTotalPriceTo').value;

if(TotalPriceTo != '')
   result = result + ' and TotalPrice <= ' + TotalPriceTo;
}
//alert('step4');
//DomainFileCodeFrom - غیرفعال
//if(isTxtDomainFileCodeFrom == true)
if(1==2)
{
var DomainFileCodeFrom = document.getElementById('txtDomainFileCodeFrom').value;

if(DomainFileCodeFrom != '')
   result = result + ' and DomainFileCode >= ' + DomainFileCodeFrom; 
}
//alert('step5');
//DomainFileCodeTo غیرفعال
//if(isTxtDomainFileCodeTo == true)
if(1==2)
{
var DomainFileCodeTo = document.getElementById('txtDomainFileCodeTo').value;

if(DomainFileCodeTo != '')
   result = result + ' and DomainFileCode <= ' + DomainFileCodeTo; 
}
//alert('step6');
//LoanFrom
if(isTxtLoanFrom == true)
{
var LoanFrom = document.getElementById('txtLoanFrom').value;

if(LoanFrom != '')
   result = result + ' and Loan >= ' + LoanFrom; 
}
//alert('step7');
//LoanTo
if(isTxtLoanTo == true)
{
var LoanTo = document.getElementById('txtLoanTo').value;

if(LoanTo != '')
   result = result + ' and Loan <= ' + LoanTo; 
}
//alert('step8');
//DepositFrom
if(isTxtDepositFrom == true)
{
var DepositFrom = document.getElementById('txtDepositFrom').value;

if(DepositFrom != '')
   result = result + ' and MinDeposit >= ' + DepositFrom;
}
//alert('step9');
//DepositTo
if(isTxtDepositTo == true)
{
var DepositTo = document.getElementById('txtDepositTo').value;

if(DepositTo != '')
   result = result + ' and MaxDeposit <= ' + DepositTo;
}
//alert('step10');
//LeaseFrom
if(isTxtLeaseFrom == true)
{
var LeaseFrom = document.getElementById('txtLeaseFrom').value;

if(LeaseFrom != '')
     result = result + ' and Lease >= ' + LeaseFrom; 
}
//alert('step11');
//LeaseTo
if(isTxtLeaseTo == true)
{
var LeaseTo = document.getElementById('txtLeaseTo').value;

if(LeaseTo != '')
     result = result + ' and Lease <= ' + LeaseTo; 
}
//alert('step12');
//AccumulationFrom
//if(isTxtAccumulationFrom == true)
//{
//var AccumulationFrom = document.getElementById('txtAccumulationFrom').value;

//if(AccumulationFrom != '')
//   result = result + ' and Accumulation >= ' + AccumulationFrom;
//}
////alert('step13');
////AccumulationTo
//if(isTxtAccumulationTo == true)
//{
//var AccumulationTo = document.getElementById('txtAccumulationTo').value;

//if(AccumulationTo != '')
//   result = result + ' and Accumulation <= ' + AccumulationTo;
//}
//alert(result);
return result;
}
//-----------------------------------
