﻿//Remove $ from the global namespace and restore prototype/which is implemented by marketeers
jQuery.noConflict();

(function( $ ) {
	$(document).ready(function() {
		$(".defaultText").focus(function(srcc)
		{
			if ($(this).val() == $(this)[0].title)
			{
				$(this).removeClass("defaultTextActive");
				$(this).val("");
			}
		});
    
		$(".defaultText").blur(function()
		{
			if ($(this).val() == "")
			{
				$(this).addClass("defaultTextActive");
				$(this).val($(this)[0].title);
			}
		});
    
		$(".defaultText").blur();      
	
		$(".story input.textinput").bind("keypress", function(event) {
			var keycode = (event.keyCode ? event.keyCode : (event.which ? event.which : event.charCode));
			if (keycode === 13) {
				$(this).siblings('input:submit').click();
        		event.preventDefault();
			}
		});
		
		//Insert an iframe if the .insertIframe is present
		//$(".insertIframe").html('<iframe src="http://netdesign.easycruit.com" scroll="0" width="100%" height="330px"> </iframe>');		 
	});
})(jQuery);

function readMore(link)
{
	jQuery("div.readMoreContainer").show("");
	jQuery("a.readmore").hide();
	jQuery("a.readless").show();
}

function readLess(link)
{
	jQuery("div.readMoreContainer").hide("");
	jQuery("a.readmore").show();
	jQuery("a.readless").hide();
}

(function($){
	//console.log($);
	$.fn.eqh = function(){
		var h = 0;
		this.each(function() {
			h = Math.max($(this).outerHeight(), h);
		});
		return this.height(h);
	};
})(jQuery);

//PIE.htc print fix
(function( $ ) {
	if ($.browser.msie && $.browser.version.substr(0,1) <= 8) { 
	//Before print
		$(window).bind("beforeprint", function() {
			$('.gallery .border').css('behavior', 'none'); 
			$('.border').css('behavior', 'none'); 
			$('.contact .button').css('behavior', 'none'); 
		});
	//After print
		$(window).bind("afterprint", function() {
			$('.gallery .border').css('behavior', 'url(/javascripts/PIE.htc)'); 
			$('.border').css('behavior', 'url(/javascripts/PIE.htc)'); 
			$('.contact .button').css('behavior', 'url(/javascripts/PIE.htc)'); 
		}); 
	}
})( jQuery );
