var WeFavPhotoSite =
{
formIDStr: "",
hiddenChoiceIDStr: "",
btnDescriptor: [],
BTN_ID_ELEM: 0,
BTN_NORMCLAS_ELEM: 1,
BTN_EMPHCLAS_ELEM: 2,
BTN_POST_NUM:  3,
galCtlDescript: [],
GAL_ID_ELEM: 0,
GAL_POST_ELEM: 1,
GAL_NORMCLAS_ELEM: 2,
GAL_EMPHCLAS_ELEM: 3
};
WeFavPhotoSite.formIDStr = 'fav_photo_sites_form';
WeFavPhotoSite.hiddenChoiceIDStr = 'userchoice';
WeFavPhotoSite.btnDescriptor =
[
["sitelist","norm_action2_btn","emph_action2_btn","b0"],
["modbtn","norm_activity_btn","emph_activity_btn","b1"],
["addbtn","norm_activity_btn","emph_activity_btn","b2"],
["removebtn","norm_activity_btn","emph_activity_btn","b3"],
["applybtn","norm_action1_btn","emph_action1_btn","b4"],
["continbtn","norm_action1_btn","emph_action1_btn","b5"],
["cancelbtn","norm_action2_btn","emph_action2_btn","b6"],
["savebtn","norm_action1_btn","emph_action1_btn","b7"],
["modtextbtn","norm_activity_btn","emph_activity_btn","b8"],
["modmnphobtn","norm_activity_btn","emph_activity_btn","b9"],
["modgalphobtn","norm_activity_btn","emph_activity_btn","b10"],
["rviewbtn","norm_activity_btn","emph_activity_btn","b11"],
["apprvbtn","norm_immed_btn","emph_immed_btn","b12"],
["viewbtn","norm_action2_btn","emph_action2_btn","b13"]
];
WeFavPhotoSite.imgPath = '../images/';
WeFavPhotoSite.extn = '.gif';
WeFavPhotoSite.galBtnChoice = 'gallery_request';
WeFavPhotoSite.galleryAction = 'galactn_op';
WeFavPhotoSite.galCtlDescript =
[
['prev_cntl','prev','prev_5bb6ef','prev_a4ef5b'],
['next_cntl','next','next_5bb6ef','next_a4ef5b'],
['done_cntl','done','close_x','close_x_hl']
];
WeFavPhotoSite.Init = function()
{
var idx;
var input;
for (idx = 0; idx < WeFavPhotoSite.btnDescriptor.length; idx++)
{
input = document.getElementById(WeFavPhotoSite.btnDescriptor[idx][WeFavPhotoSite.BTN_ID_ELEM]);
if (input)
WeFavPhotoSite.CreateActivityBtnObj(idx);
}
for (idx = 0; idx < 3; idx++)
WeFavPhotoSite.CreateActionButton(idx);
WeFavPhotoSite.CreateKeydownObj();
};
WeFavPhotoSite.CreateKeydownObj = function()
{
var keyObj = function()
{
this.OnKeydown = function (evt)
{
var action = "";
if (evt.keyCode === 13)
action = WeFavPhotoSite.galCtlDescript[2][WeFavPhotoSite.GAL_POST_ELEM];
else if (evt.keyCode === 80 || evt.keyCode === 112)
action = WeFavPhotoSite.galCtlDescript[0][WeFavPhotoSite.GAL_POST_ELEM];
else if (evt.keyCode === 78 || evt.keyCode === 110)
action = WeFavPhotoSite.galCtlDescript[1][WeFavPhotoSite.GAL_POST_ELEM];
if (action != "")
{
var node = document.getElementById(WeFavPhotoSite.hiddenChoiceIDStr);
node.value = WeFavPhotoSite.galBtnChoice;
node = document.getElementById(WeFavPhotoSite.galleryAction);
node.value = action;
var form = document.getElementById(WeFavPhotoSite.formIDStr);
form.submit();
}
};
if (typeof window.addEventListener !== "undefined")
document.addEventListener("keydown", this.OnKeydown, false);
else if (typeof window.attachEvent !== "undefined")
document.attachEvent("onkeydown", this.OnKeydown);
};
return new keyObj;
};
WeFavPhotoSite.CreateActivityBtnObj = function
(
radBtnNum
)
{
var radBtnObj = function (radBtnNum,sltdRadBtnStr)
{
var that = this;
this.btnDescription = WeFavPhotoSite.btnDescriptor[radBtnNum];
this.node = document.getElementById(this.btnDescription[WeFavPhotoSite.BTN_ID_ELEM]);
this.ClickAction = function ()
{
var node = document.getElementById(WeFavPhotoSite.hiddenChoiceIDStr);
node.value = that.btnDescription[WeFavPhotoSite.BTN_POST_NUM];
var form = document.getElementById(WeFavPhotoSite.formIDStr);
form.submit();
};
this.node.onclick = this.ClickAction;
this.MouseoverAction = function ()
{
that.node.className = that.btnDescription[WeFavPhotoSite.BTN_EMPHCLAS_ELEM];
};
this.node.onmouseover = this.MouseoverAction;
this.MouseoutAction = function ()
{
that.node.className = that.btnDescription[WeFavPhotoSite.BTN_NORMCLAS_ELEM];
};
this.node.onmouseout = this.MouseoutAction;
};
return new radBtnObj(radBtnNum);
};
WeFavPhotoSite.CreateActionButton = function
(
scrBtnNum
)
{
var scrBtnObj = function (scrBtnNum)
{
var that = this;
this.scrBtnDesc = WeFavPhotoSite.galCtlDescript[scrBtnNum];
this.node = document.getElementById(this.scrBtnDesc[WeFavPhotoSite.GAL_ID_ELEM]);
this.ClickAction = function ()
{
var node = document.getElementById(WeFavPhotoSite.hiddenChoiceIDStr);
node.value = WeFavPhotoSite.galBtnChoice;
node = document.getElementById(WeFavPhotoSite.galleryAction);
node.value = that.scrBtnDesc[WeFavPhotoSite.GAL_POST_ELEM];
var form = document.getElementById(WeFavPhotoSite.formIDStr);
form.submit();
};
this.node.onclick = this.ClickAction;
this.MouseoverAction = function ()
{
var imgName;
if (that.isAScoreBtn == true)
{
var imgElem = that.scrBtnDesc[WeFavPhotoSite.GAL_POST_ELEM] == WeFavPhotoSite.currscore ?
WeFavPhotoSite.GAL_EMPHSCRCLAS_ELEM : WeFavPhotoSite.GAL_EMPHCLAS_ELEM;
imgName = that.scrBtnDesc[imgElem];
}
else
imgName = that.scrBtnDesc[WeFavPhotoSite.GAL_EMPHCLAS_ELEM];
that.node.src = WeFavPhotoSite.imgPath + imgName + WeFavPhotoSite.extn;
};
this.node.onmouseover = this.MouseoverAction;
this.MouseoutAction = function ()
{
var imgName;
if (that.isAScoreBtn == true)
{
var imgElem = that.scrBtnDesc[WeFavPhotoSite.GAL_POST_ELEM] == WeFavPhotoSite.currscore ?
WeFavPhotoSite.GAL_NORMSCRCLAS_ELEM : WeFavPhotoSite.GAL_NORMCLAS_ELEM;
imgName = that.scrBtnDesc[imgElem];
}
else
imgName = that.scrBtnDesc[WeFavPhotoSite.GAL_NORMCLAS_ELEM];
that.node.src = WeFavPhotoSite.imgPath + imgName + WeFavPhotoSite.extn;
};
this.node.onmouseout = this.MouseoutAction;
};
return new scrBtnObj(scrBtnNum);
};
WeFavPhotoSite.Start = function ()
{
if (document.addEventListener)
{
window.addEventListener("load",WeFavPhotoSite.Init,false);
}
else
{
window.attachEvent("onload",WeFavPhotoSite.Init);
}
};
WeFavPhotoSite.Start();
var WePostShowPage = function
(
folderStr
)
{
var node = document.getElementById(WeFavPhotoSite.hiddenChoiceIDStr);
node.value = 'showinfopage';
node = document.getElementById('sitenum');
node.value = folderStr;
var horizPx = self.pageXOffset;
var vertPx = self.pageYOffset;
node = document.getElementById('horizOfst');
node.value = horizPx;
node = document.getElementById('vertOfst');
node.value = vertPx;
var form = document.getElementById(WeFavPhotoSite.formIDStr);
form.submit();
};
var WePostGalleryImage = function
(
imgNumberStr
)
{
var node = document.getElementById(WeFavPhotoSite.hiddenChoiceIDStr);
node.value = 'showimg';
node = document.getElementById('imgnum');
node.value = imgNumberStr;
var form = document.getElementById(WeFavPhotoSite.formIDStr);
form.submit();
};
var WePagePosition = function()
{
var horizPx = self.pageXOffset;
var vertPx = self.pageYOffset;
node = document.getElementById('horizOfst');
node.value = horizPx;
node = document.getElementById('vertOfst');
node.value = vertPx;
};
