" +
"" +
"" +
"" +
"");
jQuery('#cd-name'+commentCtr).text(cmmnt.name);
jQuery('#cd-role'+commentCtr).text(cmmnt.institution);
jQuery('#cd-copy'+commentCtr).html(cmmnt.comment);
jQuery('#comment'+commentCtr).fadeIn('slow');
}
} else {
size = 0;
}
var com = getStaticResource("article.comments.comments");
if (size == '1') {
com = getStaticResource("article.comments.comment");
}
if(form == 'commentPostAbstract'){
jQuery('#commentbox' + componentId).html('' + size + " " + com + '');
jQuery("#commentheader" + componentId).text(size + " " + com);
} else {
jQuery('#commentbox' + componentId).html(size + ' ' + com);
}
}
}
);
}
function commentEvent(item,form){
var componentId = parseInt(item.id.split('commentbox')[1]);
var jid = jQuery("#jid").val();
if (jQuery('#'+item.id+"-box").css('display') == 'none') {
jQuery('#'+item.id+"-box").slideToggle();
loadComments(jid, componentId, form);
} else {
jQuery('#'+item.id+"-box").slideToggle();
}
return false;
}
function validateComment(componentId) {
var valid=true;
var name = jQuery("#name" + componentId).val();
var institution = jQuery("#institution" + componentId).val();
var email = jQuery("#email" + componentId).val();
var updates = jQuery("#updates" + componentId).val();
var comment = jQuery("#Comment" + componentId).val();
if (!name) {
jQuery("#namelabel" + componentId).text(getStaticResource("article.comments.name.required"));
jQuery("#name" + componentId).attr("class", "error");
valid= false;
} else {
jQuery("#namelabel" + componentId).text("");
jQuery("#name" + componentId).removeClass("error");
}
if (!comment) {
jQuery("#commentlabel" + componentId).text(getStaticResource("article.comments.comment.required"));
jQuery("#Comment" + componentId).attr("class", "error");
valid= false;
} else {
jQuery("#commentlabel" + componentId).text("");
jQuery("#Comment" + componentId).removeClass("error");
}
if (!email || !checkEmail(email)) {
jQuery("#emaillabel" + componentId).text(getStaticResource("article.comments.invalid.email"));
jQuery("#email" + componentId).attr("class", "error");
valid= false;
} else {
jQuery("#emaillabel" + componentId).text("");
jQuery("#email" + componentId).removeClass("error");
}
return valid;
}
function postCommentEvent(item,form) {
var componentId = parseInt(item.id.split('cb')[1]);
var name = jQuery("#name" + componentId).val();
var institution = jQuery("#institution" + componentId).val();
var email = jQuery("#email" + componentId).val();
var updates = "off";
if (jQuery("#updates" + componentId).is(':checked')) {
updates = "on";
}
var comment = jQuery("#Comment" + componentId).val();
var challenge = jQuery("[name=recaptcha_challenge_field]").val();
var response = jQuery("[name=recaptcha_response_field]").val();
var jid = jQuery("#jid").val();
jQuery("#postAlert" + componentId).html(getStaticResource("article.comments.wait") + " ");
if (validateComment(componentId)) {
if (jQuery("#alert" + componentId).is(':checked')) {
jQuery("#postAlert" + componentId).html(getStaticResource("article.comments.log.in"));
$(window).scrollTop($('#commentbox' + componentId + "-box").position().top);
} else {
jQuery.post('/action/comment?'+Math.random(),
{type: 'saveComments', name:name, institution:institution, email:email, updates: updates, comment:comment, jid:jid, componentId:componentId, recaptcha_challenge_field: challenge, recaptcha_response_field: response},
function(data) {
if (data.indexOf('Error') < 0 && data != 'false') {
if (data == 'spam') {
jQuery("#postAlert" + componentId).html(getStaticResource("article.comments.invalid.captcha"));
$(window).scrollTop($('#commentbox' + componentId + "-box").position().top);
} else if (data == 'moderated'){
jQuery("#postAlert" + componentId).html(getStaticResource("article.comments.moderated"));
jQuery("#Comment" + componentId).val("");
jQuery("#comctr" + componentId).html("1000");
loadCommentsAnchor(jid,componentId,form);
} else {
jQuery("#postAlert" + componentId).html(getStaticResource("article.comments.success"));
jQuery("#Comment" + componentId).val("");
jQuery("#comctr" + componentId).html("1000");
loadCommentsAnchor(jid,componentId,form);
}
} else {
jQuery("#postAlert" + componentId).html(getStaticResource("article.comments.error"));
}
Recaptcha.reload();
}
);
}
} else {
jQuery("#postAlert" + componentId).html("");
}
return false;
}
function previewEvent(){
var articleId = jQuery(this).attr("id");
jQuery(this).toggleClass("active");
jQuery(this).parent().siblings(".previewbox").slideToggle();
var componentId = parseInt(articleId.split('hp')[1]);
var cached = jQuery(this).parent().siblings("#cached"+componentId).html();
var hasAccess = jQuery(this).parent().siblings('#access'+componentId).val();
var link = jQuery(this).parent().siblings('#link'+componentId).val();
var previewtab = jQuery(this).parent().siblings(".previewbox").children("#categoryitems").children(".contents");
var previewbox = previewtab.children("#content_container");
var tabs = previewtab.children("ul").children("li");
if(jQuery(this).hasClass("active") && cached == 'false') {
var currentURL = document.URL;
PreviewTabsContent.getAbstractText2(componentId, currentURL, function(data) {
if (data == '') {
previewbox.children("#preview"+ componentId + "-1").html("There is no abstract available for this article.
");
} else if (data == '****') {
previewbox.children("#preview"+ componentId + "-1").html("There is no abstract available for this article.
");
} else {
previewbox.children("#preview"+ componentId + "-1").html("" + data + "
");
if(typeof MathJax !== 'undefined' && typeof toggleMathJax == 'function'){
MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
toggleMathJax();
}else if (typeof loadMathjax !== 'undefined'){
loadMathjax();
}
}
});
if (hasAccess == 'true') {
PreviewTabsContent.getReferences(componentId, function(data) {
if (data != '' && data != '****') {
tabs.children("#tab" + componentId + "-4").fadeIn();
previewbox.children("#preview" + componentId + "-4").html("" + data + "
");
jQuery("#tab" + componentId + "-4").bind("click",function(){
jQuery.ajax({
type : "GET",
url : "/action/captureEventCommon",
data : {aid:componentId, currentURL:currentURL, itemType:"previewReferences"}
});
});
if(typeof MathJax !== 'undefined' && typeof toggleMathJax == 'function'){
MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
toggleMathJax();
}else if (typeof loadMathjax !== 'undefined'){
loadMathjax();
}
}
});
PreviewTabsContent.getStructure(componentId, link, function(data) {
if (data != '' && data != '****') {
tabs.children("#tab" + componentId + "-2").fadeIn();
previewbox.children("#preview" + componentId + "-2").html("" + data + "
");
if(typeof MathJax !== 'undefined' && typeof toggleMathJax == 'function'){
MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
toggleMathJax();
}else if (typeof loadMathjax !== 'undefined'){
loadMathjax();
}
}
});
PreviewTabsContent.getFiguresAndTablesText(componentId, link, 3, function(data) {
if (data != '' && data != '****') {
tabs.children("#tab" + componentId + "-3").fadeIn();
previewbox.children("#preview" + componentId + "-3").html("" + data + "
");
}
});
PreviewTabsContent.getFiguresAndTablesText(componentId, link, 5, function(data) {
if (data != '' && data != '****') {
tabs.children("#tab" + componentId + "-5").fadeIn();
previewbox.children("#preview" + componentId + "-5").html("" + data + "
");
}
});
PreviewTabsContent.getFiguresAndTablesText(componentId, link, 6, function(data) {
if (data != '' && data != '****') {
tabs.children("#tab" + componentId + "-6").fadeIn();
previewbox.children("#preview" + componentId + "-6").html("" + data + "
");
}
});
}
//alert(previewtab.children("ul#previewtabs"+componentId).children("li").eq(3).children("a").attr("id"));
//previewtab.children("ul#previewtabs"+componentId).children("li").eq(3).children("a").click(displayPreviewTabs);
displayPreviewTabs(previewtab.children("ul#previewtabs"+componentId).children("li").eq(0),previewbox);
displayPreviewTabs(previewtab.children("ul#previewtabs"+componentId).children("li").eq(1),previewbox);
displayPreviewTabs(previewtab.children("ul#previewtabs"+componentId).children("li").eq(2),previewbox);
displayPreviewTabs(previewtab.children("ul#previewtabs"+componentId).children("li").eq(3),previewbox);
displayPreviewTabs(previewtab.children("ul#previewtabs"+componentId).children("li").eq(4),previewbox);
displayPreviewTabs(previewtab.children("ul#previewtabs"+componentId).children("li").eq(5),previewbox);
displayPreviewTabs(previewtab.children("ul#previewtabs"+componentId).children("li").eq(6),previewbox);
/*previewtab.children("ul#previewtabs"+componentId).children("li").click(function(){
var rel = jQuery(this).children("a").attr("rel");
alert(rel);
var tab = rel.replace("preview","tab");
jQuery(this).children("a").removeClass("active");
//previewtab.children("ul#previewtabs"+componentId).children("li").children("a").removeClass("active");
jQuery(this).children("a#"+tab).addClass("active");
previewbox.children("div").hide();
previewbox.children("div#"+rel).show();
}); */
jQuery(this).parent().siblings("#cached"+componentId).html('true');
}
return false;
}
function displayPreviewTabs(previewTab,previewbox){
previewTab.children("a").click(function(){
var rel = jQuery(this).attr("rel");
var tab = rel.replace("preview","tab");
jQuery(this).removeClass("active");
previewTab.children("a#"+tab).addClass("active");
previewbox.children("div").hide();
previewbox.children("div#"+rel).show();
});
}
/**
* Page refresh for CJO SSO
*/
function refreshPage() {
setTimeout(function() {
location.reload(true);
}, 4000);
};
/**
* Update SSO Session
*/
function updateSession() {
setTimeout(function() {
jQuery.get("/action/updateSession");
}, 4000);
};
/**
* Added for NLS
*/
function getStaticResource(key) {
var value = "";
jQuery.ajax({
type : "GET",
url : "/action/reloadMessages",
data : {type: "4", key: key},
async : false,
cache : false,
success :
function(result) {
value = result;
}
});
return value;
}
//added to remove unwanted js file dynamically
function removejscssfile(filename, filetype){
var targetelement=(filetype=="js")? "script" : (filetype=="css")? "link" : "none" //determine element type to create nodelist from
var targetattr=(filetype=="js")? "src" : (filetype=="css")? "href" : "none" //determine corresponding attribute to test for
var allsuspects=document.getElementsByTagName(targetelement)
for (var i=allsuspects.length; i>=0; i--){ //search backwards within nodelist for matching elements to remove
if (allsuspects[i] && allsuspects[i].getAttribute(targetattr)!=null && allsuspects[i].getAttribute(targetattr).indexOf(filename)!=-1)
allsuspects[i].parentNode.removeChild(allsuspects[i]) //remove element by calling parentNode.removeChild()
}
}
/**
* This function should be used to attain the window.onload behavior. This is created to avoid conflict in multiple window.onload calls
*/
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
function computePageNum(issueTitle, category, issueId, volumeId, seriesId, itemInfoURL, jid, journalTitle) {
var totalPageNum = "";
var itemPdfURL = "http://portal.sds.sheridanpress.local/CSR.aspx";
var itemCode = "";
jQuery.ajax({
type : "GET",
url : "/action/computePageNumber",
data : {jid:jid, volumeId:volumeId, issueId:issueId, seriesId:seriesId},
async : false,
success :
function(result) {
totalPageNum = result;
}
});
if(volumeId.length==1) {
itemCode = jid + "_0" + volumeId + "_" + issueId;
} else {
itemCode = jid + "_" + volumeId + "_" + issueId;
}
return AddToCart(itemCode, issueTitle, category, '', '', issueId, volumeId, itemInfoURL, itemPdfURL, '', '', totalPageNum, journalTitle);
}