function JQueryNotify(text, type, sticky)
{
	if(type!='' && sticky)
		$.jnotify(text, type, sticky);
	else if(type!='')
		$.jnotify(text, type);
	else if(sticky)
		$.jnotify(text, sticky);
	else
		$.jnotify(text);
}
function OpenPopup(file)
{
	win = window.open(file,'Popup','width=600,height=450,scrollbars=1');
	WindowPosition(600,450,win);
}
function WindowPosition(widthX,heightX,windowName)
{
	var width = (screen.width);
	var height = (screen.height - 25);
	var centerleft = 0;
	var centertop = 0;
	var centerleft = (width/2) - (widthX/2);
	var centertop = (height/2) - (heightX/2);
	var width=widthX;
	var height=heightX;
	windowName.moveTo(centerleft,centertop);
	windowName.resizeTo(width, height);
	windowName.focus();
}
function UploadContentPics(dir)
{
	info="content_pics.php?dir="+dir;
	win = window.open(info,'editor','menubars=0,width=500,height=550,scrollbars=1,resizable=1');
	WindowPosition(1050,450,win);
}
function AddAnother()
{
	if(Validate(document.forms[0]))
	{
		document.forms[0].add_mode.value = "Y";
		document.forms[0].submit();
	}
	else
		document.forms[0].add_mode.value = "N";
}
function str_trim(str) // strips of leading and following whitespaces from a string
{	
	if(str.length > 0)
		while(str.charAt(0)==' ')
			str = str.substr(1);
		
	if(str.length > 0)
		while(str.charAt((str.length - 1))==' ')
			str = str.substring(0, str.length-1);
	
	return str;
}
function validate_email(email_txt) // validates a string as a email id
{
	var emailReg = "^[\\w-_\.]*[\\w-_\.]\@([\\w].+)\.[\\w]$";
	var regex = new RegExp(emailReg);
	return regex.test(email_txt);
}

