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);
};

$(document).ready(function(){

	$("#HeaderMenu").supersubs({
		minWidth:	12,   // minimum width of sub-menus in em units 
		maxWidth:	60,   // maximum width of sub-menus in em units 
		extraWidth:	1     // extra width can ensure lines don't sometimes turn over 
	}).superfish();

	if (MyJS == 'Frontpage') {
		if (gup('nobounce') != 'y')
			$('#SliderSlogan').delay(1000).effect("slide", { direction: "up", easing: 'easeOutBounce' }, 2800);
		else
			$('#SliderSlogan').show();

		$("#slider").easySlider({
			auto: true,
			continuous: true,
			numeric: false,
			speed:	800,
			pause:	5000,
			controlsShow: false
		});		

	}

	if (MyJS == 'portfolio') {
		$('a.PortfolioOpenLink').click(function(){
			$("div.PortfolioScreenshotContainer a", $(this).parent()).eq(0).click();
		});
	
		$('div.PortfolioListNumTag').click(function(){
			$("div.PortfolioScreenshotContainer a", $(this).parent()).eq(0).click();
		});
		
		$("#slider2").easySlider({
			speed:	500,
			auto: false,
			numeric: true,
			controlsShow: true,
			ease: 'easeInOutBack'
//			vertical: true
//			ease: 'easeInOutSine'
		});
	}
	
	if (MyJS == 'iPhoneAnimated') {
	}

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

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

	

});
