PageSourceSearch

https://nosabooks.com/Common/Scripts/HandleRequest_1.js

js nosabooks.com collected 2026-10-02 13:21:43 UTC 134,650 bytes, 2,737 lines download raw bytes

1// NOSA BOOK SCRIPT FILE
2// Allrights reserved
3// Copyright 2012
4var isbns = Array();
5var defultThumb = "<img class=\"bookThumb\" src=\"../App_Themes/MainTheme/MainImages/bookblue.png\" />";
6//var pnlBtnImage = "<img src='../App_Themes/MainTheme/MainImages/PnlBtm.gif' width='300px' height='6' title='' style='display:block; margin-bottom:5px;'>"
7var SrchUrl = ''; //search query url
8var qKind = ''; // query Kind
9var qText = ''; // query Text
10var qKind1 = ''; // query Kind
11var qText1 = ''; // query Text
12var qKind2 = ''; // query Kind
13var qText2 = ''; // query Text
14var qOp = ''; // query operator
15var qOp1 = ''; // query operator1
16var qOrder = ''; // query order
17var qFullView = 0; // query book with FullView
18var qPreview = 0; // query book with Preview
19var qFullView1 = 0; // query book with FullView
20var qPreview1 = 0; // query book with Preview
21var curQID = 0;
22var qMaxCount = 10;
23var hasRightPanel = 1; // in preferences can change this value to 0(don't show right panel in pages)
24var isAdvancedSrch = 0; // must be set 1 if advance panel is visible
25var queryID = 1;  //show the queryID. it's used in show search history .in normal search we don't send queryid in url parameters.
26var qTS; // TS. read from TS_Handle in searchquery.acsx
27var qnk = ''; // query normal key
28var qsrv = ''; // query limited server name
29
30//Edited By Farshbaf  1392-02-02
31var qpub = ''; // query limited vippublisher name
32//End Edit
33
34var qstep = 1; // query step
35var qsDate = '', qeDate = ''; // query limited by date
36var IsInRequest = false;
37var marcKind = '';
38var marcKey = '';
39var docIdx = 0;
40var curPage = 0;
41var curHolderID = 0;
42var SrchRef = 7; // set from cookie .
43var SrchDis = 21; // set from cookie.
44var BrowseDis = 1; // have description for browse section ( subject description for subject heading)
45var SrchMerge = 1; // set from cookie
46var favBook = 0; // set from cookie
47var holdingArray = '';
48var VIPPublisherArray = '';
49var ps, pe;
50var pagingMethod = 1;
51var totalResultCount = 0;
52var isNext = 1;
53var resetPaging = 1;
54var resource = 1; // 0:latin 1:farsi
55var authorTitle = '';
56var fullMode = '0';
57var publisherDiv_id = "";
58var isInSuggestionList = false;
59var pubFilterChars = ['آ', 'ا', 'ب', 'پ', 'ت', 'ث', 'ج', 'چ', 'ح', 'خ', 'د', 'ذ', 'ر', 'ز', 'ژ', 'س', 'ش', 'ص', 'ض', 'ط',
60                      'ظ', 'ع', 'غ', 'ف', 'ق', 'ک', 'گ', 'ل', 'م', 'ن', 'و', 'ه', 'ی'];
61
62
63//Edited By Farshbaf: (92-1-17) to save the count of the books with FullView and Preview
64var fullViewBooksCount = 0;
65var previewBooksCount = 0;
66//End Edit
67
68//Edited By Farshbaf: (92-1-17) if in Suggestion Phase, No Exact or Nearby Term is found, it should be assigned 1
69var NoExactOrNearByTermWasFound = 0;
70//End Edit
71
72//added by saboor: 
73var BrowserIsOld = 0; //0 is new, 1 is old(2.3 and less)---keeps the browser version
74
75var swipedir = "none";
76var isMouseDraged = 0;
77//end saboor
78
79
80
81//***************************************************
82$(document).ready(function() {
83
84    GetBrowserInfo();
85
86    if (window.location.href.toLowerCase().indexOf("home.aspx") > 0) {
87        if ($.cookie('FavBook')) favBook = $.cookie('FavBook');
88        getHomePageParams();
89
90        //        var el = document.getElementById("swipeSurface");
91        //        DetectSwipe(el, function(swipedir) { }, 50, true);
92        //        var el2 = document.getElementById("headerWrapper");
93        //        DetectSwipe(el2, function(swipedir) { }, 50, false);
94        //        var el3 = document.getElementById("right_div");
95        //        DetectSwipe(el3, function(swipedir) { }, 50, false);
96        //        var el4 = document.getElementById("MenuBarMainItems");
97        //        DetectSwipe(el4, function(swipedir) { }, 50, false);
98    }
99
100    if (window.location.href.toLowerCase().indexOf("search.aspx") > 0) {
101
102        // if we want user to set display mode
103        if ($.cookie('SrchRef')) SrchRef = $.cookie('SrchRef');
104        if ($.cookie('SrchDis')) SrchDis = $.cookie('SrchDis');
105        if ($.cookie('discDis')) BrowseDis = $.cookie('discDis');
106
107        if ($.cookie('SrchMerge')) SrchMerge = $.cookie('SrchMerge');
108        if ($.cookie('SearchResultCount')) qMaxCount = $.cookie('SearchResultCount');
109        DoSearch(true);
110
111        //        var el = document.getElementById("infoPannel");
112        //        DetectSwipe(el, function(swipedir) { }, 50, false);
113        //        var el2 = document.getElementById("headerWrapper");
114        //        DetectSwipe(el2, function(swipedir) { }, 50, false);
115        //        var el3 = document.getElementById("right_div");
116        //        DetectSwipe(el3, function(swipedir) { }, 50, false);
117        //        var el4 = document.getElementById("MenuBarMainItems");
118        //        DetectSwipe(el4, function(swipedir) { }, 50, false);
119    }
120    if (window.location.href.toLowerCase().indexOf("book.aspx") > 0) {
121        GetBook();
122        //        var el = document.getElementById("infoPannel");
123        //        DetectSwipe(el, function(swipedir) { }, 50, false);
124        //        var el2 = document.getElementById("headerWrapper");
125        //        DetectSwipe(el2, function(swipedir) { }, 50, false);
126        //        var el3 = document.getElementById("right_div");
127        //        DetectSwipe(el3, function(swipedir) { }, 50, false);
128        //        var el4 = document.getElementById("MenuBarMainItems");
129        //        DetectSwipe(el4, function(swipedir) { }, 50, false);
130    }
131
132    if (!isAdvancedSrch) {
133        //saboor added 940423
134        $('#advance_div').slideUp('slow');
135        $('#simple_div').slideDown('slow');
136        $('#repose_querySpan').slideDown('slow');
137        $('#show_advance').html('جستجوی پیشرفته');
138        $('#down_show_advance').html('جستجوی پیشرفته');
139        //end saboor
140        if (qKind != '') $("#sqk").val(text[qKind][1]);
141        if (qText != '') {
142            if (qKind in ({ 'authortitle': 1, 'uniformtitle': 1 })) $('#ctl00_SearchQueryControl1_term_txt').val('');
143            else $('#ctl00_SearchQueryControl1_term_txt').val(qText);
144            if (parseInt(qFullView) === 1) $('#fullView_chk').attr('checked', 'checked');
145            if (parseInt(qPreview) === 1) $('#preview_chk').attr('checked', 'checked');
146        }
147    }
148    else {
149        //saboor added 940423
150        $('#advance_div').slideDown('slow');
151        $('#simple_div').slideUp('slow');
152        $('#repose_querySpan').slideUp('slow');
153        $('#show_advance').html('جستجوی ساده');
154        $('#down_show_advance').html('جستجوی ساده');
155        $('#NearMsg_lab').css("display", "none");
156        $('#adv_magnifierWrapper').css('display', "inline-block");
157        //end saboor
158        if (qKind != '') $("#qk").val(text[qKind][1]);
159        if (qText != '') $('#ctl00_SearchQueryControl1_q').val(qText);
160        if (qKind1 != '') $("#qk1").val(text[qKind1][1]);
161        if (qText1 != '') $('#ctl00_SearchQueryControl1_q1').val(qText1);
162        if (qKind2 != '') $("#qk2").val(text[qKind2][1]);
163        if (qText2 != '') $('#ctl00_SearchQueryControl1_q2').val(qText2);
164        if (qsDate != '') $('#sDate').val(qsDate);
165        if (qeDate != '') $('#eDate').val(qeDate);
166        $('#ctl00_SearchQueryControl1_ts_radio [value="' + qTS + '"]').attr('checked', 'checked');
167        if (parseInt(qFullView1) === 1) $('#fullView_adv_chk').attr('checked', 'checked');
168        if (parseInt(qPreview1) === 1) $('#preview_adv_chk').attr('checked', 'checked');
169
170    }
171
172    //commented by saboor 940519, this code hides the repose_querySpan pannel if the search term is English,
173     //so if our next search is farsi we don't have any access to repose_querySpan options
174        if ($('#ctl00_SearchQueryControl1_term_txt')[0].value.length != 0) {
175            if (qText.charCodeAt(0) >= 128) {
176                $('#ctl00_SearchQueryControl1_term_txt').css("direction", "rtl").css("textAlign", "right");
177                //$('#repose_querySpan').css("display", "");
178            }
179            else {
180                $('#ctl00_SearchQueryControl1_term_txt').css("direction", "ltr").css("textAlign", "left");
181                //$('#repose_querySpan').css("display", "none");
182            }
183        }
184});
185
186var GetBrowserInfo = function() {
187    //    var nVer = navigator.appVersion;
188    var nAgt = navigator.userAgent;
189    //    var browserName = navigator.appName;
190    //    var fullVersion = '' + parseFloat(navigator.appVersion);
191    //    var majorVersion = parseInt(navigator.appVersion, 10);
192    //    var nameOffset, verOffset, ix;
193
194    var agentID;
195    if (nAgt.toLowerCase().match(/android\s+([\d\.]+)/)) {
196        agentID = nAgt.toLowerCase().match(/android\s+([\d\.]+)/)[1];
197        if (parseInt(agentID, 10) < 3)
198            BrowserIsOld = 1;
199        else
200            BrowserIsOld = 0;
201    }
202    else {
203        BrowserIsOld = 0; //it's not android
204    }
205    document.getElementById("topMenuBar").setAttribute("data-browserIsOld", BrowserIsOld);
206    document.getElementById("bodyWrapper").setAttribute("data-browserIsOld", BrowserIsOld);
207
208    //    // In Opera, the true version is after "Opera" or after "Version"
209    //    if ((verOffset = nAgt.indexOf("Opera")) != -1) {
210    //        browserName = "Opera";
211    //        fullVersion = nAgt.substring(verOffset + 6);
212    //        if ((verOffset = nAgt.indexOf("Version")) != -1)
213    //            fullVersion = nAgt.substring(verOffset + 8);
214    //    }
215    //    // In MSIE, the true version is after "MSIE" in userAgent
216    //    else if ((verOffset = nAgt.indexOf("MSIE")) != -1) {
217    //        browserName = "Microsoft Internet Explorer";
218    //        fullVersion = nAgt.substring(verOffset + 5);
219    //    }
220    //    // In Chrome, the true version is after "Chrome" 
221    //    else if ((verOffset = nAgt.indexOf("Chrome")) != -1) {
222    //        browserName = "Chrome";
223    //        fullVersion = nAgt.substring(verOffset + 7);
224    //    }
225    //    // In Safari, the true version is after "Safari" or after "Version" 
226    //    else if ((verOffset = nAgt.indexOf("Safari")) != -1) {
227    //        browserName = "Safari";
228    //        fullVersion = nAgt.substring(verOffset + 7);
229    //        if ((verOffset = nAgt.indexOf("Version")) != -1)
230    //            fullVersion = nAgt.substring(verOffset + 8);
231    //    }
232    //    // In Firefox, the true version is after "Firefox" 
233    //    else if ((verOffset = nAgt.indexOf("Firefox")) != -1) {
234    //        browserName = "Firefox";
235    //        fullVersion = nAgt.substring(verOffset + 8);
236    //    }
237    //    // In most other browsers, "name/version" is at the end of userAgent 
238    //    else if ((nameOffset = nAgt.lastIndexOf(' ') + 1) < (verOffset = nAgt.lastIndexOf('/'))) {
239    //        browserName = nAgt.substring(nameOffset, verOffset);
240    //        fullVersion = nAgt.substring(verOffset + 1);
241    //        if (browserName.toLowerCase() == browserName.toUpperCase()) {
242    //            browserName = navigator.appName;
243    //        }
244    //    }
245    //    // trim the fullVersion string at semicolon/space if present
246    //    if ((ix = fullVersion.indexOf(";")) != -1)
247    //        fullVersion = fullVersion.substring(0, ix);
248    //    if ((ix = fullVersion.indexOf(" ")) != -1)
249    //        fullVersion = fullVersion.substring(0, ix);
250
251    //    majorVersion = parseInt('' + fullVersion, 10);
252    //    if (isNaN(majorVersion)) {
253    //        fullVersion = '' + parseFloat(navigator.appVersion);
254    //        majorVersion = parseInt(navigator.appVersion, 10);
255    //    }
256
257    //    alert('Browser name  = ' + browserName + '<br>'
258    //                + 'Full version  = ' + fullVersion + '<br>'
259    //                + 'Major version = ' + majorVersion + '<br>'
260    //                + 'navigator.appName = ' + navigator.appName + '<br>'
261    //                + 'navigator.userAgent = ' + navigator.userAgent + '<br>'
262    //                + 'android Version = ' + agentID);
263};
264
265//***************************************************
266var Handle_xmlHttpRequest = function(Aurl, AMethod, AReqID, Acache, Anasync, SingleRequest, LockUI) {
267
268    if (SingleRequest == undefined) SingleRequest = true;
269    if (LockUI == undefined) LockUI = true;
270
271    if (SingleRequest)
272        if (IsInRequest) return false;
273
274    if (LockUI)
275        $.uiLock('');
276
277    if (SingleRequest)
278        IsInRequest = true;
279
280    $.ajaxSetup({
281        beforeSend: function(xhr) {
282            xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
283            xhr.setRequestHeader("Connection", "close");
284        }
285    });
286
287    var resultXML;
288    var req = '';
289    req = $.ajax({
290        type: AMethod,
291        url: encodeURI(Aurl),  //encodeURIComponent(Aurl),
292        cache: Acache,
293        data: "{}",
294        async: Anasync,
295        contentType: "text/xml; charset=UTF-8",
296        dataType: "xml",
297        success: function(xml) {
298            if (handelExceptions(xml)) {
299                resultXML = xml;
300                processResult(xml, AReqID);
301            }
302        },
303        error: function(xhr, textStatus, error) {
304            alert("جواب دریافتی از سرور قابل نمایش نمی باشد.لطفا عبارت جستجو را تغییر دهید");
305            alert(error);
306        },
307        complete: function() {
308            if (SingleRequest)
309                IsInRequest = false;
310
311            if (LockUI)
312                $.uiUnlock('');
313
314            //Edited By Farshbaf 1392-03-4
315            //To Support Repository Service Requests we need to add a new Type called Repository
316            processPostResult(resultXML, AReqID);
317            //End Edit
318        }
319    });
320};
321//***************************************************
322var DoSearch = function() {
323    getUrlInfo();
324    document.title = qText + " - NOSA BOOKS";
325
326    //Edited By Farshbaf: (92-1-19) If No Exact or NearBy Result was found in Suggestion Phase, Create an empty Result and call processResult to show Not Found in Client
327    if (!NoExactOrNearByTermWasFound)
328        Handle_xmlHttpRequest("HandleRequest.aspx?ReqType=1" + getUrlInfo() + "&reset=" + resetPaging + "&maxcount=" + qMaxCount + "&curpage=" + curPage + "&hk=" + curHolderID +
329                                              "&ref=" + SrchRef + "&dis=" + SrchDis + "&bd=" + BrowseDis + "&merge=" + SrchMerge, "GET", 2, false, true);
330    else {
331
332        //Edited By Farshbaf 1392/02/23 for correcting the Error of javascript in: document.implementation.createDocument --> I have used JQuery instead of javascript to create an empty xml file
333        var xmlDocument = $('<Response />');
334        //End Edit
335        processResult(xmlDocument, 2);
336    }
337
338    //End Edit                                              
339
340};
341//***************************************************
342var GetBook = function() {
343    getUrlInfo();
344    Handle_xmlHttpRequest("HandleRequest.aspx?ReqType=5" + getUrlInfo(), "GET", 6, false, true);
345};
346//***************************************************
347var getHomePageParams = function() {
348
349    Handle_xmlHttpRequest("HandleRequest.aspx?ReqType=3&ReqID=7", "Get", 3, true, false);
350};
351//***************************************************
352var prevHeading = function(Aq, Aqk, Aqnk, Aqts) {
353    Handle_xmlHttpRequest("HandleRequest.aspx?ReqType=3&ReqID=1&Next=0&q=" + Aq + "&qk=" + Aqk + "&qnk=" + Aqnk + "&qts=" + Aqts + "&adv=0&rp=1", "GET", 5, false, true);
354};
355//***************************************************
356var nextHeading = function(Aq, Aqk, Aqnk, Aqts) {
357    Handle_xmlHttpRequest("HandleRequest.aspx?ReqType=3&ReqID=1&Next=1&q=" + Aq + "&qk=" + Aqk + "&qnk=" + Aqnk + "&qts=" + Aqts + "&adv=0&rp=1", "GET", 5, false, true);
358};
359//***************************************************
360var show_NearbyTerm = function(e) {
361    GetInfoBeforSearch();
362    if (e == undefined) // when phishnahad link clicked
363    {
364        $('#err_lab').html('');
365        Handle_xmlHttpRequest("HandleRequest.aspx?ReqType=2&qk=" + qKind + "&q=" + qText + "&rp=" + hasRightPanel + "&adv=" + isAdvancedSrch + "&qts=" + qTS, "GET", 4, false, true);
366    }
367    else {
368        var eKeyCode = (e.keyCode ? e.keyCode : e.which);
369        if (eKeyCode == 40 || eKeyCode == 38) return;
370
371        if ((e.ctrlKey) && (eKeyCode == 32) && qText != '') {
372            $('#err_lab').html('');
373            Handle_xmlHttpRequest("HandleRequest.aspx?ReqType=2&qk=" + qKind + "&q=" + qText + "&rp=" + hasRightPanel + "&adv=" + isAdvancedSrch + "&qts=" + qTS, "GET", 4, false, true);
374            e.returnValue = false;
375        }
376    }
377};
378
379//***************************************************
380
381var getUrlInfo = function(reset) {
382    var urlParams = '';
383
384    if ($.getUrlVar('adv')) { isAdvancedSrch = parseInt($.getUrlVar('adv')); urlParams += "&adv=" + isAdvancedSrch; }
385    if (isAdvancedSrch) {
386        if ($.getUrlVar('qk')) { qKind = $.getUrlVar('qk'); urlParams += "&qk=" + qKind; }
387        if ($.getUrlVar('q')) {
388            qText = $.getUrlVar('q');
389            qText = qText.replace(/\""/g, '');
390            urlParams += "&q=" + qText;
391        }
392
393        if ($.getUrlVar('qk1')) { qKind1 = $.getUrlVar('qk1'); urlParams += "&qk1=" + qKind1; }
394        if ($.getUrlVar('q1')) {
395            qText1 = $.getUrlVar('q1');
396            qText1 = qText1.replace(/\""/g, '');
397            urlParams += "&q1=" + qText1;
398        }
399        if ($.getUrlVar('op')) { qOp = $.getUrlVar('op'); urlParams += "&op=" + qOp; }
400
401        if ($.getUrlVar('qk2')) { qKind2 = $.getUrlVar('qk2');
401 urlParams += "&qk2=" + qKind2; }
402        if ($.getUrlVar('q2')) {
403            qText2 = $.getUrlVar('q2');
404            qText2 = qText2.replace(/\""/g, '');
405            urlParams += "&q2=" + qText2;
406        }
407        if ($.getUrlVar('op1')) { qOp1 = $.getUrlVar('op1'); urlParams += "&op1=" + qOp1; }
408        if ($.getUrlVar('sdate')) { qsDate = $.getUrlVar('sdate'); urlParams += "&sdate=" + qsDate; }
409        if ($.getUrlVar('edate')) { qeDate = $.getUrlVar('edate'); urlParams += "&edate=" + qeDate; }
410
411        if ($.getUrlVar('fv')) { qFullView1 = $.getUrlVar('fv'); urlParams += "&fv=" + qFullView1; }
412        if ($.getUrlVar('pv')) { qPreview1 = $.getUrlVar('pv'); urlParams += "&pv=" + qPreview1; }
413    }
414
415    else {
416        if ($.getUrlVar('qk')) qKind = $.getUrlVar('qk');
417        else qKind = "title";
418
419        urlParams += "&qk=" + qKind;
420
421        if ($.getUrlVar('q')) {
422            qText = $.getUrlVar('q');
423            qText = qText.replace(/\""/g, '');
424
425            urlParams += "&q=" + qText;
426        }
427
428        if ($.getUrlVar('fv')) { qFullView = $.getUrlVar('fv');
428 urlParams += "&fv=" + qFullView; }
429        if ($.getUrlVar('pv')) { qPreview = $.getUrlVar('pv'); urlParams += "&pv=" + qPreview; }
430    }
431
432    if (!$.getUrlVar('qts'))
433        Get_TS();
434    else qTS = $.getUrlVar('qts');
435    urlParams += "&qts=" + qTS;
436
437    if ($.getUrlVar('qid')) { queryID = $.getUrlVar('qid'); urlParams += "&qid=" + queryID; }
438    if ($.getUrlVar('qo')) { qOrder = $.getUrlVar('qo'); urlParams += "&qo=" + qOrder; }
439    if ($.getUrlVar('rp')) { hasRightPanel = $.getUrlVar('rp'); urlParams += "&rp=" + hasRightPanel; }
440
441    if ($.getUrlVar('curpage')) { curPage = $.getUrlVar('curpage'); urlParams += "&curpage=" + curPage; }
442    if ($.getUrlVar('ref')) { urlParams += "&ref=" + $.getUrlVar('ref'); }
443    if ($.getUrlVar('dis')) { urlParams += "&dis=" + $.getUrlVar('dis'); }
444    if ($.getUrlVar('next')) { urlParams += "&next=" + $.getUrlVar('next'); }
445    if ($.getUrlVar('merge')) { urlParams += "&merge=" + $.getUrlVar('merge'); }
446    if ($.getUrlVar('bd')) { urlParams += "&bd=" + $.getUrlVar('bd'); }
447
448    if ($.getUrlVar('qnk')) { qnk = $.getUrlVar('qnk'); urlParams += "&qnk=" + qnk; }
449    if ($.getUrlVar('qsrv')) { qsrv = $.getUrlVar('qsrv');
449 urlParams += "&qsrv=" + qsrv; }
450    //Edited By Farshbaf 1392-02-02 For Publisher Limitation
451    if ($.getUrlVar('qpub')) { qpub = $.getUrlVar('qpub'); urlParams += "&qpub=" + qpub; }
452    //End Edit
453
454    if ($.getUrlVar('step')) { qstep = $.getUrlVar('step'); urlParams += "&step=" + qstep; }
455    if ($.getUrlVar('kind')) { urlParams += "&kind=" + $.getUrlVar('kind'); }
456    if ($.getUrlVar('atmarc')) { urlParams += "&atmarc=" + $.getUrlVar('atmarc'); } // autorTitle Marcreckey
457    if ($.getUrlVar('atts')) { urlParams += "&atts=" + $.getUrlVar('atts'); } // autorTitle TS
458
459    //Edited by Farshbaf: (92-1-17) if in Suggestion Phase, No Exact or NearBy Term is found, NoExactOrNearByTermWasFound will be assigned 1     
460    if ($.getUrlVar('nf')) { NoExactOrNearByTermWasFound = parseInt($.getUrlVar('nf'), 10); }
461    //End Edit
462
463    if (reset != 0) {
464        if ($.getUrlVar('marckind')) { marcKind = $.getUrlVar('marckind'); urlParams += "&marckind=" + marcKind; }
465        if ($.getUrlVar('marckey')) { marcKey = $.getUrlVar('marckey'); urlParams += "&marckey=" + marcKey; }
466        if ($.getUrlVar('idx')) { docIdx = $.getUrlVar('idx'); urlParams += "&idx=" + docIdx; }
467        if ($.getUrlVar('hk')) { urlParams += "&hk=" + $.getUrlVar('hk'); }
468    }
469
470
471
472    return urlParams;
473};
474//***************************************************
475var getSrchQuery = function() {
476    var queryStr = '', extra_query = '', qText_dis = '', qText1_dis = '', qText2_dis = '';
477    var myObjectArray = [];
478    if (!isAdvancedSrch) {
479        if (qKind == text['authortitle'][0]) {
480            if (qTS == 3)
481                queryStr = ["<span class='srchTermTitle'>عبارت جستجو: </span> ", "تمامی نسخه های فارسی", " [ ", authorTitle, " ] "].join('');
482            else queryStr = ["<span class='srchTermTitle'>عبارت جستجو: </span> ", "تمام نسخه های لاتین", " [ ", authorTitle, " ] "].join('');
483            document.title = authorTitle + " - NOSA BOOKS";
484        }
485        else if (qKind == text['uniformtitle'][0]) {
486            queryStr = ["<span class='srchTermTitle'>عبارت جستجو: </span> ", "تمامی کتابهای دارای عنوان قراردادی", " ", "<span style=' font-weight:bold;'>", authorTitle, "</span>"].join('');
487            document.title = authorTitle + " - NOSA BOOKS";
488        }
489    }
490    else {
491        if (qKind != '') {
492            var qObj = new Object();
493            extra_query = [extra_query, "&qk=", qKind, "&q=", qText].join('');
494            qObj = {
495                dispalyData: "<a class='hlink' href='Search.aspx?adv=" + isAdvancedSrch + extra_query + "&qts=" + qTS + "&rp=" + hasRightPanel + "'>" + qText + "</a>",
496                Data: qText,
497                Kind: qKind
498            };
499            myObjectArray.push(qObj);
500        }
501
502        if (qKind1 != '') {
503            var qObj = new Object();
504            extra_query = [extra_query, "&qk1=", qKind1, "&q1=", qText1].join('');
505            qObj = {
506                dispalyData: "<a class='hlink' href='Search.aspx?adv=" + isAdvancedSrch + extra_query + "&qts=" + qTS + "&rp=" + hasRightPanel + "'>" + qText1 + "</a>",
507                Data: qText1,
508                Kind: qKind1
509            };
510            myObjectArray.push(qObj);
511        }
512
513        if (qKind2 != '') {
514            var qObj = new Object();
515            extra_query = [extra_query, "&qk2=", qKind2, "&q2=", qText2].join('');
516            qObj = {
517                dispalyData: "<a class='hlink' href='Search.aspx?adv=" + isAdvancedSrch + extra_query + "&qts=" + qTS + "&rp=" + hasRightPanel + "'>" + qText2 + "</a>",
518                Data: qText2,
519                Kind: qKind2
520            };
521            myObjectArray.push(qObj);
522        }
523
524        if (qsDate != '') {
525            var qObj = new Object();
526            extra_query = [extra_query, "&sdate=", qsDate].join('');
527            qObj = {
528                dispalyData: "<a class='hlink' href='Search.aspx?adv=" + isAdvancedSrch + extra_query + "&qts=" + qTS + "&rp=" + hasRightPanel + "'>" + qsDate + "</a>",
529                Data: qsDate,
530                Kind: 'startDate'
531            };
532            myObjectArray.push(qObj);
533        }
534
535        if (qeDate != '') {
536            var qObj = new Object();
537            extra_query = [extra_query, "&edate=", qeDate].join('');
538            qObj = {
539                dispalyData: "<a class='hlink' href='Search.aspx?adv=" + isAdvancedSrch + extra_query + "&qts=" + qTS + "&rp=" + hasRightPanel + "'>" + qeDate + "</a>",
540                Data: qeDate,
541                Kind: 'endDate'
542            };
543            myObjectArray.push(qObj);
544        }
545
546        if (qFullView1 != '0') {
547            var qObj = new Object();
548            extra_query = [extra_query, "&fv=", qFullView1].join('');
549            //            qObj = {
550            //                dispalyData: "<a class='hlink' href='Search.aspx?adv=" + isAdvancedSrch + extra_query + "&qts=" + qTS + "&rp=" + hasRightPanel + "'>" + qFullView1 + "</a>",
551            //                Data: qFullView1,
552            //                Kind: 'fullView'
553            //            };
554            //            myObjectArray.push(qObj);
555        }
556
557        if (qPreview1 != '0') {
558            var qObj = new Object();
559            extra_query = [extra_query, "&pv=", qPreview1].join('');
560            //            qObj = {
561            //                dispalyData: "<a class='hlink' href='Search.aspx?adv=" + isAdvancedSrch + extra_query + "&qts=" + qTS + "&rp=" + hasRightPanel + "'>" + qPreview1 + "</a>",
562            //                Data: qPreview1,
563            //                Kind: 'preview'
564            //            };
565            //            myObjectArray.push(qObj);
566        }
567
568        for (var i = 0; i < myObjectArray.length; i++) {
569            if (queryStr != '') queryStr = [queryStr, "<span style=''> > </span> "].join('');
570            if (i < myObjectArray.length - 1)
571                queryStr = [queryStr, text[myObjectArray[i].Kind][1], " [ ", myObjectArray[i].dispalyData, " ] "].join('');
572            else
573                queryStr = [queryStr, text[myObjectArray[i].Kind][1], " [ ", myObjectArray[i].Data, " ] "].join('');
574        }
575
576        if (queryStr != '') queryStr = ["<span class='srchTermTitle'>عبارت جستجو: </span> ", queryStr].join('');
577    }
578    return queryStr;
579};
580
581
582//***************************************************
583//Edited By Farshbaf 1392-02-04 For VIPPublisher Limitation
584//Generates the Selected Holdings List Requested for filtering bu User , and Calls the GenAndLoadLimitationURL() function to Handle Filtering
585var limitResultByHolding = function(qur_step, aSrvID, hold_id) {
586
587    holdingArray = '';
588    if (qur_step != 0) // all center
589    {
590        $("#holdsec_div :checkbox:checked").each(function() {
591            if ($(this).attr("id") != 'all_center') {
592                if (holdingArray != '') holdingArray += ',';
593                holdingArray += "'" + $(this).attr("id") + "'";
594            }
595        });
596    };
597    GenAndLoadLimitationURL(qur_step);
598
599    if ($('#mnuCloseRightDiv').css("display") !== "none") {
600        CloseRightSlideMenu();
601    };
602};
603//End Edit
604
605//Edited By Farshbaf 1392-02-04 For VIPPublisher Limitation
606//Generates the Selected VIP Publisher List Requested for filtering bu User , and Calls the GenAndLoadLimitationURL() function to Handle Filtering
607var LimitResultByVIPPublisher = function(qur_step, aVIPPiblisherID, hold_id) {
608    VIPPublisherArray = '';
609    if (qur_step != 0) // all VIPPublisher 
610    {
611        $("#VIPPublishersec_div :checkbox:checked").each(function() {
612            if ($(this).attr("id") != 'all_VIPPublisher') {
613                if (VIPPublisherArray != '') VIPPublisherArray += ',';
614                VIPPublisherArray += "'" + $(this).attr("id") + "'";
615            }
616        });
617    }
618
619    GenAndLoadLimitationURL(qur_step);
620
621    if ($('#mnuCloseRightDiv').css("display") !== "none") {
622        CloseRightSlideMenu();
623    }
624};
625//End Edit
626//***************************************************
627
628//Edited By Farshbaf 1392-02-04 For VIPPublisher Limitation
629//Check for and Merge the limitation condition defined by User and load the page to provide filtering
630var GenAndLoadLimitationURL = function(qur_step) {
631    var LimitationArray = "";
632    if (holdingArray != "")
633        LimitationArray += "&qsrv=" + holdingArray;
634
635    if (VIPPublisherArray != "")
636        LimitationArray += "&qpub=" + VIPPublisherArray;
637
638    resetPaging = 1;
639    var url = "ReqType=1&ReqID=10&reset=1" + LimitationArray + "&step=" + qur_step + "&bd=" + BrowseDis + getUrlInfo() + "&pm=" + pagingMethod +
640        "&ps=" + ps + "&pe=" + pe + "&merge=" + SrchMerge;
641    $.history.load(url);
642
643}
644//End Edit
645
646//***************************************************
647var processResult = function(xml, AReqID) {
648    if (qTS == "3") resource = 1;
649    else resource = 0;
650    if (AReqID === 1) processSuggestion(xml);
651    if (AReqID === 2) processSearchPage(xml);
652    if (AReqID === 3) processHomePageData(xml);
653    if (AReqID === 4) processSuggestion(xml);
654    if (AReqID === 5) processSubjectHeadings(xml);
655    if (AReqID === 6) processBookPage(xml);
656    //Edited By Farshbaf 1392-03-4
657    //To Support Repository Service Requests we need to add a new Type called Repository
658    //Process Async Page Results
659    if (AReqID === 7) processVIPPublisherNotes(xml);
660    //End Edit
661};
662//***************************************************
663//Edited By Farshbaf 1392-03-4
664//To Support Repository Service Requests we need to add a new Type called Repository
665var processPostResult = function(xml, AReqID) {
666    if (qTS == "3") resource = 1;
667    else resource = 0;
668    if (AReqID === 1);
669    if (AReqID === 2) { ScrollPageTop(); HandeRightSlideMenuVisibility(); }
670    if (AReqID === 3);
671    if (AReqID === 4);
672    if (AReqID === 5);
673    if (AReqID === 6) {
674        GetNotes(xml);
675        ScrollPageTop();
676    }
677    if (AReqID === 7);
678};
679//End Edit
680//***************************************************
681//Edited By Farshbaf 1392-03-4
682//To Support Repository Service Requests we need to add a new Type called Repository
683var processVIPPublisherNotes = function(xml) {
684    var htmlStr = '', spacer = "<img src='../App_Themes/MainTheme/MainImages/spacer.gif' width='100%' height='10' />";
685
686    /*
687    $(xml).find("Field").each(function() {
688    if ($(this).attr("FN") == 12)  // 12 is the Qualifier Number for Book's VIPPublisher Note
689    htmlStr += "<div>" + $(this).attr("FV") + "</div>" + spacer;
690    });
691    */
692    //Edited By Farshbaf
693    //1392-03-21
694    //we will show only first part info if there are more than one result
695    $($(xml).find("ItemFields")[0]).find("Field").each(function() {
696        //if ($(this).attr("FN") == 12)  // 12 is the Qualifier Number for Book's VIPPublisher Note
697        if ($(this).attr("FN") == "يادداشت ناشر")  // 12 is the Qualifier Number for Book's VIPPublisher Note
698            htmlStr += "<div>" + $(this).attr("FV") + "</div>" + spacer;
699    });
700    //End Edit
701
702    if (htmlStr == '')
703        $('#RepositoryNotes_HolderDiv').css("display", "none");
704    else {
705        htmlStr = "<div id='publisherNoteText'>" + htmlStr + "</div>";
706        $("#RepositoryNotes_div").html(htmlStr);
707    }
708
709};
710//***************************************************
711var GetNotes = function(xml) {
712    var publisherCode = '', isbnStr = '', NLIIdentifier = '', requestStr = '';
713
714    //Get VIPPublisherCode
715    $(xml).find("Item").each(function() {
716        if ($(this).attr("refkind") === "3") {
717            $(this).find("repository").each(function() {
718                if ($(this).attr("kind") === "3") {
719                    publisherCode = $(this).attr("code").substr(0, $(this).attr("code").indexOf("/"));
720                }
721            });
722        }
723    });
724
725    if (publisherCode != '')
726        if (parseInt(publisherCode) < 1000) { // publishers with code greater than than 1000 are inactive publishers and won't be considered as VIPPublisher
727
728        $(xml).find("isbn").each(function() {
729            if (isbnStr == '')
730                isbnStr = $(this).text().substring(1);
731            else
732                isbnStr = [isbnStr, $(this).text().substring(1)].join(',');
733        });
734
735        NLIIdentifier = $($(xml).find("nlia")[0]).text().substring(1);
736
737        if (isbnStr != '') requestStr = "&isbn=" + isbnStr;
738        if (NLIIdentifier != '') requestStr += "&nlia=" + NLIIdentifier;
739
740        if (requestStr != '')
741            Handle_xmlHttpRequest("HandleRequest.aspx?ReqType=6&ReqID=1" + requestStr, "GET", 7, false, true, true, false); // Client side ReqId = 7 is for VIPPublisher Note
742        /*
743        if (isbnStr != '')
744        Handle_xmlHttpRequest("HandleRequest.aspx?ReqType=6&ReqID=1" + "&isbn=" + isbnStr, "GET", 7, false, true, true, false); // Client side ReqId = 7 is for VIPPublisher Note
745        else if(NLIIdentifier != '')
746        Handle_xmlHttpRequest("HandleRequest.aspx?ReqType=6&ReqID=1" + "&nlia=" + NLIIdentifier, "GET", 7, false, true, true, false); // Client side ReqId = 7 is for VIPPublisher Note            
747        */
748        else
749            $('#RepositoryNotes_HolderDiv').css("display", "none");
750    }
751
752};
753//***************************************************
754var processSuggestion = function(xml) {
755    var Header_Img;
756    var suggStr;
757    if ($(xml).find("suggest").length === 0) {
758
759        //Edited by Farshbaf: (1392-01-17)
760        /* No Exact or Nearby Result was found for the saerched Term, so "Not Found" Message will be redirected to Search Page*/
761        suggStr = "عبارت جستجو یافت نشد. عبارت را تغییر داده و مجددا سعی نمائید.";
762        $("#NearTerm_div").html('');
763        $("#NearTerm_div").append("<table width=98% id='NearTerm_table' border=0 >" + suggStr + "</table>");
764        if ($('#closeNearTerm_div')) { $('#closeNearTerm_div').css("display", 'block'); $('#fimg').css("display", 'block'); }
765        $("#NearTerm_div").css("display", "block").css("height", "200px");
766        $("#closeNearTerm_div").css("top", "27");
767        $('#fimg').css("top", "20");
768        //End Edit
769
770
771    }
772    else {
773
774        $(xml).find("suggest").each(function() {
775            if ($(this).attr("termurl")) { setSearchUrl('Search.aspx' + $(this).attr("termurl") + '&rp=' + hasRightPanel + "&adv=" + isAdvancedSrch); }
776            else {
777                if (qKind in ({ 'subject': 1 })) {
778                    if ($(this).attr("ts") == "1") Header_Img = "<img width='31' height='14' src='../App_Themes/MainTheme/MainImages/LCSH.png' />";
779                    else if ($(this).attr("ts") == "2") Header_Img = "<img  width='31' height='14' src='../App_Themes/MainTheme/MainImages/mesh.png' />";
780                    else if ($(this).attr("ts") == "3") Header_Img = "<img  width='31' height='14' src='../App_Themes/MainTheme/MainImages/nlai.png' />";
781                }
782                suggStr = [suggStr,
783            "<tr><td width=32>",
784            Header_Img,
785            "</td><td><a style='margin:0px 4px 0px 4px;' target='_top'  hidefocus='hidefocus' id='",
786            $(this).attr("term"),
787            "' href='Search.aspx?qk=", qKind, "&q=", $(this).attr("term"), "&qnk=", $(this).attr("normalkey"), "&adv=", isAdvancedSrch, "&qts=", $(this).attr("ts"), "&rp=", hasRightPanel, "'>",
788            $(this).attr("term"), "</a></td></tr>"
789            ].join('');
790            }
791        });
792        if (suggStr != '') {
793            cur_Index = -1;
794            if (qTS == "3") $("#NearTerm_div").css("direction", "rtl").css("textAlign", "right");
795            else $("#NearTerm_div").css("direction", "ltr").css("textAlign", "left");
796
797            if ($('#closeNearTerm_div')) { $('#closeNearTerm_div').css("display", 'block'); $('#fimg').css("display", 'block'); }
798            $("#NearTerm_div").css("display", "block").css("height", "200");
799            $("#closeNearTerm_div").css("top", "27");
800            $('#fimg').css("top", "20");
801
802            $("#NearTerm_div").html('');
803            $("#NearTerm_div").append("<table width=98% id='NearTerm_table' border=0 >" + suggStr + "</table>");
804        }
805    }
806};
807//***************************************************
808var processSearchPage = function(xml) {
809    var BT_HTMLContent = $(xml).find('btnodes').text();
810    var NT_HTMLContent = $(xml).find('ntnodes').text();
811    var RT_HTMLContent = $(xml).find('rtnodes').text();
812    var headingt_HTMLContent = $(xml).find('headingnodes').text();
813
814    if ($(xml).find("desclist").length != 0) $('#desc_div').html('');
815
816    if ($(xml).find('btnodes').length != 0 || $(xml).find('ntnodes').length != 0 || $(xml).find('rtnodes').length != 0
817        || $(xml).find('headingnodes').length != 0 || $(xml).find("limitations").length != 0)
818        $('#right_div').html('');
819
820    var right_sec = [right_sec, "<div id='srch_rightPnlWrapper'>"].join('');
821
822    //right_sec = [right_sec, "<div class='mnuRightCloseWrapper'><span id='srch_mnuCloseRightDiv' class='mnuCloseRightClass roundRight'>▶</span></div>"].join('');
823
824    if (headingt_HTMLContent != '')
825        right_sec = [right_sec, "<div class='srch_rightPnl_Sub'><div class='secHeaderBlue'><div id='h_subHead_div' class='showSecFixed' onclick='closeSection(\"h_subHead_div\",\"subHead_div\");'></div><div class='srch_rightPnlTitle'>",
826            'سرعنوان موضوعی',
827        "</div></div><div class='secContent' id='subHead_div'>", headingt_HTMLContent, "</div><div class='pannelSpacer'></div></div>"].join('');
828
829    if (NT_HTMLContent != '')
830        right_sec = [right_sec, "<div class='srch_rightPnl_Sub'><div class='secHeaderBlue'><div id='h_ntsec_div' class='showSecFixed' onclick='closeSection(\"h_ntsec_div\",\"ntsec_div\");'></div><div class='srch_rightPnlTitle'>",
831            "موضوعات اخص (Narrower Terms)",
832         "</div></div><div class='secContent' id='ntsec_div'>", NT_HTMLContent, "</div><div class='pannelSpacer'></div></div>"].join('');
833
834    if (BT_HTMLContent != '')
835        right_sec = [right_sec, "<div class='srch_rightPnl_Sub'><div class='secHeaderBlue'><div id='h_btsec_div' class='showSecFixed' onclick='closeSection(\"h_btsec_div\",\"btsec_div\");'></div><div class='srch_rightPnlTitle'>",
836        'موضوعات اعم (Broader Terms)',
837        "</div></div><div class='secContent' id='btsec_div'>", BT_HTMLContent, "</div><div class='pannelSpacer'></div></div>"].join('');
838
839    if (RT_HTMLContent != '')
840        right_sec = [right_sec, "<div class='srch_rightPnl_Sub'><div class='secHeaderBlue'><div id='h_rtsec_div' class='showSecFixed' onclick='closeSection(\"h_rtsec_div\",\"rtsec_div\");'></div><div class='srch_rightPnlTitle'>",
841        'موضوعات هم ارز (Related Terms)',
842        "</div></div><div class='secContent' id='rtsec_div'>", RT_HTMLContent, "</div><div class='pannelSpacer'></div></div>"].join('');
843
844    right_sec = [right_sec, "</div>"].join('');
845
846    $("#right_div").append(right_sec);
847
848    if ($("#right_div").find('table.STGrid')) {
849        $('table.STGrid').find("tr:last td").css("border", "0");
850        $('table.NTHeading_Table').find("tr:last td a").css("border", "0");
851    }
852
853    HandleSearchResultSection(xml, "#info_div");
854    HandleLimitationSection(xml, "#right_div");
855    HandleDescriptionSection(xml, "#desc_div");
856    if ($('#srch_mnuCloseRightDiv').css("display") === "none") {
857        SetRightSlideMenu();
858    }
859    $('#SrchQuery_div').html(getSrchQuery());
860};
861//***************************************************
862var processSubjectHeadings = function(xml) {
863    var headingt_HTMLContent = $("headingnodes", xml).text();
864    if (headingt_HTMLContent != '')
865        $("#subHead_div").html(headingt_HTMLContent);
866};
867
868//***************************************************
869var processHomePageData = function(xml) {
870    HandleRightSections(xml, "#right_div", 0);
871    HandleFavBooksSection($(xml).find("FavBooks")[0], "#FavBooks_div");
872    HandleFavBooksSection($(xml).find("FullViewBooks")[0], "#FullViewBooks_div");
873    HandleAdsPanelSection(xml, "#adsContent");
874
875    //Edited by Farshbaf: (92-1-17) to process the result xml and Show the Count of FullView and Preview Books in HomePage Corresponding Labels
876    HandleFullViewAndPreviewBooksCountInfo($(xml).find("FullViewAndPreviewBooksCountInfo")[0]);
877    //End Edit 
878
879    if (window.location.href.toLowerCase().indexOf("home.aspx") > 0) {
880        if (window.location.href.toLowerCase().indexOf("fv") > 0) favBook = 1;
881        else if (window.location.href.toLowerCase().indexOf("fb") > 0) favBook = 0;
882
883        if (favBook == 1) {
884            $('#FavBooks_div').css("display", "none");
885            $('#FullViewBooks_div').css("display", "");
886            $('#FB_td').removeClass("tab tabactive").addClass("tab");
887            $('#FV_td').removeClass("tab").addClass("tab tabactive");
888        }
889        else {
890            $('#FavBooks_div').css("display", "");
891            $('#FullViewBooks_div').css("display", "none");
892            $('#FB_td').removeClass("tab").addClass("tab tabactive");
893            $('#FV_td').removeClass("tab tabactive").addClass("tab");
894        }
895
896        SetFullViewAndPreviewBooksCountInfoVisible();
897
898    }
899};
900//*******************Jalali Extension Method*********
901Date.prototype.toJalaliDateString = function(grgYear, grgMonth, grgDay) {
902
903
904    var grgSumOfDays = Array(Array(0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365), Array(0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366));
905    var hshSumOfDays = Array(Array(0, 31, 62, 93, 124, 155, 186, 216, 246, 276, 306, 336, 365), Array(0, 31, 62, 93, 124, 155, 186, 216, 246, 276, 306, 336, 366));
906    function grgIsLeap(Year) {
907        return ((Year % 4) == 0 && ((Year % 100) != 0 || (Year % 400) == 0));
908    }
909
910    function hshIsLeap(Year) {
911        Year = (Year - 474) % 128;
912        Year = ((Year >= 30) ? 0 : 29) + Year;
913        Year = Year - Math.floor(Year / 33) - 1;
914        return ((Year % 4) == 0);
915    }
916
917    var hshYear = grgYear - 621;
918    var hshMonth, hshDay;
919
920    var grgLeap = grgIsLeap(grgYear);
921    var hshLeap = hshIsLeap(hshYear - 1);
922
923    var hshElapsed;
924    var grgElapsed = grgSumOfDays[(grgLeap ? 1 : 0)][grgMonth - 1] + grgDay;
925
926    var XmasToNorooz = (hshLeap && grgLeap) ? 80 : 79;
927
928    if (grgElapsed <= XmasToNorooz) {
929        hshElapsed = grgElapsed + 286;
930        hshYear--;
931        if (hshLeap && !grgLeap)
932            hshElapsed++;
933    }
934    else {
935        hshElapsed = grgElapsed - XmasToNorooz;
936        hshLeap = hshIsLeap(hshYear);
937    }
938
939    for (var i = 1; i <= 12; i++) {
940        if (hshSumOfDays[(hshLeap ? 1 : 0)][i] >= hshElapsed) {
941            hshMonth = i;
942            hshDay = hshElapsed - hshSumOfDays[(hshLeap ? 1 : 0)][i - 1];
943            break;
944        }
945    }
946    return hshYear + "-" + (hshMonth >= 1 && hshMonth <= 9 ? '0' + hshMonth : hshMonth) + "-" + (hshDay >= 1 && hshDay <= 9 ? '0' + hshDay : hshDay);
947}
948//***************************************************
949String.prototype.Compare = function(Str2) {
950    var result = 1;
951    var Str1 = this.split("");
952    var Str2 = Str2.split("");
953    for (var i = 0; i <= Str1.length - 1; i++) {
954        if (Str1[i] < Str2[i]) {
955            result = -1;
956            break;
957        }
958        else if (Str1[i] > Str2[i]) {
959            result = 1;
960            break;
961        }
962        else {
963            result = 0;
964        }
965    }
966    return result;
967}
968//***************************************************
969
970var ArrayAdsInfo = [];
971
972var HandleAdsPanelSection = function(xml, div_id) {
973
974    var flashSettingStr = GetFlashSettingStr(xml);
975    var tmpStr = '';
976    var tmp = [];
977    var defaultheight = '';
978    var defaultwidth = '';
979    var virtualdirectory = '';
980    var maxofdisplayableads = 0;
981    var defaultorder = 0;
982    var renderedStr = '';
983    var pubStartDate = '';
984    var pubEndDate = '';
985    var curJalaliDate = '';
986    var AdsCnt = 0;
987    var SortedArr = Array();
988    var CurDate = new Date();
989    SortedArr = GetSortedList(xml);
990    curJalaliDate = CurDate.toJalaliDateString(CurDate.getFullYear(), CurDate.getMonth() + 1, CurDate.getDate());
991    curJalaliDate = curJalaliDate.replace(/\-/g, "");
992
993
994    ArrayAdsInfo = [];
995
996
997    //USE DYNAMIC INITIALIZATION
998    $(xml).find('displayoption').each(function() {
999        if ($(this).attr('type').toString() === 'string') {
1000            tmpStr = $(this).attr('name').toString() + "='" + $(this).attr('value').toString() + "';";
1001        }
1002        else if ($(this).attr('type').toString() === 'int') {
1003            tmpStr = $(this).attr('name').toString() + "=" + $(this).attr('value').toString() + ";";
1004        }
1005        eval(tmpStr);
1006
1007    });
1008
1009    var i = 0;
1010    var tmpOrder = 0;
1011    var fileName = '';
1012    var aafileName = '';
1013    var filePath = '';
1014    var advClassId = '';
1015    var advName = '';
1016    var advWidth = '';
1017    var advHeight = '';
1018    var advUrl = '';
1019    var hasEdgeAdv = 0;
1020
1021    while (i <= SortedArr.length - 1) {
1022        $(xml).find("aditem").each(function() {
1023            if ($(this).attr('isenabled') === 'true') {
1024
1025                pubStartDate = $(this).attr('pubstartdate');
1026                pubEndDate = $(this).attr('pubenddate');
1027                fileName = $.trim($(this).attr('mediafilename').toString());
1028                pubStartDate = (pubStartDate == undefined) ? '' : pubStartDate.replace(/\-/g, "");
1029                pubEndDate = (pubEndDate == undefined) ? '' : pubEndDate.replace(/\-/g, "");
1030
1031                if ((pubStartDate.Compare(curJalaliDate) <= 0 || !pubStartDate) && (pubEndDate.Compare(curJalaliDate) >= 0 || !pubEndDate)) {
1032                    tmpOrder = $(this).attr("rankorder");
1033                    tmpOrder = (tmpOrder) ? parseInt(tmpOrder) : 0;
1034                    if (tmpOrder == SortedArr[i]) {
1035                        if (AdsCnt <= maxofdisplayableads - 1) {
1036                            if ($(this).attr('mediakind').toString() === 'edgehtml') {
1037                                advClassId = $.trim($(this).attr('advclassid').toString());
1038                                advName = $.trim($(this).attr('advname').toString());
1039                                advWidth = $.trim($(this).attr('width').toString());
1040                                advHeight = $.trim($(this).attr('height').toString());
1041                                filePath = "../Ads/" + advName;
1042                                advUrl = $.trim($(this).attr('url').toString());
1043
1044                                ArrayAdsInfo.push({
1045                                    'advName': advName,
1046                                    'advClassId': advClassId,
1047                                    'advFilePath': filePath,
1048                                    'advFileName': fileName,
1049                                    'advWidth': advWidth,
1050                                    'advHeight': advHeight,
1051                                    'advUrl': advUrl
1052                                });
1053
1054                                renderedStr = [renderedStr, '<div class="ads"><a  href=\"', advUrl, '\" onclick="if(isMouseDraged==0){window.open(this.href); return false;}; isMouseDraged = 0;"><div id="', advName, '" class="', advClassId, ' advBox"></div></a></div>'].join('');
1055                                //renderedStr = [renderedStr, '<div class="ads"><a href=\"', advUrl, '\" target="_blank"><div id="', advName, '" class="', advClassId, ' advBox"></div></a></div>'].join('');
1056                                if (hasEdgeAdv == 0) {
1057                                    hasEdgeAdv = 1;
1058                                }
1059                                ++AdsCnt;
1060                            }
1061                            else if ($(this).attr('mediakind').toString() === 'flash') {
1062                                renderedStr = [renderedStr, '<div class="ads">', '<embed ', flashSettingStr, 'src="', virtualdirectory + fileName + '"',
1063                                   'width="', ($(this).attr('width')) ? $(this).attr('width').toString() + '"' : defaultwidth + '"', 'height="',
1064                                   ($(this).attr('height')) ? $(this).attr('height').toString() + '"' : defaultheight + '"', '/></div>'].join(' ');
1065                                ++AdsCnt;
1066                            }
1067                            else if ($(this).attr('mediakind').toString() === 'image') {
1068                                renderedStr = [renderedStr, '<div class="ads">', '<a href=\"', $(this).attr('targeturl').toString(), '\" ><img src="', virtualdirectory + fileName + '"', 'alt="',
1069                                    $(this).attr('desc').toString() + '"', 'title="', $(this).atrr('desc').toString() + '"',
1070                                    'width="' + defaultwidth + '"', 'height="',
1071                                   ($(this).attr('height')) ? $(this).attr('height').toString() : defaultheight + '"', '/></a></div>'].join(' ');
1072                                ++AdsCnt;
1073                            }
1074                        }
1075                    }
1076                }
1077            }
1078        });
1079        ++i;
1080    }
1081    $(div_id).html(renderedStr);
1082
1083    if (hasEdgeAdv == 1) {
1084        setTimeout("LoadEdgeAdvs();", 1000);
1085    }
1086}
1087
1088var AdobeEdgeLoadComposition = function(s_fileName, s_advClassId, s_width, s_height) {
1089
1090    AdobeEdge.loadComposition(s_fileName, s_advClassId, {
1091        scaleToFit: "none",
1092        centerStage: "none",
1093        minW: "0px",
1094        maxW: "undefined",
1095        width: s_width,
1096        height: s_height
1097    }, { "dom": {} }, { "dom": {} });
1098}
1099
1100var LoadEdgeAdvs = function() {
1101    //this is for chrome and fire fox compatibility
1102    if (document.readyState == 'complete') {
1103        for (var i = 0; i < ArrayAdsInfo.length; i++) {
1104            AdobeEdgeLoadComposition(ArrayAdsInfo[i].advFilePath + '/' + ArrayAdsInfo[i].advFileName, ArrayAdsInfo[i].advClassId, ArrayAdsInfo[i].advWidth, ArrayAdsInfo[i].advHeight);
1105        };
1106    } else { setTimeout("LoadEdgeAdvs();", 1000); }
1107};
1108
1109var GetAdvertiseId = function(s_advName) {
1110    for (var i = 0; i < ArrayAdsInfo.length; i++) {
1111        if (ArrayAdsInfo[i].advName == s_advName) {
1112            return ArrayAdsInfo[i].advName;
1113        }
1114    };
1115}
1116
1117var GetAdvertiseClassId = function(s_advName) {
1118    for (var i = 0; i < ArrayAdsInfo.length; i++) {
1119        if (ArrayAdsInfo[i].advName == s_advName) {
1120            return ArrayAdsInfo[i].advClassId;
1121        }
1122    };
1123}
1124
1125var GetAdvertiseFilePath = function(s_advName) {
1126    for (var i = 0; i < ArrayAdsInfo.length; i++) {
1127        if (ArrayAdsInfo[i].advName == s_advName) {
1128            return ArrayAdsInfo[i].advFilePath;
1129        }
1130    };
1131}
1132
1133//***************************************************
1134//Edited By Farshbaf: (92-1-17)  to Append the count of books with fullview and preview to corresponding Labels in HomePage
1135var HandleFullViewAndPreviewBooksCountInfo = function(xml) {
1136
1137    fullViewBooksCount = parseInt($(xml).find("Info").attr("FullViewBooksCount"), 10);
1138    previewBooksCount = parseInt($(xml).find("Info").attr("PreviewBooksCount"), 10);
1139
1140    $('#FullViewBooksCountLabel').html('').append("(" + fullViewBooksCount.toString() + " جلد)");
1141    $('#PreviewBooksCountLabel').html('').append("(" + previewBooksCount.toString() + " جلد)");
1142
1143    $('#AdvSrchFullViewBooksCountLabel').html('').append("(" + fullViewBooksCount.toString() + " جلد)");
1144    $('#AdvSrchPreviewBooksCountLabel').html('').append("(" + previewBooksCount.toString() + " جلد)");
1145
1146
1147}
1148//End Edit
1149
1150//******************************************************
1151//Edited By Farshbaf: (92-1-17)  to visible Lables for showing the count of books with fullview and preview in HomePage
1152var SetFullViewAndPreviewBooksCountInfoVisible = function() {
1153
1154    $('#FullViewBooksCountLabel').css("display", "inline");
1155    $('#PreviewBooksCountLabel').css("display", "inline");
1156    $('#AdvSrchFullViewBooksCountLabel').css("display", "inline");
1157    $('#AdvSrchPreviewBooksCountLabel').css("display", "inline");
1158}
1159//End Edit
1160
1161//******************************************************
1162Array.prototype.unique = function() {
1163    var r = new Array();
1164    o: for (var i = 0, n = this.length; i < n; i++) {
1165        for (var x = 0, y = r.length; x < y; x++) {
1166            if (r[x] == this[i]) {
1167                continue o;
1168            }
1169        }
1170        r[r.length] = this[i];
1171    }
1172    return r;
1173}
1174//****************************************************
1175var GetSortedList = function(xml) {
1176    var SortedList = Array();
1177    var tmpInt = 0;
1178    var tmpStr = '';
1179    $(xml).find("aditem").each(function() {
1180        tmpInt = $(this).attr("rankorder");
1181        tmpInt = (tmpInt) ? parseInt(tmpInt) : 0;
1182        SortedList.push(tmpInt);
1183    });
1184    SortedList.sort(function(a, b) { return (b - a); });
1185    return SortedList.unique();
1186
1187}
1188//****************************************************
1189var GetFlashSettingStr = function(xml) {
1190    var flashSettingStr = '';
1191    $(xml).find("flashoption").each(function() {
1192
1193
1194        flashSettingStr = [flashSettingStr, $(this).attr('name') + '="' + $(this).attr('value') + '"'].join(' ');
1195
1196
1197    });
1198    return flashSettingStr;
1199}
1200//***************************************************
1201var HandleRightSections = function(xml, div_id, isBigHeader) {
1202    var str, extraSec = ''; var showSecClass = 'showSec', hideSecClass = 'hideSec', itemTextArr = '';
1203    var align = "right";
1204    var dir = "rtl";
1205    var tree_image = "<div class='childFa'></div>";
1206    var i = 1, counter = 0;
1207    var isPublisherSection = false;
1208    var pubFilterCharstr = '';
1209    if (isBigHeader) { showSecClass = 'showSecM'; hideSecClass = 'hideSecM'; }
1210
1211    //str = [str, "<div class='mnuRightCloseWrapper'><span id='mnuCloseRightDiv' class='mnuCloseRightClass roundRight'>▶</span></div>"].join('');
1212
1213    $(xml).find("Section").each(function() {
1214        isPublisherSection = false;
1215        pubFilterCharstr = '';
1216        extraSec = '';
1216 counter = 0;
1217        if ($(this).find("head").attr("id") === 'publishers') { publisherDiv_id = 'c' + i; isPublisherSection = true; }
1218        if ($(this).find("head").text() === 'Subject Browse' ||
1219           ($(this).find("head").text().indexOf('ویکی پدیا') > 0 && resource == 0)) { align = "left"; dir = "ltr"; tree_image = "<div class='childEn'></div>"; }
1220
1221        var curDiv_id = "c" + i;
1222        if (isPublisherSection) curDiv_id = "pub_tabl";
1223
1224        str = [str, "<div class='secHeaderBlue'><div id='h", i, "' class='", showSecClass, " ' onclick='closeSection(\"h", i, "\",\"", curDiv_id, "\");'></div><div style='position:relative; top:-10px; left:-5px; width:12em; white-space:nowrap;' >",
1225        $(this).find("head").text(),
1226        "</div></div>"].join('');
1227
1228        if (isPublisherSection) {
1229            pubFilterCharstr = ["<div id='pub_tabl'><div id='filterCharsColumn'>",
1230                                     "<span id='up_div'>▲</span><div class='publisher_wrapper'><div class='publisher_list'><div id='pubFilter_tbl'>"].join('');
1231
1232            for (var j = 0; j < pubFilterChars.length; j++) {
1233                pubFilterCharstr = [pubFilterCharstr, "<div><a id='", pubFilterChars[j], "' onclick=\" doPublisherFilter(\'", pubFilterChars[j], "'); \">", pubFilterChars[j], "</a></div>"].join('');
1234            }
1235
1236            pubFilterCharstr = [pubFilterCharstr, "</div></div></div><span id='down_div'>▼</span></div><div id='secContentWrapper' style='padding:0px;'>"].join('');
1237
1238            str = [str, pubFilterCharstr].join('');
1239        }
1240        //-----------------
1241
1242
1243        //        str = [str, "<div id='c", i, "' class='secContent isExpandedSubMenu' style='text-align:" + align + "; '>"].join('');
1244        str = [str, "<div id='c", i, "' class='secContent' style='text-align:" + align + "; '>"].join('');
1245
1246        $(this).find("content").each(function() {
1247            if (itemTextArr.indexOf("***" + $(this).text() + "***") < 0) {
1248                if (counter > 10 && !isPublisherSection) {
1249                    extraSec = [extraSec, "<div style='padding-right:" + $(this).attr("indent") + "px; padding-left:" + $(this).attr("indent") + "px; direction:" + dir + "; margin:1px 0px 1px 0px;'>"].join('');
1250                    if ($(this).attr("indent") > 0) {
1251                        extraSec = [extraSec, tree_image].join('');
1252                    }
1253                    else if ($(this).attr("indent") == 0) {
1254                        extraSec = [extraSec, "<div class='ColorDot' style='float:", align, "; margin-top:6px;' />"].join('');
1255                    }
1256
1257                    if ($(this).attr("url") != '' && $(this).attr("indent") != -2) {
1258                        extraSec = [extraSec, "<a class='right_hlink' href='", $(this).attr("url"), "'", "target=", $(this).attr("target"), " >", $(this).text(), "</a></div>"].join('');
1259                    }
1260                    else {
1261                        extraSec = [extraSec,
1262                  $(this).text(),
1263                  "</div>"
1264                  ].join('');
1265                    }
1266                }
1267                else {
1268                    str = [str, "<div style=' padding-right:" + $(this).attr("indent") + "px; padding-left:" + $(this).attr("indent") + "px; direction:" + dir + "; margin:1px 0px 1px 0px;'>"].join('');
1269                    if ($(this).attr("indent") > 0) {
1270                        str = [str, tree_image].join('');
1271                    }
1272                    else if ($(this).attr("indent") == 0) {
1273                        str = [str, "<div class='ColorDot' style='float:", align, "; margin-top:6px;'/>"].join('');
1274                    }
1275
1276                    if ($(this).attr("url") != '' && $(this).attr("indent") != -2) {
1277                        str = [str, "<a class='right_hlink' href='", $(this).attr("url"), "'", "target=", $(this).attr("target"), " >", $(this).text(), "</a></div>"].join('');
1278                    }
1279                    else {
1280                        str = [str,
1281                  $(this).text(),
1282                  "</div>"
1283                  ].join('');
1284                    }
1285                }
1286                counter++;
1287            }
1288            itemTextArr += "***" + $(this).text() + "***";
1289        });
1290        if (extraSec != '') str = [str, '<div id="ex', i, '" style="display:none; " >', extraSec, '</div>', '<div id="pex', i, '" style=" text-align:left; color:#666666; cursor:pointer; cursor:hand;" onclick=" ToggleSec(\'ex', i, '\');">بیشتر...</div>'].join('');
1291
1292        if (pubFilterCharstr != '')
1293            str = [str, '<div id="pex" style=" text-align:left; color:#666666; cursor:pointer; cursor:hand;">بیشتر...</div></div></div></div></div>'].join('');
1294        else str = [str, "</div>"].join('');
1295        str = [str, "<div id='rightDiv_pnlSpacer'></div>"].join('');
1296        i++;
1297    });
1298    $(div_id).append(str);
1299    makeScrollable("div.publisher_wrapper", "div.publisher_list");
1300    doPublisherFilter('Ø¢');
1301};
1302//***************************************************
1303var HandleLimitationSection = function(xml, div_id) {
1304
1305    //Edited By Farshbaf 1392-02-03 For VIPPublisher Limitation
1306    //The has been modified to be able to Process the All Limitations instead of just Holdings
1307
1308    var str, i, show_count, extraSec;
1309    var dir = 'rtl';
1310
1311    $(xml).find("Section").each(function() {
1312
1313        i = 0;
1314        str = '';
1315        extraSec = '';
1316        show_count = parseInt($(this).find("show_Count").text());
1317
1318        //Append Holding Records to RightPanel
1319        if ($(this).find("head").attr("id") === "holdings") {
1320
1321            str = [str, "<div class='secHeaderGreen'><div id='h_holdsec_div' class='showSecFixed' onclick='closeSection(\"h_holdsec_div\",\"holdsec_div\");'><img src='../App_Themes/MainTheme/MainImages/spacer.gif' width='10px' height='10' /></div><div class='limitSec_Title'>",
1322            $(this).find("head").text(),
1323            "</div></div><div class='secContent' id='holdsec_div'><div id='holdsec_innerDiv'>"].join('');
1324
1325            if ($(this).find("content").length != 0) {
1326
1327                str = [str,
1328                    "<div id='tr_all_center'>",
1329                    "<input checked=checked disabled=disabled id='all_center' type='checkbox' onclick='limitResultByHolding(0,\"\", 0);' />",
1330                    "تمامی مراکز اطلاع رسانی (", totalResultCount, ")<div  id='selSrvList' style='margin-right:5px;width:95%'></div><hr/></div>"
1331                    ].join('');
1332            }
1333
1334            $(this).find("content").each(function() {
1335
1336
1337                if (i > show_count) {
1338                    extraSec = [extraSec, "<div id='hold_", i, " style='display:table-row;clear:both;padding-right:" + $(this).attr("indent") + "px; padding-left:" + $(this).attr("indent") + "px; direction:" + dir + "; margin:3px 0px 3px 0px;'>"].join('');
1339                    extraSec = [extraSec, "<div style='display:table-column;float:right;width:8%'><input id='", $(this).attr("actualname"), "' type='checkbox' onclick='limitResultByHolding(", $(this).attr("qstep"), ",\"", $(this).attr("actualname"), "\",", i, ");' /></div>"].join('');
1340                    extraSec = [extraSec, "<div class='srvname' style='display:table-column;float:right;width:92%;margin-bottom:5px;margin-top:2px'>", $(this).text(), "</div></div>"].join('');
1341                }
1342                else {
1343                    str = [str, "<div id='hold_", i, " style='display:table-row;width:100%;clear:both;padding-right:" + $(this).attr("indent") + "px; padding-left:" + $(this).attr("indent") + "px; direction:" + dir + "; margin:3px 0px 3px 0px;'>"].join('');
1344                    str = [str, "<div style='display:table-column;float:right;width:8%'><input id='", $(this).attr("actualname"), "' type='checkbox' onclick='limitResultByHolding(", $(this).attr("qstep"), ",\"", $(this).attr("actualname"), "\",", i, ");' /></div>"].join('');
1345                    str = [str, "<div class='srvname' style='display:table-column;float:right;width:92%;margin-bottom:5px;margin-top:2px'>", $(this).text(), "</div></div>"].join('');
1346                }
1347
1348                i++;
1349            });
1350
1351            if (extraSec != '') str = [str, "<div id='HiddenHoldingsSec' style='display:none; ' >", extraSec, "</div><div id='pHiddenHoldingsSec' style=' text-align:left; color:#666666; cursor:pointer; cursor:hand;z-index:10' onclick='ToggleSec(\"HiddenHoldingsSec\");'>بیشتر...</div>"].join('');
1352
1353            str = [str, "</div></div> "].join('');
1354
1355            $(div_id).append(str);
1356
1357        } //Append VIPPublisher Records to RightPanel
1358        else if ($(this).find("head").attr("id") === "VIPPublishers") {
1359
1360            var publish_count = $(this).find("publish_count").text();
1361
1362            str = [str, "<div class='secHeaderGreen'><div id='h_VIPPublishersec_div' class='showSecFixed' onclick='closeSection(\"h_VIPPublishersec_div\",\"VIPPublishersec_div\");'><img src='../App_Themes/MainTheme/MainImages/spacer.gif' width='10px' height='10' ></div><div class='limitSec_Title' >",
1363                $(this).find("head").text(),
1364                "</div></div><div class='secContent' id='VIPPublishersec_div'><div id='VIPPublishersec_innerDiv'>"].join('');
1365
1366            if ($(this).find("content").length != 0) {
1367
1368
1369                str = [str,
1370                    "<div id='tr_all_VIPPublisher' >",
1371                    "<input checked=checked disabled=disabled id='all_VIPPublisher' type='checkbox' onclick='LimitResultByVIPPublisher(0,\"\", 0);' />",
1372                    "تمامی ناشرین فعال (", publish_count, ")<div  id='selVIPPublisherList' style='margin-right:5px;width:95%'></div><hr/></div>"
1373                    ].join('');
1374
1375            }
1376
1377
1378            $(this).find("content").each(function() {
1379
1380                if (i > show_count) {
1381                    extraSec = [extraSec, "<div id='VIPPublisher_", i, " style='display:table-row;width:100%;clear:both;padding-right:" + $(this).attr("indent") + "px; padding-left:" + $(this).attr("indent") + "px; direction:" + dir + "; margin:3px 0px 3px 0px;'>"].join('');
1382                    extraSec = [extraSec, "<div style='display:table-column;float:right;width:8%'>
1382<input id='", $(this).attr("vipppublisherkey"), "' type='checkbox' onclick='LimitResultByVIPPublisher(", $(this).attr("qstep"), ",\"", $(this).attr("vipppublisherkey"), "\",", i, ");' /></div>"].join('');
1383                    extraSec = [extraSec, "<div class='vippublishername' style='display:table-column;float:right;width:90%;margin-bottom:5px;margin-top:2px;'>", $(this).text(), "</div></div>"].join('');
1384                }
1385                else {
1386                    str = [str, "<div id='VIPPublisher_", i, " style='display:table-row;width:100%;clear:both;padding-right:" + $(this).attr("indent") + "px; padding-left:" + $(this).attr("indent") + "px; direction:" + dir + "; margin:3px 0px 3px 0px;'>"].join('');
1387                    str = [str, "<div style='display:table-column;float:right;width:8%'><input id='", $(this).attr("vipppublisherkey"), "' type='checkbox' onclick='LimitResultByVIPPublisher(", $(this).attr("qstep"), ",\"", $(this).attr("vipppublisherkey"), "\",", i, ");' /></div>"].join('');
1388                    str = [str, "<div class='vippublishername' style='display:table-column;float:right;width:90%;margin-bottom:5px;margin-top:2px;'>", $(this).text(), "</div></div>"].join('');
1389                }
1390
1391                i++;
1392            });
1393
1394            if (extraSec != '') str = [str, "<div id='HiddenVIPPublishersSec' style='display:none; ' >", extraSec, "</div><div id='pHiddenVIPPublishersSec' style=' text-align:left; color:#666666; cursor:pointer; cursor:hand;z-index:10' onclick='ToggleSec(\"HiddenVIPPublishersSec\");'>بیشتر...</div>"].join('');
1395
1396            str = [str, "</div></div>"].join('');
1397
1398            $(div_id).append(str);
1399
1400
1401        }
1402
1403
1404    });
1405
1406
1407};
1408//***************************************************
1409var HandleDescriptionSection = function(xml, div_id) {
1410    var desc = '', lcLink = '';
1411    $(xml).find("desclist").find("Item").each(function() {
1412        desc = [desc, GetFullInfoStr($(this))].join('');
1413    });
1414
1415    if ($(xml).find("desclist").length != 0) {
1416        lcLink = $(xml).find("desclist").attr("lclink");
1417        if (lcLink != undefined) {
1418            lcLink = "<a class='hlink' style='margin:5px 3% 5px 5px;' target=_blank href='http://id.loc.gov/authorities/" + lcLink + "'>مشاهده موضوع در کتابخانه کنگره آمریکا</a><br><br>";
1419        }
1420        else lcLink = '';
1421        desc = ["<div id='descWrapper'>", desc, "</div>"].join('');
1422        $(div_id).append("<div class='secHeaderYellow' style='padding-top:2px; margin-bottom:5px;'>" + $(xml).find("desclist").attr("head") + "</div>" +
1423                           lcLink +
1424                           desc +
1425                           "</div><div class='pannelSpacer'></div>");
1426    }
1427};
1428//***************************************************
1429var processBookPage = function(xml) {
1430    var str, book_table, thumb, holderid = 0, isbnStr = '', title = '', usmarcStr = ''; holdingsStr = ''; curSrv = ''; formStr = ''; needGoogleImg = false; pagingStr = '';
1431    var nextUrl = '', prevUrl = '', firstUrl = '', lastUrl = ''; reposeSrv = ''; reposeSrv_vd = ''; reposeSrv_vdg = ''; thumbInfo = ''; publisherCode = '';
1432
1433    if ($.getUrlVar('mode') === '1') {
1434        fullMode = '1';
1435    }
1436    else {
1437        fullMode = '0';
1438    }
1439
1440    var Next_btn = "<a class='paging_btn_dis' >بعدی</a>",
1441        Next_img = "<div class='nextImg_dis'></div>",
1442        Prev_btn = "<a class='paging_btn_dis' >قبلی</a>",
1443        Prev_img = "<div class='prevImg_dis'></div>",
1444        First_btn = "<a class='paging_btn_dis' >ابتدا</a>",
1445        First_img = "<div class='firstImg_dis'></div>",
1446        Last_btn = "<a class='paging_btn_dis' >انتها</a>",
1447        Last_img = "<div class='lastImg_dis'></div>";
1448
1449    reposeSrv = $(xml).find("ItemList").attr("repositorysrv");
1450    reposeSrv_vd = $(xml).find("ItemList").attr("repositorysrv_vd");
1451    reposeSrv_vdg = $(xml).find("ItemList").attr("repositorysrv_vdg");
1452
1453
1454    $(xml).find("Item").each(function() {
1455        thumb = ''; thumbInfo = ''; publisherCode = '';
1456        if ($(this).attr("refkind") === "3") resource = 1;
1457        else resource = 0;
1458        //**************
1459        if ($(this).attr("thumb")) {
1460            thumb = $(this).attr("thumb");
1461            needGoogleImg = true;
1462        }
1463        else {
1464            if ($(this).attr("refkind") === "3") {
1465                $(this).find("repository").each(function() {
1466                    if ($(this).attr("kind") === "3") {
1467                        thumb = ["<img class=\"bookThumb\"  src='", reposeSrv, reposeSrv_vdg, "getFile.aspx?FileGuid=", $(this).attr("guid"), "&cmd=Thumb&thmMaxSize=100&thmMode=UPTO", "' />"].join('');
1468                        publisherCode = $(this).attr("code").substr(0, $(this).attr("code").indexOf("/"));
1469                    }
1470                    else {
1471                        var itemSrc = [reposeSrv, reposeSrv_vd, "getfile.aspx?FileGuid=", $(this).attr("guid")].join('');
1472                        thumbInfo = [thumbInfo, "<br>", "<a class='thumbInfoText' target=_blank href='", itemSrc + "'>", $(this).attr("desc"), "</a>"].join('');
1473                    }
1474                });
1475                if (publisherCode != '')
1476                    if (parseInt(publisherCode) < 1000)
1477                    thumbInfo = [thumbInfo, "<br><br>", "<a class='thumbInfoTextLink' target=_op onclick=\"popwin=window.open('", reposeSrv, reposeSrv_vdg,
1478                               "webui/index.aspx?_cmd=2&_nv=", publisherCode, "&_nvt=code&_HideMenu=1",
1479                               "', \'ChildWindow\', \'location=no, menubar=no, top=25, left=25, width=\' + (window.screen.width-50) + \', height=\' + (window.screen.height-120) + \', resizable=yes, scrollbars=yes\'); popwin.focus(); \"  >"
1480                                  , "مشخصات ناشر", "</a>"].join('');
1481                thumb = [thumb, thumbInfo].join('');
1482            }
1483        }
1484
1485        if (thumb === '') thumb = defultThumb;
1486        //**************
1487        var thumbisbn = '';
1488        if ($(this).attr("isbnforthumb")) {
1489            if (thumbisbn == '') { thumbisbn = $(this).attr("isbnforthumb"); }
1490        }
1491        if (isbnStr != '') isbnStr = isbnStr + ",";
1492        isbnStr += thumbisbn;
1493        //**************
1494        $(this).find("title").each(function() {
1495            title = $(this).text();
1496        });
1497        //**************
1498        if ($(this).attr("dockey") != "-1") {
1499            if ($(xml).find("ItemList").attr("total") > 1) {
1500                holderid = $(xml).find("ItemList").attr("holderid");
1501                docIdx = parseInt($(this).attr("dockey"));
1502                if (docIdx != 0) {
1503                    First_btn = "<a class='paging_btn' href='" + "book.aspx?Simorgh=1&marckey=" + $(this).attr("refreckey") + "&marckind=" + $(this).attr("refkind") + "&idx=0" + "&hk=" + holderid + getUrlInfo(0) + "&mode=" + fullMode + "'>ابتدا</a>";
1504                    First_img = "<div class='firstImg'></div>";
1505                }
1506                if (docIdx - 1 >= 0) {
1507                    Prev_btn = "<a class='paging_btn' href='" + "book.aspx?Simorgh=1&marckey=" + $(this).attr("refreckey") + "&marckind=" + $(this).attr("refkind") + "&idx=" + (docIdx - 1) + "&hk=" + holderid + getUrlInfo(0) + "&mode=" + fullMode + "' >قبلی</a>";
1508                    Prev_img = "<div class='prevImg'></div>";
1509                }
1510                if (docIdx + 1 < $(xml).find("ItemList").attr("total")) {
1511                    Next_btn = "<a class='paging_btn' href='" + "book.aspx?Simorgh=1&marckey=" + $(this).attr("refreckey") + "&marckind=" + $(this).attr("refkind") + "&idx=" + (docIdx + 1) + "&hk=" + holderid + getUrlInfo(0) + "&mode=" + fullMode + "' >بعدی</a>";
1512                    Next_img = "<div class='nextImg'></div>";
1513                }
1514                if (docIdx + 1 != $(xml).find("ItemList").attr("total")) {
1515                    Last_btn = "<a class='paging_btn' href='" + "book.aspx?Simorgh=1&marckey=" + $(this).attr("refreckey") + "&marckind=" + $(this).attr("refkind") + "&idx=" + (parseInt($(xml).find("ItemList").attr("total")) - 1) + "&hk=" + holderid + getUrlInfo(0) + "&mode=" + fullMode + "' >انتها</a>";
1516                    Last_img = "<div class='lastImg'></div>";
1517                }
1518
1519                pagingStr = [pagingStr,
1520                                        "<div id='pagingBar' class='paging-table'>",
1521                                            "<div id='pagingBar_innerDiv' class='pagingBar_innerClass'>",
1522                                            "<div style='width:0.5625em; display:inline-block;' >", First_img, "</div>",
1523                                            "<div style='width:2em; display:inline-block; text-align:right;'>", First_btn, "</div>",
1524                                            "<div style='width:0.3125em; display:inline-block;' >", Prev_img, "</div>",
1525                                            "<div style='width:2em; display:inline-block; text-align:right;'>", Prev_btn, "</div>",
1526                                            "<div class='pagingBar_recordIndexer'> رکورد ", (docIdx + 1), " از ", $(xml).find("ItemList").attr("total"), " </div>",
1527                                            "<div style='width:2.5em; display:inline-block;'>", Next_btn, "</div>",
1528                                            "<div style='width:0.3125em; display:inline-block;' >", Next_img, "</div>",
1529                                            "<div style='width:2em; display:inline-block;'>", Last_btn, "</div>",
1530                                            "<div style='width:0.5625em; display:inline-block;' >", Last_img, "</div>",
1531                                            "</div>",
1532                                        "</div>"].join('');
1533
1534            }
1535        }
1536        //**************
1537
1538        book_table = [book_table, "<div id='bookListInfoBar'>",
1539                                  "<div id='bookListInfoBar_Title'>اطلاعات فهرست نویسی کتاب</div>"].join('');
1540
1541        book_table = [book_table, "<div id='format_div' class='paging_btn' onmouseover='$(this).css(\"color\", \"black\");' onmouseout='$(this).css(\"color\", \"maroon\");' onclick='changeformat();'>MARC FORMAT</div>"].join('');
1542        book_table = [book_table, pagingStr, "</div>"].join('');
1543        book_table = "<div class='secHeaderYellow' >" + book_table + "</div><div id='lable_div'> <div id='lable_innerDiv' class='lable_innerDivClass' data-LanguageType='" + resource + "'> <div id='lable_imageColumn' class='bookInfo_ImageBox' data-LanguageType='" + resource + "'>";
1544
1545        str = [str, book_table,
1546        thumb,
1547        "</div><div id='lable_TextColumn' class='bookInfo_TextBox' data-LanguageType='" + resource + "'>",
1548        "<div id='lable_TextColumn_Sub'>",
1549        "<div id='lable_TextSub_Title'><span class='bookTitle'>
1549", title, "</span></div>",
1550        "<div id='lable_TextSub_Info'><div>", GetFullInfoStr($(this)),
1551        "</div></div>",
1552        "</div></div>",
1553     ].join('');
1554        str = [str, "</div></div>"].join('');
1555    });
1556
1557    if ($(xml).find("bookeditions")) {
1558        HandleRightSections(xml, "#right_div", 1);
1559    }
1560
1561    usmarcStr = [usmarcStr, "<div id='usmarc_div' style='display:none;'><div id='usmarc_innerDiv'>"].join('');
1562    $(xml).find("format").each(function() {
1563        usmarcStr = [usmarcStr, "<div class='bookInfoLine'><div class='usmarc_txtTitle'>", $(this).attr("tag"), "</div>",
1564                            "<div class='usmarc_txtUnderScore'>", $(this).attr("indicator"), "</div>",
1565                            "<div class='usmarc_txtContent'>", $(this).attr("buffer"), "</div></div>"].join('');
1566    });
1567    usmarcStr = [usmarcStr, "</div></div>"].join('');
1568
1569    $(xml).find("holding").each(function() {
1570        if (holdingsStr == '') holdingsStr = [holdingsStr, "<div id='simorghStockPannel'>"].join('');
1571        if (curSrv != $(this).attr("srvname"))
1572            holdingsStr = [holdingsStr, "<div class='srvNameWrapper'><div class='ColorDot' style='float:right; margin-top:8px;'></div>", $(this).attr("srvname"), "</div>"].join('');
1573        holdingsStr = [holdingsStr, "<div class='srvSubContentWrapper'><div class='srvSubName'>", $(this).attr("dbname"), "</div>",
1574                                        "<div class='srvSubButtonsWrapper'><span style=\"cursor:hand;\" >",
1575                                                "<div  onclick=\"DoPost('ExpertDisplay" + $(this).attr("mfn") + "');\" class='srvSubButton' title='' onmouseover=\"ChangeClass(this, 'srvSubButtonOver', 'srvSubButton');\" onmouseout=\"ChangeClass(this, 'srvSubButton', 'srvSubButtonOver');\">نمایش تخصصی</div>",
1576                                                "<div  onclick=\"DoPost('ReqDoc" + $(this).attr("mfn") + "');\" class='srvSubButton' onmouseover=\"ChangeClass(this, 'srvSubButtonOver', 'srvSubButton');\" onmouseout=\"ChangeClass(this, 'srvSubButton', 'srvSubButtonOver');\">موجودی در مرکز</div>",
1577                                             "</span></div>",
1578                                        "</div>"].join('');
1579
1580        formStr = [formStr, "<form target=_blank id='ReqDoc" + $(this).attr("mfn"), "' method=post action='", $(this).attr("broker"), "/ExReqDoc'>",
1581                                               "<input type=hidden name='SNAME' value='", $(this).attr("actualsrv"), "' />",
1582                                               "<input type=hidden name='DBID' value='", $(this).attr("dbid"), "' />",
1583                                               "<input type=hidden name='MFN' value='", $(this).attr("mfn"), "' />",
1584                                               "<input type=hidden name='DPN' value='DocVolLst' />",
1585                                "</form>",
1586                                "<form target=_blank id='ExpertDisplay" + $(this).attr("mfn"), "' method=post action='", $(this).attr("broker"), "/ExDubExpRec'>",
1587                                               "<input type=hidden name='SNAME' value='", $(this).attr("actualsrv"), "' />",
1588                                               "<input type=hidden name='DBID' value='", $(this).attr("dbid"), "' />",
1589                                               "<input type=hidden name='MFN' value='", $(this).attr("mfn"), "' />",
1590                                               "<input type=hidden name='DPN' value='DocVolLst' />",
1591                                "</form>"].join('');
1592        curSrv = $(this).attr("srvname");
1593    });
1594
1595    if (holdingsStr != '')
1596        holdingsStr = [holdingsStr, "</div><br>"].join('');
1597    //}
1598
1599    document.title = title + " - NOSA BOOKS";
1600
1601    $('#info_div').append(str + usmarcStr);
1602
1603    //Edited By Farshbaf 1392-03-4
1604    //To Support Repository Service Requests we need to add a new Type called Repository
1605    if (publisherCode != '')
1606        if (parseInt(publisherCode) < 1000) //Is Publisher Active
1607    {
1608        $('#info_div').append(["<div id='RepositoryNotes_HolderDiv'><div class='pannelSpacer'></div><div class='secHeaderYellow'>یادداشت ناشر</div>",
1609                "<div id='RepositoryNotes_div'><center><img src='../App_Themes/MainTheme/MainImages/Loader200px.gif' height='100px' width='100px' /></center></div></div>"].join(''));
1610    }
1611    //End Edit
1612    if (holdingsStr != '')
1613        $('#info_div').append("<div class='pannelSpacer'></div><div class='secHeaderGreen'>موجودی در شبکه سیمرغ</div>" + holdingsStr);
1614
1615    $('#info_div').append(formStr);
1616    isbns = [isbnStr];
1617    if (needGoogleImg)
1618        GetThumbFromGoogleAPI(isbns);
1619
1620    if (fullMode === '1') {
1621        $('#usmarc_div').css("display", "block");
1622        $('#lable_div').css("display", "none");
1623    }
1624    else {
1625        $('#usmarc_div').css("display", "none");
1626        $('#lable_div').css("display", "block");
1627    }
1628
1629    if (window.location.href.toLowerCase().indexOf("book.aspx") > 0) {
1630
1631        if ($('#mnuCloseRightDiv').css("display") === "none") {
1632            SetRightSlideMenu();
1633        }
1634    }
1635};
1636
1637//***************************************************
1638var HandleSearchResultSection = function(xml, div_id) {
1639    var str = '', thumb, rank, isbnStr = '', title = '', _fullRecUrl = '', counter = 0; pagingStr = ''; startIdx = 0;
1640    reposeSrv = ''; reposeSrv_vd = ''; reposeSrv_vdg = ''; thumbInfo = ''; publisherCode = '';
1641    if (resetPaging) {
1642        curPage = 0;
1643        ps = 0; pe = 0;
1644        pagingMethod = 1;
1645        totalResultCount = 0;
1646        isNext = 1;
1647    }
1648    curHolderID = $(xml).find("ItemList").attr("holderid");
1649    totalResultCount = $(xml).find("ItemList").attr("total");
1650    authorTitle = $(xml).find("ItemList").attr("authortitle");
1651    reposeSrv = $(xml).find("ItemList").attr("repositorysrv");
1652    reposeSrv_vd = $(xml).find("ItemList").attr("repositorysrv_vd");
1653    reposeSrv_vdg = $(xml).find("ItemList").attr("repositorysrv_vdg");
1654
1655    if ($(xml).find("ItemList").find("Item").length != 0)
1656        pagingStr = getSearchResultPageCounter();
1657
1658
1659    $(xml).find("ItemList").find("Item").each(function() {
1660        thumb = ''; thumbInfo = ''; publisherCode = '';
1661        counter++;
1662        _fullRecUrl = "book.aspx?Simorgh=1&marckey=" + $(this).attr("refreckey") + "&marckind=" + $(this).attr("refkind") + "&idx=" + $(this).attr("dockey") + "&hk=" + curHolderID + getUrlInfo();
1663        //**************
1664        if ($(this).attr("thumb")) {
1665            thumb = $(this).attr("thumb");
1666        }
1667        else {
1668            if ($(this).attr("refkind") === "3") {
1669                var last_kind = '';
1670                $(this).find("repository").each(function() {
1671                    if ($(this).attr("kind") != last_kind && $(this).attr("kind") in ({ '2': 1, '32': 1, '10': 1, '3': 1 })) { // just show متن کامل،مشخصات ناشر، اولین معرفی کتاب
1672                        if ($(this).attr("kind") === "3") {
1673                            thumb = ["<img class=\"bookThumb\"  src='", reposeSrv, reposeSrv_vdg, "getFile.aspx?FileGuid=", $(this).attr("guid"), "&cmd=Thumb&thmMaxSize=100&thmMode=UPTO", "' />"].join('');
1674                            publisherCode = $(this).attr("code").substr(0, $(this).attr("code").indexOf("/"));
1675                        }
1676                        else {
1677                            var itemSrc = [reposeSrv, reposeSrv_vd, "getfile.aspx?FileGuid=", $(this).attr("guid")].join('');
1678                            thumbInfo = [thumbInfo, "<br>", "<a class='thumbInfoText' target=_blank href='", itemSrc + "'>", $(this).attr("desc"), "</a>"].join('');
1679                        }
1680                    }
1681                    last_kind = $(this).attr("kind");
1682                });
1683                if (publisherCode != '')
1684                    if (parseInt(publisherCode) < 1000)
1685                    thumbInfo = [thumbInfo, "<br><br>", "<a class='thumbInfoTextLink' target=_op onclick=\"popwin=window.open('", reposeSrv, reposeSrv_vdg,
1686                               "webui/index.aspx?_cmd=2&_nv=", publisherCode, "&_nvt=code&_HideMenu=1",
1687                               "', \'ChildWindow\', \'location=no, menubar=no, top=25, left=25, width=\' + (window.screen.width-50) + \', height=\' + (window.screen.height-120) + \', resizable=yes, scrollbars=yes\'); popwin.focus(); \"  >"
1688                                  , "مشخصات ناشر", "</a>"].join('');
1689                thumb = [thumb, thumbInfo].join('');
1690            }
1691        }
1692
1693        if (thumb === '') thumb = defultThumb;
1694        //**************
1695        var thumbisbn = '';
1696        if ($(this).attr("isbnforthumb")) {
1697            thumbisbn = $(this).attr("isbnforthumb");
1698            isbns[counter - 1] = thumbisbn;
1699        }
1700        //**************
1701        $(this).find("title").each(function() {
1702            title = $(this).text();
1703        });
1704        //**************
1705        if ($(this).attr("rank")) {
1706            rank = $(this).attr("rank");
1707        }
1708        //**************
1709        var book_tablnk = "<div class='bookInfo_clickArea' onclick=\"if(event.target.tagName != 'A') {window.location ='" + _fullRecUrl + "';}\"><div class='bookInfo_innerDiv' data-LanguageType='" + resource + "' style='border-bottom: 1px solid #DCDCDC;'><div id='srch_imageColumn' class='bookInfo_ImageBox' data-LanguageType='" + resource + "'>";
1710        if (counter === parseInt($(this).attr("listcount"))) {
1711            book_tablnk = "<div class='bookInfo_clickArea' onclick=\"if(event.target.tagName != 'A') {window.location ='" + _fullRecUrl + "';}\"><div class='bookInfo_innerDiv' data-LanguageType='" + resource + "'><div id='srch_imageColumn' class='bookInfo_ImageBox' data-LanguageType='" + resource + "'>"
1712        }
1713
1714        str = [str, book_tablnk,
1715        "<div>", thumb, "</div>",
1716        "</div><div id='srch_TextColumn' class='bookInfo_TextBox' data-LanguageType='" + resource + "'>",
1717        "<div id='srch_TextColumn_Sub'>",
1718        "<div id='srch_TextSub_Title'><span class='bookTitle'>", title, "</span></div>",
1719        "<div id='srch_TextSub_Info'><div>", GetFullInfoStr($(this), $(this).attr("dockey")),
1720        "</div></div>",
1721        "</div></div>",
1722     ].join('');
1723        str = [str, "</div></div></div>"].join('');
1724
1725
1726    });
1727
1728    $(div_id).html('');
1729    if (str != '')
1730        $(div_id).append("<div id='paging_panel' class='secHeaderYellow' style='padding-top:0px;'>" + pagingStr + "</div>" + str + "<div id='paging_panel' class='secHeaderYellow' style='padding-top:0px;'>" + pagingStr + "</div>");
1731    else {
1732        var emptyStr = [emptyStr, "<span class='error' style='font-weight:bold;'>عبارت جستجو یافت نشد.</span>"].join('');
1733        $(div_id).append("<div id='paging_panel' class='secHeaderYellow' style='padding-top:0px;'>" + pagingStr + "</div>" + "<div style='height:600px'>" + emptyStr + "</div>" + "<div id='paging_panel' class='secHeaderYellow' style='padding-top:0px;'>" + pagingStr + "</div>");
1734    }
1735    GetThumbFromGoogleAPI(isbns);
1736};
1737
1738//***************************************************
1739var nextResults = function() {
1740    pagingMethod = 1;
1741    resetPaging = 0;
1742    isNext = 1;
1743    curPage++;
1744    SetHashValue();
1745};
1746
1747//***************************************************
1748var prevResults = function() {
1749    pagingMethod = 1;
1750    resetPaging = 0;
1751    isNext = 0;
1752    curPage--;
1753
1754    SetHashValue();
1755};
1756//***************************************************
1757var firstResults = function() {
1758    pagingMethod = 2;
1759    resetPaging = 0;
1760    isNext = 0;
1761
1762    SetHashValue();
1763};
1764//***************************************************
1765var lastResults = function() {
1766    pagingMethod = 2;
1767    resetPaging = 0;
1768    isNext = 1;
1769
1770    SetHashValue();
1771};
1772
1773//***************************************************
1774var getSearchResultPageCounter = function() {
1775    // aFillMethod=1(click next/prev)  aFillMethod=2(click page number)
1776    var listHolderCount, pageStr, counter = '', start, end = '';
1777
1778    var Next_btn = "<a class='paging_btn_dis' >بعدی</a>",
1779        Next_img = "<div class='nextImg_dis'></div>",
1780        Prev_btn = "<a class='paging_btn_dis' >قبلی</a>",
1781        Prev_img = "<div class='prevImg_dis'></div>",
1782        First_btn = "<a class='paging_btn_dis' >ابتدا</a>",
1783        First_img = "<div class='firstImg_dis'></div>",
1784        Last_btn = "<a class='paging_btn_dis' >انتها</a>",
1785        Last_img = "<div class='lastImg_dis'></div>";
1786
1787    var totalPageCount = 0;
1788
1789    if (totalResultCount % qMaxCount != 0)
1790        totalPageCount = Math.floor(totalResultCount / qMaxCount) + 1;
1791    else totalPageCount = totalResultCount / qMaxCount;
1792
1793    if (totalPageCount <= 3) listHolderCount = 3;
1794    else listHolderCount = 5;
1795
1796    if (curPage > totalPageCount) curPage = totalPageCount;
1797    if (curPage < 0) curPage = 0;
1798
1799    if (resetPaging == 1) { // first time
1800        ps = 0;
1801        if (totalPageCount < listHolderCount) pe = totalPageCount;
1802        else pe = listHolderCount;
1803    }
1804    else {
1805        if (pagingMethod == 1) {
1806            if (isNext === "1") {
1807                if (curPage == pe) { ps++; pe++; }
1808            }
1809            else {
1810                if (curPage + 1 == ps) { ps--; pe--; }
1811            }
1812        }
1813        else if (pagingMethod == 2) {
1814            if (curPage + Math.floor((listHolderCount / 2)) + 1 <= totalPageCount)
1815                pe = curPage + Math.floor((listHolderCount / 2)) + 1;
1816            else pe = totalPageCount;
1817            if (pe < listHolderCount) pe = listHolderCount;
1818
1819            ps = pe - listHolderCount;
1820        }
1821    }
1822
1823    if (ps < 0) ps = 0;
1824    if (pe > totalPageCount) pe = totalPageCount;
1825
1826    counter = [counter, "<div id='srch_pageCounter'>"].join('');
1827
1828    for (var i = ps; i < pe; i++) {
1829        if (i == curPage)
1830            counter += "<span class='srch_currPageNumber'>" + (i + 1) + "</span>";
1831        else
1832            counter += "<a class='srch_hiddenPagesNumber' onclick='pagingMethod=2; curPage=" + i + "; isNext=1; resetPaging=0; SetHashValue();'>" + (i + 1) + "</a>";
1833    }
1834
1835    counter = [counter, "</div>"].join('');
1836
1837    if (curPage != 0) {
1838        First_btn = "<a class='paging_btn' onclick='curPage=0; firstResults();'>ابتدا</a>";
1839        First_img = "<div class='firstImg'></div>";
1840    }
1841
1842    if (curPage != totalPageCount - 1) {
1843        Last_btn = "<a class='paging_btn' onclick='curPage=" + (totalPageCount - 1) + "; lastResults();'>انتها</a>";
1844        Last_img = "<div class='lastImg'></div>";
1845    }
1846
1847    if (ps <= curPage && curPage != 0) {
1848        Prev_btn = "<a class='paging_btn'  onclick='prevResults();'>قبلی</a>";
1849        Prev_img = "<div class='prevImg'></div>";
1850    }
1851    if (totalPageCount - 1 > curPage) {
1852        Next_btn = "<a id='nxt_btn' class='paging_btn' onclick='nextResults();'>بعدی</a>";
1853        Next_img = "<div class='nextImg'></div>";
1854    }
1855    else { }
1856
1857
1858    start = (curPage * qMaxCount) + 1;
1859    end = ((curPage + 1) * qMaxCount);
1860    if (end > totalResultCount) end = totalResultCount;
1861
1862    counter = ["<div id='srch_pagingBar_innerDiv' class='pagingBar_innerClass'>",
1863               "<div style='width:0.5625em; display:inline-block;' >", First_img, "</div>",
1864               "<div style='width:2em; display:inline-block; text-align:right;'>", First_btn, "</div>",
1865               "<div style='width:0.3125em; display:inline-block;' >", Prev_img, "</div>",
1866               "<div style='width:2em; display:inline-block; text-align:right;'>", Prev_btn, "</div>",
1867               "<div style='min-width:5.625em; display:inline-block; text-align:center; margin:auto;'>
1867", counter, " </div>",
1868               "<div style='width:2.5em; display:inline-block;'>", Next_btn, "</div>",
1869               "<div style='width:0.3125em; display:inline-block;' >", Next_img, "</div>",
1870               "<div style='width:2em; display:inline-block;'>", Last_btn, "</div>",
1871               "<div style='width:0.5625em; display:inline-block;' >", Last_img, "</div>",
1872               "</div>"].join('');
1873
1874    if (totalPageCount == 1) counter = '';
1875    pageStr = [pageStr, "<div id='srch_resultBar'><div id='srch_resultBarRecCounter'>نتایج جستجو: ", start, " تا ", end, " از ", totalResultCount, "</div><div id='srch_pagingBar' class='paging-table'>"].join('');
1876    pageStr = [pageStr, counter].join('');
1877    pageStr = [pageStr, "</div></div>"].join('');
1878
1879    $("#paging_panel").html(pageStr);
1880    return pageStr;
1881};
1882//***************************************************
1883var HandleFavBooksSection = function(xml, div_id) {
1884    var str, thumb, thumbInfo, isbnStr = '', title = '', _fullRecUrl = '', counter = 0; reposeSrv = ''; reposeSrv_vd = ''; reposeSrv_vdg = '';
1885    resource = 1;
1886    reposeSrv = $(xml).find("ItemList").attr("repositorysrv");
1887    reposeSrv_vd = $(xml).find("ItemList").attr("repositorysrv_vd");
1888    reposeSrv_vdg = $(xml).find("ItemList").attr("repositorysrv_vdg");
1889
1890    $(xml).find("Item").each(function() {
1891        thumb = '';
1892        thumbInfo = '';
1893        counter++;
1894        _fullRecUrl = "book.aspx?Simorgh=1&marckey=" + $(this).attr("refreckey") + "&marckind=" + $(this).attr("refkind");
1895        //**************
1896        if ($(this).attr("thumb")) {
1897            thumb = $(this).attr("thumb");
1898        }
1899        else {
1900            if ($(this).attr("refkind") === "3") {
1901                if ($(this).attr("visitedtimes") != "0") {
1902                    $(this).find("repository").each(function() {
1903                        if ($(this).attr("kind") === "3") {
1904                            thumb = ["<img class=\"bookThumb\"  src='", reposeSrv, reposeSrv_vdg, "getFile.aspx?FileGuid=", $(this).attr("guid"), "&cmd=Thumb&thmMaxSize=100&thmMode=UPTO", "' />"].join('');
1905                        }
1906                    });
1907                }
1908                else if ($(this).attr("fullviewCD") != '') {
1909                    var last_kind = '';
1910                    $(this).find("repository").each(function() {
1911                        if ($(this).attr("kind") != last_kind && $(this).attr("kind") in ({ '2': 1, '32': 1, '3': 1 })) { // just show متن کامل
1912                            if ($(this).attr("kind") === "3") {
1913                                thumb = ["<img class=\"bookThumb\"  src='", reposeSrv, reposeSrv_vdg, "getFile.aspx?FileGuid=", $(this).attr("guid"), "&cmd=Thumb&thmMaxSize=100&thmMode=UPTO", "' />"].join('');
1914                            }
1915                            else {
1916                                var itemSrc = [reposeSrv, reposeSrv_vd, "getfile.aspx?FileGuid=", $(this).attr("guid")].join('');
1917                                thumbInfo = [thumbInfo, "<br>", "<a style='font-family: Tahoma;	font-size:0.75em;  color:#333;' target=_blank href='", itemSrc, "' onclick='event.cancelBubble = true;' >", $(this).attr("desc"), "</a>"].join('');
1918                            }
1919                        }
1920                        last_kind = $(this).attr("kind");
1921                    });
1922                    thumb = [thumb, thumbInfo].join('');
1923                }
1924            }
1925        }
1926
1927        if (thumb === '') thumb = defultThumb;
1928        //**************
1929        var thumbisbn = '';
1930        $(this).find("isbn").each(function() {
1931            if (thumbisbn == '') { thumbisbn = $(this).text(); }
1932        });
1933        if (isbnStr != '') isbnStr = isbnStr + ",";
1934        isbnStr = thumbisbn;
1935        //**************
1936        $(this).find("title").each(function() {
1937            title = $(this).text();
1938        });
1939        //**************
1940
1941        var book_tablnk = "<a class='bookinfolink' href='" + _fullRecUrl + "'><div class='bookInfo_innerDiv' onclick=\"(function(){if(isMouseDraged==0){window.location ='" + _fullRecUrl + "';}; isMouseDraged = 0;})(event)\" style='border-bottom: 1px solid #DCDCDC;'><div><div class='bookInfo_ImageBox'>";
1942        if (counter === parseInt($(this).attr("listcount"))) {
1943            book_tablnk = "<a class='bookinfolink' href='" + _fullRecUrl + "'><div class='bookInfo_innerDiv' onclick=\"(function(){if(isMouseDraged==0){window.location ='" + _fullRecUrl + "';}; isMouseDraged = 0;})(event)\"><div><div class='bookInfo_ImageBox'>"
1944        }
1945
1946
1947        str = [str, book_tablnk,
1948        thumb,
1949        "</div><div class='bookInfo_TextBox'>",
1950        "<div style='width:100%; margin-bottom:7px;'>",
1951         "<div><div class='bookTitleWrapper'><span class='bookTitle'>", title, "</span></div></div>",
1952         "<div style='width:100%; padding-right:3%;'>", GetFullInfoStr($(this)),
1953        "</div>"].join('');
1954
1955        if ($(this).attr("visitedtimes") != "0")
1956            str = [str, "<div style='width:100%; padding-right:5%; float:right;'><div><span class='bookTitle' style='font-size:0.8125em; font-weight:normal; line-height:1.875em;'>تعداد بازدید : ", $(this).attr("visitedtimes"), "</span></div></div>"].join('');
1957        else if ($(this).attr("fullviewCD") != '')
1958            str = [str, "<div style='width:100%; padding-right:5%; float:right;'><div><span class='bookTitle' style='font-size:0.8125em; font-weight:normal; line-height:1.875em;'>تاریخ تولید : ", $(this).attr("fullviewCD"), "</span></div></div>"].join('');
1959        str = [str, "</div></div></div>", "</div></a>"].join('');
1960    });
1961
1962    $(div_id).append(str);
1963    isbns = [isbnStr];
1964    GetThumbFromGoogleAPI(isbns);
1965};
1966
1967//***************************************************
1968var GetFullInfoStr = function(item, AdocKey) {
1969    var str = '';
1970    var itemKind = '';
1971    var talign = 'left', dir = 'ltr', left = '-135px';
1972    if (resource === 0) { talign = 'right'; dir = 'rtl'; left = "135px"; }
1973    item.find("creator").each(function() {
1974        if (itemKind != "creator") {
1975            str = [str,
1976            "<div class='bookInfoLine' data-LanguageType='" + resource + "'><div class='TxtTitle' data-LanguageType='" + resource + "'>", text.creator[1], "</div>",
1977            "<div class='TxtContent' data-LanguageType='" + resource + "'>", $(this).text(), "</div></div>"].join('');
1978        }
1979        else if (AdocKey == undefined) {
1980            str = [str,
1981            "<div class='bookInfoLine' data-LanguageType='" + resource + "'><div class='TxtTitle' data-LanguageType='" + resource + "'>&nbsp;</div>",
1982            "<div class='TxtContent' data-LanguageType='" + resource + "'>", $(this).text(), "</div></div>"].join('');
1983        }
1984        itemKind = "creator";
1985    });
1986    item.find("date").each(function() {
1987        if (itemKind != "date") {
1988            str = [str,
1989            "<div class='bookInfoLine' data-LanguageType='" + resource + "'><div class='TxtTitle' data-LanguageType='" + resource + "'>", text.date[1], "</div>",
1990            "<div class='TxtContent' data-LanguageType='" + resource + "'>", $(this).text(), "</div></div>"].join('');
1991        }
1992        itemKind = "date";
1993    });
1994
1995    item.find("subject").each(function() {
1996        if (itemKind != "subject") {
1997            str = [str,
1998            "<div class='bookInfoLine' data-LanguageType='" + resource + "'><div class='TxtTitle' data-LanguageType='" + resource + "'>", text.subject[1], "</div>",
1999            "<div class='TxtContent' data-LanguageType='" + resource + "'>", $(this).text(), "</div></div>"].join('');
2000        }
2001        else {
2002            str = [str,
2003            "<div class='bookInfoLine' data-LanguageType='" + resource + "'><div class='TxtTitle' data-LanguageType='" + resource + "'>&nbsp;</div>",
2004            "<div class='TxtContent' data-LanguageType='" + resource + "'>", $(this).text(), "</div></div>"].join('');
2005        }
2006        itemKind = "subject";
2007    });
2008    item.find("contributors").each(function() {
2009        if (itemKind != "contributors") {
2010            str = [str,
2011            "<div class='bookInfoLine' data-LanguageType='" + resource + "'><div class='TxtTitle' data-LanguageType='" + resource + "'>", text.contributors[1], "</div>",
2012            "<div class='TxtContent' data-LanguageType='" + resource + "'>", $(this).text(), "</div></div>"].join('');
2013        }
2014        else {
2015            str = [str,
2016            "<div class='bookInfoLine' data-LanguageType='" + resource + "'><div class='TxtTitle' data-LanguageType='" + resource + "'>&nbsp;</div>",
2017            "<div class='TxtContent' data-LanguageType='" + resource + "'>", $(this).text(), "</div></div>"].join('');
2018        }
2019        itemKind = "contributors";
2020    });
2021
2022    item.find("descriptions").each(function() {
2023        if (itemKind != "descriptions") {
2024            str = [str,
2025            "<div class='bookInfoLine' data-LanguageType='" + resource + "'><div class='TxtTitle' data-LanguageType='" + resource + "'>", text.description[1], "</div>",
2026            "<div class='TxtContent' data-LanguageType='" + resource + "'>", $(this).text(), "</div></div>"].join('');
2027        }
2028        else {
2029            str = [str,
2030            "<div class='bookInfoLine' data-LanguageType='" + resource + "'><div class='TxtTitle' data-LanguageType='" + resource + "'>&nbsp;</div>",
2031            "<div class='TxtContent' data-LanguageType='" + resource + "'>", $(this).text(), "</div></div>"].join('');
2032        }
2033        itemKind = "descriptions";
2034    });
2035
2036    item.find("publisher").each(function() {
2037        if (itemKind != "publisher") {
2038            str = [str,
2039            "<div class='bookInfoLine' data-LanguageType='" + resource + "'><div class='TxtTitle' data-LanguageType='" + resource + "'>", text.publisher[1], "</div>",
2040            "<div class='TxtContent' data-LanguageType='" + resource + "'>", $(this).text(), "</div></div>"].join('');
2041        }
2042        itemKind = "publisher";
2043    });
2044
2045    if (AdocKey == undefined) {
2046        item.find("isbn").each(function() {
2047            if (itemKind != "isbn") {
2048                str = [str,
2049            "<div class='bookInfoLine' data-LanguageType='" + resource + "'><div class='TxtTitle' data-LanguageType='" + resource + "'>", text.isbn[1], "</div>",
2050            "<div class='TxtContent' data-LanguageType='" + resource + "'>", $(this).text(), "</div></div>"].join('');
2051            }
2052            else {
2053                str = [str,
2054            "<div class='bookInfoLine' data-LanguageType='" + resource + "'><div class='TxtTitle' data-LanguageType='" + resource + "'>&nbsp;</div>",
2055            "<div class='TxtContent' data-LanguageType='" + resource + "'>", $(this).text(), "</div></div>"].join('');
2056            }
2057            itemKind = "isbn";
2058        });
2059    }
2060    item.find("dewey").each(function() {
2061        if (itemKind != "dewey") {
2062            str = [str,
2063            "<div class='bookInfoLine' data-LanguageType='" + resource + "'><div class='TxtTitle' data-LanguageType='" + resource + "'>", text.dewey[1], "</div>",
2064            "<div class='TxtContent' data-LanguageType='" + resource + "'>", $(this).text(), "</div></div>"].join('');
2065        }
2066        else {
2067            str = [str,
2068            "<div class='bookInfoLine' data-LanguageType='" + resource + "'><div class='TxtTitle' data-LanguageType='" + resource + "'>&nbsp;</div>",
2069            "<div class='TxtContent' data-LanguageType='" + resource + "'>", $(this).text(), "</div></div>"].join('');
2070        }
2071        itemKind = "dewey";
2072    });
2073
2074    item.find("lccallnumber").each(function() {
2075        if (itemKind != "lccallnumber") {
2076            str = [str,
2077            "<div class='bookInfoLine' data-LanguageType='" + resource + "'><div class='TxtTitle' data-LanguageType='" + resource + "'>", text.lccallnumber[1], "</div>",
2078            "<div class='TxtContent' data-LanguageType='" + resource + "'>", $(this).text(), "</div></div>"].join('');
2079        }
2080        else {
2081            str = [str,
2082            "<div class='bookInfoLine' data-LanguageType='" + resource + "'><div class='TxtTitle' data-LanguageType='" + resource + "'>&nbsp;</div>",
2083            "<div class='TxtContent' data-LanguageType='" + resource + "'>", $(this).text(), "</div></div>"].join('');
2084        }
2085        itemKind = "lccallnumber";
2086    });
2087
2088    item.find("nlmcallnumber").each(function() {
2089        if (itemKind != "nlmcallnumber") {
2090            str = [str,
2091            "<div class='bookInfoLine' data-LanguageType='" + resource + "'><div class='TxtTitle' data-LanguageType='" + resource + "'>", text.nlmcallnumber[1], "</div>",
2092            "<div class='TxtContent' data-LanguageType='" + resource + "'>", $(this).text(), "</div></div>"].join('');
2093        }
2094        else {
2095            str = [str,
2096            "<div class='bookInfoLine' data-LanguageType='" + resource + "'><div class='TxtTitle' data-LanguageType='" + resource + "'>&nbsp;</div>",
2097            "<div class='TxtContent' data-LanguageType='" + resource + "'>", $(this).text(), "</div></div>"].join('');
2098        }
2099        itemKind = "nlmcallnumber";
2100    });
2101
2102    item.find("lcclassnum").each(function() {
2103        if (itemKind != "lcclassnum") {
2104            str = [str,
2105            "<div class='bookInfoLine'><div class='TxtTitle'>", text.lcclassnum[1], "</div>",
2106            "<div class='TxtContent' style='direction:ltr;'>", $(this).text(), "</div></div>"].join('');
2107        }
2108        else {
2109            str = [str,
2110            "<div class='bookInfoLine'><div class='TxtTitle'>&nbsp;</div>",
2111            "<div class='TxtContent' style='direction:ltr;'>", $(this).text(), "</div></div>"].join('');
2112        }
2113        itemKind = "lcclassnum";
2114    });
2115
2116    item.find("otherheading").each(function() {
2117        if (itemKind != "otherheading") {
2118            str = [str,
2119            "<div class='bookInfoLine'><div class='TxtTitle'>", text.otherheading[1], "</div>",
2120            "<div class='TxtContent' style='direction:ltr; text-align:right;'>", $(this).text(), "</div></div>"].join('');
2121        }
2122        else {
2123            str = [str,
2124            "<div class='bookInfoLine'><div class='TxtTitle'>&nbsp;</div>",
2125            "<div class='TxtContent' style=' direction:ltr; text-align:right;'>", $(this).text(), "</div></div>"].join('');
2126        }
2127        itemKind = "otherheading";
2128    });
2129
2130    item.find("treenumber").each(function() {
2131        if (itemKind != "treenumber") {
2132            str = [str,
2133            "<div class='bookInfoLine'><div class='TxtTitle'>", text.treenumber[1], "</div>",
2134            "<div class='TxtContent' style='direction:ltr;'>", $(this).text(), "</div></div>"].join('');
2135        }
2136        else {
2137            str = [str,
2138            "<div class='bookInfoLine'><div class='TxtTitle'>&nbsp;</div>",
2139            "<div class='TxtContent' style='direction:ltr;'>", $(this).text(), "</div></div>"].join('');
2140        }
2141        itemKind = "treenumber";
2142    });
2143
2144    item.find("deweyclassnumber").each(function() {
2145        if (itemKind != "deweyclassnumber") {
2146            str = [str,
2147            "<div class='bookInfoLine'><div class='TxtTitle'>", text.deweyclassnumber[1], "</div>",
2148            "<div class='TxtContent' style='direction:ltr;'>", $(this).text(), "</div></div>"].join('');
2149        }
2150        else {
2151            str = [str,
2152            "<div class='bookInfoLine'><div class='TxtTitle'>&nbsp;</div>",
2153            "<div class='TxtContent' style='direction:ltr;'>", $(this).text(), "</div></div>"].join('');
2154        }
2155        itemKind = "deweyclassnumber";
2156    });
2157
2158    item.find("nlmclassnumber").each(function() {
2159        if (itemKind != "nlmclassnumber") {
2160            str = [str,
2161            "<div class='bookInfoLine'><div class='TxtTitle'>", text.nlmclassnumber[1], "</div>",
2162            "<div class='TxtContent' style='direction:ltr;'>", $(this).text(), "</div></div>"].join('');
2163        }
2164        else {
2165            str = [str,
2166            "<div class='bookInfoLine'><div class='TxtTitle'>&nbsp;</div>",
2167            "<div class='TxtContent' style='direction:ltr;'>", $(this).text(), "</div></div>"].join('');
2168        }
2169        itemKind = "nlmclassnumber";
2170    });
2171
2172    item.find("classnumber").each(function() {
2173        if (itemKind != "classnumber") {
2174            str = [str,
2175            "<div class='bookInfoLine'><div class='TxtTitle'>", text.classnumber[1], "</div>",
2176            "<div class='TxtContent' style='direction:ltr;'>", $(this).text(), "</div></div>"].join('');
2177        }
2178        else {
2179            str = [str,
2180            "<div class='bookInfoLine'><div class='TxtTitle'>&nbsp;</div>",
2181            "<div class='TxtContent' style='direction:ltr;'>", $(this).text(), "</div></div>"].join('');
2182        }
2183        itemKind = "classnumber";
2184    });
2185
2186    item.find("usedfor").each(function() {
2187        if (itemKind != "usedfor") {
2188            str = [str,
2189            "<div class='bookInfoLine'><div class='TxtTitle'>", text.usedfor[1], "</div>",
2190            "<div class='TxtContent' style='direction:ltr;'>", $(this).text(), "</div></div>"].join('');
2191        }
2192        else {
2193            str = [str,
2194            "<div class='bookInfoLine'><div class='TxtTitle'>&nbsp;</div>",
2195            "<div class='TxtContent' style='direction:ltr;'>", $(this).text(), "</div></div>"].join('');
2196        }
2197        itemKind = "usedfor";
2198    });
2199
2200    if (AdocKey == undefined) {
2201        item.find("nlia").each(function() {
2202            if (itemKind != "nlia") {
2203                str = [str,
2204            "<div class='bookInfoLine' data-LanguageType='" + resource + "'><div class='TxtTitle' data-LanguageType='" + resource + "'>", text.nlia[1], "</div>",
2205            "<div class='TxtContent' data-LanguageType='" + resource + "'>", $(this).text(), "</div></div>"].join('');
2206            }
2207            else {
2208                str = [str,
2209            "<div class='bookInfoLine' data-LanguageType='" + resource + "'><div class='TxtTitle' data-LanguageType='" + resource + "'>&nbsp;</div>",
2210            "<div class='TxtContent' data-LanguageType='" + resource + "'>", $(this).text(), "</div></div>"].join('');
2211            }
2212            itemKind = "nlia";
2213        });
2214    }
2215
2216    item.find("format").each(function() {
2217        if (itemKind != "format") {
2218            str = [str,
2219            "<div class='bookInfoLine' data-LanguageType='" + resource + "'><div class='TxtTitle' data-LanguageType='" + resource + "'>", text.format[1], "</div>",
2220            "<div class='TxtContent' data-LanguageType='" + resource + "'>", $(this).text(), "</div></div>"].join('');
2221        }
2222        itemKind = "format";
2223    });
2224
2225    if (AdocKey >= 0) {
2226        item.find("related").each(function() {
2227
2228            str = [str,
2229        "<div class='bookInfoLine' data-LanguageType='" + resource + "'>",
2230        "<div class='TxtTitle' data-LanguageType='" + resource + "' style='text-align:", talign, "; direction:", dir, "; padding-bottom:5px;'><div class='edition-logo'></div></div><div class='TxtContent' data-LanguageType='" + resource + "' style='padding-top:20px; padding-bottom:5px;'>"].join('');
2231
2232            if ($(this).attr("kind") === "0") // uniformtitle
2233                str = [str, "<span class='TxtContent webkit_NotWrappableText' data-LanguageType='" + resource + "'>تمامی کتابهای دارای عنوان قراردادی </span>"].join('');
2234
2235            str = [str,
2236          "<a class='hlink' style='font-size:0.75em;' href='", $(this).attr("url"), "' target=_blank>", $(this).attr("name"), "</a>", "</div></div>"].join('');
2237
2238            itemKind = "related";
2239        });
2240
2241        if (item.find("repository").length > 0) {
2242            str = [str,
2243        "<div class='bookInfoLine' data-LanguageType='" + resource + "'>",
2244        "<div class='TxtTitle' data-LanguageType='" + resource + "' style='text-align:", talign, "; direction:", dir, ";'><div onclick='ShowNextRowTable(event, ", AdocKey, ", \"sr\");' class='repository-logo'></div></div><div class='TxtContent' data-LanguageType='" + resource + "' style=' color:maroon; padding-bottom:0px; margin-left:0px;'>", "<div class='clickAreaHeight' style='display:table-cell;' onclick='ShowNextRowTable(event, ", AdocKey, ", \"sr\");'>منابع دیجیتال مرتبط</div>", "<div id='sh", AdocKey, "' class='clickAreaHeight' onclick='ShowNextRowTable(event, ", AdocKey, ", \"sr\");'><div class='showHolding' style='top:2px; padding-right:10px; display:inline-block; margin-left:5px;' ></div></div>", "</div></div>",
2245        "<div style='width:100%;'><div><div><div id='reposTable_", AdocKey, "' style='display:none;'>"].join('');
2246//        "<div style='display:inline-block; width:100%;'><div style='padding-bottom:5px;'><div ><div id='reposTable_", AdocKey, "' style='display:none;'>"].join('');
2247
2248            item.find("repository").each(function() {
2249
2250                if ($(this).attr("kind") != "3") {
2251                    var itemSrc = [reposeSrv, reposeSrv_vd, "getfile.aspx?FileGuid=", $(this).attr("guid")].join('');
2252                    str = [str, "<div style='float: left; width: 100%'><div class='TxtTitle' data-LanguageType='" + resource + "'>&nbsp;</div>",
2253                                    "<div class='TxtContent bookAttachmentsContent' data-LanguageType='" + resource + "' >",
2254                                        "<div class='ColorDot' style='display: inline-block;'/><div style='display: inline;'>",
2255                                        "<a style='color:#333;' target=_blank href='", itemSrc + "'>", $(this).attr("desc"), "</a>",
2256                                    "</div></div></div>"].join('');
2257                }
2258            });
2259            str = [str, "</div></div></div></div>"].join('');
2260            itemKind = "repository";
2261        }
2262
2263        if (item.find("holding").length > 0) {
2264            str = [str,
2265        "<div class='bookInfoLine' data-LanguageType='" + resource + "'>",
2266        "<div class='TxtTitle' data-LanguageType='" + resource + "' style='text-align:", talign, "; direction:", dir, ";' ><div onclick='ShowNextRowTable(event, ", AdocKey, ", \"sh\");' class='holding-logo'></div></div><div class='TxtContent' data-LanguageType='" + resource + "' style=' color:maroon; padding-bottom:0px;'>", "<div class='clickAreaHeight' style='display:table-cell;' onclick='ShowNextRowTable(event, ", AdocKey, ", \"sh\"); '>موجودی در شبکه سیمرغ</div>", "<div id='sh", AdocKey, "' class='clickAreaHeight' onclick='ShowNextRowTable(event, ", AdocKey, ", \"sh\");'><div class='showHolding' style='top:2px; padding-right:10px; display: inline-block; margin-left:5px;' ></div></div>", "</div></div>",
2267        "<div style='display:inline-block; width:100%;'><div style='padding-bottom:5px;'><div ><div border=0 id='holdTable_", AdocKey, "' style='display:none;'>"].join('');
2268
2269            item.find("holding").each(function() {
2270                str = [str,
2271             "<div style='float: left; width: 100%'><div class='TxtTitle' data-LanguageType='" + resource + "'>&nbsp;</div>",
2272                "<div class='TxtContent bookAttachmentsContent' data-LanguageType='" + resource + "' >", "<div class='ColorDot' style='display: inline-block;'/><div style='display: inline;'>", $(this).attr("srvname"), "</div></div></div>"].join('');
2273
2274            });
2275            str = [str, "</div></div></div></div>"].join('');
2276            itemKind = "holding";
2277        }
2278
2279
2280    }
2281    return str;
2282};
2283
2284//start saboor 940325
2285//function for slide right menu
2286var s_body, s_mask, s_toggleSlideRight, s_slideMenuRight, s_closeButton;
2287
2288var SetRightSlideMenu = function() {
2289    s_body = document.querySelector("#contentWrapper");
2290    s_mask = document.createElement("div");
2291    s_toggleSlideRight = document.querySelector(".mnuOpenRightClass");
2292    s_slideMenuRight = document.querySelector(".rightPannelClass");
2293    s_closeButton = document.querySelector(".mnuCloseRightClass");
2294    var activeNav;
2295
2296    s_mask.className = "mask";
2297
2298    /* slide menu right */
2299    s_toggleSlideRight.addEventListener("click", function() {
2300        SlideHandler.add(s_body, "smr-open");
2301        document.body.appendChild(s_mask);
2302        activeNav = "smr-open";
2303        SlideHandler.remove(s_slideMenuRight, "rightPannelClass");
2304        SlideHandler.remove(s_closeButton, "mnuCloseRightClass");
2305        SlideHandler.add(s_slideMenuRight, "rightPannelSlided");
2306        SlideHandler.add(s_closeButton, "mnuCloseRightShow");
2307    });
2308
2309    /* hide active menu if mask is clicked */
2310    s_mask.addEventListener("click", function() {
2311        SlideHandler.remove(s_body, activeNav);
2312        activeNav = "";
2313        var myElem = document.querySelector(".mask");
2314        if (myElem != null) {
2315            document.body.removeChild(s_mask);
2316        }
2317        SlideHandler.remove(s_slideMenuRight, "rightPannelSlided");
2318        SlideHandler.remove(s_closeButton, "mnuCloseRightShow");
2319        SlideHandler.add(s_slideMenuRight, "rightPannelClass");
2320        SlideHandler.add(s_closeButton, "mnuCloseRightClass");
2321    });
2322
2323    /* hide active menu if mask is touched_for mobile browsers */
2324    /*s_mask.addEventListener("touchstart", function() {
2325        SlideHandler.remove(s_body, activeNav);
2326        activeNav = "";
2327        var myElem = document.querySelector(".mask");
2328        if (myElem != null) {
2329            document.body.removeChild(s_mask);
2330        }
2331        SlideHandler.remove(s_slideMenuRight, "rightPannelSlided");
2332        SlideHandler.remove(s_closeButton, "mnuCloseRightShow");
2333        SlideHandler.add(s_slideMenuRight, "rightPannelClass");
2334        SlideHandler.add(s_closeButton, "mnuCloseRightClass");
2335    });*/
2336
2337    /* hide active menu if close menu button is clicked */
2338    [ ].slice.call(document.querySelectorAll(".mnuCloseRightClass")).forEach(function(el, i) {
2339        el.addEventListener("click", function() {
2340            SlideHandler.remove(s_body, ".smr-open");
2341            activeNav = "";
2342            var myElem = document.querySelector(".mask");
2343            if (myElem != null) {
2344                document.body.removeChild(s_mask);
2345            }
2346            SlideHandler.remove(s_slideMenuRight, "rightPannelSlided");
2347            SlideHandler.remove(s_closeButton, "mnuCloseRightShow");
2348            SlideHandler.add(s_slideMenuRight, "rightPannelClass");
2349            SlideHandler.add(s_closeButton, "mnuCloseRightClass");
2350        });
2351    });
2352};
2353
2354//function to close right slided menu manually
2355var CloseRightSlideMenu = function() {
2356    s_body = document.querySelector("#contentWrapper");
2357    if (SlideHandler.has(s_body, "smr-open")) {
2358        s_mask = document.querySelector(".mask");
2359        s_slideMenuRight = document.querySelector(".rightPannelSlided");
2360        s_closeButton = document.querySelector(".mnuCloseRightShow");
2361        var activeNav = "smr-open";
2362
2363        SlideHandler.remove(s_body, activeNav);
2364        document.body.removeChild(s_mask);
2365        SlideHandler.remove(s_slideMenuRight, "rightPannelSlided");
2366        SlideHandler.remove(s_closeButton, "mnuCloseRightShow");
2367        SlideHandler.add(s_slideMenuRight, "rightPannelClass");
2368        SlideHandler.add(s_closeButton, "mnuCloseRightClass");
2369    };
2370};
2371
2372//function to open right slided menu manually
2373var OpenRightSlideMenu = function() {
2374
2375    SlideHandler.add(s_body, "smr-open");
2376    document.body.appendChild(s_mask);
2377    activeNav = "smr-open";
2378    SlideHandler.remove(s_slideMenuRight, "rightPannelClass");
2379    SlideHandler.remove(s_closeButton, "mnuCloseRightClass");
2380    SlideHandler.add(s_slideMenuRight, "rightPannelSlided");
2381    SlideHandler.add(s_closeButton, "mnuCloseRightShow");
2382};
2383
2384//***************************************************************
2385//function for slide left menu
2386var l_body, l_mask, s_toggleSlideLeft, s_slideMenuLeft, s_leftCloseButton, s_topBar;
2387var SetLeftSlideMenu = function() {
2388    l_body = document.querySelector("#contentWrapper");
2389    l_mask = document.createElement("div");
2390    s_topBar = document.querySelector("#topMenuBar");
2391    s_toggleSlideLeft = document.querySelector(".mnuOpenLeftClass");
2392    s_slideMenuLeft = document.querySelector("#MenuBarMainItems");
2393    s_leftCloseButton = document.querySelector(".mnuCloseLeftClass");
2394    var activeNav;
2395
2396    l_mask.className = "mask";
2397
2398    /* slide menu left */
2399    s_toggleSlideLeft.addEventListener("click", function() {
2400        SlideHandler.add(l_body, "sml-open");
2401        document.body.appendChild(l_mask);
2402        activeNav = "sml-open";
2403        SlideHandler.add(s_slideMenuLeft, "leftPannelSlided");
2404        SlideHandler.add(s_leftCloseButton, "mnuCloseLeftShow");
2405        SlideHandler.add(s_topBar, "topBarNormal");
2406        SlideHandler.remove(s_slideMenuLeft, "MenuBarMainItemsClass");
2407        SlideHandler.remove(s_leftCloseButton, "mnuCloseLeftClass");
2408        SlideHandler.remove(s_topBar, "topBarFixed");
2409    });
2410
2411    /* hide active menu if mask is clicked */
2412    l_mask.addEventListener("click", function() {
2413        SlideHandler.remove(l_body, activeNav);
2414        activeNav = "";
2415        document.body.removeChild(l_mask);
2416        SlideHandler.remove(s_slideMenuLeft, "leftPannelSlided");
2417        SlideHandler.remove(s_leftCloseButton, "mnuCloseLeftShow");
2418        SlideHandler.remove(s_topBar, "topBarNormal");
2419        SlideHandler.add(s_slideMenuLeft, "MenuBarMainItemsClass");
2420        SlideHandler.add(s_leftCloseButton, "mnuCloseLeftClass");
2421        SlideHandler.add(s_topBar, "topBarFixed");
2422    });
2423
2424    /* hide active menu if mask is touched_for mobile browsers */
2425    /*l_mask.addEventListener("touchstart", function() {
2426        SlideHandler.remove(l_body, activeNav);
2427        activeNav = "";
2428        document.body.removeChild(l_mask);
2429        SlideHandler.remove(s_slideMenuLeft, "leftPannelSlided");
2430        SlideHandler.remove(s_leftCloseButton, "mnuCloseLeftShow");
2431        SlideHandler.remove(s_topBar, "topBarNormal");
2432        SlideHandler.add(s_slideMenuLeft, "MenuBarMainItemsClass");
2433        SlideHandler.add(s_leftCloseButton, "mnuCloseLeftClass");
2434        SlideHandler.add(s_topBar, "topBarFixed");
2435    });*/
2436
2437    /* hide active menu if close menu button is clicked */
2438    [ ].slice.call(document.querySelectorAll(".mnuCloseLeftClass")).forEach(function(el, i) {
2439        el.addEventListener("click", function() {
2440            SlideHandler.remove(l_body, activeNav);
2441            activeNav = "";
2442            document.body.removeChild(l_mask);
2443            SlideHandler.remove(s_slideMenuLeft, "leftPannelSlided");
2444            SlideHandler.remove(s_leftCloseButton, "mnuCloseLeftShow");
2445            SlideHandler.remove(s_topBar, "topBarNormal");
2446            SlideHandler.add(s_slideMenuLeft, "MenuBarMainItemsClass");
2447            SlideHandler.add(s_leftCloseButton, "mnuCloseLeftClass");
2448            SlideHandler.add(s_topBar, "topBarFixed");
2449        });
2450    });
2451};
2452
2453//function to open left slided menu manually
2454var OpenLeftSlideMenu = function() {
2455
2456    SlideHandler.add(l_body, "sml-open");
2457    document.body.appendChild(l_mask);
2458    activeNav = "sml-open";
2459    SlideHandler.remove(s_slideMenuLeft, "MenuBarMainItemsClass");
2460    SlideHandler.remove(s_leftCloseButton, "mnuCloseLeftClass");
2461    SlideHandler.remove(s_topBar, "topBarFixed");
2462    SlideHandler.add(s_slideMenuLeft, "leftPannelSlided");
2463    SlideHandler.add(s_leftCloseButton, "mnuCloseLeftShow");
2464    SlideHandler.add(s_topBar, "topBarNormal");
2465};
2466
2467//function to close left slided menu manually
2468var CloseLeftSlideMenu = function() {
2469    l_body = document.querySelector("#contentWrapper");
2470    if (SlideHandler.has(l_body, "sml-open")) {
2471        l_mask = document.querySelector(".mask");
2472        s_slideMenuLeft = document.querySelector("#MenuBarMainItems");
2473        s_leftCloseButton = document.querySelector(".mnuCloseLeftClass");
2474        s_topBar = document.querySelector("#topMenuBar");
2475        var activeNav = "sml-open";
2476
2477        SlideHandler.remove(l_body, activeNav);
2478        document.body.removeChild(l_mask);
2479        SlideHandler.add(s_slideMenuLeft, "MenuBarMainItemsClass");
2480        SlideHandler.add(s_leftCloseButton, "mnuCloseLeftClass");
2481        SlideHandler.add(s_topBar, "topBarFixed");
2482        SlideHandler.remove(s_slideMenuLeft, "leftPannelSlided");
2483        SlideHandler.remove(s_leftCloseButton, "mnuCloseLeftShow");
2484        SlideHandler.remove(s_topBar, "topBarNormal");
2485    };
2486};
2487
2488////this function simulates swipe for mouse
2489//function DetectSwipe(el, callback, swipeThreshold, blnPreventClick) {
2490//    var touchsurface = el,
2491//    swipedir,
2492//    startX,
2493//    startY,
2494//    distX,
2495//    distY,
2496//    threshold = swipeThreshold, //required min distance traveled to be considered swipe
2497//    restraint = 100, // maximum distance allowed at the same time in perpendicular direction
2498//    allowedTime = 1000, // maximum time allowed to travel that distance
2499//    elapsedTime,
2500//    startTime,
2501//    handleswipe = callback || function(swipedir) { };
2502
2503//    touchsurface.addEventListener('mousedown', function(e) {
2504//        swipedir = 'none'
2505//        dist = 0
2506//        startX = e.pageX
2507//        startY = e.pageY
2508//        startTime = new Date().getTime() // record time when finger first makes contact with surface
2509//        if (e.target.tagName.toUpperCase() == 'INPUT' || e.target.tagName.toUpperCase() == 'SELECT') {
2510
2511//        } else {
2512//            e.preventDefault();
2513//        }
2514//    }, false);
2515
2516//    touchsurface.addEventListener('mousemove', function(e) {
2517//        e.preventDefault(); // prevent scrolling when inside DIV
2518//    }, false);
2519
2520//    if (blnPreventClick) {
2521//        touchsurface.addEventListener('click', function(e) {
2522//            e.preventDefault();
2523//        }, false);
2524//    }
2525
2526//    touchsurface.addEventListener('mouseup', function(e) {
2527//        distX = e.pageX - startX // get horizontal dist traveled by finger while in contact with surface
2528//        distY = e.pageY - startY // get vertical dist traveled by finger while in contact with surface
2529//        elapsedTime = new Date().getTime() - startTime // get time elapsed
2530//        if (elapsedTime <= allowedTime) { // first condition for awipe met
2531//            if (Math.abs(distX) >= threshold && Math.abs(distY) <= restraint) { // 2nd condition for horizontal swipe met
2532//                swipedir = (distX < 0) ? 'left' : 'right' // if dist traveled is negative, it indicates left swipe
2533//                isMouseDraged = 1;
2534//            }
2535//            else if (Math.abs(distY) >= threshold && Math.abs(distX) <= restraint) { // 2nd condition for vertical swipe met
2536//                swipedir = (distY < 0) ? 'up' : 'down' // if dist traveled is negative, it indicates up swipe
2537//                isMouseDraged = 1;
2538//            }
2539//        }
2540//        e.preventDefault()
2541//        HandleAfterSwipeAction(el, swipedir);
2542//    }, false);
2543//};
2544
2545function DetectSwipe(el, callback, swipeThreshold, blnPreventClick) {
2546    var touchsurface = el,
2547    swipedir,
2548    startX,
2549    startY,
2550    distX,
2551    distY,
2552    threshold = swipeThreshold, //required min distance traveled to be considered swipe
2553    restraint = 100, // maximum distance allowed at the same time in perpendicular direction
2554    allowedTime = 1000, // maximum time allowed to travel that distance
2555    elapsedTime,
2556    startTime,
2557    handleswipe = callback || function(swipedir) { };
2558
2559    touchsurface.addEventListener('touchstart', function(e) {
2560        var touchobj = e.changedTouches[0]
2561        swipedir = 'none'
2562        dist = 0
2563        startX = touchobj.pageX
2564        startY = touchobj.pageY
2565        startTime = new Date().getTime() // record time when finger first makes contact with surface
2566    }, false);
2567
2568    //    touchsurface.addEventListener('touchmove', function(e) {
2569    //        //e.preventDefault(); //this is for chrome
2570    //    }, false);
2571
2572    touchsurface.addEventListener('touchend', function(e) {
2573        var touchobj = e.changedTouches[0]
2574        distX = touchobj.pageX - startX // get horizontal dist traveled by finger while in contact with surface
2575        distY = touchobj.pageY - startY // get vertical dist traveled by finger while in contact with surface
2576        elapsedTime = new Date().getTime() - startTime // get time elapsed
2577        if (elapsedTime <= allowedTime) { // first condition for awipe met
2578            if (Math.abs(distX) >= threshold && Math.abs(distY) <= restraint) { // 2nd condition for horizontal swipe met
2579                swipedir = (distX < 0) ? 'left' : 'right' // if dist traveled is negative, it indicates left swipe
2580                isMouseDraged = 1;
2581            }
2582            else if (Math.abs(distY) >= threshold && Math.abs(distX) <= restraint) { // 2nd condition for vertical swipe met
2583                swipedir = (distY < 0) ? 'up' : 'down' // if dist traveled is negative, it indicates up swipe
2584                isMouseDraged = 1;
2585            }
2586        }
2587        HandleAfterSwipeAction(el, swipedir);
2588    }, false);
2589
2590    touchsurface.addEventListener('touchcancel', function(e) {
2591        var touchobj = e.changedTouches[0]
2592        distX = touchobj.pageX - startX // get horizontal dist traveled by finger while in contact with surface
2593        distY = touchobj.pageY - startY // get vertical dist traveled by finger while in contact with surface
2594        elapsedTime = new Date().getTime() - startTime // get time elapsed
2595        if (elapsedTime <= allowedTime) { // first condition for awipe met
2596            if (Math.abs(distX) >= threshold && Math.abs(distY) <= restraint) { // 2nd condition for horizontal swipe met
2597                swipedir = (distX < 0) ? 'left' : 'right' // if dist traveled is negative, it indicates left swipe
2598                isMouseDraged = 1;
2599            }
2600            else if (Math.abs(distY) >= threshold && Math.abs(distX) <= restraint) { // 2nd condition for vertical swipe met
2601                swipedir = (distY < 0) ? 'up' : 'down' // if dist traveled is negative, it indicates up swipe
2602                isMouseDraged = 1;
2603            }
2604        }
2605        HandleAfterSwipeAction(el, swipedir);
2606    }, false);
2607};
2608
2609var HandleAfterSwipeAction = function(s_element, s_swipedir) {
2610    switch (s_element.id) {
2611        case 'swipeSurface':
2612            if (s_swipedir == "left") {
2613                if ($('#mnuOpenRightDiv').css('display') != 'none') {
2614                    SetRightSlideMenu();
2615                    OpenRightSlideMenu();
2616                }
2617            }
2618            else if (s_swipedir == "right") {
2619                if ($('#mnuOpenLeftDiv').css('display') != 'none') {
2620                    SetLeftSlideMenu();
2621                    OpenLeftSlideMenu();
2622                }
2623            }
2624            break;
2625
2626        case 'headerWrapper':
2627            if (s_swipedir == "left") {
2628                if ($('#mnuOpenRightDiv').css('display') != 'none') {
2629                    SetRightSlideMenu();
2630                    OpenRightSlideMenu();
2631                }
2632            }
2633            else if (s_swipedir == "right") {
2634                if ($('#mnuOpenLeftDiv').css('display') != 'none') {
2635                    SetLeftSlideMenu();
2636                    OpenLeftSlideMenu();
2637                }
2638            }
2639            break;
2640
2641        case 'infoPannel':
2642            if (s_swipedir == "left") {
2643                if ($('#mnuOpenRightDiv').css('display') != 'none') {
2644                    SetRightSlideMenu();
2645                    OpenRightSlideMenu();
2646                }
2647            }
2648            else if (s_swipedir == "right") {
2649                if ($('#mnuOpenLeftDiv').css('display') != 'none') {
2650                    SetLeftSlideMenu();
2651                    OpenLeftSlideMenu();
2652                }
2653            }
2654            break;
2655        case 'right_div':
2656            if (s_swipedir == "right") {
2657                if ($('#mnuOpenRightDiv').css('display') != 'none') {
2658                    CloseRightSlideMenu();
2659                }
2660            }
2661            break;
2662
2663        case 'MenuBarMainItems':
2664            if (s_swipedir == "left") {
2665                if ($('#mnuOpenLeftDiv').css('display') != 'none') {
2666                    CloseLeftSlideMenu();
2667                }
2668            }
2669
2670
2671            //        case 'infoPannel':  
2672            //            if (s_swipedir == "left") {  
2673            //                $('#FavBooks_div').css("display", "none");  
2674            //                $('#FullViewBooks_div').css("display", "");  
2675            //                $.history.load("fv");  
2676            //            }  
2677            //            else if (s_swipedir == "right") {  
2678            //                $('#FavBooks_div').css("display", "");  
2679            //                $('#FullViewBooks_div').css("display", "none");  
2680            //                $.history.load("fb");  
2681            //            }  
2682            //            break;  
2683    }
2684
2685}
2686
2687
2688//function for slide right menu
2689$(function(window) {
2690    SetRightSlideMenu();
2691});
2692
2693//function for slide left menu
2694$(function(window) {
2695    SetLeftSlideMenu();
2696});
2697
2698var HandeRightSlideMenuVisibility = function() {
2699    if ($('#mnuOpenRightDiv').css('display') != 'none') {
2700        var srp = 0;
2701        if ($.getUrlVar('srp'))
2702            srp = $.getUrlVar('srp');
2703        if (srp == 1) {
2704            SetRightSlideMenu();
2705            OpenRightSlideMenu();
2706        }
2707    }
2708};
2709
2710//this function converts the farsi numbers to English numbers in a string (it's useful in search results)
2711var ConverFarsiNumsToEng = function(str) {
2712
2713    return (str.replace(/[٠١٢٣٤٥٦٧٨٩]/g, function(d) { return (d.charCo
2713deAt(0) - 1632); }).replace(/[Û°Û±Û²Û³Û´ÛµÛ¶Û·Û¸Û¹]/g, function(d) { return (d.charCodeAt(0) - 1776); }));
2714
2715};
2716
2717//this function is a tool for add/remove specified classes from an element
2718function ChangeClass(element, cAdd, cRemove) {
2719    $(element).addClass(cAdd).removeClass(cRemove);
2720};
2721
2722function ScrollPageTop() {
2723
2724    if ($('#mnuGoToSrchWrapper').css('display') != 'none') {
2725        $('html, body').animate({ scrollTop: $('#contentWrapper').offset().top - $('#topMenuBar').height() }, 'slow');
2726    }
2727};
2728
2729//end saboor
2730
2731
2732//------------------saboor
2733$(document).bind("pagecreate", "#contentWrapper", function() {
2734    $("FB_td").bind("swipeleft", function() {
2735        $(this).hide();
2736    });
2737});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.