// Facebook Sharer
function fbs_click() {
	u=location.href;
	t=document.title;
	window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
	return false;
}

// Generic Jump Menu
function JumpMenu(targ,selObj){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
}

// Opens Window PopUp
function winPopUp(winURL,winName,winWidth,winHeight)
{
	var w = window.open(winURL, winName, "width="+winWidth+", height="+winHeight+", toolbars=no, scrollbars=yes");
	w.focus();
}

// Trims White Spaces in the passed values
function trimText(obj) {
	var str = "";
	for (var i=0; i < obj.length; i++) {
		var letter = obj.charAt(i).toLowerCase();
		if (letter == " ")
			continue;
		str = str + letter;
	}
	return str;
}

// Regenerates Captcha Image
function newCaptcha() {
	var url = 'generate_veriword.php?sid='+Math.random();
	new Ajax.Request(url, {
	  method: 'get',
	  onSuccess: function(transport) {
		var code = transport.responseText;
		document.getElementById("captcha_img").src = "anti_spam.php?key=" + code;
		document.getElementById("cveriword").value = code;
	  },
	  onFailure:function(){ alert('Something went wrong...') }
	});
}

// Validates Passed Email Address
function isValidEmail(email){ 
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	if(reg.test(email) == false) {
		return false;
	} else {
		return true; 
	}
} 
