// JavaScript Document

$(function () {

	

	//Round corners

	if(!isRunningIE) {

		//5px roundies

		DD_roundies.addRule('.allRound_5px', '5px', true);

		DD_roundies.addRule('.topRound_5px', '5px 5px 0px 0px', true);

		DD_roundies.addRule('.bottomRound_5px', '0px 0px 5px 5px', true);

		DD_roundies.addRule('.leftRound_5px', '5px 0px 0px 5px', true);

		DD_roundies.addRule('.rightRound_5px', '0px 5px 5px 0px', true);

		DD_roundies.addRule('.ltRound_5px', '5px 0px 0px 0px', true);

		DD_roundies.addRule('.rtRound_5px', '0px 5px 0px 0px', true);

		DD_roundies.addRule('.rbRound_5px', '0px 0px 5px 0px', true);

		DD_roundies.addRule('.lbRound_5px', '0px 0px 0px 5px', true);

		

		//3px roundies

		DD_roundies.addRule('.allRound_3px', '3px', true);

	}

	

	//tabs

	$(".moduleTabs ul.tabs").tabs("div.panes > div", {effect: 'fade'});

	

	//scrollable for category module on home page

	$('#moduleCat .scrollable').scrollable({vertical: true, size: 1, clickable: false});

	

	//Top 10 module cycle

	$('#moduleTop10 .right').cycle({ 

	    fx:      'fade', 

	    speed:    1000, 

	    timeout:  5000,

		pause: 		true,

		activePagerClass: 'active',

		pauseOnPagerHover: true,

		pager: "#moduleTop10 .listContainer",

		pagerAnchorBuilder: function(idx, slide) {

	        return '#moduleTop10 .listContainer .listItem div:eq(' + idx + ')';

	    }

	});

	

	//scrollable for left side Menu

	//$('#secMenu .scrollable').scrollable({vertical: true, size: 10, clickable: false}).mousewheel();

	

	//logo image center

	if($('.logoCamera img').lenght != 0) {

	$('.logoCamera img').each(

		function () {

			var logoCameraHeight = $(this).parent().height();

			var logoCameraImgHeight = $(this).height();

			$(this).css({

				'margin-top': (logoCameraHeight - logoCameraImgHeight)/2 + 'px'

			});

		}

	);

	}

	

	/*footer position bottom by dynamicaly adding height to MainContent 

	  in case the height is not pushing the footer enough */

	if ($('#mainContent').height() < ($(window).height() -261)) {$('#mainContent').height($(window).height() -261)}

	

	// fancy

	$('.fancy').attr('rel','gallery').fancybox();

	

});



function postCom(form) {

	

	var nume = $('input[name="com_nume"]').val();

	var mail = $('input[name="com_mail"]').val();

	var text = $('textarea[name="com_text"]').val();

	

	if(nume.length == 0) {$('input[name="com_nume"]').addClass('com_error'); $('.com_error_nume').show();}

	if(mail.length == 0) {$('input[name="com_mail"]').addClass('com_error'); $('.com_error_mail').show();}

	if(text.length == 0) {$('textarea[name="com_text"]').addClass('com_error'); $('.com_error_text').show();}

	

	if(nume.length > 0 && mail.length > 0 && text.length > 0) {

		$(form).submit();

	}
	else return false;
	

}
