﻿
// JScript File

function setImageGalleryEN(selID)
{  
    stroutput="";
    var imagegallerylength=imageGallery.length;
    if(imageGallery.length>pageLength)
    {
        imagegallerylength=pageLength; 
    }
    for(i=0;i<imagegallerylength;i++)
	{
	    
        stroutput +="<div class='mediaCenter'><p>";
        stroutput +=imageGallery[i][3]+"/"+imageGallery[i][4]+"/"+imageGallery[i][5]+": "+imageGallery[i][1]+":<br/>";
        var imageGalleryItem="";
        imageGalleryItem="imageGalleryItem"+"_"+i;
        var objarray=null;
        objarray = "imageGalleryItem_1";
        
        //alert(objarray.length);
        //alert((var)imageGalleryItem.length);
        var itemcount=eval('imageGalleryItem_'+i+'.length');
        
        if(itemcount > 0)
        {
            stroutput +="<b>" + itemcount +" الصور</b>";
        }
        else
        {
               stroutput += "No Images";
        }
        stroutput +="</p>";
        if(itemcount > 0)
        {
            if(itemcount > 5)
            {
                itemcount=5;    
            }
            for(j=0;j<itemcount;j++)
	        {
	            //alert("<a href='"+eval('imageGalleryItem_'+i+'['+j+'][0]')+"/"+eval('imageGalleryItem_'+i+'['+j+'][1]')+"' rel='lightbox'  title='"+eval('imageGalleryItem_'+i+'['+j+'][2]')+"'><img alt='"+eval('imageGalleryItem_'+i+'['+j+'][2]')+"' src='"+eval('imageGalleryItem_'+i+'['+j+'][3]')+"/"+eval('imageGalleryItem_'+i+'['+j+'][4]')+"'/></a>");
                stroutput += "<a href='"+eval('imageGalleryItem_'+i+'['+j+'][0]')+"/"+eval('imageGalleryItem_'+i+'['+j+'][1]')+"' rel='lightbox'  title='"+eval('imageGalleryItem_'+i+'['+j+'][2]')+"'><img alt='"+eval('imageGalleryItem_'+i+'['+j+'][2]')+"' src='"+eval('imageGalleryItem_'+i+'['+j+'][3]')+"/"+eval('imageGalleryItem_'+i+'['+j+'][4]')+"'/></a>"; 
            }
            stroutput += "<div class='clear'></div><p>";
            stroutput += "<a href='"+eval('imageGalleryItem_'+i+'[0][0]')+"/"+eval('imageGalleryItem_'+i+'[0][1]')+"' title='"+eval('imageGalleryItem_'+i+'[0][2]')+"' rel='lightbox["+imageGallery[i][1]+"]'> <img height='14' alt='' src='/files/images/btn-media-viewGal_AR.gif' width=89/></a>";
            for(j=1;j<eval('imageGalleryItem_'+i+'.length');j++)
	        {
                stroutput += "<a href='"+eval('imageGalleryItem_'+i+'['+j+'][0]')+"/"+eval('imageGalleryItem_'+i+'['+j+'][1]')+"' title='"+eval('imageGalleryItem_'+i+'['+j+'][2]')+"' rel='lightbox["+imageGallery[i][1]+"]' ></a>"; 
            }
            
            
            stroutput += "</p>";
        }
        stroutput += "</div>";
    }    
    
    //document.write.getElementById("ImageContainer").innerHTML+=stroutput
    document.write(stroutput);    
         
         
        
   }
 
 
function setImageGalleryListEN(selID)
{  
    
    stroutput="";
    var count=Math.ceil(imageGallery.length/pageLength);
    var pageID=selID;
    var temp = (pageID*pageLength)+pageLength;  
    if(temp>imageGallery.length)
    {
       temp=imageGallery.length;
    }
    for(i=(pageID*pageLength);i<temp;i++)
	{
	    
        stroutput +="<div class='mediaCenter'><p>";
        stroutput +=imageGallery[i][3]+"/"+imageGallery[i][4]+"/"+imageGallery[i][5]+": "+imageGallery[i][1]+":<br/>";
        var imageGalleryItem="";
        imageGalleryItem="imageGalleryItem"+"_"+i;
        var objarray=null;
        objarray = "imageGalleryItem_1";
        
        //alert(objarray.length);
        //alert((var)imageGalleryItem.length);
        var itemcount=eval('imageGalleryItem_'+i+'.length');
        
        if(itemcount > 0)
        {
            stroutput +="<b>" + itemcount +" الصور</b>";
        }
        else
        {
               stroutput += "No Images";
        }
        stroutput +="</p>";
        if(itemcount > 0)
        {
            if(itemcount > 5)
            {
                itemcount=5;    
            }
            for(j=0;j<itemcount;j++)
	        {
	            //alert("<a href='"+eval('imageGalleryItem_'+i+'['+j+'][0]')+"/"+eval('imageGalleryItem_'+i+'['+j+'][1]')+"' rel='lightbox'  title='"+eval('imageGalleryItem_'+i+'['+j+'][2]')+"'><img alt='"+eval('imageGalleryItem_'+i+'['+j+'][2]')+"' src='"+eval('imageGalleryItem_'+i+'['+j+'][3]')+"/"+eval('imageGalleryItem_'+i+'['+j+'][4]')+"'/></a>");
                stroutput += "<a href='"+eval('imageGalleryItem_'+i+'['+j+'][0]')+"/"+eval('imageGalleryItem_'+i+'['+j+'][1]')+"' rel='lightbox'  title='"+eval('imageGalleryItem_'+i+'['+j+'][2]')+"'><img alt='"+eval('imageGalleryItem_'+i+'['+j+'][2]')+"' src='"+eval('imageGalleryItem_'+i+'['+j+'][3]')+"/"+eval('imageGalleryItem_'+i+'['+j+'][4]')+"'/></a>"; 
            }
            stroutput += "<div class='clear'></div><p>";
            stroutput += "<a href='"+eval('imageGalleryItem_'+i+'[0][0]')+"/"+eval('imageGalleryItem_'+i+'[0][1]')+"' title='"+eval('imageGalleryItem_'+i+'[0][2]')+"' rel='lightbox["+imageGallery[i][1]+"]'> <img height='14' alt='' src='/files/images/btn-media-viewGal_AR.gif' width=89/></a>";
            for(j=1;j<eval('imageGalleryItem_'+i+'.length');j++)
	        {
                stroutput += "<a href='"+eval('imageGalleryItem_'+i+'['+j+'][0]')+"/"+eval('imageGalleryItem_'+i+'['+j+'][1]')+"' title='"+eval('imageGalleryItem_'+i+'['+j+'][2]')+"' rel='lightbox["+imageGallery[i][1]+"]' ></a>"; 
            }
            
            
            stroutput += "</p>";
        }
        stroutput += "</div>";
    }   
    strPreNext="";
    strPreNext+="<div class='t2EventListNo pagelistcenter'>";
    if(pageID == 0)
    { 
        strPreNext +='<img alt="First" src="/files/images/btn-next.gif" />';
    }
    else 
    {
         strPreNext +='<input type="image" onclick="setImageGalleryListPagingEN('+0+')" alt="First" src="/files/images/btn-next.gif" />';	 
     
    }  
    startlimit=0
    endlimit=count
    
    if(count <= 5)
    {
        startlimit=0;
        endlimit=count;
    }
    else if(pageID < (count-2))
    {	        
        if(pageID >= 2)
        {
            startlimit=pageID-2;
            endlimit=pageID+3;
        }
        else
        {
	        startlimit=0;
            endlimit=5; 
        }
    }
    else
    {
        startlimit=count-5;
        endlimit=count;
    }                
    for(i=startlimit;i<endlimit;i++)
    {    	 
          if(i == pageID )
          {
            strPreNext +="<a style='text-decoration: none;' class='Pagination_a'  >"+ ( i + 1 )  +"</a>";	     
          }
          else
          {
            strPreNext +="<a style='text-decoration: underline;'  href='#' onclick='setImageGalleryListPagingEN("+i+")' >"+ ( i + 1 )  +"</a>";	     
          }
          if(i < endlimit -1 )
          {
         
            strPreNext +='<span>|</span>';
           
          }          
    }	
    if(pageID == count -1 )
    {
        strPreNext +=' <img src="/files/images/btn-prev.gif" alt="Last" />';
    }
    else
    {  
        nextpageid=pageID + 1;
        strPreNext +='<input type="image" onclick="setImageGalleryListPagingEN('+nextpageid+')" alt="Last" src="/files/images/btn-prev.gif" />';      
    }
    strPreNext+="<br/></div>";
     
    
    //document.write.getElementById("ImageContainer").innerHTML+=stroutput
    //document.write(stroutput+strPreNext); 
    var strresult=stroutput+strPreNext;    
    document.write(strresult); 
    //document.getElementById("ImageContainer").innerHTML =strresult;     
         
        
   }
   
   
function setImageGalleryListPagingEN(selID)
{  
    
    stroutput="";
    var count=Math.ceil(imageGallery.length/pageLength);
    var pageID=selID;
    var temp = (pageID*pageLength)+pageLength;  
    if(temp>imageGallery.length)
    {
       temp=imageGallery.length;
    }
    for(i=(pageID*pageLength);i<temp;i++)
	{
	    
        stroutput +="<div class='mediaCenter'><p>";
        stroutput +=imageGallery[i][3]+"/"+imageGallery[i][4]+"/"+imageGallery[i][5]+": "+imageGallery[i][1]+":<br/>";
        var imageGalleryItem="";
        imageGalleryItem="imageGalleryItem"+"_"+i;
        var objarray=null;
        objarray = "imageGalleryItem_1";
        
        //alert(objarray.length);
        //alert((var)imageGalleryItem.length);
        var itemcount=eval('imageGalleryItem_'+i+'.length');
        
        if(itemcount > 0)
        {
            stroutput +="<b>" + itemcount +" الصور</b>";
        }
        else
        {
               stroutput += "No Images";
        }
        stroutput +="</p>";
        if(itemcount > 0)
        {
            if(itemcount > 5)
            {
                itemcount=5;    
            }
            for(j=0;j<itemcount;j++)
	        {
	            //alert("<a href='"+eval('imageGalleryItem_'+i+'['+j+'][0]')+"/"+eval('imageGalleryItem_'+i+'['+j+'][1]')+"' rel='lightbox'  title='"+eval('imageGalleryItem_'+i+'['+j+'][2]')+"'><img alt='"+eval('imageGalleryItem_'+i+'['+j+'][2]')+"' src='"+eval('imageGalleryItem_'+i+'['+j+'][3]')+"/"+eval('imageGalleryItem_'+i+'['+j+'][4]')+"'/></a>");
                stroutput += "<a href='"+eval('imageGalleryItem_'+i+'['+j+'][0]')+"/"+eval('imageGalleryItem_'+i+'['+j+'][1]')+"' rel='lightbox'  title='"+eval('imageGalleryItem_'+i+'['+j+'][2]')+"'><img alt='"+eval('imageGalleryItem_'+i+'['+j+'][2]')+"' src='"+eval('imageGalleryItem_'+i+'['+j+'][3]')+"/"+eval('imageGalleryItem_'+i+'['+j+'][4]')+"'/></a>"; 
            }
            stroutput += "<div class='clear'></div><p>";
            stroutput += "<a href='"+eval('imageGalleryItem_'+i+'[0][0]')+"/"+eval('imageGalleryItem_'+i+'[0][1]')+"' title='"+eval('imageGalleryItem_'+i+'[0][2]')+"' rel='lightbox["+imageGallery[i][1]+"]'> <img height='14' alt='' src='/files/images/btn-media-viewGal_AR.gif' width=89/></a>";
            for(j=1;j<eval('imageGalleryItem_'+i+'.length');j++)
	        {
                stroutput += "<a href='"+eval('imageGalleryItem_'+i+'['+j+'][0]')+"/"+eval('imageGalleryItem_'+i+'['+j+'][1]')+"' title='"+eval('imageGalleryItem_'+i+'['+j+'][2]')+"' rel='lightbox["+imageGallery[i][1]+"]' ></a>"; 
            }
            
            
            stroutput += "</p>";
        }
        stroutput += "</div>";
    }   
    strPreNext="";
    strPreNext+="<div class='t2EventListNo pagelistcenter'>";
    if(pageID == 0)
    { 
        strPreNext +='<img alt="First" src="/files/images/btn-next.gif" />';
    }
    else 
    {
         strPreNext +='<input type="image" onclick="setImageGalleryListPagingEN('+0+')" alt="First" src="/files/images/btn-next.gif" />';	 
     
    }  
    startlimit=0
    endlimit=count
    
    if(count <= 5)
    {
        startlimit=0;
        endlimit=count;
    }
    else if(pageID < (count-2))
    {	        
        if(pageID >= 2)
        {
            startlimit=pageID-2;
            endlimit=pageID+3;
        }
        else
        {
	        startlimit=0;
            endlimit=5; 
        }
    }
    else
    {
        startlimit=count-5;
        endlimit=count;
    }                
    for(i=startlimit;i<endlimit;i++)
    {    	 
          if(i == pageID )
          {
            strPreNext +="<a style='text-decoration: none;' class='Pagination_a'  >"+ ( i + 1 )  +"</a>";	     
          }
          else
          {
            strPreNext +="<a style='text-decoration: underline;'  href='#' onclick='setImageGalleryListPagingEN("+i+")' >"+ ( i + 1 )  +"</a>";	     
          }
          if(i < endlimit -1 )
          {
         
            strPreNext +='<span>|</span>';
           
          }          
    }	
    if(pageID == count -1 )
    {
        strPreNext +=' <img src="/files/images/btn-prev.gif" alt="Last" />';
    }
    else
    {  
        nextpageid=pageID + 1;
        strPreNext +='<input type="image" onclick="setImageGalleryListPagingEN('+nextpageid+')" alt="Last" src="/files/images/btn-prev.gif" />';      
    }
    strPreNext+="<br/></div>"; 
    var strresult=stroutput + strPreNext;
    
    document.getElementById("ImageContainer").innerHTML =strresult
//    document.write(stroutput+strPreNext);    
         
         
        
   }