﻿// create agworks namespace
if (!AgWorks)
	var AgWorks = {};
	

jQuery.fn.center = function () {
	this.css("position", "absolute");
	this.css("top", ($(window).height() - this.height()) / 2 + $(window).scrollTop() + "px");
	this.css("left", ($(window).width() - this.width()) / 2 + $(window).scrollLeft() + "px");
	return this;
}




jQuery.fn.centerInParent = function (parent) {
	this.css("position", "absolute");
	this.css("top", ($(parent).height() - this.height()) / 2 + $(parent).scrollTop() + "px");
	this.css("left", ($(parent).width() - this.width()) / 2 + $(parent).scrollLeft() + "px");
	return this;
}

String.prototype.endsWith = function (suffix) {
	return (this.substr(this.length - suffix.length) === suffix);
}

String.prototype.startsWith = function (prefix) {
	return (this.substr(0, prefix.length) === prefix);
}

