
	// Cufon text replacememnt, add more elements to replace text with cufon generated text.
	Cufon.replace('ul.sf-menu a, h3, h1, a.btn, .cufon, .content h1, .content h2, .content h3, .content h4, .content h5, .content h6, #footer h4',{hover: true});

	var i = 0;//initialize
	var int = 0; //Internet Explorer Fix

	$(document).ready(function () {

	    //Main navigation dropdowns
	    $('ul.sf-menu').superfish({
	        delay: 300,                            // one second delay on mouseout 
	        animation: { height: 'show' },               // fade-in and slide-down animation 
	        speed: 'fast',                          // faster animation speed 
	        autoArrows: false,                           // disable generation of arrow mark-up 
	        dropShadows: false                            // disable drop shadows 
	    });

	    //Coin slider customization
	    $('#coin-slider').coinslider({ width: 920, height: 337, navigation: true, opacity: 1 });

	    $('input.sidetext, .sidebar input, input.large, input.medium, input.small, input.extra_small').focus(function () {
	        $(this).addClass("input_hover");
	    });

	    $('input.sidetext, input.large, input.medium, input.small, input.extra_small').blur(function () {
	        $(this).removeClass("input_hover");
	    });

	    $('input.green').focus(function () {
	        $(this).addClass("green_hover");
	    });

	    $('input.green').blur(function () {
	        $(this).removeClass("green_hover");
	    });

	    $('input.red').focus(function () {
	        $(this).addClass("red_hover");
	    });

	    $('input.red').blur(function () {
	        $(this).removeClass("red_hover");
	    });

	    $('input.yellow').focus(function () {
	        $(this).addClass("yellow_hover");
	    });

	    $('input.yellow').blur(function () {
	        $(this).removeClass("yellow_hover");
	    });

	    $('input.large, input.medium, input.small, input.extra_small').blur(function () {
	        $(this).removeClass("input_hover");
	    });

	    //email fields change class using css sprites
	    $('#email').focus(function () {
	        $('.input_small').removeClass("input_small").addClass("input_small_highlight");
	    });

	    //Make any email field return to normal on blur
	    $('#email').blur(function () {
	        $('.input_small_highlight').removeClass("input_small_highlight").addClass("input_small");
	    });

	    //Submit button class change using css sprites
	    $(".submit").hover(function () {
	        $(this).addClass("submit_hover");
	    },
	  		function () {
	  		    $(this).removeClass("submit_hover");
	  		}
		);

	    // apply htmlarea plugin to textareas with htmlarea class
	    if ($(document).htmlarea) {
	        $('textarea.htmlarea').htmlarea({
	            css: applicationPath + '/App_Themes/' + theme + '/jHtmlArea.Editor.css'
	        });
	    }

	    $('#cycle').cycle({
	        fx: 'fade',
	        speed: 500,
	        timeout: 5000
	    });

	    // Add watermarks
	    $("[watermark]").each(function (num, el) {
	        $(el).watermark($(el).attr("watermark"));
	    });

	    // Add Datepickers
	    if ($.datepicker) {
	        $.datepicker.setDefaults({
	            duration: 'fast',
	            showAnim: 'fadeIn',
	            showOn: 'button',
	            buttonImage: applicationPath + '/App_Themes/' + theme + '/images/icons/calendar.gif',
	            buttonImageOnly: true
	        });

	        $('.datepicker').datepicker();
	        $('.datepicker').mask('99/99/9999');
	    }

	    // client logo toggling
	    $('div#clientLogo div#strip a').each(function (idx, el) {
	        $(el).children('img.slug:first').hover(function () {
	            $(this).toggle();
	            $(this).next().toggle();
	        });

	        $(el).children('img.hide:first').hover(function () {
	            $(this).toggle();
                $(this).prev().toggle();
	        });
	    });
	});

function deleteConfirm() {
	return confirm("Are you sure?");
}

function addSubscriber(sender) {
    var txtEmail = $(sender).prev();
    var pattern = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
    if (pattern.test($(txtEmail).val())) {
        $.ajax({
            url: addSubscriberPath,
            type: 'POST',
            dataType: 'json',
            contentType: 'application/json; charset=utf-8',
            data: $.toJSON({ email: $(txtEmail).val() }),
            success: function (data) {
                alert('Your email was added to subscribers\' list.');
                $(txtEmail).val('');
                $(txtEmail).watermark();
            },
            error: function (data, status, e) {
                alert('An error occured. Please try again later.');
            }
        });
    }
    else {
        alert('Email address is not correct.');
    }

    return false;
}

