var xmlHttp

function forgotPassword()
{
	document.getElementById("txtHint").innerHTML="<input type=text name='fPass' value='Enter UserId' maxlength=45><input type=button value='Get Password' onClick='forgotPassword1(fPass.value);' >";
}

function forgotPassword1(userid)
{
	if(userid=="")
	{
	document.getElementById("signUp").innerHTML="<font color='red'>Please enter userid and then click submit</font>"
	return;
	}
	
	if(userid.length > 45)
	{
	document.getElementById("signUp").innerHTML="<font color='red'>Userid can't be more than 45 characters</font>"
	return;
	}
	
	xmlHttpForgotPassword=GetXmlHttpObject();
	if (xmlHttpForgotPassword==null)
	{
	alert ("Your browser does not support AJAX!");
	return;
	} 
	
	
	var url="http://www.gobooks.co.in/forgotPasswd.php?userid=" + userid;
	
	xmlHttpForgotPassword.onreadystatechange=stateChangedForgotPasswd;
	
	xmlHttpForgotPassword.open("POST",url,true);
	
	xmlHttpForgotPassword.send(null);
	//document.getElementById("txtHint").innerHTML="";
}

function stateChangedForgotPasswd() 
{ 

if (xmlHttpForgotPassword.readyState==4)
{ 
	if(xmlHttpForgotPassword.responseText == "")
		document.getElementById("signUp").innerHTML="This text means some error";
	else{
		document.getElementById("signUp").innerHTML=xmlHttpForgotPassword.responseText;
		document.getElementById("txtHint").innerHTML="";
		}
	
}
}

function Download(booksno)
{
	xmlHttpDownload=GetXmlHttpObject();
	if (xmlHttpDownload==null)
	{
	alert ("Your browser does not support AJAX!");
	return;
	} 
	
	
	var url="http://www.gobooks.co.in/file.phtml?booksno=" + booksno;
	alert(booksno);
	xmlHttpDownload.onreadystatechange=stateChangedDownload;
	
	xmlHttpDownload.open("POST",url,true);
	
	xmlHttpDownload.send(null);
	//document.getElementById("txtHint").innerHTML="";
}

function stateChangedDownload() 
{ 

if (xmlHttpDownload.readyState==4)
{ 
	if(xmlHttpDownload.responseText == "")
		document.getElementById("signUp").innerHTML="This text means some error";
	else
		document.getElementById("signUp").innerHTML=xmlHttpDownload.responseText;
	
}
}

function getPasswd(secretAns)
{
	
	if(secretAns=="")
	{
	document.getElementById("showPasswd").innerHTML="<font color='red'>Please enter Secret Answer</font>";
	return;
	}
	
	xmlHttpGetPasswd=GetXmlHttpObject();
	if (xmlHttpGetPasswd==null)
	{
	alert ("Your browser does not support AJAX!");
	return;
	} 
	
	
	var url="http://www.gobooks.co.in/forgotPasswd.php?secretAnswer=" + secretAns;
	
	xmlHttpGetPasswd.onreadystatechange=stateChangedGetPasswd;
	
	xmlHttpGetPasswd.open("POST",url,true);
	
	xmlHttpGetPasswd.send(null);
	//document.getElementById("txtHint").innerHTML="";
}

function stateChangedGetPasswd() 
{ 

if (xmlHttpGetPasswd.readyState==4)
{ 
	if(xmlHttpGetPasswd.responseText == "")
		document.getElementById("showPasswd").innerHTML="This text means some error";
	else{
		document.getElementById("showPasswd").innerHTML=xmlHttpGetPasswd.responseText;
		
	}
}
}

function changePasswdMain()
{
	//alert('changePasswd');
	//return;
	xmlHttpChangePasswd=GetXmlHttpObject();
	if (xmlHttpChangePasswd==null)
	{
	alert ("Your browser does not support AJAX!");
	return;
	} 
	
	
	var url="http://www.gobooks.co.in/changePasswd.php";
	
	xmlHttpChangePasswd.onreadystatechange=stateChangedChangePasswdMain;
	
	xmlHttpChangePasswd.open("POST",url,true);
	
	xmlHttpChangePasswd.send(null);
	//document.getElementById("txtHint").innerHTML="";
}

function stateChangedChangePasswdMain() 
{ 

if (xmlHttpChangePasswd.readyState==4)
{ 
	if(xmlHttpChangePasswd.responseText == "")
		document.getElementById("changePasswd").innerHTML="This text means some error";
	else{
		document.getElementById("changePasswd").innerHTML=xmlHttpChangePasswd.responseText;
		
	}
}
}

function changePasswd(current, newer, renewer)
{

	if(current=="")
	{
	document.getElementById("changePasswdTxt").innerHTML="<font color='red'>Please enter current Passsword and then click Submit</font>";
	return;
	}
	
	if(newer=="")
	{
	document.getElementById("changePasswdTxt").innerHTML="<font color='red'>Please enter new Passsword and then click Submit</font>";
	return;
	}
	
	if(renewer=="")
	{
	document.getElementById("changePasswdTxt").innerHTML="<font color='red'>Please enter new Passsword and then click Submit</font>";
	return;
	}
	
	if(newer!=renewer)
	{
	document.getElementById("changePasswdTxt").innerHTML="<font color='red'>Please make sure that new passwords match</font>";
	return;
	}
	xmlHttpChangePasswd=GetXmlHttpObject();
	if (xmlHttpChangePasswd==null)
	{
	alert ("Your browser does not support AJAX!");
	return;
	} 
	
	
	var url="http://www.gobooks.co.in/changePasswd.php?current="+current + "&newer="+newer;
	
	xmlHttpChangePasswd.onreadystatechange=stateChangedChangePasswd;
	
	xmlHttpChangePasswd.open("POST",url,true);
	
	xmlHttpChangePasswd.send(null);
	//document.getElementById("txtHint").innerHTML="";
}

function stateChangedChangePasswd() 
{ 

if (xmlHttpChangePasswd.readyState==4)
{ 
	if(xmlHttpChangePasswd.responseText == "")
		document.getElementById("changePasswd").innerHTML="This text means some error";
	else{
		document.getElementById("changePasswd").innerHTML=xmlHttpChangePasswd.responseText;
		
	}
}
}

function addFeedBack(type, feedback)
{

	if(type=="")
	{
	//alert('Please add some comment');
	document.getElementById("showFeedback").innerHTML="<font color='red'>Please select some Type and then click Submit</font>";
	return;
	}
	
	if(feedback=="")
	{
	//alert('Please add some comment');
	document.getElementById("showFeedback").innerHTML="<font color='red'>Please add some Feedback and then click Submit</font>";
	return;
	}
	
	xmlHttpAddFeedBack=GetXmlHttpObject();
	if (xmlHttpAddFeedBack==null)
	{
	alert ("Your browser does not support AJAX!");
	return;
	} 
	
	
	var url="http://www.gobooks.co.in/feedback1.php?type="+type+"&feedback="+feedback;
	//alert(url);
	xmlHttpAddFeedBack.onreadystatechange=stateChangedAddFeedBack;
	
	xmlHttpAddFeedBack.open("POST",url,true);
	
	xmlHttpAddFeedBack.send(null);
	//document.getElementById("txtHint").innerHTML="";
}

function stateChangedAddFeedBack() 
{ 

if (xmlHttpAddFeedBack.readyState==4)
{ 
	if(xmlHttpAddFeedBack.responseText == "")
		document.getElementById("content").innerHTML="This text means some error";
	else{
		document.getElementById("content").innerHTML=xmlHttpAddFeedBack.responseText;
		
	}
}
}




function showSignUp()
{
	xmlHttpSignUp=GetXmlHttpObject();
	if (xmlHttpSignUp==null)
	{
	alert ("Your browser does not support AJAX!");
	return;
	} 
	
	
	var url="http://www.gobooks.co.in/signup.php";
	
	xmlHttpSignUp.onreadystatechange=stateChangedSignUp;
	
	xmlHttpSignUp.open("GET",url,true);
	
	xmlHttpSignUp.send(null);
	
}



function stateChangedSignUp() 
{ 

if (xmlHttpSignUp.readyState==4)
{ 
	if(xmlHttpSignUp.responseText == "")
		document.getElementById("signUp").innerHTML="This text means some error";
	else
		document.getElementById("signUp").innerHTML=xmlHttpSignUp.responseText;
	
}
}


function addUser(fname, sex, email, password, repassword, country,  address, state, secretQ, secretA, agree)
{
 //alert(fname+ " " + sex + " " + email + " " + password + " " + country + " " + address + " " + state);
 //return;
  // alert(document.getElementById(secretQuestion));
  //alert(secretQ + " " + sex + " " + country);
  if(fname=="")
  {
	document.getElementById("signUpMsg").innerHTML="<font color='red'>Please enter Name and then click submit</font>"
	return;
  }
  
  if(fname.length > 45)
  {
	document.getElementById("signUpMsg").innerHTML="<font color='red'>Please enter Name in maximum of 45 characters</font>"
	return;
  }
  
  if(email=="")
  {
	document.getElementById("signUpMsg").innerHTML="<font color='red'>Please enter Email and then click submit</font>"
	return;
  }
  
  var expression= /^[a-zA-Z0-9@._]+$/;
  if(email.match(expression)){
	apos=email.indexOf("@")
	dotpos=email.lastIndexOf(".")
	
  }	
  
  if (apos<1||dotpos-apos<2) {
  document.getElementById("signUpMsg").innerHTML="<font color='red'>Incorrect Email Address</font>";
	return;
  }
  if(email.length > 45)
  {
	document.getElementById("signUpMsg").innerHTML="<font color='red'>Please enter Email in maximum of 45 characters</font>"
	return;
  }
  
  if(password=="" | repassword=="")
  {
	document.getElementById("signUpMsg").innerHTML="<font color='red'>Please enter Password and then click submit</font>"
	return;
  }
  
  if(password.length <6 | password.length > 45 | repassword.length < 6 | repassword.length > 45)
  {
	document.getElementById("signUpMsg").innerHTML="<font color='red'>Please make sure password length is between 6 and 45 characters</font>"
	return;
  }
  
  if(password!=repassword)
  {
	document.getElementById("signUpMsg").innerHTML="<font color='red'>Please make sure Passwords match and then click Submit</font>"
	return;
  }
  

  if(secretQ=="")
 {
	document.getElementById("signUpMsg").innerHTML="<font color='red'>Please enter SecretQuestion and then click submit</font>"
	return;
  }
  
  if(secretA=="")
  {
	document.getElementById("signUpMsg").innerHTML="<font color='red'>Please enter SecretAnswer and then click submit</font>"
	return;
  }
  
  if(secretA.length > 45)
  {
	document.getElementById("signUpMsg").innerHTML="<font color='red'>Please enter SecretAnswer in maximum of 45 characters</font>"
	return;
  }
  
  if(country=="")
  {
	document.getElementById("signUpMsg").innerHTML="<font color='red'>Please enter Country and then click submit</font>"
	return;
  }
  
  
  
  if(address=="")
  {
	document.getElementById("signUpMsg").innerHTML="<font color='red'>Please enter Address and then click submit</font>"
	return;
  }
  
  if(address.length > 45)
  {
	document.getElementById("signUpMsg").innerHTML="<font color='red'>Please enter Address in maximum of 45 characters</font>"
	return;
  }
  
  if(state=="")
  {
	document.getElementById("signUpMsg").innerHTML="<font color='red'>Please enter State and then click submit</font>"
	return;
  }
  
  if(state.length > 45)
  {
	document.getElementById("signUpMsg").innerHTML="<font color='red'>Please enter State in maximum of 45 characters</font>"
	return;
  }
  
  if (agree.checked==false)
  {
	document.getElementById("signUpMsg").innerHTML="<font color='red'>Please agree to the terms of use and privacy policy</font>"
	return;
  }
  
  
  
	xmlHttpAddUser=GetXmlHttpObject();
	if (xmlHttpAddUser==null)
	{
	alert ("Your browser does not support AJAX!");
	return;
	} 
	
	
	var url="http://www.gobooks.co.in/adduser.php?fname="+fname + "&sex="+sex + "&email=" + email + "&password=" + password + "&country=" + country + "&address=" + address + "&state=" + state + "&secretQuestion=" + secretQ + "&secretAnswer=" + secretA;
	
	xmlHttpAddUser.onreadystatechange=stateChangedAddUser;
	
	xmlHttpAddUser.open("POST",url,true);
	
	xmlHttpAddUser.send(null);
	
}

function stateChangedAddUser() 
{ 

if (xmlHttpSignUp.readyState==4)
{ 
	if(xmlHttpAddUser.responseText == "")
		document.getElementById("signUpMsg").innerHTML="Please wait...working...";
	else if(xmlHttpAddUser.responseText == "<font color='red'>UserId already exists!!!</font>")
		{
		document.getElementById("signUpMsg").innerHTML=xmlHttpAddUser.responseText;
		
		
		}
		else
		 document.getElementById("signUp").innerHTML=xmlHttpAddUser.responseText;
	
}
}

function Login(userid, passwd)
{
	//alert(userid + passwd);
	if(userid=="")
	{
	document.getElementById("txtHint").innerHTML="<font color='red'>Please enter userid and then click Submit</font>";
	return;
	}
	
	if(passwd=="")
	{
	document.getElementById("txtHint").innerHTML="<font color='red'>Please enter password and then click Submit</font>";
	return;
	}
	
	xmlHttpLogin=GetXmlHttpObject();
	if (xmlHttpLogin==null)
	{
	alert ("Your browser does not support AJAX!");
	return;
	} 
	
	
	var url="http://www.gobooks.co.in/verify.php?userid="+userid +"&passwd="+passwd;
	//alert(url);
	xmlHttpLogin.onreadystatechange=stateChangedLogin;
	
	xmlHttpLogin.open("POST",url,true);
	
	xmlHttpLogin.send(null);
	
}

function checkLogin(user, passwd)
{
if(user=="" | passwd=="")
{
document.getElementById("txtHint").innerHTML="<font color='red'>Please enter UserId/Password</font>";
return false;
}
return true;
}

function stateChangedLogin() 
{ 

if (xmlHttpLogin.readyState==4)
{ 
	if(xmlHttpLogin.responseText == "")
		document.getElementById("txtHint").innerHTML="This text means some error";
	else
		document.getElementById("txtHint").innerHTML=xmlHttpLogin.responseText;
	
}
}

function UploadEbook()
{
	//alert('hello');
	xmlHttpUpload=GetXmlHttpObject();
	if (xmlHttpUpload==null)
	{
	alert ("Your browser does not support AJAX!");
	return;
	} 
	
	document.getElementById("content").innerHTML = '<div style="height: 20px;"><em>Loading ...</em></div>';
	var url="http://www.gobooks.co.in/upload.php";
	
	xmlHttpUpload.onreadystatechange=stateChangedUpload;
	
	xmlHttpUpload.open("POST",url,true);
	
	xmlHttpUpload.send(null);
	
}

function stateChangedUpload() 
{ 

if (xmlHttpUpload.readyState==4)
{ 
	if(xmlHttpUpload.responseText == "")
		document.getElementById("content").innerHTML="This text means some error";
	else
		document.getElementById("content").innerHTML=xmlHttpUpload.responseText;
	
}
}

function RequestEbook(isbn, ebookname, author)
{
	//alert(isbn + ebookname);
	//alert(isbn + ebookname + author);
	
	if(isbn.length > 0)
	{
	if(isbn.length==10 || isbn.length==13)
	{
	}
	else
	{
	document.getElementById("requestMsg").innerHTML="<font color='red'>Please enter ISBN as 10 or 13 digits</font>";
	return;
	}
	}
	
	if(isbn.length > 0 && isNaN(isbn))
	{
	document.getElementById("requestMsg").innerHTML="<font color='red'>Please enter ISBN as digits</font>";
	return;
	}
	

	if(ebookname=="")
	{
	document.getElementById("requestMsg").innerHTML="<font color='red'>Please enter EbookName and then click Submit</font>";
	return;
	}
	
	xmlHttpRequestEbook=GetXmlHttpObject();
	if (xmlHttpRequestEbook==null)
	{
	alert ("Your browser does not support AJAX!");
	return;
	} 
	
	
	var url="http://www.gobooks.co.in/requestebook1.php?isbn="+isbn + "&ebookname=" + ebookname + "&author=" + author;
	//alert(url);	
	xmlHttpRequestEbook.onreadystatechange=stateChangedRequestEbook;
	
	xmlHttpRequestEbook.open("POST",url,true);
	
	xmlHttpRequestEbook.send(null);
	
}

function stateChangedRequestEbook() 
{ 

if (xmlHttpRequestEbook.readyState==4)
{ 
	if(xmlHttpRequestEbook.responseText == "")
		document.getElementById("content").innerHTML="This text means some error";
	else
		document.getElementById("content").innerHTML=xmlHttpRequestEbook.responseText;
	
}
}

function category(type, screen)
{
	//alert(type);
	//alert(type + screen);
	xmlHttpCategory=GetXmlHttpObject();
	if (xmlHttpCategory==null)
	{
	alert ("Your browser does not support AJAX!");
	return;
	} 
	
	
	var url="http://www.gobooks.co.in/Categories.php?category="+type+"&screen="+screen;
	//alert(url);	
	xmlHttpCategory.onreadystatechange=stateChangedCategory;
	
	xmlHttpCategory.open("POST",url,true);
	
	xmlHttpCategory.send(null);
	
}

function stateChangedCategory() 
{ 

if (xmlHttpCategory.readyState==4)
{ 
	if(xmlHttpCategory.responseText == "")
		document.getElementById("content").innerHTML="This text means some error";
	else
		document.getElementById("content").innerHTML=xmlHttpCategory.responseText;
	
}
}


function Search(keyword1, screen)
{
	//alert('Search');
	//alert(keyword + screen);
	if(keyword1=="")
	{
	alert("Pleas enter keyword for search");
	return;
	}
	xmlHttpSearch=GetXmlHttpObject();
	if (xmlHttpSearch==null)
	{
	alert ("Your browser does not support AJAX!");
	return;
	} 
	
	
	var url="http://www.gobooks.co.in/Search.php?key="+keyword1+"&screen="+screen;
	//alert(url);	
	xmlHttpSearch.onreadystatechange=stateChangedSearch;
	
	xmlHttpSearch.open("POST",url,true);
	
	xmlHttpSearch.send(null);
	
}

function stateChangedSearch() 
{ 

if (xmlHttpSearch.readyState==4)
{ 
	if(xmlHttpSearch.responseText == "")
		document.getElementById("content").innerHTML="This text means some error";
	else
		document.getElementById("content").innerHTML=xmlHttpSearch.responseText;
	
}
}

function SearchISBN(isbn)
{
	//alert('Search');
	//alert(keyword + screen);
	if(isbn=="")
	{
	alert("Pleas enter ISBN for search");
	return;
	}
	
	if(isbn.length==10 || isbn.length==13)
	{
	}
	else
	{
	alert("Please enter ISBN as 10 or 13 digits");
	return;
	}
	
	if(isNaN(isbn))
	{
	alert("Please enter ISBN as digits");
	return;
	}
	
	xmlHttpSearchISBN=GetXmlHttpObject();
	if (xmlHttpSearchISBN==null)
	{
	alert ("Your browser does not support AJAX!");
	return;
	} 
	
	
	var url="http://www.gobooks.co.in/Search.php?keyISBN="+isbn;
	//alert(url);	
	xmlHttpSearchISBN.onreadystatechange=stateChangedSearchISBN;
	
	xmlHttpSearchISBN.open("POST",url,true);
	
	xmlHttpSearchISBN.send(null);
	
}

function stateChangedSearchISBN() 
{ 

if (xmlHttpSearchISBN.readyState==4)
{ 
	if(xmlHttpSearchISBN.responseText == "")
		document.getElementById("content").innerHTML="This text means some error";
	else
		document.getElementById("content").innerHTML=xmlHttpSearchISBN.responseText;
	
}
}

function Rate(booksno, num)
{
xmlHttpRating=GetXmlHttpObject();
	if (xmlHttpRating==null)
	{
	alert ("Your browser does not support AJAX!");
	return;
	} 
	
	
	var url="http://www.gobooks.co.in/rate.php?booksno="+booksno+"&rating="+num;
	//alert(url);	
	xmlHttpRating.onreadystatechange=stateChangedRate;
	
	xmlHttpRating.open("POST",url,true);
	
	xmlHttpRating.send(null);
}

function stateChangedRate() 
{ 

if (xmlHttpRating.readyState==4)
{ 
	if(xmlHttpRating.responseText == "")
		document.getElementById("ratingMsg").innerHTML="This text means some error";
	else
		{
		document.getElementById("ratingMsg").innerHTML=xmlHttpRating.responseText;
		
		}
	
}
}


function AddComments(commentText, bookSno)
{
//alert(commentText);
//alert(bookSno);
	if(commentText=="")
	{
	//alert('Please add some comment');
	document.getElementById("commentMsg").innerHTML="<font color='red'>Please add some Review and then click Submit</font>";
	return;
	}
	
	xmlHttpAddComment=GetXmlHttpObject();
	if (xmlHttpAddComment==null)
	{
	//alert ("Your browser does not support AJAX!");
	return;
	} 
	
	
	var url="http://www.gobooks.co.in/AddComment.php?booksno="+bookSno+ "&comment="+commentText;
	//alert(url);
	xmlHttpAddComment.onreadystatechange=stateChangedAddComment;
	
	xmlHttpAddComment.open("POST",url,true);
	
	xmlHttpAddComment.send(null);	
	
}

function stateChangedAddComment() 
{ 

if (xmlHttpAddComment.readyState==4)
{ 
	if(xmlHttpAddComment.responseText == "")
		document.getElementById("commentMsg").innerHTML="This text means some error";
	else
		document.getElementById("commentMsg").innerHTML=xmlHttpAddComment.responseText;
	
}
}

function ShowComments(bookSno, screen)
{
//alert(commentText);
//alert(bookSno);
	xmlHttpShowComment=GetXmlHttpObject();
	if (xmlHttpShowComment==null)
	{
	//alert ("Your browser does not support AJAX!");
	return;
	} 
	
	
	var url="http://www.gobooks.co.in/ShowComment.php?booksno="+bookSno+"&screen="+screen;
	//alert(url);
	xmlHttpShowComment.onreadystatechange=stateChangedShowComment;
	
	xmlHttpShowComment.open("POST",url,true);
	
	xmlHttpShowComment.send(null);	
	
}

function stateChangedShowComment() 
{ 

if (xmlHttpShowComment.readyState==4)
{ 
	if(xmlHttpShowComment.responseText == "")
		document.getElementById("showComment").innerHTML="This text means some error";
	else
		document.getElementById("showComment").innerHTML=xmlHttpShowComment.responseText;
	
}
}


function showRequestedEbooks(screen)
{
//alert(commentText);
//alert(bookSno);
	xmlHttpShowRequested=GetXmlHttpObject();
	if (xmlHttpShowRequested==null)
	{
	//alert ("Your browser does not support AJAX!");
	return;
	} 
	
	
	var url="http://www.gobooks.co.in/ShowRequested.php?screen="+screen;
	//alert(url);
	xmlHttpShowRequested.onreadystatechange=stateChangedShowRequested;
	
	xmlHttpShowRequested.open("POST",url,true);
	
	xmlHttpShowRequested.send(null);	
	
}

function stateChangedShowRequested() 
{ 

if (xmlHttpShowRequested.readyState==4)
{ 
	if(xmlHttpShowRequested.responseText == "")
		document.getElementById("content").innerHTML="This text means some error";
	else
		document.getElementById("content").innerHTML=xmlHttpShowRequested.responseText;
	
}
}

function upload(){


	
	var par = window.parent.document;

	// hide old iframe
	var iframes = par.getElementsByTagName('iframe');
	var iframe = iframes[iframes.length - 1];
	iframe.className = 'hidden';

	// create new iframe
	var new_iframe = par.createElement('iframe');
	new_iframe.src = 'upload.php';
	new_iframe.frameBorder = '0';
	par.getElementById('iframe_container').appendChild(new_iframe);

	// add image progress
	var images = par.getElementById('images_container');
	var new_div = par.createElement('div');
	var new_img = par.createElement('img');
	new_img.src = 'indicator.gif';
	new_img.className = 'load';
	new_div.appendChild(new_img);
	images.appendChild(new_div);
	
	// send
	var imgnum = images.getElementsByTagName('div').length - 1;
	document.iform.imgnum.value = imgnum;
	setTimeout(document.iform.submit(),5000);
}

function Validate(frm)
{
//alert(frm.name);
//alert(document.getElementById('ISBNtxt').value);
if(document.getElementById('ISBNtxt').value=="" || document.getElementById('ISBNtxt').value==undefined)
{
	//document.getElementById("uploadMsg").innerHTML="<font color='red'>Please enter ISBN and then click Submit</font>";
	//return false;
}

if(document.getElementById('ISBNtxt').value.length > 0)
{
if(document.getElementById('ISBNtxt').value.length==10 || document.getElementById('ISBNtxt').value.length==13)
{
}
else
{
	document.getElementById("uploadMsg").innerHTML="<font color='red'>Please enter ISBN as 10 or 13 digits</font>";
	return false;

}
}

if(isNaN(document.getElementById('ISBNtxt').value))
	{
	document.getElementById("uploadMsg").innerHTML="<font color='red'>Please enter ISBN as digits</font>";
	return false;
	}

if(document.getElementById('BookNametxt').value=="" || document.getElementById('BookNametxt').value==undefined)
{
	document.getElementById("uploadMsg").innerHTML="<font color='red'>Please enter BookName and then click Submit</font>";
	return false;
}

if(document.getElementById('Authortxt').value=="" || document.getElementById('Authortxt').value==undefined)
{
	document.getElementById("uploadMsg").innerHTML="<font color='red'>Please enter Author and then click Submit</font>";
	return false;
}

if(document.getElementById('Editiontxt').value=="" || document.getElementById('Editiontxt').value==undefined)
{
	document.getElementById("uploadMsg").innerHTML="<font color='red'>Please enter Edition and then click Submit</font>";
	return false;
}

if(document.getElementById('file').value=="")
{
	document.getElementById("uploadMsg").innerHTML="<font color='red'>Please enter File and then click Submit</font>";
	return false;
}

if(document.getElementById('file').value!="")
{
	var objUpload=eval("document.getElementById('file')");
    var sUpload=objUpload.value;
	
    if(sUpload!="")
    {
     		var iExt=sUpload.indexOf("\\");
       		var iDot=sUpload.indexOf(".");
		if((iExt < 0 ) || (iDot < 0))
        {
            //alert("Invalid File Path for Upload!");
			//document.getElementById("uploadMsg").innerHTML="<font color='red'>Invalid file path for upload!</font>";	
			//objUpload.focus();
            //event.returnValue=false; 
           // return false; 
        }

        if(iDot > 0)
        {
            var aUpload=sUpload.split(".");
            if(aUpload[aUpload.length-1]=="pdf" || aUpload[aUpload.length-1]=="PDF")
            {
                //alert("Only *.pdf Files Are Allowed!");
				return true;
			
			}
			else
			{
				document.getElementById("uploadMsg").innerHTML="<font color='red'>Only *.pdf Files Are Allowed!</font>";
                objUpload.focus();
                //event.returnValue=false; 
                return false; 
			}
		}		
	}
	
	return false;
}



	

	return true;
//document.frm.submit();
//return true;
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}


function inviteFriend(emailId)
{

emailId = emailId.value;
//alert(emailId);
if(emailId=="")
  {
	document.getElementById("emailMsg").innerHTML="<font color='red'>Please enter Email and then click submit</font>"
	return;
  }
  
  var expression= /^[a-zA-Z0-9@._]+$/;
  if(emailId.match(expression)){
	 apos=emailId.indexOf("@")
     dotpos=emailId.lastIndexOf(".")
	
  }	
  
  if (apos<1||dotpos-apos<2) {
  document.getElementById("emailMsg").innerHTML="<font color='red'>Incorrect Email Address</font>";
	return;
  }
  
  
  
	xmlHttpInvite=GetXmlHttpObject();
	if (xmlHttpInvite==null)
	{
	alert ("Your browser does not support AJAX!");
	return;
	} 
	
	
	
	var url="http://www.gobooks.co.in/invite.php?email="+emailId;
	//alert(url);
	xmlHttpInvite.onreadystatechange=stateChangedInvite;
	
	xmlHttpInvite.open("GET",url,true);
	
	xmlHttpInvite.send(null);	

}

function stateChangedInvite() 
{ 

if (xmlHttpInvite.readyState==4)
{ 
	if(xmlHttpInvite.responseText == "")
		document.getElementById("emailMsg").innerHTML="This text means some error";
	else
		document.getElementById("emailMsg").innerHTML=xmlHttpInvite.responseText;
	
}
}
