function gup( name ) {
	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	var regexS = "[\\?&]"+name+"=([^&#]*)";
	var regex = new RegExp( regexS );
	var results = regex.exec( window.location.href );
	if( results == null )
		return "";
	else
		return results[1];
}

(function ($) {
// VERTICALLY ALIGN FUNCTION
	$.fn.vAlignM = function() {
		return this.each(function(i){
			var ah = $(this).height();
			var ph = $(this).parent().height();
			var mh = (ph - ah) / 2;
			$(this).css('margin-top', mh);
		});
	};
})(jQuery);



(function ($) {
// VERTICALLY ALIGN FUNCTION
	$.fn.vAlignP = function() {
		return this.each(function(i){
			var ah = $(this).height();
			var ph = $(this).parent().height();
			var mh = (ph - ah) / 2;
			$(this).css('padding-top', mh);
		});
	};
})(jQuery);



jQuery.fn.equalizeCols = function(){
	var height = 0;
	return this.css("height","auto").each(function(){
	height = Math.max( height, jQuery(this).outerHeight() );
	}).css("height", height);
};

$(window).load(function() {
	var TheHeight = $('#RightContainer').outerHeight() + 30;
	$('#LeftContainer').height(TheHeight);
});

$(document).ready(function(){
	
	if (MyJS == 'Frontpage') {
		
	}
	else {
		$('#InnerMenu ul').hide();
				
		var ActiveLi = $("#InnerMenu li[data-object_link_id='" + ObjLinkID + "']");
		ActiveLi.children('a').addClass('ActiveLink')
		ActiveLi.parents('li').children('a').addClass('ActiveLink');
		ActiveLi.parents('ul').show();
		
		$('#InnerMenu li:has("ul") > a').click(function(e){
			
			var ThisChildUL = $('> ul', $(this).parent('li'));
			var ThisParentsUL = $(this).parents('ul');
			var ThisDirectParentUL = $(this).parent('ul');

			$('#InnerMenu ul').not(ThisParentsUL).not(ThisChildUL).slideUp('slow');
			ThisChildUL.slideToggle('slow');

			e.preventDefault();
		});
	}

	if (MyJS == 'product_category') {
		$('a.ProductCategoryOpenLink').click(function(){
			$("div.ProductMediaContainer a", $(this).parent()).eq(0).click();
		});
	}
	else if (MyJS == 'ProductAndService' || MyJS == 'Contacts') {
		$("#slider").easySlider({
			auto: true,
			continuous: true,
			numeric: true,
			speed:	500
		});		
	}

	$("a[rel^='prettyPhoto']").prettyPhoto({overlay_gallery: false, theme: 'dark_rounded', social_tools: ''});

// 	$('.PortfolioBlock').equalizeCols();

	

});
