// JavaScript Document

$(document).ready(function(){

$(function(){
	$('.button_reg').click(function() {
		$('.Slide_blu_Div').slideToggle(500,function(){
			        $('div.button_reg').toggleClass('su');
		  });
		$('#Reg').fadeIn("2000");
		$('#Log').fadeIn("2000");
		
	});
	
	$(function(){ 
		$('.infield').inFieldLabels();
	});
	$('.OpenReg').click(function() {
		$('.Slide_blu_Div').slideToggle(500,function(){
			        $('div.button_reg').toggleClass('su');
		  });
	    $("#Reg").fadeIn("2000");
	    $("#Log").fadeIn("2000");
		
	});

	$('.Portfolio .wrapper ul').anythingSlider({
    infiniteSlides: false,
		buildArrows: true,
		easing: "swing",                // Anything other than "linear" or "swing" requires the easing plugin
		autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not
		//startStopped: true,            // If autoPlay is on, this can force it to start stopped
		delay: 10000,                    // How long between slide transitions in AutoPlay mode
		animationTime: 600,             // How long the slide transition takes
		hashTags: false,                // Should links change the hashtag in the URL?
		buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
		pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
		startText: "&rsaquo;",          // Start text
		stopText: "&bull;",             // Stop text
		navigationFormatter: null       // Details at the top of the file on this use (advanced use)
	});	

	$('.open-search').click(function() {
		$('#Adv-search').slideToggle(500);			   
		});
	
	// 
	
	$('.commento').click(function() {
		$('html, body').animate({
		scrollTop: $("#Form-commento").offset().top
		}, 2000);				
	});
	
	
	$('.up').click(function() {
		$('html, body').animate({
		scrollTop: $("#Blu-Line").offset().top
		}, 2000);				
	});
	
	$('#Form-Petition').validationEngine({promptPosition: "topLeft"});	

	$('.cortona').click(function() {
		var src = "http://www.areadem.info/adon.pl?act=Petitions&Mode=Get&key=cortona2";
			$.modal('<iframe src="' + src + '" scrolling="no" style="border:0;" frameborder="0">',{
					onOpen: function (dialog) {
							dialog.overlay.fadeIn(300, function () {
								dialog.container.fadeIn(300, function () {
									dialog.data.fadeIn('slow');
									});
							});
					},

					onClose: function (dialog) {
					$.validationEngine.closePrompt('.formError',true)
						dialog.data.fadeOut(300, function () {
							dialog.container.fadeOut(300, function () {
									dialog.overlay.fadeOut(300, function (){
									$.modal.close();
							});
						});
					});
			  }});
			
	
   });

	$('.live').click(function() {
		var src = "http://www.areadem.info/adon.pl?act=Tmpl&tmpl=cortona_live";
			$.modal('<iframe src="' + src + '" scrolling="no" style="border:0;" frameborder="0">',{
					overlayId:'simplemodal-overlay-live' ,
					containerId:'simplemodal-container-live',
					dataId:'simplemodal-data-live',
					onOpen: function (dialog) {
							dialog.overlay.fadeIn(300, function () {
								dialog.container.fadeIn(300, function () {
									dialog.data.fadeIn('slow');
									});
							});
					},

					onClose: function (dialog) {
					$.validationEngine.closePrompt('.formError',true)
						dialog.data.fadeOut(300, function () {
							dialog.container.fadeOut(300, function () {
									dialog.overlay.fadeOut(300, function (){
									$.modal.close();
							});
						});
					});
			  }});
     });	
  });

	/*setTimeout(function(){ 
		var src = "http://www.areadem.info/adon.pl?act=Tmpl&tmpl=cortona_live";
			$.modal('<iframe src="' + src + '" scrolling="no" style="border:0;" frameborder="0">',{
					overlayId:'simplemodal-overlay-live' ,
					containerId:'simplemodal-container-live',
					dataId:'simplemodal-data-live',
					onOpen: function (dialog) {
							dialog.overlay.fadeIn(300, function () {
								dialog.container.fadeIn(300, function () {
									dialog.data.fadeIn('slow');
									});
							});
					},

					onClose: function (dialog) {
					$.validationEngine.closePrompt('.formError',true)
						dialog.data.fadeOut(300, function () {
							dialog.container.fadeOut(300, function () {
									dialog.overlay.fadeOut(300, function (){
									$.modal.close();
							});
						});
					});
			  }});
								
		}, 3000);*/
	
});

