$(document).ready(function(){
$("form#frmcomments").submit(function() {
$("span.success").text("Validating...").show();
if($("input#name").val()==""){
$("span.success").text("Please enter your name.").show();
return false;
}
else if ($("textarea#comment").val() == "") {
$("span.success").text("Please enter your comment").show();
return false;
}
else if ($("[name=mathguard_answer]").val() == "") {
$("span.success").text("Please answer the math question and re-submit").show();
return false;
}
else{
var mg_answer=$("[name=mathguard_answer]").val();
var mg_code=$("[name=mathguard_code]").val();
var mg_status = $.ajax({
url: "php/mg_validate.php",
data: "mathguard_answer="+mg_answer+"&mathguard_code="+mg_code,
async: false }).responseText;
if(mg_status=="bot"){
$("span.error").text("Please re-enter your answer and re-submit").show();
$("span.success").text("");
$("[name=mathguard_answer]").css({border:"1px solid #aa0000"});
$("[name=mathguard_answer]").val("");
return false;
}
else
return true;
}
});
});
$(function() {
// Use this example, or...
$('a[@rel*=eclick]').lightBox(); // click enlargements
$('a[@rel*=eclick_feature]').lightBox(); // featured click enlargements
$('a[@rel*=clickpals]').lightBox(); // click premium artists
// This, or...
// $('#gallery-* a').lightBox(); // Select all links in object with gallery ID
// This, or...
});
$(function() {
$(".pal_slide").jCarouselLite({
btnNext: ".next",
btnPrev: ".prev",
auto: 1800,speed:1500,
vertical:true, visible: 3, circular:false
});
});
$(function() {
$(".nonCircular .pal_woa_slide").jCarouselLite({
btnNext: ".nonCircular .woanext",
btnPrev: ".nonCircular .woaprev",
vertical:false, visible: 4, circular:false
});
});
$("form#author_comments").submit(function() {
$("span.success").text("Validating...").show();
if($("input#name").val()==""){
$("span.success").text("Please enter your name.").show();
return false;
}
else if ($("textarea#comment").val() == "") {
$("span.success").text("Please enter your comment").show();
return false;
}
else if ($("[name=mathguard_answer]").val() == "") {
$("span.success").text("Please answer the math question and re-submit").show();
return false;
}
else{
var mg_answer=$("[name=mathguard_answer]").val();
var mg_code=$("[name=mathguard_code]").val();
var mg_status = $.ajax({
url: "php/mg_validate.php",
data: "mathguard_answer="+mg_answer+"&mathguard_code="+mg_code,
async: false }).responseText;
if(mg_status=="bot"){
$("span.error").text("Please re-enter your answer and re-submit").show();
$("span.success").text("");
$("[name=mathguard_answer]").css({border:"1px solid #aa0000"});
$("[name=mathguard_answer]").val("");
return false;
}
else
return true;
}
});
function sendtofriend(aid,story_title,author_name,btext){
var testy=$("span#"+aid+" p.letBody").html();
var ibegin=testy.indexOf("span class=");
if(ibegin>0){
iend=testy.indexOf("/span");
if(iend>ibegin){
testy1=testy.substr(0,ibegin);
testy2=testy.substr(iend,testy.length-iend);
testy=testy1+testy2;
}
}
testy=btext+testy;
var config_Notification={UIConfig: '', siteName: 'The Painter\'s Keys', APIKey: '1_7tg30mJLHdyPE_9H7uT3WX8by8R-D_Bek-mMNyW-sxcrwzEVewcCpwmOM2c5y9eOvbLeVish-S4-6dvg2LrUdw==', requiredPermissions: '3', language: 'Auto'};
Gigya.Social.showNotificationUI(config_Notification,null,null,null,'400','400',testy,'Type in a message to your friend.',story_title+' by '+author_name,null,true,'Send this letter to a friend',true);
}
function sndreply(src) {
ema=src.substring(src.indexOf("~")+1,src.length)+"@"+src.substring(0,src.indexOf("~"))
window.location="mailto:"+ema;
}
function view_author_comments(author_id){
if($("span#c"+author_id).css("display")=="none"){
$("span#c"+author_id).css({display:"block"});
$("span#c"+author_id+" div.comment_wrap").addClass("author_comment_wrap");
$("span#c"+author_id+" div.comment_head").addClass("author_comment_head");
$("span#c"+author_id+" div.comment_text").addClass("author_comment_text");
}
}
function remove_author_comment_form(){
$("span.author_comments").remove();
}
function add_author_comment(author_id,click_id){
remove_author_comment_form();
var myfrm='';
$("span#"+author_id).after(myfrm);
$("div#mg").clone().insertAfter($("textarea.author_comment"));
// $("textarea.author_comment").after($("div#mg"));
}
function author_comment_form(author_id,click_id,click_url){
$("#frc*").css({display:"none"});
if($("#frc"+author_id).css("display")=="none"){
$.post("php/fr_add_comment.php",
{author_id:author_id, click_id:click_id,click_url:click_url},
function(data){
$("#frc"+author_id).html(data);
$("#frc"+author_id).css({display:"block"});
$("#frc"+author_id+" a.add_author_comment_link").text("test");
}
);
}
}
function cancel_author_comment_form(author_id){
$("#frc"+author_id).css({display:"none"});
$("#frc"+author_id).html("");
}