// JavaScript Document

function equalHeight(group) {
	tallest = 0;
	group.each(function() {
		thisHeight = $(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	group.height(tallest);
}

function reportingAbuse(comment_id){
if (!!mag_user.logged_in){
  var id = comment_id;
  var popWin = window.open('/comments/report-this?comment_id='+id,'popForm','width=450,height=330');
  popWin.focus();
} else {
  var id = comment_id;
  var url = document.URL;
  //alert(url);
  var popWin = window.open('/comments_report_abuse_login?comment_id='+id+'&pUrl='+url,'popForm','width=450,height=330,resizable=1');
  popWin.focus();
}
}

$(document).ready(function(){
	/* prevent exec script in search box */
    $("form[action='/search/'] a")
	.attr("href","#")
	.click(function(e){
		e.preventDefault();
		$(this).parents("form").submit();    
	});

	$("form[action='/search/']").submit(function(){
		$input = $("input[name=q]",this);
		//get unsafe search string 
		var s = $input.val();
		//replace
		s = s.replace(/</g,'&lt;').replace(/>/g,'&gt;');
		//set safe search string 
		$input.val(s);
	});

});

