$(document).ready(function(){
$("#id_search_heading_btn").click(
function () {
var author = $("#id_search_heading_author").val();
var title = $("#id_search_heading_title").val();
if(author == " search author..." && title == " search title..."){
alert('Please enter a search term.');
return false;
}
else{
//search_heading_ajax(author,title);
$.ajax({
type: "POST",
url: "/includes/check_search.php",
data: "qa="+escape(author)+"&qt="+escape(title),
beforeSend: function(){
$("#id_search_heading_match").attr('innerHTML','
');
},
success: function(data){
$("#id_search_heading_match").attr('innerHTML',data);
}
});
}
}
);
});
$(document).ready(function(){
$("#id_search_heading_author").keyup(
function (e) {
if(e.keyCode == 13) {//check for enter keypress
var author = $("#id_search_heading_author").val();
var title = $("#id_search_heading_title").val();
if(author == " search author..." && title == " search title..."){
alert('Please enter a search term.');
return false;
}
else{
//search_heading_ajax(author,title);
$.ajax({
type: "POST",
url: "/includes/check_search.php",
data: "qa="+escape(author)+"&qt="+escape(title),
beforeSend: function(){
$("#id_search_heading_match").attr('innerHTML','');
},
success: function(data){
$("#id_search_heading_match").attr('innerHTML',data);
}
});
}
}
}
);
});
$(document).ready(function(){
$("#id_search_heading_title").keyup(
function (e) {
if(e.keyCode == 13) {//check for enter keypress
var author = $("#id_search_heading_author").val();
var title = $("#id_search_heading_title").val();
if(author == " search author..." && title == " search title..."){
alert('please enter a search term');
return false;
}
else{
//search_heading_ajax(author,title);
$.ajax({
type: "POST",
url: "/includes/check_search.php",
data: "qa="+escape(author)+"&qt="+escape(title),
beforeSend: function(){
$("#id_search_heading_match").attr('innerHTML','');
},
success: function(data){
$("#id_search_heading_match").attr('innerHTML',data);
}
});
}
}
}
);
});
function search_notify(){
var qt = $("#id_kw_home").val();
$.ajax({
type: "POST",
url: "/includes/check_search_notify.php",
data: "&qt="+qt
});
}
function search_heading(author,title){//search via links code
$("#id_search_heading_author").val(author);
$("#id_search_heading_title").val(title);
$.ajax({
type: "POST",
url: "/includes/check_search.php",
data: "qa="+escape(author)+"&qt="+escape(title),
beforeSend: function(){
$("#id_search_heading_match").attr('innerHTML','');
},
success: function(data){
$("#id_search_heading_match").attr('innerHTML',data);
}
});
}
function clear_search_heading(){
document.getElementById("id_search_heading_author").value = ' search author...';
document.getElementById('id_search_heading_title').value = ' search title...';
document.getElementById("id_search_heading_match").innerHTML='';
}
function clear_search_heading_2(){
document.getElementById("id_kw_home").value = ' keywords...';
document.getElementById("id_kw_check_home").innerHTML='';
}
function clear_search(){
document.getElementById("id_search_author").value = ' search author...';
document.getElementById('id_search_title').value = ' search title...';
document.getElementById("id_search_heading_author").value = ' search author...';
document.getElementById('id_search_heading_title').value = ' search title...';
document.getElementById("id_search_match").innerHTML='';
document.getElementById("id_search_heading_match").innerHTML='';
}
function switchType_password(strname) {
var strname = strname;
var new_input = document.createElement('input');
old_input = document.getElementById(strname);
new_input.id = old_input.id;
new_input.name = old_input.name;
new_input.className = old_input.className;
new_input.type = 'password';
new_input.maxLength = old_input.maxLength;
new_input.value = "";
old_input.parentNode.replaceChild(new_input, old_input);
setTimeout(function () { document.getElementById(strname).focus(); }, 0);
}
function validate_login() {
var username = $("#id_username").val();
var password = $("#id_pass_login").val();
//check for null
if (username==null||username==""||username=="username"){
alert("Please enter a username.");
return false;
}
//check length
if (username.length>21 || username.length<3){
alert("Username must be between 3 and 20 characters in length");
return false;
}
//check allowable characters
var pattern=/[^a-z^0-9^A-Z_]/;
if (pattern.test(username)) {
alert("Username allowable characters: a-z, A-Z, 0-9");
return false;
}
}