function PopComments (comment) {
    window.open(comment,
                    'comment',
                    'width=500,height=500,scrollbars=yes,status=yes');
}


function hov(loc,cls) {
	if(loc.className) {
		loc.className=cls;
	}
}

function echeck(str) {
			var at="@"
			var dot="."
			var lat=str.indexOf(at)
			var lstr=str.length
			var ldot=str.indexOf(dot)
			if (str.indexOf(at)==-1){
				alert("Invalid E-mail Format")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail Format")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail Format")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail Format")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail Format")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail Format")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail Format")
		    return false
		 }
 		 return true					
	}

function ValidateForm(){
	var nameID=document.frmContact.from_name
	var emailID=document.frmContact.from_email
	var subjectID=document.frmContact.subject
	var messageID=document.frmContact.message
	
	if ((nameID.value==null)||(nameID.value=="")){
		alert("Please Enter your Name")
		nameID.focus()
		return false
	}
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your E-mail")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	if ((subjectID.value==null)||(subjectID.value=="")){
		alert("Please Enter a Subject Line")
		subjectID.focus()
		return false
	}
	if ((messageID.value==null)||(messageID.value=="")){
		alert("Please Enter a Message")
		messageID.focus()
		return false
	}
	return true
 }

function get_ajax(){
		if (window.XMLHttpRequest) { // Mozilla, Safari, ...
			var http_request_it = new XMLHttpRequest();
        } else if (window.ActiveXObject) { // IE
			var http_request_it = new ActiveXObject("Microsoft.XMLHTTP"); 
        }
        return http_request_it;
	}

	function clicktrackresponse() {
		if (http_request_it.readyState == 4) {
			if (http_request_it.status == 200) {
				result = http_request_it.responseText;           
			}
		}
	}

	function link_tracker(url, id) {
		http_request_it = get_ajax();
		var poststr = "url="+ escape(url) + "&entry_id="+escape(id);
		http_request_it.onreadystatechange = clicktrackresponse;
		http_request_it.open('POST', '/link_tracker.php', true);
		http_request_it.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		http_request_it.setRequestHeader("Content-length", poststr.length);
		http_request_it.setRequestHeader("Connection", "close");
		http_request_it.send(poststr);
	}
