
////////////////////////////////////////////////////////////
//Copyright: Sandip Debnath (sandipdebnath@hotmail.com). 
//You have to keep this notice to use it, and can not 
//change anything below this line.
////////////////////////////////////////////////////////////

var picDir = "Pictures";
var currentnum =0;
var dir = "";
var year = 0;
var imga = new Array();
var jmga = new Array();
var imgname = new Array();

var sta=0;
var end=0;

function OnOffDir(dx)
{
 d1.className='al_toff';
 d2.className='al_toff';
 d3.className='al_toff';
 d4.className='al_toff';
 d5.className='al_toff';
 dx.className='al_ton';
}

function OnOffYear(yx)
{
 y1.className='al_loff';
 y2.className='al_loff';
 y3.className='al_loff';
 y4.className='al_loff';
 y5.className='al_loff';
 y6.className='al_loff';
 y7.className='al_loff';
 yx.className='al_lon';
}

///////////////////////////////////////////////////
function FillUp()
{
 sta = 0; end= 0;
 if(dir != "" && year != 0)
 {
  imga = [];
  jmga = [];
  imgname = [];
  if(dir == 'Boisakhi')
  {
   if(year==2007) //for 2007 we got all sequential
   { 
   imgname = ["IMG_8333.JPG","IMG_8334.JPG","IMG_8335.JPG","IMG_8336.JPG",
   "IMG_8337.JPG","IMG_8338.JPG","IMG_8339.JPG","IMG_8340.JPG","IMG_8341.JPG",
   "IMG_8342.JPG","IMG_8343.JPG","IMG_8344.JPG","IMG_8345.JPG","IMG_8346.JPG",
   "IMG_8347.JPG","IMG_8348.JPG","IMG_8349.JPG","IMG_8350.JPG","IMG_8351.JPG",
   "IMG_8352.JPG","IMG_8353.JPG","IMG_8354.JPG","IMG_8355.JPG","IMG_8356.JPG",
   "IMG_8357.JPG","IMG_8358.JPG","IMG_8359.JPG","IMG_8360.JPG","IMG_8361.JPG",
   "IMG_8362.JPG","IMG_8363.JPG","IMG_8364.JPG","IMG_8365.JPG","IMG_8366.JPG"];
   }
   if(year==2006) {}
   if(year==2005) {}
   if(year==2004) {}
   if(year==2003) 
   {
    imgname = ["Medha_Oscar.JPG","MVC-001F.JPG","MVC-002F.JPG","MVC-003F.JPG",
	"MVC-004F.JPG","MVC-005F.JPG","MVC-006F.JPG","MVC-007F.JPG","MVC-008F.JPG",
	"MVC-009F.JPG","MVC-010F.JPG","MVC-011F.JPG","MVC-012F.JPG","MVC-013F.JPG",
	"MVC-014F.JPG","MVC-015F.JPG","MVC-016F.JPG","MVC-017F.JPG","MVC-018F.JPG",
	"MVC-019F.JPG","MVC-020F.JPG","MVC-021F.JPG"];
   }
   if(year==2002)
   {
    imgname = ["Ankita.jpg","Arjun.jpg","Boisakhi_2002.jpg","Bonny_Bidisha.jpg",
	"Bonny_Bidisha_small.jpg","Dance.jpg","Gautamda.jpg","Group1.jpg","Group2.jpg",
	"Group3.jpg","Group4.jpg","Group5.jpg","Irika.jpg","Irika2.jpg","Irika3.jpg",
	"Kakchoritra.jpg","Kakchoritra2.jpg","Kakchoritra3.jpg","Kakchoritra4.jpg",
	"Kakchoritra5.jpg","Kunal.jpg","Madhurina_Rupa.jpg","Maya.jpg","Maya_Tiyasha.jpg",
	"Medha_Mimie.jpg","Medha_Ponti.jpg","Minie.jpg","Oscar_Rik.jpg","Priya.jpg",
	"Raju.jpg","Singer_Group.jpg","Sukanya_kids.jpg","Surma_Manoj.jpg","Swati.jpg",
	"Swati2.jpg","Tinni_Biju.jpg","Tinni_Mimie.jpg","Tupshi.jpg","Young_Singers.jpg",
	"Young_Singers2.jpg"];
   }
  }
  
  if(dir == 'SaraswatiPuja')
  {
    if(year==2006)
	{
	 imgname = ["Anjali_full.jpg","Anjali_thumb.jpg","Children_full.jpg",
	 "Children_thumb.jpg","Pujo_full.jpg","Pujo_Thumb.jpg","Tahkur_full.jpg",
	 "Thaku_Thumb.jpg"];
	}
  }

 }//if


 sta = 0;
 end = imgname.length;

 for(var i=sta; i< end; i++)
 {
	  imga.push(picDir + "\\" + dir + year + "\\" + imgname[i]);
	  jmga.push(picDir + "\/" + dir + year + "\/" + imgname[i]);
 }
 //alert(sta, end);
 if(dir != "" && year != 0)
   this.upform.dir.value= dir +year;

SwitchImage3(imga,0);
}

///////////////////////////////////////////////////
function DirSelect(what)
{
 dir=what;
 FillUp();
}

///////////////////////////////////////////////////
function YearSelect(what)
{
 year=what;
 FillUp();
}

///////////////////////////////////////////////////
function ShowBig(img)
{
 //ImageBig = new Image(190,100);
 //ImageBig.src = img;
 //if(document.images)
 // {
	if (document.all||document.getElementById){ document.getElementById(big).src = img; }
	else if (document.layers){ document.big.src = img; }
 // }
}

///////////////////////////////////////////////////
function SwitchImage1(imgarr, num)
{
 currentnum = num
 if (document.all||document.getElementById){
  album.innerHTML = num+':'+imgarr[num]+'<a href=\"'+imgarr[num] +'\" border=0 target=_blank><img src=' + imgarr[num] + ' height=100 width=200></a>';
 }
 else if (document.layers){
  document.albu.document.write(num+':'+imgarr[num]+'<a href=\"'+imgarr[num] +'\" border=0 target=_blank><img src=' + imgarr[num] + ' height=100 width=200></a>');
  document.albu.document.close();
 }
}


///////////////////////////////////////////////////
function SwitchImage3(imgarr, num)
{
 var src;

 if(imgarr.length == 0) 
 {
  var ye=year;
  var di=dir;
  if (year==0) ye = 'Not Available';
  if (dir=='') di = 'Not Available';
  src = '<br>Year: ' + ye + '<br>Event: ' + di ; 
  src +='<br><br>No picture has yet been published for this event and year. <br>If you have uploaded any image, it will be published soon.';

 }
 else
 {
  currentnum = num;
  //alert(currentnum);
  //alert(imgarr[currentnum]);
  var num1 = currentnum % imgarr.length;
  var num2 = (currentnum + 1) % imgarr.length;
  var num3 = (currentnum + 2) % imgarr.length;

  var temp="";

  src = 'Total Image : ' + imgarr.length;
  src += ' (Year: ' + year + ', Event: ' + dir +')'; 
  var temp = '<br><table border=0 cellpadding=2 width=100%><tr><td colspan=3 class=al_l>&nbsp;</td></tr>'+
         '<tr><td align=center><a href=javascript:openWindow(\''+jmga[num1]+'\');><img src=' + 
         imgarr[num1] + 
         ' height=100 width=155></a></td><td align=center><a href=javascript:openWindow(\''+jmga[num2]+'\');><img src=' + 
         imgarr[num2] + 
         ' height=100 width=155></a></td><td align=center><a href=javascript:openWindow(\''+jmga[num3]+'\');><img src=' + 
         imgarr[num3] + 
         ' height=100 width=155></a></td></tr>'+ 
         '<tr><td class=cal align=center>' + (num1+1) + " : " + imgname[num1] + 
         '</td><td class=cal align=center>' + (num2+1) + " : " + imgname[num2] + 
         '</td><td class=cal align=center>' + (num3+1) + " : " + imgname[num3] + '</td></tr></table>';


  var temp2 = '<br><table border=0 cellpadding=2 width=100%><tr><td colspan=3 class=al_l>&nbsp;</td></tr>'+
         '<tr><td align=center><a href=# onClick="document.getElementById(\'big\').src=\''+jmga[num1]+'\'"><img src=' + 
         imgarr[num1] + 
         ' height=100 width=155></a></td><td align=center><a href=javascript:openWindow(\''+jmga[num2]+'\');><img src=' + 
         imgarr[num2] + 
         ' height=100 width=155></a></td><td align=center><a href=javascript:openWindow(\''+jmga[num3]+'\');><img src=' + 
         imgarr[num3] + 
         ' height=100 width=155></a></td></tr>'+ 
         '<tr><td class=cal align=center>' + (num1+1) + " : " + imgname[num1] + 
         '</td><td class=cal align=center>' + (num2+1) + " : " + imgname[num2] + 
         '</td><td class=cal align=center>' + (num3+1) + " : " + imgname[num3] + '</td></tr></table>';

  src += '<br><table border=0 cellpadding=2 width=100%><tr><td colspan=3 class=al_l>&nbsp;</td></tr>'+
         '<tr><td align=center><a onClick="ShowPhoto(\''+jmga[num1]+'\');"><img src=' + 
         imgarr[num1] + 
         ' height=100 width=155></a></td><td align=center><a onClick="ShowPhoto(\''+jmga[num2]+'\');"><img src=' + 
         imgarr[num2] + 
         ' height=100 width=155></a></td><td align=center><a onClick="ShowPhoto(\''+jmga[num3]+'\');"><img src=' + 
         imgarr[num3] + 
         ' height=100 width=155></a></td></tr>'+ 
         '<tr><td class=cal align=center>' + (num1+1) + " : " + imgname[num1] + 
         '</td><td class=cal align=center>' + (num2+1) + " : " + imgname[num2] + 
         '</td><td class=cal align=center>' + (num3+1) + " : " + imgname[num3] + '</td></tr></table>';


      //alert(src);
 }

 
 //IE
 if (document.all||document.getElementById){
  album.innerHTML = src;
  //alert("1");
 }
 else if (document.layers){
  document.albu.document.write('src');
  document.albu.document.close();
  alert("2");
 }
}

///////////////////////////////////////////////////
function Next(imgarr)
{
 var nextnum = currentnum+3;
 if(nextnum > imgarr.length) nextnum -= imgarr.length;
 SwitchImage3(imgarr,nextnum)
}

///////////////////////////////////////////////////
function Prev(imgarr)
{
 var prevnum = currentnum-3
 if(prevnum < 0) prevnum += imgarr.length;
 SwitchImage3(imgarr,prevnum)
}

//function openWindow(windowURL,windowName,windowWidth,windowHeight) {
function openWindow(windowURL) 
{
 window.name = 'parentWnd';
 var windowName='test';
 var windowWidth = 360;
 var windowHeight = 240;
 var newWindow = window.open(windowURL,windowName,'width='+windowWidth+',height='+windowHeight+',toolbar=0,location=0,directories=0, status=0,menuBar=0,scrollBars=1,resizable=1');
 //alert(windowURL+windowName+'width='+windowWidth+',height='+windowHeight+',toolbar=0,location=0,directories=0, status=0,menuBar=0,scrollBars=1,resizable=1');
 newWindow.focus();
}

///////////////////////////////////////////////////
function ShowPhoto(image)
{
 src = '<a href=javascript:openWindow(\''+image+'\');><img src='+image+' width=498px></a>';

 //increase hit counter
 src += '<!-- Begin Shinystat Free code -->'+
'<script type="text/javascript" language="JavaScript" src="http://codice.shinystat.com/cgi-bin/getcod.cgi?USER=UttoronRoot"></script>'+
'<noscript>'+
'<a href="http://www.shinystat.com" target="_top">'+
'<img src="http://www.shinystat.com/cgi-bin/shinystat.cgi?USER=UttoronRoot" alt="Free web stats" border="0"></a>'+
'</noscript>'+
'<!-- End Shinystat Free code -->'+
'  <script type="text/javascript">'+
'var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");'+
'document.write(unescape("%3Cscript src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E"));'+
'</script>'+
'<script type="text/javascript">'+
'var pageTracker = _gat._getTracker("UA-215279-6");'+
'pageTracker._initData();'+
'pageTracker._trackPageview();'+
'</script>';


 //IE
 if (document.all||document.getElementById){
  photo.innerHTML = src;
  //alert("1");
 }
 else if (document.layers){
  document.phot.document.write('src');
  document.phot.document.close();
 }
}

///////////////////////////////////////////////////
function UploadOnOff(obj) 
{
	var el = document.getElementById(obj);       

	if ( el.style.display != "none" ) 
        {
		el.style.display = 'none';
	}
	else 
        {
		el.style.display = '';
	}
}