﻿﻿var selected_radio="B";var selected_region="0";var selected_city="0";$(document).ready(function(){});function getRegion()
{}
function getCity()
{var file_name="";file_name='rbBranches.xml';$.ajax({type:"GET",url:"xml/"+file_name,dataType:"xml",complete:function(data){$("#choosecity").empty();$("#choosecity").append("<option value='0'>--Select City--</option>");var json=$.xmlToJSON(data.responseXML);json.Branch.SortByNode("CITY_EN");var out="",prev="",curr="";var str=selected_region.substring(0,1);if(str=='A')
{for(var i=0;i<json.Branch.length;i++){curr=json.Branch[i].CITY_EN[0].Text;if(curr!=prev)
{if(json.Branch[i].AREA[0].Text==selected_region.substring(1,2))
$("#choosecity").append("<option value="+curr+">"+curr+"</option>");}
prev=curr;}}
else
{for(var i=0;i<json.Branch.length;i++){curr=json.Branch[i].CITY_EN[0].Text;if(curr!=prev)
{if(json.Branch[i].BRANCHTYPE[0].Text==selected_region.substring(1,2))
$("#choosecity").append("<option value="+curr+">"+curr+"</option>");}
prev=curr;}}}});}
function getSearchResult()
{var file_name="";if(selected_radio=='B')
{file_name='rbBranches.xml';$.ajax({type:"GET",url:"xml/"+file_name,dataType:"xml",complete:function(data){var tableString="";var json=$.xmlToJSON(data.responseXML);json.Branch.SortByNode("CODE");$("#searchResult").empty();if(selected_city==0)
{tableString="";}
else
{tableString='<table class="txt" border="0"><tr><th width="20px"></th><th width="60px" align="left">Code</th><th width="280px" align="left">Branch Name</th><th width="260px" align="left">Address</th><th style="text-align:center;width:80px;margin-left:10px; margin-right:10px">Map</th></tr>';}
var str=selected_region.substring(0,1);if(str=='A')
{for(var i=0;i<json.Branch.length;i++)
{if(selected_region.substring(1,2)==json.Branch[i].AREA[0].Text)
{if(selected_city==json.Branch[i].CITY_EN[0].Text)
{if(json.Branch[i].MAP[0].Text)
{var url="'"+json.Branch[i].MAP[0].Text+"/E"+json.Branch[i].CODE[0].Text+".gif'";var map='<td style="text-align:center;width:80px;margin-left:10px; margin-right:10px"><a class="MnuNavLink" href='+url+' onclick="popup('+url+'); return false">View</a></td>';}
else
{var map='</td><td width="80px"></td>';}
tableString+='<tr><td><img id="dropdownimageInner'+i+'" src="../images/collapseplus.gif" onclick="unfoldSubResultDiv('+i+','+json.Branch[i].CODE[0].Text+');" /></td><td width="60px">'+json.Branch[i].CODE[0].Text+'</td><td width="280px">'+json.Branch[i].NAME_EN[0].Text+'</td><td width="260px">'+json.Branch[i].ADRS_EN[0].Text+'</td>'+map+'</tr><tr><td colspan="5"><div id="outer_subSearchResult'+i+'"></div></td></tr>';}}}}
else
{for(var i=0;i<json.Branch.length;i++)
{if(selected_region.substring(1,2)==json.Branch[i].BRANCHTYPE[0].Text)
{if(selected_city==json.Branch[i].CITY_EN[0].Text)
{if(json.Branch[i].MAP[0].Text)
{var url="'"+json.Branch[i].MAP[0].Text+"/E"+json.Branch[i].CODE[0].Text+".gif'";var map='<td style="text-align:center;width:80px;margin-left:10px; margin-right:10px"><a class="MnuNavLink" href='+url+' href='+url+' onclick="popup('+url+'); return false">View</a></td>';}
else
{var map='<td width="80px"></td>';}
tableString+='<tr><td><img id="dropdownimageInner'+i+'" src="../images/collapseplus.gif" onclick="unfoldSubResultDiv('+i+','+json.Branch[i].CODE[0].Text+');" style="width:15px; height:15px;"/></td><td width="60px">'+json.Branch[i].CODE[0].Text+'</td><td width="280px">'+json.Branch[i].NAME_EN[0].Text+'</td><td width="260px">'+json.Branch[i].ADRS_EN[0].Text+'</td>'+map+'</tr><tr><td colspan="5"><div id="outer_subSearchResult'+i+'"></div></td></tr>';}}}}
tableString+="</table>";$("#searchResult").append(tableString);}});}
else
{file_name='rbATMs.xml';$.ajax({type:"GET",url:"xml/"+file_name,dataType:"xml",complete:function(data){var tableString="";var json=$.xmlToJSON(data.responseXML);json.ATMDetails.SortByNode("CITY_EN");$("#searchResult").empty();if(selected_city==0)
{tableString="";}
else
{tableString='<table class="txt" border="0"><tr><th width="60px">code</th><th style="text-align:center;width:280px;margin-left:10px; margin-right:10px">ATM Name</th><th style="text-align:center;width:270px;margin-left:10px; margin-right:10px">Location</th><th width="90px" align="left">Map</th></tr>';}
for(var i=0;i<json.ATMDetails.length;i++)
{if(selected_city==json.ATMDetails[i].CITY_EN[0].Text)
tableString+="<tr></td><td width='95px'></td><td style='text-align:left;width:280px;margin-left:10px; margin-right:10px'>"+json.ATMDetails[i].NAME_EN[0].Text+"</td><td style='text-align:Center;width:270px;margin-left:10px; margin-right:10px'>"+json.ATMDetails[i].LOCATION[0].Text+"</td><td width='90px'></td></tr>";}
tableString+="</table>";$("#searchResult").append(tableString);}});}}
function foldSubResultDiv(thisId)
{document.getElementById("outer_subSearchResult"+thisId).setAttribute("style","width:100%;height:5px;");document.getElementById("outer_subSearchResult"+thisId).style.visibility='hidden';document.getElementById("dropdownimageInner"+thisId).setAttribute("src","../images/collapseplus.gif");document.getElementById("dropdownimageInner"+thisId).setAttribute("onclick","unfoldSubResultDiv('"+thisId+"');");}
function unfoldSubResultDiv(thisId,code)
{file_name='rbBranches.xml';$.ajax({type:"GET",url:"xml/"+file_name,dataType:"xml",complete:function(data)
{var tableString="";var json=$.xmlToJSON(data.responseXML);var temp=json.Branch[0].CODE[0].Text;for(var i=0;i<json.Branch.length;i++)
{if(code==json.Branch[i].CODE[0].Text)
{var temp=json.Branch[i].POBOX_EN[0].Text;tableString+='<div id="outer_subSearchResult'+thisId+'" style="width:100%;margin-bottom:20px;"><table class="txt"><tr><td style="width:60px;"></td><td style="width:95px;">P.O. Box:</td><td style="width:320px;">'+json.Branch[i].POBOX_EN[0].Text+'</td></tr><tr><td style="width:95px;"></td><td style="width:280px;">Manager:</td><td style="width:320px;">'+json.Branch[i].GMNAME_EN[0].Text+'</td></tr><tr><td style="width:95px;"></td><td style="width:280px;">Tel.No.:</td><td style="width:320px;">'+json.Branch[i].GMTEL[0].Text+'</td></tr><tr><td style="width:95px;"></td><td style="width:280px;">Branch Tel.:</td><td style="width:320px;">'+json.Branch[i].TEL[0].Text+'</td></tr><tr><td style="width:95px;"></td><td style="width:280px;">Fax:</td><td style="width:320px;">'+json.Branch[i].FAX[0].Text+'</td></tr></table>';}}
tableString+="</div>";$("#outer_subSearchResult"+thisId).append(tableString);}})
document.getElementById("outer_subSearchResult"+thisId).setAttribute("style","width:100%;height:230px;");document.getElementById("outer_subSearchResult"+thisId).style.visibility='visible';document.getElementById("dropdownimageInner"+thisId).setAttribute("src","../images/collapseminus.gif");document.getElementById("dropdownimageInner"+thisId).setAttribute("onclick","foldSubResultDiv('"+thisId+"');");}
﻿var selected_radio="B";var selected_region="0";var selected_city="0";$(document).ready(function(){});function getRegion()
{}
function getCity()
{var file_name="";file_name='rbBranches.xml';$.ajax({type:"GET",url:"xml/"+file_name,dataType:"xml",complete:function(data){$("#choosecity").empty();$("#choosecity").append("<option value='0'>--إختر مدينة--</option>");var json=$.xmlToJSON(data.responseXML);json.Branch.SortByNode("CITY_AR");var out="",prev="",curr="";var str=selected_region.substring(0,1);if(str=='A')
{for(var i=0;i<json.Branch.length;i++){curr=json.Branch[i].CITY_AR[0].Text;if(curr!=prev)
{if(json.Branch[i].AREA[0].Text==selected_region.substring(1,2))
$("#choosecity").append("<option value="+curr+">"+curr+"</option>");}
prev=curr;}}
else
{for(var i=0;i<json.Branch.length;i++){curr=json.Branch[i].CITY_AR[0].Text;if(curr!=prev)
{if(json.Branch[i].BRANCHTYPE[0].Text==selected_region.substring(1,2))
$("#choosecity").append("<option value="+curr+">"+curr+"</option>");}
prev=curr;}}}});}
function getSearchResult()
{var file_name="";if(selected_radio=='B')
{file_name='rbBranches.xml';$.ajax({type:"GET",url:"xml/"+file_name,dataType:"xml",complete:function(data){var tableString="";var json=$.xmlToJSON(data.responseXML);json.Branch.SortByNode("CODE");$("#searchResult").empty();if(selected_city==0)
{tableString="";}
else
{tableString='<table class="txt" border="0"><tr><th width="20px"></th><th width="60px" align="right">الكود</th><th width="280px" align="right">اسم الفرع</th><th width="260px" align="right">العنوان</th><th style="text-align:center;width:80px;margin-left:10px; margin-right:10px">الخريطة</th></tr>';}
var str=selected_region.substring(0,1);if(str=='A')
{for(var i=0;i<json.Branch.length;i++)
{if(selected_region.substring(1,2)==json.Branch[i].AREA[0].Text)
{if(selected_city==json.Branch[i].CITY_AR[0].Text)
{if(json.Branch[i].MAP[0].Text)
{var url="'"+json.Branch[i].MAP[0].Text+"/A"+json.Branch[i].CODE[0].Text+".gif'";var map='<td style="text-align:center;width:80px;margin-left:10px; margin-right:10px"><a class="MnuNavLink" href='+url+' href='+url+' onclick="popup('+url+'); return false">عرض</a></td>';}
else
{var map='</td><td width="80px"></td>';}
tableString+='<tr><td><img id="dropdownimageInner'+i+'" src="../images/collapseplus.gif" onclick="unfoldSubResultDiv('+i+','+json.Branch[i].CODE[0].Text+');" /></td><td width="60px">'+json.Branch[i].CODE[0].Text+'</td><td width="280px">'+json.Branch[i].NAME_AR[0].Text+'</td><td width="260px">'+json.Branch[i].ADRS_AR[0].Text+'</td>'+map+'</tr><tr><td colspan="5"><div id="outer_subSearchResult'+i+'"></div></td></tr>';}}}}
else
{for(var i=0;i<json.Branch.length;i++)
{if(selected_region.substring(1,2)==json.Branch[i].BRANCHTYPE[0].Text)
{if(selected_city==json.Branch[i].CITY_AR[0].Text)
{if(json.Branch[i].MAP[0].Text)
{var url="'"+json.Branch[i].MAP[0].Text+"/A"+json.Branch[i].CODE[0].Text+".gif'";var map='<td style="text-align:center;width:80px;margin-left:10px; margin-right:10px"><a class="MnuNavLink" href='+url+' href='+url+' onclick="popup('+url+'); return false">عرض</a></td>';}
else
{var map='<td width="80px"></td>';}
tableString+='<tr><td><img id="dropdownimageInner'+i+'" src="../images/collapseplus.gif" onclick="unfoldSubResultDiv('+i+','+json.Branch[i].CODE[0].Text+');" style="width:15px; height:15px;"/></td><td width="60px">'+json.Branch[i].CODE[0].Text+'</td><td width="280px">'+json.Branch[i].NAME_AR[0].Text+'</td><td width="260px">'+json.Branch[i].ADRS_AR[0].Text+'</td>'+map+'</tr><tr><td colspan="5"><div id="outer_subSearchResult'+i+'"></div></td></tr>';}}}}
tableString+="</table>";$("#searchResult").append(tableString);}});}
else
{file_name='rbATMs.xml';$.ajax({type:"GET",url:"xml/"+file_name,dataType:"xml",complete:function(data){var tableString="";var json=$.xmlToJSON(data.responseXML);json.ATMDetails.SortByNode("CITY_AR");$("#searchResult").empty();if(selected_city==0)
{tableString="";}
else
{tableString='<table class="txt" border="0"><tr><th width="60px">الكود</th><th style="text-align:center;width:280px;margin-left:10px; margin-right:10px">اسم الصراف الآلي</th><th style="text-align:center;width:270px;margin-left:10px; margin-right:10px">الموقع</th><th width="90px" align="right">الخريطة</th></tr>';}
for(var i=0;i<json.ATMDetails.length;i++)
{if(selected_city==json.ATMDetails[i].CITY_AR[0].Text)
tableString+="<tr></td><td width='95px'></td><td style='text-align:right;width:280px;margin-left:10px; margin-right:10px'>"+json.ATMDetails[i].NAME_AR[0].Text+"</td><td style='text-align:Center;width:270px;margin-left:10px; margin-right:10px'>"+json.ATMDetails[i].LOCATION[0].Text+"</td><td width='90px'></td></tr>";}
tableString+="</table>";$("#searchResult").append(tableString);}});}}
function foldSubResultDiv(thisId)
{document.getElementById("outer_subSearchResult"+thisId).setAttribute("style","width:100%;height:5px;");document.getElementById("outer_subSearchResult"+thisId).style.visibility='hidden';document.getElementById("dropdownimageInner"+thisId).setAttribute("src","../images/collapseplus.gif");document.getElementById("dropdownimageInner"+thisId).setAttribute("onclick","unfoldSubResultDiv('"+thisId+"');");}
function unfoldSubResultDiv(thisId,code)
{file_name='rbBranches.xml';$.ajax({type:"GET",url:"xml/"+file_name,dataType:"xml",complete:function(data)
{var tableString="";var json=$.xmlToJSON(data.responseXML);var temp=json.Branch[0].CODE[0].Text;for(var i=0;i<json.Branch.length;i++)
{if(code==json.Branch[i].CODE[0].Text)
{var temp=json.Branch[i].POBOX_AR[0].Text;tableString+='<div id="outer_subSearchResult'+thisId+'" style="width:100%;margin-bottom:20px;"><table class="txt"><tr><td style="width:60px;"></td><td style="width:95px;">صندوق البريد:</td><td style="width:320px;">'+json.Branch[i].POBOX_AR[0].Text+'</td></tr><tr><td style="width:95px;"></td><td style="width:280px;">مدير الفرع:</td><td style="width:320px;">'+json.Branch[i].GMNAME_AR[0].Text+'</td></tr><tr><td style="width:95px;"></td><td style="width:280px;">رقم الهاتف:</td><td style="width:320px;">'+json.Branch[i].GMTEL[0].Text+'</td></tr><tr><td style="width:95px;"></td><td style="width:280px;">هاتف الفرع:</td><td style="width:320px;">'+json.Branch[i].TEL[0].Text+'</td></tr><tr><td style="width:95px;"></td><td style="width:280px;">الفاكس:</td><td style="width:320px;">'+json.Branch[i].FAX[0].Text+'</td></tr></table>';}}
tableString+="</div>";$("#outer_subSearchResult"+thisId).append(tableString);}})
document.getElementById("outer_subSearchResult"+thisId).setAttribute("style","width:100%;height:230px;");document.getElementById("outer_subSearchResult"+thisId).style.visibility='visible';document.getElementById("dropdownimageInner"+thisId).setAttribute("src","../images/collapseminus.gif");document.getElementById("dropdownimageInner"+thisId).setAttribute("onclick","foldSubResultDiv('"+thisId+"');");}