/*
$(document).ready(function(){
    $('#sectionId_16 label').addClass("watermark");
});     */


/*
Watermarks

This does the watermarking for input boxes, use the watermark class on
labels, watermarkJS is added so you can position the label over the input


$(function(){

	$('label.watermark').addClass("watermarkJS");
	$('label.watermark').each(function(index,label){
	    eleInput = $('#'+$(label).attr("for"))[0];
	    
	    if(eleInput.value != "")
	    {
	        $(label).hide();
	    }
	    
	    $(eleInput).blur(function(){
	        eleInput = $('#'+$(label).attr("for"))[0];
	        if(eleInput.value == "")
	        {
	            $(label).show();
	        }
	    });
	    $(eleInput).focus(function(){
	        eleInput = $('#'+$(label).attr("for"))[0];
	        $(label).hide();
	    });
	    
	});
	
});     */
/*
End Watermarks
*/


// AJAX enable in-line gallery module
/*jQuery(function($){
	$('.moduleType_Images:has(.type-inline)').each(function(index,section){ // all inline sections
		$('.gallerylist li a',section).click(function(){
			thumbpath = $('img',this).attr('src');
			imgID = thumbpath.substring(thumbpath.lastIndexOf("_")+1);
			imgID = imgID.substring(0,imgID.indexOf('.'));
			//console.log(imgID);
			$('.image-inline',section).attr('src','/UserFiles/Image/images_full_'+imgID+'.jpg')
			$('.image-inline',section).attr('alt',$('img',this).attr('alt'))
			$('.gallerylist li.selected',section).removeClass('selected');
			$(this).parent().addClass('selected');
			
			$('.image-description',section).load($(this).attr('href')+' #'+$(section).attr('id')+' .image-description *' );
			if((typeof pageTracker)!="undefined")
			{
				// don't neglect analytics!
				pageTracker._trackPageview($(this).attr('href'));
			}
			return false;
		});
	})
});*/

/*
jQuery(function($){
    $('#sectionId_10 ul').cycle({
		fx: 'fade',
		speed: 3000,
		timeout: 7000,
		random: 1,
		height: 316
	});
});   */


$(function() {
    try {
        $("#body-background").ezBgResize();
    }
    catch(err) { 
    }
});

$(window).bind("resize", function(){
    try {
        $("#body-background").ezBgResize();
    } 
    catch(err) { 
    }
});


function querySt(parm) {
	var qs = window.location.search.substring(1);
	var qspairs = qs.split("&");
	for (i=0; i < qspairs.length; i++) {
		var ft = qspairs[i].split("=");
		if (ft[0] == parm) {
			return ft[1];
		}
	}
}

$(function() {
    
    $(".BodyContent h3").each(function(i, ele) {
        var head = $(this).html();
        $(this).html("<span class='firstLetter'>"+head.substring(0,1)+"</span>"+head.substring(1,head.length));
    });

    $("#sectionId_363 .moduleInnerContent").cycle({ fx: 'fade', speed: 750, timeout: 8000 });

	if ($("#sectionId_374").length != 0)
	{
		//E-Card contact form page, image/text replacement
		var imgsizerUrl = $("#sectionId_374 img#ecard_r4_c7").attr("src");
		var imgUrlQS = querySt("ECard-Image");
	
		$("#sectionId_374 img#ecard_r4_c7").attr("src", imgsizerUrl.replace("$ECard-Image$", imgUrlQS));
	}
	
	/*if($("meta[name='mor_roles']").length > 0 && ($("meta[name='mor_roles']").attr("content").indexOf("Editor") > -1 || $("meta[name='mor_roles']").attr("content").indexOf("Administrator") > -1)) 
	{
		$('.ECardLink a').show();
	}*/	
	
});





