// JavaScript Document

  var mouseX = 0;
  var mouseY = 0;
  var responseAJAX = '';
  $(document).mousemove( function(e) {
	  mouseX = e.pageX;
	  mouseY = e.pageY-160;
  });
  $(document).ready(function(){
	$(".popup_ref").mouseover(function(){
		src = (this.rel);
										   
		loadFile(src);
		$("#popup").fadeIn(75);
		$(document).bind('mousemove', function() {
			ww = ($(window).width());
	
			
			if(ww < (mouseX + (ww / 2)))
				{
				$("#popup").removeClass("babol_box");
				$("#popup").addClass("babol_box2");
				$("#popup").css("left",mouseX-450);
				$("#popup").css("top",mouseY);
				
				}
			else
				{
				$("#popup").removeClass("babol_box2");
				$("#popup").addClass("babol_box");
				$("#popup").css("left",mouseX);
				$("#popup").css("top",mouseY);
				}
			});
		 	
		});
	$(".popup_ref").mouseout(function(){
		$("#popup").hide();
		});
	});
  
  
function loadFile(src)
	{
	$.ajax({
		  url: "/content/get_speach_bubble_content/"+src,
		  cache: false,
		  async: false,
		  type: "POST",
		  success: function(html){
			responseAJAX = (html);
			$("#popup").html(responseAJAX);
		  }
		});
	}
	
	
	
    $(function(){
       

		$('.rounded').corner();
    });
	
		$(document).ready(function(){
		 // add a class of hidden to any ul's that are the child of an li. As we set any elements with a class of hidden to have the property display: none, this will now hide these nested ul's when the page loads
		//$('.news_year li ul').addClass("hidden");

	 // select any a tags that are children of a ul that contains an li that has both ul and li children. Apply a function to the selected elements that will fire when it is clicked
		$('.news_year > li').click(function() {
												  
// toggle the class "hidden" on the child ul of the li containing the a tag that has been clicked										 
		
		$('.news_year li ul').addClass("hidden");

		$(this).children('ul').removeClass("hidden");

		
		// return false so that the link is not followed	
		//return false;
		

	});
	});
	
    $(function(){
        $('.left,.right,.icon_menu,.summary_wrapper').equalHeight();
    });
	
	
	
		$(document).ready(function(){
		
			$('.submit').click(function() {
		var data = $('#contact_form').serialize();
			
			
				$.ajax({
				type: "POST",
				url: '/content/send_mail',
				data: data,
				success: function(response) {
				$('.response').html(response);
				 
				}
				});
			});
			


				
				
		}); 
	
jQuery(function() {
    jQuery('#ulSlides').ulslide({
                                 width: 600,
                                 height: 'auto',
                                 bnext: '#e1_next',
                                 bprev: '#e1_prev',
                                 axis: 'x'
                            
                              });
							  
	  jQuery('#ulSlides_big').ulslide({
                                 width: 960,
                                 height: 'auto',
                                 bnext: '#e1_next',
                                 bprev: '#e1_prev',
                                 axis: 'x'
                            
                              });	
	jQuery('#ulSlides_big_auto').ulslide({
                                 width: 960,
                                 height: 'auto',
                                 bnext: '#e1_next',
                                 bprev: '#e1_prev',
                                 axis: 'x',
								 autoslide: 5000,
								 duration:700
                            
                              });	
							  
		jQuery('#head_imgs_ul').ulslide({
                                 width: 960,
                                 height: 'auto',
                                 bnext: '#e1_next',
                                 bprev: '#e1_prev',
                                 axis: 'x',
								 autoslide: 5000,
								 affect: 'fade',
								 duration:200
                            
                              });					  
							  
							  
	$('.SlideControl').click(function(){
   			 var slider = $('#ulSlides')[0];
			var slide = $(this).attr("rel");
		
  			 slider.uslCurrent(slide); // 0 - first, 1 - second...
    		slider.uslRefresh();
			});
			
	$('.SlideControl_big').click(function(){
   			 var slider = $('#ulSlides_big')[0];
			var slide = $(this).attr("rel");
		
  			 slider.uslCurrent(slide); // 0 - first, 1 - second...
    		slider.uslRefresh();
	});		
					
});

		

	

