
var initialsubj="Hay buddy, take a look at this"
var initialmsg="Hi:\n You may want to check out this site: "+window.location
var good;

function test(){
	alert("atest");
}
function closecomment(nid) {
	
	document.getElementById("comment"+nid).innerHTML="<p></p>";
}
function checkEmailAddress(field) {

var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\.sex)|(\.biz)|(\.aero)|(\.coop)|(\.museum)|(\.name)|(\.pro)|(\..{2,2}))$)\b/gi);
if (goodEmail) {
good = true;
}
else {
alert('Please enter a valid address.');
field.focus();
field.select();
good = false;
   }
}
u = window.location;
function mailThisUrl() {
good = false
checkEmailAddress(document.eMailer.email);
if (good) {

//window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+document.title+" "+u;
window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+initialmsg
   }
}

function popup(mylink, windowname,a)
{
	
	
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
   if (a==1) {
window.open(href, windowname, 'width=500,height=550,scrollbars=yes,resize=no,screenX=300,ScreenY=200');
}
if(a==3) {
	
	window.open(href, windowname, 'width=830,height=780,scrollbars=no,resize=no,screenX=300,ScreenY=120');
	
}

else {window.open(href, windowname, 'width=500,height=250,scrollbars=no,resize=no,screenX=380,ScreenY=380'); }
return false;
}

function checkcommentform(nid) {
	var name;
	var email;
	var comment;
    name =document.getElementById("cname"+nid).value;
	email = document.getElementById("cemail"+nid).value;
	comment =document.getElementById("ccomment"+nid).value;
/*			var goodEmail = document.getElementById("ccomment"+nid).value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\.sex)|(\.biz)|(\.aero)|(\.coop)|(\.museum)|(\.name)|(\.pro)|(\..{2,2}))$)\b/gi);
		if (goodEmail) {
		return  true;
		}
		else {
		alert('Please enter a valid address.');
		return false;
		   }*/
	if (name=="") {
		alert("Please enter your name.");
		return false;
	}
	if (email=="") {
		alert("Please enter your email address.");
		return false;	
	}
	
	if (comment=="") {
		alert("Please enter your comment.");
		return false;	
	}else {
		addComment(nid,name,email,comment);
		return  true;
	}
	
}




var xmlHttp
var comid
function addComment(strs,name,email,comment)
{

comid = strs;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="comments.php";
url=url+"?nid="+strs;
url=url+"&name="+name;
url=url+"&email="+email;
url=url+"&comment="+comment;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 

function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("comment"+comid).innerHTML=xmlHttp.responseText;
}
}

function showComment(strs)
{

comid=strs;	
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="commentform.php";
url=url+"?qr="+strs;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 

function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("comment"+comid).innerHTML=xmlHttp.responseText;
}
}

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 submitSearch(text)
{
	if (text.txtsearch.value=="") {
		alert ("Please enter keywords for search..");
		return false;
	}else {
		return true;
	}
}
