//<![CDATA[	

	//SIFR
	
	var mido = {
	    src: 'mido.swf',
		ratios:[8, 1.41, 9, 1.33, 12, 1.35, 14, 1.29, 15, 1.3, 19, 1.28, 20, 1.27, 28, 1.26, 29, 1.24, 34, 1.25, 40, 1.24, 43, 1.23, 44, 1.24, 64, 1.23, 67, 1.22, 68, 1.23, 72, 1.22, 73, 1.23, 115, 1.22, 116, 1.21, 1.22]
	  };
	sIFR.activate(mido);
	
	sIFR.useStyleCheck = true;
	
	sIFR.replace(mido, {
		selector: '.Bt',
		css: [
		'.sIFR-root { text-align: left; color: #0A4C4F; margin-left: 0px; margin-right: 0px; }'
		],
		wmode: 'transparent'
	});
	
	sIFR.replace(mido, {
		selector: '.R,.G,.M',
		css: [
		'.sIFR-root { text-align: left; color: #efede7; margin-left: 0px; margin-right: 0px; }'
		],
		wmode: 'transparent'
	});
				
				
	$(document).ready(function() {
		//ECCEZIONI PER IE-------------------------------------
		if($.browser.msie){
			$('#backTo').css("right","24px");
		}

		//FUNZION ROLLOVER IMMAGINI DETTAGLIO-------------------------------------
		/*$('.portaImg img').bind('mouseover',imgOver);

		
		function imgOver(){
			
			var overlayRollH=$(this).height()+'px';
			var overlayRollW=$(this).width()+'px';
			
			
			$(this.parentNode).prepend('<div class="overlayImg"></div>').find('.overlayImg').bind('mouseout',imgOut).css({
				"height" : overlayRollH,
				"width" : overlayRollW,
				"opacity" : 0
			}).stop().animate({
				"opacity" : 1
			});
			
			$(this.parentNode).prepend('<div class="overlayRoll"></div>').find('.overlayRoll').css({
				"height" : overlayRollH,
				"width" : overlayRollW,
				"opacity" : 0
			}).stop().animate({
				"opacity" : 0.1
			});
			
			
		}
		
		function imgOut(){
			
			$(this).stop().animate({
				"opacity" : 0
			},function(){
				$(this).remove();
			});
			
			$(this.parentNode).find('.overlayRoll').stop().animate({
				"opacity" : 0
			},function(){
				$(this).remove();
			});
			
		}*/
		
		//APRE E CHIUDE IL BANNER-------------------------------------
		
		$("#op").toggle(
	      function () {
	        $('#cyanRamp').stop().animate({
				"height" : "258px"
			});
			
			$('#creative').stop().animate({
				"height" : "258px"
			});
			
			$('.otherMobile').fadeIn("slow");

	      },
	      function () {
	        $('#cyanRamp').stop().animate({
				"height" : "100px"
			});
			
			$('#creative').stop().animate({
				"height" : "100px"
			});
			$('.otherMobile').fadeOut("fast");
	      }
	    );
		
		
		
		//EVITA I PROBLEMI DI VALIDAZIONE DELL'ATTRIBUTO BLANK-------------------------------------
		
		$("a[rel='external']").attr("target","_blank"); 
		
		//FUNZIONI PER IL FUMETTO NEL FOOTER-------------------------------------------------------
		
		function enterLogo(){
			
			$("#bubble").animate({
				opacity: "show",
				top:"-77px"
			},300);
			
		}
		
		$("#bubbleCont a").one('mouseover',enterLogo);
		
		$("#bubbleCont a").bind('mouseout',function(){
			
			$("#bubble").animate({
				opacity: "hide",
				top:"-67px"
			},250, function(){
				
				$("#bubbleCont a").one('mouseover',enterLogo);
				
				})
		})
			
			
		//FUNZIONI PER IL FORM-----------------------------------------------------------------------
		
		function initForm(){
			
			$(":text").bind('focus', function(){
				
				$(this).css('border','1px solid #d1d63e');
				
			})
			
			$(":text").bind('blur', function(){
				
				$(this).css('border','1px solid #363636');
				
			})
			
			$("textarea").bind('focus', function(){
				
				$(this).css('border','1px solid #d1d63e');
				
			})
			
			$("textarea").bind('blur', function(){
				
				$(this).css('border','1px solid #363636');
				
			})
			
			$(":submit").replaceWith("<div class='submit'><a onclick='submitForm()'>INVIA</a></div>")
			
			$(".submit").hover(function(){
				
				$(this).find('a').css({
					
					"color" : "#f4f4f4",
					
					"border-bottom" : "1px dotted #d1d63e",
					
					"cursor" : "pointer"
					
				})
				
			},function(){
				
				$(this).find('a').css({
					
					"color" : "#C2C0BA",
					
					"border-bottom" : "none"
					
				})
				
			})
			
		}
		
		
		
		initForm();
		
	
		//ROLLOVERS FOOTER-----------------------------------------------------------------------
		
		$(".project").hover(function(){
			
				if($(this).parent().parent().attr('title')=='recentWorks'){
					
					$col='2px solid #d6433e';
					$col2='#d6433e';
					
				}else if($(this).parent().parent().attr('title')=='latestProjects'){
					
					$col='2px solid #d43d84';
					$col2='#d43d84';
					
				}
				
				$(this).css('cursor','pointer');
				
				$(this).children(".txt").css('color','#f4f4f4');
				
				$(this.getElementsByTagName("img")[0]).css('border',$col);
				
				$(this.getElementsByTagName("strong")[0]).css('color','#f4f4f4');
					
			},function(){
				
				$(this).css('cursor','default');
				
				$(this).children(".txt").css('color','#C2C0BA');
				
				$(this.getElementsByTagName("img")[0]).css('border','2px solid #363636');
				
				$(this.getElementsByTagName("strong")[0]).css('color','#f4f4f4');
				
			})
		
		
		//FUNZIONI PORTFOLIO-----------------------------------------------------------------------
		
		function setHandlers(){
			
			$('.polaroid').bind('mouseenter',over);
			//$('.polaroid').one('mouseenter',over);
			
			$('.polaroid').bind('mouseleave',out);
			
			$('.polaroid').bind('click', clicked);
			
		}
	
		
		function over(){
			
				var navDuration = 350;
				var pS = $(this).contents().find(".polaroidSpec");
				
					
					pS.stop().animate({
						top: "40px"		
					}, navDuration);
				
			
		}
		
		function out(){
			
			var navDuration = 350;
			var pS = $(this).contents().find(".polaroidSpec");
			
			pS.stop().animate({
					top: "120px"
				}, navDuration);
			}
		
		function clicked(){
			//alert("creativesource");
		}
	
		setHandlers();
	
	
	});	
	
	function submitForm(){
		
	
		$.ajax({
		   type: "POST",
		   url: "http://www.creativesource.it/sendMessage.php",
		   data: "ajax=true&content="+$('#content').val()+"&email="+$('#email').val(),
		   success: function(msg){
			   	$('#messageContent').html('Messaggio <span>*</span>')
		    	$('#messageEmail').html('Email <span>*</span>')
		    	$('#messageResult').html('');
		    	
		    	if(msg=="1"){
		     		$('#messageEmail').html('Email <span>*</span> <span ><small>[Inserisci un\'indirizzo Email valido]</small></span>');
		     	}else if(msg=="2"){
		     		$('#messageEmail').html('Email <span>*</span> <span ><small>[Il campo Email &egrave; obbligatorio]</small></span>');
		     	}else if(msg=="3"){
		     		$('#messageContent').html('Messaggio <span>*</span> <span ><small>[Il campo Messaggio &egrave; obbligatorio]</small></span>');
		     	}else if(msg=="4"){
		     		$('#messageResult').html('Messaggio <span>*</span> <span ><small>[Impossibile inviare l\'email ora. Riprovare pi&ugrave; tardi ]</small></span>');
		     	}else if(msg=="0"){
		     		$('#messageResult').html('<span ><small>[Email inviata correttamente]</small></span>');
		     	
		     	}
		   }
		 });

	}
	
//]]>
