var home = "http://www.eldho.com/";
var name = "Eldho Thomas";
var email = "eldho.thomas@gmail.com";
//var base1 = "http://www.fortunecity.com/tinpan/spicegirls/886/album/";
var base1 = "http://www.eldho.com/album/";
var base2 = "http://www.fortunecity.com/oasis/belize/589/album/";

function gohome()
{
   top.location = home;
}

function gopage(page)
{
   var fullpage = home + page;
   document.location = fullpage;
}

function getalbumid(albumname)
{
   if (albumname == "Ruby")
   {
      return "K00";
   }
   if (albumname == "AL_MS")
   {
      return "J50/H00/D00";
   }
   if (albumname == "Storm_Scenes")
   {
      return "I00/R00/I00";
   }
}

function goalbum(albumname)
{
   var fullpage = home + "gallery/index.php?album=/" + getalbumid(albumname)
   document.location = fullpage;
}

function gogallery(albumid)
{
   var fullpage = home + "gallery/index.php?album=/" + albumid
   document.location = fullpage;
}



function smail()
{
   var mailink = "mailto:" + name + "<" + email + ">"
   document.location = mailink;
}

function getbase(picname)
{

   if (( picname.substring(0,5) == "achan" )  ||
       ( picname.substring(0,5) == "amish" )   ||
       ( picname.substring(0,4) == "ammi" )   ||
       ( picname.substring(0,5) == "anbus" )  ||
       ( picname.substring(0,5) == "ashok" )  ||
       ( picname.substring(0,4) == "balf" )   ||
       ( picname.substring(0,5) == "balan" )  ||
       ( picname.substring(0,6) == "banner" ) ||
       ( picname.substring(0,5) == "canoe" )  ||
       ( picname.substring(0,2) == "ct" )     ||
       ( picname.substring(0,4) == "deep" )   ||
       ( picname.substring(0,5) == "eck01" )  ||
       ( picname.substring(0,4) == "eldh" )   ||
       ( picname.substring(0,5) == "epcot" )  ||
       ( picname.substring(0,3) == "fam" )    ||
       ( picname.substring(0,4) == "galv" )  ||
       ( picname.substring(0,5) == "faust" )  ||
       ( picname.substring(0,5) == "gcany" )  ||
       ( picname.substring(0,4) == "hmtf" )   ||
       ( picname.substring(0,3) == "hsp" )    ||
       ( picname.substring(0,3) == "ind" )    ||
       ( picname.substring(0,4) == "img_" )    ||
       ( picname.substring(0,4) == "ital" )   ||
       ( picname.substring(0,4) == "katy" )   ||
       ( picname.substring(0,5) == "kochu" )  ||
       ( picname.substring(0,5) == "koshy" )  ||
       ( picname.substring(0,5) == "magki" )  ||
       ( picname.substring(0,3) == "mat" )    ||
       ( picname.substring(0,5) == "maywe" )  ||
       ( picname.substring(0,5) == "merca" )  ||
       ( picname.substring(0,5) == "niaga" )  ||
       ( picname.substring(0,4) == "niba" )   ||
       ( picname.substring(0,4) == "ozdr" )   ||
       ( picname.substring(0,3) == "par" )   ||
       ( picname.substring(0,4) == "phil" )   ||
       ( picname.substring(0,4) == "phot" )   ||
       ( picname.substring(0,5) == "prasa" )  ||
       ( picname.substring(0,4) == "ragh" )   ||
       ( picname.substring(0,4) == "ravi" )   ||
       ( picname.substring(0,5) == "rbday" )     ||
       ( picname.substring(0,5) == "reebi" )  ||
       ( picname.substring(0,4) == "rent" )   ||
       ( picname.substring(0,2) == "ru" )     ||
       ( picname.substring(0,5) == "santa" )     ||
       ( picname.substring(0,4) == "scen" )   ||
       ( picname.substring(0,4) == "seaw" )   ||
       ( picname.substring(0,5) == "shant" )  ||
       ( picname.substring(0,4) == "slam" )   ||
       ( picname.substring(0,5) == "smoky" )  ||
       ( picname.substring(0,4) == "stan" )   ||
       ( picname.substring(0,5) == "starc" )  ||
       ( picname.substring(0,5) == "stfai" )  ||
       ( picname.substring(0,5) == "stf01" )  ||
       ( picname.substring(0,3) == "stl" )    ||
       ( picname.substring(0,5) == "stpat" )  ||
       ( picname.substring(0,3) == "stz" )  ||
       ( picname.substring(0,5) == "sunil" )  ||
       ( picname.substring(0,5) == "suppy" )  ||
       ( picname.substring(0,3) == "tkp" )    ||
       ( picname.substring(0,5) == "unive" )  ||
       ( picname.substring(0,5) == "washd" )  ||
       ( picname.substring(0,3) == "wed" )    ||
       ( picname.substring(0,4) == "vish" )   ||
       ( picname.substring(0,4) == "wetw" )   ||
       ( picname.substring(0,3) == "we3" )   ||
       ( picname.substring(0,5) == "wintr" ))

   {
      return base1;
   }
   
   if (( picname.substring(0,5) == "xxxxx" )  ||
       ( picname.substring(0,5) == "xxxxx" )) 
   {
      return base2;
   }

   return home;
}

function pop(picname)
{
   var piclink = getbase(picname) + picname;
   window.open(piclink, "popwin", 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=640,height=480');
}

function pic(picname)
{
   var piclink = getbase(picname) + picname;
   return piclink;
}


// This function is to be called only 'onload' only if there are any images
// that are to be directly displayed (like in wedding.htm).
// In the HTML, such files should be give as src="xxx/picname.jpg"

function showxxx()
{
   for ( var i=0; i<document.images.length; i++ ) 
   {
      var tmpsrc = document.images[i].src; 
      if ( tmpsrc.indexOf("/") >= 0 )    // If the src contains "/".
      { 
         var tmpary = tmpsrc.split("/"); 
         var len = tmpary.length;
         if ( tmpary[len-2] == "xxx" )    // If prefix = "xxx"
         {
            var picname = tmpary[len-1];  // Gets the basename. 
            document.images[i].src = pic(picname); // Append outsider prefix.
         }
      }
   }
}


// This function is not being used now, but just kept for future reference.
// This was earlier called "onload" to get the basename and display 
// any picture followed by src=

function picall()
{
   for ( var i=0; i<document.images.length; i++ ) 
   { 
      var tmpsrc = document.images[i].src; 
      if ( tmpsrc.indexOf("/") >= 0 )    // If the src contains "/".
      { 
         var tmpary = tmpsrc.split("/"); 
         var picname = tmpary[tmpary.length-1];  // Gets the basename. 
      } 
      else
      {  
         var picname = tmpsrc;
      }

      var homsrc = home + picname;
      if ( homsrc == tmpsrc )        // If the original src is at homepage.
      {
         document.images[i].src=pic(picname);   // Append outsider prefix. 
      }
   } 
}

function ensureframe()
{
   if (top.location != home)
   {
      var thispage = self.location;
      top.location = home;
      //Add lines to set the right frame to thispage.
   }
}

function eunsuretop()
{
   if (top.location != self.location)
   {
      top.location = self.location;
   }
}

