function customSlider(list, itemsPerSlide,lang) {

    $(list).children().last().css('margin-left', '0px'); $(list).children().last().css('margin-right', '0px');
    var liWidth = $(list).children('li').outerWidth(true); //get total width of each item
    var totalItems = $(list).children().length; //get total number of items

    var slideWidth = liWidth * itemsPerSlide; //total width per slide
    var totalWidth = (liWidth * (totalItems - 1)) + ($(list).children().last().outerWidth(true)); //total width of all items
    $(list).parent().css('width', slideWidth + "px"); //set div width
    $(list).css('width', totalWidth + "px"); //set ul width

    //pager html code
    var pagerTotal = Math.ceil(totalItems / itemsPerSlide); //number of pager items
    var pagertxt = "<div class='slidePager'>";
    for (i = 0; i < pagerTotal; i++) {
        pagertxt += "<a href='javascript:void(0)'></a>";
    }
    $(pagertxt).appendTo($(list).parent());
    $('.slidePager a:first-child').addClass('selectedP');
    //end of pager code

    //pager click code
    $('.slidePager a').click(function () {
        var index = $(this).index('.slidePager a');
        var leftPos
        if(lang=="ar")
        	leftPos = index * slideWidth;
        else
        	leftPos = index * slideWidth*-1;
        $(list).animate({
            left: leftPos + "px"
        }, 2000);
        $('.slidePager a').removeClass();
        $(this).addClass('selectedP');
    });
    //end of pager click code
}
function customSlider2(list, itemsPerSlide,lang) {
var dir;
if(lang=='en')
	dir='right';
else
	dir='left';
    $(list).children().last().css('margin-left', '0px'); $(list).children().last().css('margin-right', '0px');
    var liWidth = $(list).children('li').outerWidth(true); //get total width of each item
    var totalItems = $(list).children().length; //get total number of items

    var slideWidth = liWidth * itemsPerSlide; //total width per slide
    var totalWidth = (liWidth * (totalItems - 1)) + ($(list).children().last().outerWidth(true)); //total width of all items
    $(list).parent().css('width', slideWidth + "px"); //set div width
    $(list).css('width', totalWidth + "px"); //set ul width
    var initialPos = 0;
    var className = $(list).parent().attr('class');
    var selectedIndex=$(list).children('.selected').index('.'+className+' ul li');
    if ($(list).children('.selected').length == 1) {
        
        initialPos = selectedIndex * liWidth;
    }
    else
        initialPos = 0;
    $(list).css(dir, initialPos + "px");
    if (initialPos == 0) { $('#prev').addClass('disabled'); }
   // debugger;
    var leftP = parseInt($(list).css(dir), 10);
    var newleftP = leftP - (itemsPerSlide * liWidth);
    var FinalPos = (liWidth * totalItems) - liWidth;
    if (selectedIndex >= totalItems - itemsPerSlide || newleftP > FinalPos || itemsPerSlide > $(list).children('li').length) { $('#next').addClass('disabled'); }

    $('#prev').click(function () {
        var leftP = parseInt($(list).css(dir), 10);
        var newleftP = leftP - (itemsPerSlide * liWidth);
        if (newleftP < 0)
            newleftP = 0;
        if (newleftP >= 0 && !$('#prev').hasClass('disabled')) {
        	if(lang=='ar'){
            $(list).animate({
                left: newleftP + "px"
            }, 2000);
            }
            else
            { $(list).animate({
                right: newleftP + "px"
            }, 2000);
}
        }
        if (newleftP <= 0) { $('#prev').addClass('disabled'); }
        var FinalPos = (liWidth * totalItems) - itemsPerSlide;
        var nextLeft = (itemsPerSlide * liWidth) + newleftP; //debugger;
        if (nextLeft < FinalPos) { $('#next').removeClass('disabled'); }
    });
    $('#next').click(function () {
        var leftP = parseInt($(list).css(dir), 10);
        var newleftP = (itemsPerSlide * liWidth) + leftP;
        var FinalPos = (liWidth * totalItems) - itemsPerSlide;
        if (newleftP < FinalPos) {
            if(lang=='ar'){
            $(list).animate({
                left: newleftP + "px"
            }, 2000);
            }
            else
            { $(list).animate({
                right: newleftP + "px"
            }, 2000);
}
        }
        var nextLeft = (itemsPerSlide * liWidth) + newleftP;
        if (nextLeft > FinalPos) { $('#next').addClass('disabled'); }
        if (nextLeft != 0) { $('#prev').removeClass('disabled'); }
        if (itemsPerSlide > $(list).children('li').length)
            $('#prev').addClass('disabled');
    });
}


function printSection()
{
var html = '<html xmlns:fb="http://ogp.me/ns/fb#"><head>';
html +='<script> function pageLoad () {var someIframe = document.getElementById("someId");\
      someIframe.parentNode.removeChild(someIframe);}\
</script>';  
if(window.location.href.toLowerCase().indexOf("english") >= 0)
	html +='<link rel="stylesheet" type="text/css" href="/Style%20Library/css/print_en.css" media="screen,print" />';
if(window.location.href.toLowerCase().indexOf("arabic") >= 0)
	html +='<link rel="stylesheet" type="text/css" href="/Style%20Library/css/print_ar.css" media="screen,print" />';
if(window.location.href.toLowerCase().indexOf("audiogallery") >= 0)
	html +='<script src="/Style Library/AudioFlashPlayer/AC_RunActiveContent.js" language="javascript"></script>';
html += '</head>\n<body><div id="fb-root"></div>';
newHtml = $('#inner').html().replace("/Style Library/Js/BreadCrumb.js","");
newHtml = newHtml.replace("InitializeBreadCrumb();","");

newHtml = newHtml.replace("<IFRAME ","<!--<IFRAME ");
newHtml = newHtml.replace("<IFRAME>","<!--<IFRAME>");
newHtml = newHtml.replace("</IFRAME>","</IFRAME>-->");
newHtml = newHtml.replace("$(document).ready(function () {","");
newHtml = newHtml.replace("});","");
html += newHtml;
html += ""

html += '</body></html>';


var printWin = window.open("","","location=0,status=0,scrollbars=1,resizable=1,width=640,height=500");
printWin.document.open();
try{
printWin.document.write(html);
}
catch(e){}
printWin.document.close();
printWin.print();

}

