var $j = jQuery.noConflict();

$j(function() {

	// comment next lines to disable features

	lightBox(); // initialize & configure lightbox script

	startTimers(); // start slidefader & newsticker timers

});

// Input Clear Default
    $('input[placeholder],textarea[placeholder]').each(function() {
        if($(this).val() === '') {
            $(this).val($(this).attr('placeholder'));    
        }
        $(this).focus(function() {
            if($(this).val() == $(this).attr('placeholder')) {
                $(this).val('');    
            }
        });
        $(this).blur(function() {
            if($(this).val() === '') {
                $(this).val($(this).attr('placeholder'));    
            }
        });
    });

// functions


function getMeta($name) {
	return $j("meta[name=" + $name + "]").attr('content');
}


var faderId, newstickerId;

function startTimers() {

	if ($j("#slides img").length > 1) {
		faderId = setInterval("slides()", getMeta("themebox.1")); // slide timer
	}

	if ($j("#newsline").length > 0) {
		newstickerId = setInterval("newsline()", getMeta("themebox.2")); // newsticker timer
	}
}

function stopTimers() {

	if (faderId) clearInterval(faderId); // clear slide fader timer
	if (newstickerId) clearInterval(newstickerId); // clear newsticker timer

}

//

function lightBox() {
	$j("a[rel^='lightbox']").prettyPhoto({
		animationSpeed: 'fast', /* fast/slow/normal */
		padding: 40, /* padding for each side of the picture */
		opacity: 0.5, /* Value betwee 0 and 1 */
		showTitle: true, /* true/false */
		allowresize: true, /* true/false */
		counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
		theme: 'dark_rounded', /* light_rounded / dark_rounded / light_square / dark_square */
		hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
		modal: false, /* If set to true, only the close button will close the window */
		changepicturecallback: function() { stopTimers(); },
		callback: function() { startTimers(); }
	});
}
//


